I've bought a hall-effect sensor (switch in this case as there is a small op-amp encased) and can't seem to get it working!
But even weirder, it's working (partly) but when I reverse it's +5V and GND...
Let me explain a bit more, the sensor is this one : http://www.selectronic.fr/capteur-a1102euat-ugn3140.html
I fed it with a +5V from the arduino, it's friend GND and I put a 10K pull-up resistor between it's output and +5V.
All good so far but... when I probe it's output, it stays firmly around 4,4-4,5V and doesn't react to any magnet I can find.
Now, out of a mistake (I'm that bad), I put it's Vcc to the GND and GND to +5V and, surprise, it gives me a steady -4,5V BUT when I get close to a magnet, it switches to +5V!! So well, it's not exactly the behaviour I'd like to see, and not even the right polarity but it works in reverse... How come!!!????
For the UGN3140 : With the flat side towards you, so you see the text on it: the left pin is 5V and right pin is output.
For the A1102EUA-T : With the flat side at the back ! The left pin is 5v, the right pin is the output.
Are you telling me that you made the wrong connections by looking at the wrong datasheet ?
When you have the output connected to 5V or a reverse voltage, the sensor might be broken.
I think 50% chance that the sensor is broken.
The way you describe it is okay. Resistor of 10k to +5V and output to arduino input, or measure it with a multimeter.
Looking at both datasheets, I don't see any differences in the pins. Anyway, both sensors were manufactured by the same company and are given to be interchangeable so I don't see them making this kind of practical joke.
Also they give it a +-30V rating so it shouldn't be dead...
But the mystery continues... Actually I was looking at the datasheet that the distributor (selectronic, french electronic shop) put on it's site. And now that I look at it, it points towards the UGN 3141-3144...
Thing is, on my sensor, it only says A(for allegro) 02E and on the back (engraved but almost invisible) 1212 800J. According to the datasheet it must then be a component which P/N ends in 02... should be A1102 EUAT then?
So, to sum it up, I was reading the "wrong" datasheet (UGN 3141 to 3142) which in the end seems to give the same pinout than the A1102EUAT that I have...
In the end, no error on the pinouts (or so it seems), but what could be the problem?
What are markings on the device ?
Did you notice that the datasheet for the 3140 says the supply voltage is -35 to +28Vdc ?
Have you considered putting a silicon diode with the cathode connected to the output and the anode to GND ?
Can you make a photo of it ? I would like to see it.
Did you try both the North and the South with a magnet ?
Do you have some more of them, at least a few that you have not used yet ? If everyone was connected wrong, they all might be broken.
If everyone was connected wrong, they all might be broken.
Very unlikely. In 30 yrs working with electronics , I've only encountered one or two defective new (straight out of the package) semi-conductor devices . From working in a semiconductor fab , I know the chips (or dies) are tested extensively before they ever cut into individual dies for packaging.
Nooooooo, I ment that if the open-collector output of the hall sensor was connected to the 5V, and the chip has enough power for a base current, the open-collector output could get too much current and the hall sensor would be broken.
I'll make a picture of it in a couple of hours when I get home.
Meanwhile, I just wanted to say, I don't think I fried the collector since it was connected to an arduino digital input which sinks not more than 20mA IIRC... And with a 10K pull-up but that makes a ridiculous current...
If you connect it to 5V (you can use a resistor of 180 ohm to 5V to protect it), and GND, and pullup resistor of 1k or 4k7 out the output, and use a multimeter, it must work.
Perhaps it is not correctly soldered ? Bad soldering can do crazy things. Or do you use breadboard ? those have sometimes bad contacts.
I have no idea what could be wrong, it should work the first time. Some components are fake, but I have not heard of fake hall switches yet.