-->
Page 1 of 2

ADC reference - measurements

PostPosted: Mon Jan 19, 2015 2:21 pm
by gicho
I haven't seen in the specification what is the ADC reference voltage, and if it is equal to the Vcc.
What I see is that the ADC range (= reference voltage) should be something like 0.966V - at least on my module.
When ADC input is grounded I get reading that fluctuates between 1 and 2.
With several test voltages I get these readings:

278mV -> 296 counts
519mV -> 549 counts
548mV -> 580 counts

Conclusions from this measurements is that there is some kind of internal voltage reference for the ADC. This is quite welcome if one wants to monitor the supply (battery) voltage with simple divider.

I still have to repeat the measurements with various supply voltages. It will be nice to know how stable the reference voltage. Variations with temperature, supply voltage and chip id :) should be analyzed.

Re: ADC reference - measurements

PostPosted: Mon Jan 19, 2015 5:17 pm
by gwizz
That's really useful measurements, thanks! I made a graph to see how linear it looks.Just glancing at it seems like the ADC is reasonably flat, just the reference voltage is a bit low. I'm sure there is a very cunning way to represent this mathematically, but I like to look at the shape of things to understand them!

Screenshot.png


Do you think it is worth having a few more test voltages?

Just to help comparisons between measurements, it would be great if you are able to specify the circuit, what equipment should be used (and how to set it up), this will help others contribute measurements - we could sort of crowd-source our own data-sheet. :D

I have been wondering what the various voltage supplies to the chip actually are, it would be good to be able to test varying these directly, but trying to cut the pins and lift them would be seriously hard :ugeek:

Re: ADC reference - measurements

PostPosted: Tue Jan 20, 2015 2:18 am
by gicho
Yep, my point was to trigger some others to make similar measurements so we can find out variations between idividual modules/chips.

Schematic is quite simple - resistor divider on the ADC input. See here for reference: http://www.learningaboutelectronics.com/Articles/Voltage-divider-calculator.php
- 1KOhm from ADC pin to GND (R2 on the link above)
- 4.7KOhm from ADC pin to the test voltage (R1 on the link above)
This divider allows me to choose from wider range of input voltages (1.5V battery, 3V battery, etc.). Could not find variable resistor (pot) yesterday.
This 4.7K are important to be safe - it limits the current that might flow into the ADC pin if somethings goes wrong.

Ths idea is dead simple - provide several different test voltages to the input of the divider (or to the ADC pin directly if you know what you are doing) and get the readings with simple test program.
My program is also quite simple - a loop stores 16 reading from system_adc_read() and then I print the average. This repeats every 100ms (a timer ticking).
Feed the test voltage - measure the actual voltage on the ADC pin (because of the divider) - write down the printed measurement.
Best way is to get one reading close to 0 (e.g. without any input - short circuit the ADC pin to ground - if you have put the divider that there is no need to do it because the pull-down resistor makes this). Than feed some values incrementally until the ADC reading reaches the maximum - 1023. Post the data here, but also specify the module type and actual (measured) supply voltage. Also it might be nice to know the environment temperature. Mines were done at about 21 degrees celcius.

Re: ADC reference - measurements

PostPosted: Tue Jan 20, 2015 2:31 am
by betgear
The resistors you've used for ADC measurement are quite low and would cause quite a drain on a battery powered device.

For monitoring a couple of AA batteries I would suggest much higher resistance,

BAT -- 1Meg ---C-- 470k --D--- GND

Place a .1uf capacitor between C and D and point C should also go to the ADC Pin.

Due to the low currents involved with such high resistance, the capacitor will store the charge for the ADC to read.

Your batteries will thank you for it though :)

*This is, of course, for monitoring battery voltage up to 3.2v or so, and not for monitoring temperature.

Glen.