Go Down

Topic: Can't read hall sensor output (Read 311 times) previous topic - next topic

cannonmoyer

I ordered these latching hall sensors (did not realize they were latching until I tested them out):
https://www.amazon.com/gp/product/B0091H0CLK/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1

Then, I ordered this non latching sensor:
https://www.amazon.com/gp/product/B008AS2YBM/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

The latching sensors worked just fine. I was able to print out the output data just as I had expected in the code with a basic Serial.println(digitalRead(2));. I then tried the non latching sensor and I have yet to read anything from that sensor except a LOW signal. I've ordered two of these sensors now and neither one has worked.

I'm coming out of my 5v pin to the 5v (far left) input pin on the switch. Plugging my ground into the the middle pin, and I've plugged the far right 5v output pin into my digial pwm pin # 2. I've used this exact same circuit for both the non latching and latching sensors and I've only been able to get the latching sensor to work. Am I doing something wrong here? Or am I just getting bad sensors?

Wawa

That sensor seems to have an open drain output, so you need a pull up resistor.

Easiest way is to enable the internal pull up resistor on that Arduino pin in void setup().

pinMode(2, INPUT_PULLUP);

Leo..

cannonmoyer

That sensor seems to have an open drain output, so you need a pull up resistor.

Easiest way is to enable the internal pull up resistor on that Arduino pin in void setup().

pinMode(2, INPUT_PULLUP);

Leo..
This worked! Thanks!!!!!!!

vaj4088

The first sensor is based on the Allegro Microsystems A1302 and is not described in the datasheet as a latching sensor.  It is a magnetic sensor with a linear output.

The second sensor is based on the Melexis US5881 and is a low sensitivity sensor that requires:

1) Proper positioning of the correct magnetic pole.

2) A pullup resistor.  This could be the pullup resistor internal to the Arduino.  There is no code and there is no mention of a pullup resistor so I would guess that this is missing.  I hate having to guess.

The sensors may be good.


raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up