Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By gicho
#7733 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.
User avatar
By gwizz
#7746 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:
You do not have the required permissions to view the files attached to this post.
User avatar
By gicho
#7775 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.
User avatar
By betgear
#7776 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.