Hall Effect Sensors 101
Know Your Sensors
However, there are two distinct kinds of Hall Effect Sensors, and this tutorial will show you how to use them.
First, you need to decide whether you want to use Latching or Non-Latching Hall Effect sensors. When buying the sensors, know what you need from them. Use the info below to determine what will work best for your uses before you order.
measurement of displacement
measurement of forces
measurement of angle velocity
measurement of linear velocity
• True solid state
• Long life (30 billion operations in a continuing keyboard module test program)
• High speed operation - over 100 kHz possible
• Operates with stationary input (zero speed)
• No moving parts
• Logic compatible input and output
• Broad temperature range (-40 to +150°C)
• Highly repeatable operation
All Hall Effect Sensors (regardless of whether they latch)
- Operate on a single digital input pin.
- Take a Power line (usually between 3V and 7V, most frequently 5V)
- Take a Ground line(usually there is "-" sign which shows it is the ground line)
- Take a Signal Line (this is usually shown by a "S" sign)
- Usually take a resistor of some sort
- Output a 1 or a 0 down its signal line. These ones and zeros can be sampled and utilized by a computer with fairly simple code, given below.
- This is a fairly comprehensive hookup guide, but be sure to read your own sensor's Data Sheet before purchasing, as your sensor could be wired very differently.
- Output a 1 only in the presence of a specific pole of a magnet (IE North or South)
- Output a 0 when not in the presence of a magnet
- Output a 0 when in the presence of the "wrong" pole of the magnet
- Are two-sided with each side reacting to a different pole
- An example of output is given below:
- Output a 1 or 0 depending on the last pole seen
- Also function on both sides
- An example output is given below:
This is some simple code to interact with your sensor. It looks like a lot of code, but it's actually just 4 lines! The rest is annotations to walk you through each line of code.
Help! I Bought the Wrong Kind!
Have no fear!! If you bought Latching when you wanted Non-Latching, there is a solution!
To transform your Latching to a Non-Latching, you need to simply turn its power pin off then back on to "reset" it each time you take a reading. This is best done using a MOSFET Switch (excellent student tutorial liked here) which is essentially a switch the Arduino can turn on and off on its own. Hook up the MOSFET in series with the Hall Effect's ground pin, then implement the following code:
Your Latching Sensor should now behave like the Non-Latching Sensor.