## ADC voltage coversion accuray error

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
makram
Posts: 11
Joined: Thu Aug 13, 2020 7:14 pm

### ADC voltage coversion accuray error

Hi Everyone,
I'm trying to covert a the ADC bit count into voltage but my results are not very precise can anyone please correct me
Here my max input voltage is 3.3v that's why I m using 11db

the ESP32 is giving a 2.02V while the multimeter is giving 2.2v

please share your thoughts to improve the accuracy I'm attaching my code and
Attachments
Measuring voltage using multimeter
WhatsApp Image 2020-09-29 at 2.01.46 AM.jpeg (45.73 KiB) Viewed 256 times
Code
Screenshot (98).png (127.49 KiB) Viewed 256 times

davef
Posts: 93
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

### Re: ADC voltage coversion accuray error

How is the ADC reference voltage derived in the ESP32? If it is one of the supply voltages to the chip is used as the reference then how accurate is it? If there is an internal reference what is the tolerance on that?

I always end up tweaking the formula to get them to agree.

kevinkk525
Posts: 781
Joined: Sat Feb 03, 2018 7:02 pm

### Re: ADC voltage coversion accuray error

The Esp32 adc is not very accurate and not linear at the edges but after some calibration in code it worked rather acceptable in my case.
For me this worked best: adc/4095*3.4 + 0.112
So the maximum voltage at 3.4V and an offset of 0.112V. It will not give you good results at the edges (close to 0V and close to 3.3V) but everything in between is rather accurate (you might need to calibrate your unit with your multimeter but using my formula you'd have a measurement of 2.193V so that is already rather close to the 2.21V of your multimeter)
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

rcolistete
Posts: 325
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

### Re: ADC voltage coversion accuray error

My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).