Max voltage level with 0.1V Resolution; 10 bit adc

Discussion in 'General Electronics Chat' started by Vindhyachal Takniki, Oct 6, 2016.

  1. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    349
    6
    1. I have a microcontroller with 10 bit adc. Adc ref voltage is 5Vdc.
    So its resolution would be: 5V/1023.
    Now in my system I have three segment display & max reading upto 99.9V. So that means I have to measure voltage with 0.1V resolution.

    2. Can I measure the system upto 99.9Vdc with 0.1V accuracy using 10bit adc?

    3. I think yes, calculation according to me:
    A. TO make 100Vdc to 5V I will use resistor divider of 20 i.e 190K:10K
    B) Resolution of MCU with 5V: 5V/1023
    C) Resolttion required 0.1V.
    D) Resolution wih divider: (5V/1023) * (20) = 0.09775V

    Since resolution requied is greater than resolution with divider so I think I can measure

    4. I dont know how much accurate system will be. Will do testing for it.
     
  2. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    With a 10 bit ADC you will get 4.88mV accuracy.
    Displaying them at 100mV resolution is no problem but that is for 5V input.

    for 100V u need to scale it....
    so, 100V/5V = 20...,
    and , 4.88mV * 20 = 97.6mV and still it is with in 100mV resolution.

    For accuracy you might need a separate stable reference. Using Vdd as reference is tricky and it is unpredictable if Vdd is not very stable and 5.00V on the spot.
     
    Last edited: Oct 6, 2016
  3. ericgibbs

    AAC Fanatic!

    Jan 29, 2010
    2,503
    380
    hi R!,
    The ADC in a PIC is ratio metric, meaning that using the Vdd as Vref will not cause a problem.
    E
     
  4. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,754
    760
    Thank you ericgibbs
    I was trying to clarify that if the Vdd is not stable due to circumstances, the measured voltage might not be accurate.
    for example in the circuit I am making, 5V is used to drive LED in PWM and driving buzzers and the sort might cause the Vdd to fluctuate. If Vdd fluctuates so would the Vref (if Vref is Vdd).
    I gave this a lots of thought and my thinking was to make the Vdd rock solid and exactly 5.00V.
    I admit I have yet to confirm this.

    What are your thought on this ericgibbs
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    Making a 5V reference off a 5V supply is quite a complex problem. Making a lower voltage reference is quite simple, which is why you will find many 4.096 or 2.048 volt reference ICs that are inexpensive and quite accurate.
     
  6. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,147
    204
    Don't forget the quantization error. An easy way to illustrate this is say you had something that had a range of 0 to 100 and +- 1 count At 1 "bit" you have +- 1 count. so it's a 50% error. At 100, you have +-1 count and it''s closer to a 1% error. The low end gets skewed.

    Dual-slope integration is a good application for meters. See: https://en.wikipedia.org/wiki/Integrating_ADC
     
  7. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    349
    6
    1. Resistor are 190K & 10K. Standard 5%

    2. Adc ref is Vdd of MCU which is 5V coming from TO92 package LM7805.

    3. This LM7805 also drives 6 segments. 3 for each voltage reading. Each segment is on sequentially for 30us & off for 150us. So it forms a total time base of 900us ofr 6 segments.

    4. Algo for sampling each channel:
    A)Take 100samples. Each sample in 250us.
    B) Add them & average them out & store the result
    C) Then 25 such sample reading are taken as obtained from (B)
    D) Now arrange these 25 samples in ascending order. Reject lowest 5 & highest 5. Then again take average of 15 remaining.
    E) Get voltage reading by formula: voltage=(result * 5)/1023.0f
    F) Apply divider: voltage * 20
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,050
    3,244
    If your resistors are ±5% then your worst-case voltage measurement accuracy will also be no better than ±5%.
    Why not use common ±1% resistors?
     
  9. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    349
    6
    1. Will use resistor as 5% only in this project.
    2. But reduced the range 0V-35V. Now will use the divider ratio: 78K:2K. This makes system upto 40V, 5V keeping upper margin.
    3. Algo will be used as in last post.
    4. One time calibration will be done: two point calibration. Calibration will be done at two voltage levels: 5V & 30V to remove any offset & gain errors.
    5. Made the board will see results
     
  10. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    A. Each sample need not be stored, just sum into one variable. Averaging here rather than later earns you nothing but extra work. if you gather 128 samples your averaging is easier.
    B.
    C. 16 or 32 remaining samples is simpler to compute.
    D. One need not sort to find the highest and lowest values.
    E. since your decimal point is well known you can compute the voltage x 10 and avoid floating point math altogether.

    Nothing necessary to do here, just some tweaks and efficiency improvements.
     
    Vindhyachal Takniki likes this.
Loading...