ADC voltage coversion accuray error

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

ADC voltage coversion accuray error

Post by makram » Mon Sep 28, 2020 8:42 pm

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
WhatsApp Image 2020-09-29 at 2.01.46 AM.jpeg
Measuring voltage using multimeter
WhatsApp Image 2020-09-29 at 2.01.46 AM.jpeg (45.73 KiB) Viewed 2031 times
Screenshot (98).png
Code
Screenshot (98).png (127.49 KiB) Viewed 2031 times

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

Re: ADC voltage coversion accuray error

Post by davef » Mon Sep 28, 2020 9:13 pm

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: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: ADC voltage coversion accuray error

Post by kevinkk525 » Mon Sep 28, 2020 9:17 pm

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

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: ADC voltage coversion accuray error

Post by rcolistete » Tue Sep 29, 2020 1:27 am

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

Post Reply