Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By btidey
#75909 Those numbers do look low. I normally see about +/- 5% in ADC from nominal across devices.

The voltage you quote is for theoretical voltages calculated from the divider ratio e.g.

5.23V (0.99619V on ADC)

Have you tried measuring the actual voltage on the ADC pin itself with a digital multimeter whilst taking the measurement. That would help eliminate any other reasons for the discrepancy.
User avatar
By rudy
#75911
dynek wrote:And final note :-) these are values from a few days ago, I just turned on the ESP with 5.23V -> ~1V on ADC and it values returned were between 770 and 787. I'm not looking for accuracy but it doesn't seem usable at all...

I did some tests quite a while ago. That is the way I feel as well. There is an old issue on the ESP8266/Arduino Github page about the A/D inaccuracy. Some ideas on how to get the best from it. I still consider it unusable for anything other than crude measurements.
User avatar
By martin_g
#75923 When you are using WiFi, make sure to set wifi_set_sleep_type(NONE_SLEEP_T), otherwise the ADC will produce some more random noise.
User avatar
By trackerj
#75924 ESP8266 internal ADC is notoriously bad in terms of accuracy and also has a bad non-linear response so for anything than very simple ADC functions I would suggest you to use an external dedicated ADC.

A good I2C candidate is the MCP3421, a single channel, low-noise, high accuracy delta-sigma A/D converter with differential inputs and up to 18 bits of resolution. Even more, it has a on-board precision 2.048V reference voltage that can be used for a full input input range of ±2.048V differentially.

For more details about MPC4321 you can look here: MCP3421 ADC I2C Driver example

If you combine it with a multi-range or an autorange ADC Input frontend you can obtain a very nice universal ADC input for your ESP8266 related projects. A full example with schematics, drivers, etc can be found here: ADC autorange frontend
Last edited by trackerj on Mon May 14, 2018 9:40 am, edited 1 time in total.