Go Down

Topic: improve ADC accuracy with sleep mode (Read 1 time) previous topic - next topic

xuexi

I tried to make Arduino nano DAC read as accurate as possible. Many articles suggested putting the cpu to sleep. All those articles I read had no data in supporting the improvement in sleep mode. I tried out some of the codings. Few of them didn't put the cpu to sleep, and few of them did not work at all. I followed the example on a couple of very good articles, With some modification, I was able to collect  the measuring data to prove the sleep mode improve accuracy.

 Based on my measurements, standard deviation for normal analogRead was 1.4 bits and with cpu sleep mode was 0.9 bits.  In many applications,  1.4 bits was small. For precision measurement, it was large. For measurements to be 99% accurate,  3 sigma (3x standard deviation) were required. That means, with normal read, in 1% of the readings, it could be off by 1.4x3 = 4.2 bits if you believe in bell curve normal distribution. With sleep mode read, it was 0.9x3=2.7 bits. With 5V reference, in 1% of the readings, it was off by 13.5mV.

To improve the accuracy, averaging was used. Based on my bench measurement with sleep mode, making 3 sigma down to 0.5 bit needed an average of 16 readings. To make it down to 0.25 bits, it needed to have an average of 200 readings. I was using 16 readings. The total no sleep read time was 2.4mS.

There was another inaccuracy due to the ADC comparator offset voltage. It could be significant if measuring at low input voltage. With my cheap Chinese clone, it was 11mV or 2.2 bits. To overcome this issue, I collected ADC outputs with various input voltages, and used  linear curve fitting to generate an equation to calculate ADC input voltage with ADC digital output.  That equation eliminated the need of  offset voltage and REF voltage which were embedded in the equation.

There is no need to point out the significance in having good noise shielding and supply decoupling while doing the measurement.  My ino code is in the attached file. I am new to Arduino. All comments are welcome.


Go Up