Im pretty new to the arduino, and I was looking for any insight into using a hall sensor to simply detect a magnet with the arduino. I would also like to visualize any output with an LCD, 7 segment display, or LED. Any help with coding and circuitry would be greatly appreciated!
Observe the type of sensor that you use. One type of sensors only switch from High to Low when magnet's polarity is swapped and you may want the other type, where it goes from High to Low when the magnet is removed. But it doesn't responds to the opposite magnetic pole.
I've been using an allegro 1302eua hall effect sensor as part of a rover we're building in our school. It's not the latching sort, so it returns a voltage proportionate to the magnetic strength it's detecting. Baseline output is 1/2 supply (2500mV on a 5V supply) and a N pole increases the voltage and a S pole decreases it.
I borrowed a pretty rubbish magnet from the physics department and the sensor picked it up from a good 70mm away.
The supplier I used in the UK sells them for about £1.35 plus postage.
Just for reference there are many types of hall sensors:-
Liner sensors - give an output proportional to the field, used in current detectors and such.
Switch - outputs zero or one.
a) In the presence of a specific magnetic field direction- non latching unipolar.
b) In the presence of any magnetic field - non latching bipolar.
c) Reflecting the last field seen - latching.
In addition, if you got the old non-ic sensor, just to Hall probe, you need to flow current through the sensor and monitor voltage across it. The voltage could get negative and gets very big if you move your magnet too fast. This type of sensor is not very fit for arduinos. The ones we talk about are mostly 3-pin TO-92(?! right?) ones.
pluggy:
Personally I'm a fan of old fashioned reed switches, cheap and simple.......
Definitely vote for Reed switches, no power is needed to drive the sensor and it can pass a moderate amount of current to power a device. On the other hand, Hall sensors can be made more sensitive with internal gains and much smaller packages.
Thanks everybody for the help! But I havent gotten anything to work yet...Im still confused as to how exactly I need to set everything up...I have a breadboard, resistors, wiring my arduino and my sensor...am I missing something? If anyone had a diagram for a simple magnetic sensor, it would help greatly!
Post what you have so far, software and schematic and we will have a look. Also say what you observe and what you hope to observe, along with the component part numbers you are using.
Thanks for the help everyone! Got the sensor working very well...went with the A1302 hall sensor and can use it to sense my magnet a good half foot away!
Personally I'm a fan of old fashioned reed switches, cheap and simple.......
If a reed switch gets permanently magnetised it jams closed - hall effect sensors have no moving parts, are smaller and less breakable. Reed switches also affect the field they sense whereas hall devices don't.