Reading current instead of voltage confusion...

My apologies if this has already been addressed. I've found a few old topics which touch on the topic, but I'm still stuck.

I have a hall effect switch that outputs 2 to 6 mA at low state and 12 to 16 mA at high state. I'm trying to have arduino turn on the LED at pin 13 when at high state and off at low state.

My issue is, the sensor always has an output of approximately 5v regardless of high or low state. Other topics have directed me to use a shunt, however this doesn't appear to be working.

I'm needing a bit of guidance to get the schematic working. The plan in the arduino code was to simply check if the analogRead() function was returning a value greater than a defined value (0 to 1024 dependant on voltage).

A switch doesn't (and can't) output current. It isn't an active device.

Do you have a data sheet link for the device you are using?

It's an Allegro A1244 IC. The datasheet can be found here: http://www.allegromicro.com/en/Products/Magnetic-Digital-Position-Sensor-ICs/Hall-Effect-Latches-Bipolar-Switches/A1244.aspx

What are the resistor values? Where did you come-up with that schematic? I don't think you need R1, and 300-400 ohms is probably about right for R2 (~14mA @ 5V). If I'm understanding how it works (I've never used a hall-effect device) You're going to get about half that voltage when the device is turned "off" (about half the current).

The switch is in series with the resistors. This creates a "voltage divider circuit" with the higher proportion of the voltage across the higher-value resistors (or higher-resistance device). i.e. If the resistors are much-higher value than the resistance of the hall-effect device, most of the 5V will appear "across" the resistors and the state of the hall-effect device will have very-little effect.

Do you have a multimeter to measure the voltage?

I take back what I said, this is an active device. I'm not familiar enough with how they operate to select proper sensing resistor.

When I measure the input voltage vs ground, I get 5V. There might be a resistor or something because the voltage of the cell output vs ground is 3.2 volts. Therefore, (if R1 = 0 ohms), the analog input is approximately 650 regardless if the cell is at high or low state -- pretty disappointing.

I'll have to try manipulating the circuit more to try to still figure it out. Essentially since voltage of the cell output is always the same, the voltage drop measured across a shunt resistor is always the same.. :-/ Not sure..

You don't need an R1 unless you want to make the math more complicated.

Now that I've studied the device a litte bit more, it is a constant current device. In the low state it will always allow up to 6mA to flow through it and in the high state it will always allow up 15mA. (both of these are nominal values.) Remove R1. I will refer to R2 just in name.

So you pick a value of R2 that makes sense for 5V.

Ohm's Law: V = I * R

5 = 15mA * R
R = 5 / 15mA = 333.33333 = 330ohm

Knowing there is a 330ohm resistor there when your device is outputting a "low" your voltage will be:
V = 5mA * 330 = 1.5V which should give an A/D reading around 300.

Essentially since voltage of the cell output is always the same, the voltage drop measured across a shunt resistor is always the same.. :-/ Not sure..

The current through the device is always the same. The voltage drop is relative to whatever resistor it is in series with. With the 330ohm resistor, the voltage across your device should be nearly 0V when it is HIGH. It'll be about 4.5V when it is LOW.

Essentially since voltage of the cell output is always the same, the voltage drop measured across a shunt resistor is always the same..

  • Your resistor might be the wrong value.
  • The device might be wired backwards or otherwise connected incorrectly.
  • The device might be defective
  • Your magnetic field may be too weak to trigger the device.