Shop OBEX P1 Docs P2 Docs Learn Events
Adc0831 questions – current conversion and leakage . — Parallax Forums

Adc0831 questions – current conversion and leakage .

vaclav_salvaclav_sal Posts: 451
edited 2011-05-24 22:01 in General Discussion
I am using ADC0831 to make a digital display from an analog source which has a full scale range from 0 to 1 mA. I got the software working converting voltage drop on 1kOhm resistor.

I was curious if there is a way to read the current instead of the voltage drop – using this converter.
I did not find any app notes on that.

My second question is more practical. I need to change the reference voltage to get full 256 bits scale.
I am going to use PWM to generate the required reference value.
It is recommended to use low leakage capacitor to keep it from discharging too fast.. Since there is a leakage inside the processor itself do I really need low leakage capacitor?
I have polystyrene caps somewhere in my junk box and I am planing to use them.
But they may be too small of a value.

What would be the most suitable make of the capacitor (technology) to use?
As always, any constructive help is appreciated.
Thanks for reading.

Cheers

Vaclav

Comments

  • kwinnkwinn Posts: 8,697
    edited 2011-05-22 13:06
    To answer your first question, no, the ADC0831 is a voltage input chip. Using a resistor as you did is the standard way of converting a current to a voltage.

    For your second question I would advise against using PWM to generate a reference voltage for an adc. It will inject noise into the system without good filtering. Simpler to use a voltage divider or voltage reference chip.You could also use an op amp to kill 2 birds with one chip. It could convert the current signal to a voltage and amplify it to the desired level.
  • vaclav_salvaclav_sal Posts: 451
    edited 2011-05-22 19:17
    Thanks for reply.
    I was afraid that I cannot convert current using this ADC.
    As far as using PWM to generate reference voltage I'll experiment with it.I am not looking for great accuracy but I need to calibrate to full scale each unit. I started with Vref tied to +5V but got only to about 80 instead of 256. But it just followed the spec. Right now I have a variable resistor on the input. I have not calculated the reference voltage and it may be easier to use simple resistor divider as you suggested plus the input resistor.
    Vaclav .
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-05-22 19:28
    How are you not getting the full 256 and only 80? I thought the 0831 just chopped whatever the span was between Vref and Vin- into 256 parts.

    edit: sorry, they call it Vin- on the data sheet, not Vref-
  • FranklinFranklin Posts: 4,747
    edited 2011-05-22 19:38
    If you could attach your circuit and what it is you are trying to measure prehaps we could help better.
  • vaclav_salvaclav_sal Posts: 451
    edited 2011-05-24 13:27
    I'll try to describe my circuit. I am little handicapped right now, scanner is broken and Eagle does not have ADC0831 in library.

    OK, the input is from source (external device) connected to 1 kOhm potentiometer -'hot” side.
    The other side goes thru 330 Ohms “safety” resistor to ground.
    The source supplies 1mA current at full scale.
    The viper goes to Vin+.
    At full scale Vin+ is 1V.

    The Vin- is grounded.
    Vref was directly connected to +5V Then my max digital output was 80.

    Now I am attempting to adjust Vref using PWM – “standard” RC output via 10kOhm resistor and 1uF capacitor directly to Vref..
    The voltage never gets pass about .7V, no matter how I adjust the PWM .

    I can see nice charge curve ( max 5 V) at the capacitor when there is no ADC loading down the RC circuit.

    It looks like the ADC Vref load is too much for the BS2e and using PWM via RC circuit only is out.
    Reason I want to use PWM is that I could calibrate the ADC – full scale = 1 V instead of using the input potentiometer.

    I am not sure how to calculate the required Vref to get full scale with my input being 1V.
    Somehow I missed it in the spec.

    When I figure it out I shall try a fixed Vref – either simple voltage divider from +5V or Zener if it is close to some standard value.
    Maybe I 'll try insert a "driver transistor" from RC to Vref.

    Thanks for your help, I appreciate it.

    Cheers
    Vaclav
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-05-24 14:32
    I know you can set Vin- and Vref to any voltage you want, just use some trimmer pots. Set Vin- to some bottom end value and set Vref to voltage to represent the total range. For example if you want to measure say 0.60 to 1.875 volts, set Vin- to 0.6 and Vref to 1.275 volts. Each bit is then equal to 0.005 volt
  • vaclav_salvaclav_sal Posts: 451
    edited 2011-05-24 15:17
    Thanks Rick,
    just where did you find this "magic formula"?
    In my case it should be Vin- GND and Vref around 1V.
    I still would like to do this in software, using PWM.
    ( Just looking for most complicated selfpunishing way!)
    I am Googling for solution right now.
    Vaclav
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-05-24 15:55
    I'm pretty sure I learned it in one of the Parallax Stamps in Class books, "Process Control" maybe.

    Its in the data sheet but its not real obvious. They call it "ratiometric". There's also a circuit on page 22 called "Digitizing a Current Flow", which might offer you some more help.

    http://www.national.com/ds/DC/ADC0831.pdf
  • vaclav_salvaclav_sal Posts: 451
    edited 2011-05-24 16:35
    Rick,
    I have been thru this ADC0931 spec several times and never found clear answer. This is typical of what I affectionately call voodoo electronics.
    They never clearly define “radiometric “ either.
    But I found a little tidbit in Parallax documentation basically saying you cannot directly drive a device from the PWM RC circuit. And they suggested OP amp buffer ( App note 15 in BS1 of all places!).
    National spec says something about the source of Vref must be capable to drive “3,5 kOhm”.

    So the question is – how do you calculate all this instead just guessing?
    But it is beginning to make sense. To bad it took this long to figure it out.
    I guess some of us are slow , but I finally found use for dozens on 741 I collected over the years past.
    Cheers
    Vaclav
  • kwinnkwinn Posts: 8,697
    edited 2011-05-24 22:01
    vaclav_sal, refer page 23 of the datasheet for this explanation.

    The ADC083x is an 8 bit adc. It compares the input voltage Vin to the reference voltage Vref and outputs an 8 bit binary number between 00000000 and 11111111 (0 – 255 decimal). This is where the term ratiometric comes from. The reading is a number representing the ratio of the Vin/Vref.

    Lets assume a Vref of 2.56V is used. That will make each bit represent 10mV (2.56/256).
    If you put 0V on the input then the output reading will be 0.
    If the input voltage is 1V the output reading will be 01100100 binary or 100 decimal. Multiply that by 10 (10mV per bit) and you have 1000mV or 1.00V
    Put 2V in and the reading is 1100100 binary, 200 decimal, which is multiplied by 10 to give 2000mV or 2.00V
    Vref can be any voltage up to the maximum voltage the chip is rated for. Typically it is either a convenient available voltage such as +5V, a voltage that makes the calculations simple such as the 2.56V above, or one that is very close to the maximum Vin to obtain the best possible resolution (1V in your case).
Sign In or Register to comment.