I would like to use three hall effect sensors, placed triangularly on a surface, to create a field in which the position of a magnet can be sensed. Currently I am using the TLE4997, a programmable, linear Sensor by Infineon.
To find out how close the magnet needs to get to a sensor in order to be sensed, I am currently experimenting with only one sensor which is connected to an Arduino Uno. I would like to continously get the exact voltage of the output (which is connected to digital Pin 2) of the sensor printed.
How can I achieve this? Using the digitalRead() command only gives me the pin state (HIGH or LOW โ right?), which is not sufficient, as I need the exact voltage values.
Use an analog input pin. The sensor will output a volatge proportional to the magnetic firld strength as measured in mT (milli-Tesla). The TLE4997 allows for programmable gain. That's my basic read. The data sheet has quite a bit of good information. Typical Arduino Uno for example has a reference voltage of 5.00 volts do on an analog input using a 10 bit A/D that is 1024 quantization levels or 0 to 5.00 volts becomes 0 to 1023 counts. This is approximate since your Arduino Uno may not have a perfect 5.00 volt reference. Looking at the data sheet and range of mT you can do the math. A Google of "measure voltage Arduino Uno" should get you the basic code to start with. That or just convert the analog input to mT using a map function in your code.
Anyway to answer your question you want an analog read not digital.
Where can you purchase these? From my 'googling', it's obsolete and isn't carried by mouser or digikey at least in the to-92 case... I can find it in the 8 pin smd (@$10.28 US each)
There was a thread on here recently about using 2 hall sensor to detect the position of a bar magnet on a slider between them which may be helpful.
Note that the field strength of a small magnet, at least on-axis, drops as the inverse cube of distance so you may need to be quite close to get a reading - or conversely be ready to accept a wide range of input signals from the hall sensors. Also see this website:
The calculator can display the field around a magnet of a shape you can define and give you the field strength at any point. Knowing the field you can compute what measurements you should get from the hall sensors.
Do you want to read exact value as in the analog voltage or do you actually want to just detect a magnet as it passes a hall effect sensor? Your first post leads me to believe you want to accurately measure magnetic field strength but now I suspect different.
first of all, thanks for your reply โ that solved my problem in an instant.
I want to get the exact sensor values to track a magnet between three hall sensors as exact as possible. In the end, the goal is to be able to kind of recognize gestures (like single or double tapping in a specific area between the three sensors).
BUT: Now having read the analog values, I see that the "trackable area" is quite tiny (the magnet needs to get as close to the sensor as 12cm in order to be recognized). I haven't programmed the sensor yet, so I'm hoping this could stretch the area a bit (at least 30cm would be good).
So basically I'm currently thinking about:
a) programming my sensor,
b) switching to another, stronger sensor, or
c) amplifying the signal.
Do you happen to know any very strong Hall Sensor that could be a better fit for this purpose?
I bought mine at a small store around the corner (in Germany) but now that you're asking, I can't find them anywhere else as well (at least not online)...
No, I was thinking about using the Arduino to program it.
I have one I'm working with for an oscilloscope to measure < 100mA. I have to amplify it quite a bit.
Don't forget when it gets sensitive the earths magnetic field can affect it...
Do you have Ferris fingers?
The magnetic field is not modified by skin and bone, I doubt you can sense a biological item with a magnetic field... at least with these kind of sensors...
What's the name of the sensor you're currently using?
Yeah, the plan is to attach a magnet to the finger, so actually the magnet is tracked. Maybe "tapping" was a little misleading โ it will probably be more like keeping the finger in certain places for certain durations, to work as gestures.
You may wish to look at Hall Effect Sensors from Allegro Microsystems and Honeywell both manufacturers are sold globally through a wide range of retailers. Texas Instruments also has a line of Hall Effect Sensors. Just remember you want a sensor with a linear output not a latching type. Also keep in mind the sensitivity you want.
thanks again for your replies and hints. Just a quick update for anyone who plans on doing a similar project in the future:
I now switched to using a magnetometer (GY-271 HMC5882L, to be exact) and so far it works very well! Meaning: the measurements are way more sensitive compared to those of the hall sensor (even with an amplification), though the output range is smaller (+/- 8 Gauss), but that's alright for my purpose.