This is a quick summary on how to use Hall Effect Sensor US5881 / US1881.
US1881 is a latching hall effect sensor. The sensor gives out an output HIGH (5V) voltage whenever the north pole of a magnet is brought close to it. However, even when the magnet is removed the sensor still outputs a HIGH voltage and does not go LOW (0V) until the south pole of the magnet is brought close to it. These type of sensors that latches on to a particular state are called latched hall effect sensors.
US5881 is a non-latching hall effect sensor. Here, the sensor gives an output HIGH voltage whenever the north pole of a magnet is brought close to it. And, switches LOW whenever the magnet is removed.
Wiring
Code
//Connect the output pin (pin 3) of the hall effect sensor to Arduino digital pin 2
#define Hall_Sensor 2
void setup()
{
Serial.begin(9600);
pinMode(Hall_Sensor, INPUT);
}
void loop()
{
while (digitalRead(Hall_Sensor) == LOW) {
Serial.println("Detect");
}
}
References:
US5881 Datasheet
https://cdn-shop.adafruit.com/datasheets/US5881_rev007.pdf
US1881 Datasheet
https://www.sparkfun.com/datasheets/Components/General/Hall-US1881EUA.pdf
ARDUINO HALL EFFECT SENSOR TUTORIAL: THE EASY WAY
http://diyhacking.com/arduino-hall-effect-sensor-tutorial/
Hall effect sensor - US5881LUA
https://www.adafruit.com/product/158
No comments:
Post a Comment