# Two wire hall effect gear sensor

I have a two-wire hall effect gear sensor I'm trying to get sensible readings from. It's an Allegro ATS682LSH (http://www.allegromicro.com/en/Products/Part_Numbers/0682/0682.pdf). The readings I'm getting don't make any sense.

Has anyone managed to get one of these working?

Thanks, Mark.

That device looks impossible to hook up wrong. What do you mean by your readings not making sense? What did you expect and what did you get?

The readings were sporadic. I'd get random HIGH/LO values when no magnetic field was even present, let alone anywhere near a rotating gear.

• Mark.

That device is a two wire current loop output. One must wire a series resistor and use the voltage drop across the resistor as the signal output to be wired to a digital input. So what source voltage are you going to use? The spec say you can use anything between +4 and +24 volts. I assume you want to be able to wire it to a arduino digital input pin? If so and you don't wish to use any kind of op-amp comparitor circuit, you will have to carefully size the sensing resistor to ensure the the sensors high and low states are converted to legal high and low arduino logic voltage levels. I think around 200 ohms might work, assuming a +5vdc Vcc for the device, but I would want to test it out first.

Figure 7 shows a typical interface using a 100 ohm sensing resistor feeding a comparitor. Figure 4 shows both high side and low side interfacing using a series sensing resistor. Again this device is not as simple to interface to an arduino digital input pin as it might first appear as the sensor is a digital current output and the arduino digital input requires a voltage input, thus the need to convert the logic current signal to a logic voltage signal that meets the AVR legal digital voltage requirements.

So how are you wiring up the sensor to arduino presently?

Lefty

Are you using the recommended Rsense value of 100 Ohms? Is Vcc between 4 and 24 Volts?

EmilyJane: Are you using the recommended Rsense value of 100 Ohms? Is Vcc between 4 and 24 Volts?

A 100 ohms resistor would only generate a maximum of around 1.8vdc for a 'high' state, not large enough to be read as a legal arduino logic high. That's why they show the 100 ohm resistor feeding a comparator.

Here are the possible current logic values possible output for the device:

ICC(LOW) 5.0 7 8.4 mA // min typical max ICC(HIGH) 11.8 14 16.8 mA

Lefty

Once you get it working satisfactorily at all, as Lefty points out, some additional conditioning will be required to get the output into a range that will reliably satisfy the Arduino's digital input requirements. I suppose you could instead use an analog input.

A 100 ohms resistor would only generate a maximum of around 1.8vdc for a 'high' state, not large enough to be read as a legal arduino logic high. That's why they show the 100 ohm resistor feeding a comparator.

I was just suggesting a hookup that should provide a guaranteed method of testing whether the device worked at all. I don't see a way to get around some sort of conditioning. With a possible maximum of 8.4 mA for a logic low, 200 Ohms gives 1.68 V which I believe is too high for a reliable logic low.

As most of the time this kind of sensor is being used to measure RPM it would be a little ackward I would think to have to read it as a analog input value, and then try and 'count' the valid thresold state to convert it to a digital variable suitable for timing the signal's frequency?

Lefty

As most of the time this kind of sensor is being used to measure RPM it would be a little ackward I would think to have to read it as a analog input value, and then try and ‘count’ the valid thresold state to convert it to a digital variable suitable for timing the signal’s frequency?

Note the use of “suppose” and “could”.

EmilyJane:

As most of the time this kind of sensor is being used to measure RPM it would be a little ackward I would think to have to read it as a analog input value, and then try and 'count' the valid thresold state to convert it to a digital variable suitable for timing the signal's frequency?

Note the use of "suppose" and "could". :-P

Yes, weasel words at best. ;) However can you see another possible application in the analog world for this device considerings it's digital output nature? I can't.

200 Ohms gives 1.68 V which I believe is too high for a reliable logic low.

Your correct. I did some quick calculations and I can't come up with a single resistor value that meets all the possible hi/lo min and max current variation that would still meet the avr's logic min and max digital voltage levels. Guess a comparitor op-amp is a requirement for using this sensor.

Lefty

Yes, weasel words at best. However can you see another possible application in the analog world for this device considerings it's digital output nature? I can't.

I was thinking along the lines of generating an interrupt using the comparator function of the 328 chip. I realize this is outside the realm of a starter project but certainly worth a look if you wanted a minimum parts count solution. Still too weasely for you?

I'm feeding it 5v from the Arduino. I first tried with a resistor, but I wasn't getting anything, if I remember correctly. I didn't realize this altered current instead of voltage.

If this isn't going to work well with an Arduino, can anyone suggest a better part?

Thanks, Mark.

EmilyJane:

Yes, weasel words at best. However can you see another possible application in the analog world for this device considerings it's digital output nature? I can't.

I was thinking along the lines of generating an interrupt using the comparator function of the 328 chip. I realize this is outside the realm of a starter project but certainly worth a look if you wanted a minimum parts count solution. Still too weasely for you?

Sounds possible. Arduino doesn't provide any comparator functions in it's core library commands so with my software skills still firmly following a learning curve I wouldn't have a clue how to implement that other then with good old hardware components. ;)

If it was me, I would just buy a Allegro version that uses voltage output: http://www.allegromicro.com/en/Products/Part_Numbers/0616/index.asp

Lefty

mgandalf: I'm feeding it 5v from the Arduino. I first tried with a resistor, but I wasn't getting anything, if I remember correctly. I didn't realize this altered current instead of voltage.

If this isn't going to work well with an Arduino, can anyone suggest a better part?

Thanks, Mark.

http://www.allegromicro.com/en/Products/Part_Numbers/0616/0616.pdf

This device seems to be able to work with a +5vdc supply and has a open collector output, so should be easy to wire up to a arduino digital input pin using a simple pull-up resistor.

Lefty

If it was me, I would just buy a Allegro version that uses voltage output:

That's what I would suggest or maybe the ATS627 if you need it to work below 10Hz.

At the risk of sounding stupid, how can I tell which are current output and which are voltage?

Thanks, Mark.

mgandalf: At the risk of sounding stupid, how can I tell which are current output and which are voltage?

Thanks, Mark.

By careful reading of the datasheet. But the term 'two wire' is kind of a process control world 'buzz word' for current loop devices. Most sensors used in process plants use current loop sensors because it allows for long cable runs between the sensors and the control system that won't be effected by the length of cabling causing voltage drops that would effect accuracy.

Lefty

A quick test is if it has three or more leads, it's probably a voltage out. Otherwise you would have to take a close look ate the data sheet. Both the parts that Lefty and I suggested are voltage out.

Great stuff, thanks! I'll try the latter one suggested. I'm attempting to sense the rotation of a carousel within a jukebox.

• Mark.