Page 1 of 1

ADC reading variation

PostPosted: Mon Jun 13, 2016 2:27 pm
by alanmcdonley
I have one channel of my Pi Droid Alpha MCP3008 ADC connected to a +/- 5A ACS712-05 current sensor which puts out 185 mV/A around 2.5v.

The ADC is nominally measuring 4.88mv/bit so I think that gives
Code: Select all
4.8828  mv          1000 mA          26.4 mA
----------       * -------         =  ____   
1 bit               185  mV            bit  around 512

(turn out it is wired up such  -26.4 mA/bit from 512)


current in mA = (ADC reading * 26.4) +/- 1.5% for current sensor and +/- 1.5 bits for the ADC

So a reading of 493 ~ 500mA +/- 7.5ma for the sensor and +/- 39.6ma for ADC ~ 500ma +/- 50ma somewhere between 450ma to 500ma or +/- 10%

or the other way around I can expect readings to vary +/- 2bits from 491 to 495 for 500mA current.

Now to my question:
Why do I have to average lots of readings to get a consistent average from set to set?
Code: Select all
Readings     Variability of five sets of average readings
10                 16%
20                 10%
33                  8%
65                  4%
75                  1.5%

example:
average of 10 readings 420ma
average of 10 readings 580ma
average of 10 readings 460ma
average of 10 readings 500ma
average of 10 reading 500ma

range of averages = 16% when performing five sets of 10 readings

Re: ADC reading variation

PostPosted: Tue Jun 14, 2016 10:42 am
by mikronauts
The ADC is driven from the Pi's 5V, whose level fluctuates due to instant power draw from the Pi.

For most sensors that does not matter, as they are ratiometric and basically work off Vcc/1024 and give you (sensor_vout/1024), so if the sensor is driven by the same voltage as the Pi, the errors basically cancel out.

Averaging many samples filters out the supply variations due to varying current draw by the Pi's on-board 3v3 regulation.

You could try adding a 100uF - 4700uF cap on the Pi's 5V, or for best results use an isolated supply to drive the MCP3208 and sensors.