Hall Effect Sensor A3144 Turns LEDs ON/OFF

Description: When a magnet is moved close enough to a Hall Effects Sensor (A3144) the red LED turns ON and the green LED turns OFF. And when the magnet is out of range the red LED turns OFF and the green LED turns back ON.

Notes: As you move the magnet back and forth you should be able to see in the serial monitor of the Arduino IDE the values of the Hall Effect Sensor changing.

Supplies:

1 – Breadboard 830 Points
1 – Arduino Nano
1 – Hall Effect Sensor (A3144)
2 – LEDs
2 – 220 Ohm Resistors
1 – 1k Ohm Resistor
1 – Magnet (Neodymium is recommended)

Arduino Code:

int greenLED = 8;

void setup() {

  pinMode(greenLED, OUTPUT);
  Serial.begin(9600);

}

void loop() {

  int sensorValue = analogRead(A1);
  Serial.println(sensorValue);

  if (analogRead(A1) > 100) {
  digitalWrite(greenLED, HIGH);
  
}

  else digitalWrite(greenLED, LOW);

}

Leave a Comment

85 + = 90