I came pretty close to calling this one “Magnets, How do they work?” But I thought that might confuse more than it would amuse. All jokes aside, hall effect sensors are pretty cool, and also pretty simple to use, but there are a few types you may not know about and I figured it would be a good time to introduce them incase your next project was In need of sensing some magnetic forces. If you don’t know, a hall-effect sensor is a device that reacts to a magnetic field. The most common reaction being the sensor acting as a digital switch “turning on” in the presence of a strong enough magnetic field. And actually most people when first looking into them only know of these. But the reality is that there any many different types, from ones that output an analog signal depending on the strength and polarity of a magnet, to ones that latch on when a strong enough field is sensed, but won’t unlatch until an equally strong, opposing field is sensed.
Hall effect sensors are all rated to work with a specific strength of magnet field (measured in Gauss) which dissipates with distance from the magnet. Just like sound, it is softer when you are further away from the source. The only reason this is important, is because the distance a magnet needs to get to one of these sensors to trigger it is totally dependent of the magnets strength. So a really powerful magnet will trigger the sensor from a greater distance than a weak magnet. Sounds obvious I know, but these sensors also have a max Gauss rating as well. So, too powerful of a magnet, getting too close, can mess them up and eventually break them. Most sensors are sold in a wide range of sensitivity. The 3 in this article work well with household magnets, but if you need ones to work with very strong magnets, they are available.
The 3 sensors we will be going over are:
OPTEK Technology OH090U – Simple Hall Effect Sensor
Melexis US1881 – Latching Hall Effect Sensor
Allegro A1321 – Ratiometric Linear Hall Effect Sensor
OPTEK Technology OH090U
The OH090U (available from digikey at $1.75) is probably what you think of when you think of a hall effect sensor, this guy acts just like a digital reed switch, when a magnetic field gets close enough, it switches. In the case of the OH090U, it switches LOW. So when no magnetic field of the minimum trigger value is sensed, the OH090U output pin will be equal to the source voltage (4.5V to 24V), and when a field of the minimum trigger strength is within range, the output pin will be ground, or 0v.
One nice thing about the OH090U is that it schmitt triggers. Meaning there is a gap between when it triggers on, and triggers off. So if the sensor triggers on at 90 gauss, it wont release until it drops below 65 gauss. This keeps it from triggering on/off/on/off if a magnet is right on the cusp of that minimum trigger spot.
Hooking It Up
The doc sheet for the OH090U says you need a capacitor between ground and the out pin, however, in my testing, it worked perfectly without it. This is probably to smooth out the signal, and 95% of the time, this is going to be ok with out the capacitor, but if you plan on using this for automative purposes or other situations that could put people in harm’s way if it were to misfire, use the capacitor, seriously. The sensor does need a 500-860Ω resistor between VCC (V+) and the output pin for it to work.
For more detail: A Strange Attraction. Various Hall Effect Sensors