ADC Averaging?

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Jan 30, 2010.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,018
    I built a bench supply with a PIC as a DMM.

    I have included my schematic below.

    I know I probably should use a voltage reference but I really don't want to get into that right now.

    Everything is built on a perf board. With the exception of the voltage divider which is currently on a Proto Board.


    My problem is that the voltage constantly jumps in a .03 volt range. What is the best but easy way to cure this problem?

    Can I do software averaging? If so, can someone suggest a algorithm?


    Will I see some stabilization once I move the divider to the perf board??
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
    Hello,

    What is the resolution (or step size) of the ADC?
    The resolution is the reference voltage divided by the number of steps.

    Greetings,
    Bertus
     
  3. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,018
    Sorry should have posted that. I am using all 12 bits.

    The divider is calculated for 40VDC but I am really reading only about 35VDC. I wanted to give some "padding" to protect any possible over voltage.

    I am reading anywhere from 1.2 VDC to the stated 35VDC.


    Oh and I am not seeing a corresponding "jumping" on my regular multimeter so I think the supply is pretty stable.
     
  4. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,018
    That is what I thought but you really should not divide on a PIC.


    How fast can I read the input?
     
  5. eng1ne

    Member

    Dec 4, 2009
    97
    3
    Just curious spinnaker, why shouldn't you divide on a PIC? I am not questioning your statement, just interested. I have a program written and debugged (but not proto'd) that is INTENTED to do a division.

    The speed you can read the input is dependent on the highest frequency of your input voltage.
     
  6. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,018
    Technically inefficient. Floating point operations take a lot of memory. But really wit the chip I have and the small little program I have. I could probably go ahead and do it.
     
  7. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,018

    Thanks.

    Maybe I misunderstood what I read but the way I understood it, it that the go done bit is just the time it takes for the ADC version to complete.

    You still need to wait for your capacitor to charge again for the input to reach full voltage.
     
  8. SRH

    New Member

    Jan 30, 2010
    4
    0
    Why not add 8 samples and shift right three locations to average 8 samples:

    (s1 + s2 + ... + s8) >> 3 = (s1 + s2 + ... + s8) / 8


    SRH
     
  9. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,887
    1,018

    I went with this method but I bumped it up to 16 samples. It is now rock solid. Thanks.
     
Loading...