AD22151 Hall effect sensor

Many wonderfull new electronic devices are now becoming available, I try to take time out to play with them. Recently I found time to hook up the AD22151 Hall Effect Sensor. This basically measures the strength of a magnetic feild near it, or for a constant strength field (permenant magnet) the distance from the sensor.
No doubt you know that magnets can make things float, but they tend to fly off in wonderfull directions or flip round and snap together. These sensors have been put to great use recently in the “floating globe/clock/light/whatever” market. Lots of gadget shop sites are selling these. They use an electromagnet in the top to suspend the and item that contains a permenant magnet in it. The sensor provides feedback on the distance between the object and top of the unit. This means it can be adjusted to hold it stable forever (well, while there is power!).

I intended to build one of these, but still havent got the time. I did however manage to wire up the TINY Surface mount sensor to a DIP adaptor and a PIC chip to test it.


There are two modes of operation, bi-polar and uni-polar. Now the AD22141 outputs an analogue voltage proportional to the field strength. For uni-polar mode it only picks up ONE pole of the magnet (couldnt tell you which!) and uses the full range to give that output. In bi-polar mode you get a zero point when no magnet is near, but either a + or – value to show either magnetic pole. This range is half the uni-polar range because its split over both poles.
In my initial tests I got a floating value of 126 (using 8bit for ease of viewing!) with no magnet, bringing a magnet near it caused it to lower all the way down to 0 slowly. 0 being the magnet stuck on top of the sensor :p
Swapping to the other pole gave me a -127 value that again (rose) dropped to 0 as I approached the sensor. In unipolar mode it seemed to make more sense, with a floating 0 that rose to around 200 as the magnet approached. The reverse pole gave no reading.

The idea is that as opposites attract, you have a +pole magnet in the floating object and an electromagnet in the stand, with – facing the object. The sensor easily picks up the + (in unipolar mode) but ignores the – from your magnet. A small controller circuit can now increase power to the magnet if the object lowers away from the sensor or decrease the power if its too close.
There are issues with oscilation (the object bouncing up and down) and damping (stopping it bouncing) but that is all advanced coding for the controller. Ive not got that far yet. These floating globes are astounding to watch and nothing beats the thrill of building your own!

Comments are closed.