Reading DC current transducer with ADC0834
Roger Pierson
Posts: 62
Hi folks,
I'm using a CRMagnetics DC current transducer to measure current from 0 to 20 amps. The transducer requires an external 24vdc power source and the output is 0-5vdc depending on the measured current.
To read this output voltage, I've connected an ADC0834 8 bit analog to digital converter. For testing purposes, I'm using Jon Williams ADC0834 code which he posted at http://forums.parallax.com/attachment.php?attachmentid=38157.
Here is the datasheet for the ADC0834: www.ortodoxism.ro/datasheets/nationalsemiconductor/DS005583.PDF
The problem I am having is that I'm getting nothing but random readings on all four channels when I try to read the output of my transducer (connected to channel 1). For testing, I have the transducer ouputing about 1vdc. As soon as I disconnect channel 1, all four channels go to zero and remain steady.
There are plenty examples to be found on here and in the N&V articles about the 0831, but not much in the way of connection examples for the 0834, which has a very different pinout. Here are the connections I'm unsure about.
Vcc (pin 14 of the ADC0834) - I have tied to VDD, along with V+.
Vref (pin 9) is tied to VDD. The output of the transducer is max 5vdc, so VDD is a good 5 volt reference, right?
AGND (Pin 8) is tied to VSS. Is this the what the ADC references 0 to?
DGND (Pin 7) is also tied to VSS.
I've tried connecting AGND to the negative side of the 24vdc power supply that powers the transducer. I get a steady reading of 0 on all channels when I do that.
Please let me know what you guys think. Thanks!
Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
I'm using a CRMagnetics DC current transducer to measure current from 0 to 20 amps. The transducer requires an external 24vdc power source and the output is 0-5vdc depending on the measured current.
To read this output voltage, I've connected an ADC0834 8 bit analog to digital converter. For testing purposes, I'm using Jon Williams ADC0834 code which he posted at http://forums.parallax.com/attachment.php?attachmentid=38157.
Here is the datasheet for the ADC0834: www.ortodoxism.ro/datasheets/nationalsemiconductor/DS005583.PDF
The problem I am having is that I'm getting nothing but random readings on all four channels when I try to read the output of my transducer (connected to channel 1). For testing, I have the transducer ouputing about 1vdc. As soon as I disconnect channel 1, all four channels go to zero and remain steady.
There are plenty examples to be found on here and in the N&V articles about the 0831, but not much in the way of connection examples for the 0834, which has a very different pinout. Here are the connections I'm unsure about.
Vcc (pin 14 of the ADC0834) - I have tied to VDD, along with V+.
Vref (pin 9) is tied to VDD. The output of the transducer is max 5vdc, so VDD is a good 5 volt reference, right?
AGND (Pin 8) is tied to VSS. Is this the what the ADC references 0 to?
DGND (Pin 7) is also tied to VSS.
I've tried connecting AGND to the negative side of the 24vdc power supply that powers the transducer. I get a steady reading of 0 on all channels when I do that.
Please let me know what you guys think. Thanks!
Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
Comments
I have been trying to digest how the ADC0834 works for the last couple of days - planned on wiring one up tonight to see if I understand - but in all my wisdom (!!), I have a couple of suggestions as I understand it (which could be pure BS).
First, I would consider connecting VREF to ground rather than VDD.
Second, I would definitely connect the grounds - you don't want a V differential
Finally, I have seen references to tying unused inputs to ground
Give it a try and let me know if I need to go back to the books!
Paul
I tried your suggestions with no result, with the exception that conecting the unused channels to ground holds them at a constant "0" instead of jumping around.
When I connect Vref to VSS I get no reading on the active channel.
I'm officially stumped.
Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
I was just wondering if you succesfully hooked up your ADC yet? I'm still dead in the water. I'm about to give up and buy the 0831 of which there are plenty examples available.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
Roger,
Sorry for the delay.
Yes, I have it hooked it up with a 10K POT between +5 and GND (wiper to Channel 0). I get a full range of values when I turn the pot from end to end. The open channels also vary when I turn the pot. If I connect the open channels to ground (through a 1K) , their readings go to 0, but I still get the full range of values from channel 0. All this SEEMS like normal behavior, but I really need to study the datasheet (and other resources) more because I want to have a better understanding of how this works.
If you want the full hookup details, I can get them to you when I get home later this afternoon.
Paul
Glad to see you are getting some results at least!
I would be interested to know how the rest of your circuit is connected. Perhaps you can save my ADC0834 from it's impending death under the heal of my boot! [noparse]:)[/noparse]
- Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
As I mentioned, I have been playing with the effects of connecting the other 3 channels to ground through a 1K to see what happens and need to study it (and the datasheet) some more.
I have attached the code I am using.
Let me know how you do and what you find.
Paul
I'm not exactly sure what changed, but I can at least duplicate your results using the 10k pot. I couldn't even get that to work before. The two biggest changes are that before I wasn't using the SARS line, and I had Vcc connected to Vdd. Now SARS is checked in the software and Vcc floats.
I tied the unused channels to ground via a 1K resistor, I tied DI and DO together to conserve Stamp Pins, and I placed a 1K resistor between DO/DI and the Stamp pin. (I saw a reference elsewhere to doing this to protect against a "data collision".)
Comparing the results on the debug window to the results on my Fluke shows that this setup seems to be accurate, to a degree. Even with 8-bit resolution and the mathmatical dancing to get around the decimal point problem I still never saw a conversion error greater than 55 millivolts.
I'll attach the modifications I made to the code you posted. I just shortened it and added some math. I also included the connection data you gave me in the code for the next person who has trouble with this thing.
Again, I appreciate your help!
Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
I just got the DC Transducer setup working. I had to address the ADC0834 into Differential mode and connect the ground to channel 0 (+) and the output to Channel 1 (-)
Works great and is about $100 cheaper than the cheapest DAQ board I could find!
-Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
Good job! Glad I could help for a change!
I didn't get a chance to work with this last evening, but I will tonight.
Would you mind elaborating on what you mean by "address the ADC0834 into Differential Mode"?
Thanks for the updated code - now to put my LCD stuff back in - I have gotten used to having results right there next to the circuit!
Paul
Instead of reading a single-ended measurment from the output of the DC Current Transducer, I had to compare the voltage at the transducer's ground to the voltage at it's output. The output voltage was more negative than the ground.
To do that, I changed the address on channel one from %1100 ('12' in the code) to %1000 ('8'). This put channel zero in differential mode with channel one, and asssigned channel zero as the most positive of the two voltages. I got these address values from the tables in the datasheet. (What's not clear in the tables is that the MSB is always '1' as it is the 'start bit')
I'll attach the code I used for my transducer setup. It's the same as I posted yesterday, except it has the address change and I added my own LCD code.
-Roger
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Roger Pierson
Senior Electronics Technicain
DTI Assoicates
Thanks Roger,
Paul