Creating Hall Effect Sensor program using Arduino UNO
Required Components
- Hall effect sensor -1 no
- magnets -1 no
- Arduino UNO -1 no
- Connecting wires -1 set
Circuit
Steps
- Make sure the components are working properly.
- Connect the Hall effect Sensor to the Arduino UNO board.
- Connect the Arduino UNO board 2nd pin to the Hall effect Sensor(Analog or Digital).
- Connect Hall effect Sensor board VCC, GND to 5V, GND of Arduino Uno Board.
- Check the Cicuit Connections.
- Check the Arduino program.
- Run the Arduino program.
Arduino Program
int hallSensorPin = 2;
int ledPin = 13;
int state = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(hallSensorPin, INPUT);
}
void loop( )
{
state = digitalRead(hallSensorPin);
if (state == LOW)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
Usage
- Positioning
- Speed detection
- Current sensing applications
- Tachometers
- Anti-lock braking systems