A3144 Hall Effect Sensor not responding to magnet

Customer:

I’m having trouble with a hall sensor I purchased. My setup is: Hall sensor pin 1 to 5V, pin 2 to GND, and pin 3 to digital pin 2. I also have an LED on digital pin 13 with GND on the board.

Here’s my code:

int hallPin = 2;
int ledPin = 13;
int hallState;

void setup(){
  Serial.begin(9600);
  pinMode(hallPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop(){
  hallState = digitalRead(hallPin);
  if (hallState == HIGH){
    Serial.print("No Magnet: ");
    digitalWrite(ledPin, LOW);
  }
  if (hallState == LOW){
    Serial.print("Magnet Is Near Sensor: ");
    digitalWrite(ledPin, HIGH);
  }
  Serial.println(hallState);
  delay(100);
}

When I bring a magnet close to the sensor, nothing happens. I’ve tried both poles of the magnet with the same result. What am I doing wrong?

Originally submitted via email support on 24 March 2016. Migrated to the forum for community visibility.

Soldered Support:

Your connection looks correct based on your description. A few things to check:

  1. You may be missing a pull-up resistor on the output pin. The sensor should work without it but may be unstable. Try adding a pull-up resistor.

  2. Your code looks fine.

  3. Do you have a multimeter available? Use it to measure the output voltage of the hall sensor pin while bringing the magnet closer to the sensor. This will help you verify if the sensor is actually responding to the magnet.

Example A3144 connection: http://geekmatic.in.ua/image/cache/catalog/tovar/A3144_1-500x500.jpg

You may also find this Arduino forum topic helpful: A3144 hall effect sensor problems - General Electronics - Arduino Forum