Offline
Newbie
Karma: 0
Posts: 19
|
 |
« on: July 28, 2011, 10:05:45 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Dallas, Texas
Offline
God Member
Karma: 0
Posts: 861
|
 |
« Reply #1 on: July 28, 2011, 10:21:24 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 19
|
 |
« Reply #2 on: July 28, 2011, 10:29:49 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #3 on: July 28, 2011, 10:42:01 am » |
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
|
|
|
|
« Last Edit: July 28, 2011, 10:53:21 am by retrolefty »
|
Logged
|
|
|
|
|
Dallas, Texas
Offline
God Member
Karma: 0
Posts: 861
|
 |
« Reply #4 on: July 28, 2011, 10:51:45 am » |
Are you using the recommended Rsense value of 100 Ohms? Is Vcc between 4 and 24 Volts?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #5 on: July 28, 2011, 10:59:06 am » |
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
|
|
|
|
« Last Edit: July 28, 2011, 11:01:37 am by retrolefty »
|
Logged
|
|
|
|
|
Dallas, Texas
Offline
God Member
Karma: 0
Posts: 861
|
 |
« Reply #6 on: July 28, 2011, 11:05:05 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Dallas, Texas
Offline
God Member
Karma: 0
Posts: 861
|
 |
« Reply #7 on: July 28, 2011, 11:11:14 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #8 on: July 28, 2011, 11:11:21 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Dallas, Texas
Offline
God Member
Karma: 0
Posts: 861
|
 |
« Reply #9 on: July 28, 2011, 11:15:05 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #10 on: July 28, 2011, 11:21:44 am » |
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
|
|
|
|
|
Logged
|
|
|
|
|
Dallas, Texas
Offline
God Member
Karma: 0
Posts: 861
|
 |
« Reply #11 on: July 28, 2011, 11:27:46 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 19
|
 |
« Reply #12 on: July 28, 2011, 11:29:18 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #13 on: July 28, 2011, 11:35:53 am » |
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.aspLefty
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15314
Measurement changes behavior
|
 |
« Reply #14 on: July 28, 2011, 11:40:24 am » |
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.pdfThis 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
|
|
|
|
|
Logged
|
|
|
|
|
|