Go Down

Topic: Two wire hall effect gear sensor (Read 2043 times) previous topic - next topic

mgandalf

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.

EmilyJane

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?

mgandalf

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.

retrolefty

#3
Jul 28, 2011, 05:42 pm Last Edit: Jul 28, 2011, 05:53 pm by retrolefty Reason: 1
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

EmilyJane

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

retrolefty

#5
Jul 28, 2011, 05:59 pm Last Edit: Jul 28, 2011, 06:01 pm by retrolefty Reason: 1

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:

Quote

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


Lefty

EmilyJane

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.

EmilyJane

Quote
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.

retrolefty

Quote
I suppose you could instead use an analog input.


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


EmilyJane

Quote
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

retrolefty


Quote
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.

Quote
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

EmilyJane

Quote
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?

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.

retrolefty


Quote
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

retrolefty


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


Go Up