us5881 Hall effect sensor can't output HIGH

I'm using the US5881 hall effect sensor in the UA package.

This version always outputs HIGH, but it goes low when the south pole of a magnet comes near.

However, this sensor will NOT output high no matter what. I checked with a multimeter, and when it gets 5v, the "high" output is 4.45 volts. This apparently isn't enough for the arduino to read it as high. Directly connecting the 5v (or 4.98v) does read high.

connecting this to one of the analog inputs returns a value of 104, and a value of 1 with the magnet. This "works" but its not the way its supposed to. I've tried the two other sensors I bought at the same time and they all output the same numbers.

So what do I do? How do I make the damn thing output closer to 5v, or the arduino accept the 4.45?

Thanks, in advance

4.45V should be enough for a "high", the ATmega168 works on TTL levels so as long as the level is greater than about 2.4V you should be good.

I think the problem is that the US5881 has an open drain output and you need to put a pull-up resistor (anything from 1K to 10k should be fine) from the OUT pin to the +5V rail to get it to work. Either that or turn on the built in internal pull-up resistor in the I/O pin in the ATmega168.

The datasheet for the US5881 says that is has an open drain output and shows how it is implemented internally which should give you some idea how it works:

that's one of the first things I tried, but it doesn't seem to work. I've tried 270, 1k, 10k and 20k resistors between the out and the 5v and none bring it up. on ANY of the sensors. something I'm doing wrong?

now I've tried it down to 91, and the internal pull up resistors. For example, with internal pull up on, it registers a 1 on the pin before I connect the hall effect sensor, but it drops to 0 when I connect it.

Its definitely supposed to read "high" without a magnetic field. whats the deal here?

Can we take a look at your code?

Replace the hall effect switch with a push button. Still doesn't work = wired it up wrong.

However, this sensor will NOT output high no matter what.

In order for the Arduino to see the high output the Arduino's pin has to be set as an input. Are you mixing that up?

here's the simplest code that I've written to test this bug. When I attach arduino 5v directly to an analog pin, I get a value near 1024. When I attach any of my 3 hall effect sensors, I get a value around 105. This drops to 1 with a magnet. But if I attach a pull up resistor, the analog value reads closer to 140 or so.

when I attach to a digital pin, it reads 0. If I pull the hall effect sensor out of my breadboard, it goes to 1 (assuming pull up resistors)

One other note, sometimes when I'm attaching 5v to the analog pin, the serial connection is messed with somehow and it disconnects. I don't understand why this happens, its infrequent and never happened before.

HONESTLY, all I'm trying to do is use an interrupt. If I could do that with an analog pin somehow, that'd be great.

int test=HIGH;
void setup()

pinMode(3, INPUT);

//digitalWrite(3, HIGH);  //sometime add this in to turn on internal pullup

void loop() {

 //test=analogRead(2);   // I used an analog pin to make sure the 
                         //value does actually decrease with a magnet.


so one new thing, its actually outputting .5volts without a magnet, and 0 with.

i tried this by hooking up only a 9volt battery and it still outputs .5 volts so, no idea.

I see that the US5881 comes in North (SE) and South (UA) oriented variants (see page 5 of the data sheet) - is your magent orientated correctly for your sensor? It needs to be such that the correct pole of the magnet is perpendicular to the sensing side of the device.

Also make sure there are not any stray strong magnetic fields present where you are using it - this is unlikely to be the cause of your problems.

The datasheet shows application circuits with a 100nF supply bypass capacitor and a 4.7nF capacitor on the output - do you have these? They could be important to proper operation of the device and are worth a shot.

The way your code is written will only print a change in the input state of PIN 3 if the input happens to be low (or high) at the time of the digitalRead (3) statement. If the input happens to be a pulse then digitalRead() statement won’t see it if the processor is busy doing something else like the Serial.println() command, which will take up most of the processor loop time.

Might be better to write the test code to loop until it detects a change in PIN 3 (high to low or low to high) then print something out.

Although I can’t see anything from the datasheet that the output from the device is momentary (pulsed)… or any other reason why it’s not working… (clutching at straws here) have you connected the grounds of the Arduino and UA5881 together?

I appreciate the suggestion, but I don't think that's the problem

I've taken the arduino completely out of the picture, and hooked up a 9v battery to power and ground. with my multimeter its still only putting out half a volt or so.

That DOES drop to 0 when the south pole of a magnet gets nearby, but... Is there a way to convert .5v to... more than that? will a radioshack transistor accept .5v as "high?" that might be an idea...

I've taken the arduino completely out of the picture

But have you still got a pull up resistor? You need one to see anything from the output. Pull up to the battery at 3K will do.

Double check the pin out on the data sheet. They are different for the two packages and it's easily missed. If using the UA package pin 1 is VDD, pin 2 is Gnd and pin 3 is out. You may have 2 and 3 reversed since both are listed in the same table and easily missed.

Or maybe not...