ADC Calibrated Value still not correct?

ron_15
Posts: 2
Joined: Wed Feb 21, 2018 4:13 pm

ADC Calibrated Value still not correct?

Postby ron_15 » Wed Feb 21, 2018 4:56 pm

Hello Everyone!

I've been playing and testing esp32 for a month now and tried to use the ADC peripheral. I was aware at the beginning about the problems it has so I tried us use the calibration method given in this page (http://esp-idf.readthedocs.io/en/latest ... s/adc.html). I have successfully measured the Vref (1083mV) and used it in the esp_adc_cal_get_characteristics() function. I tried to use adc1_to_voltage() to get my calibrated value but still I am not getting the right voltage. On my Voltmeter I am measuring ~1.27v but on the calibrated ADC I am getting 1.241v. =(

I tried to look for other tutorials on the net and found one that was giving me a very close value. I got it from G6EJD. Here's his sample code (https://github.com/G6EJD/ESP32-ADC-Accu ... curate.ino). He made an equation out of the curve he got. Using this code I am getting 1.268v. Very much closer.

I am actually confused now on ESP's ADC Calibration Fix on whether it's really working or if whether I am doing something wrong.

Could anyone shed some light on this issue? I mean basing from my results/method the ESP fix was not giving me the right voltage.

Summary of Measurments:
Voltmeter Value: ~1270mV
ESP Fix: ~1240mV
G6EJD: ~ 1268mV

Pibbotley
Posts: 45
Joined: Fri Feb 16, 2018 7:06 pm

Re: ADC Calibrated Value still not correct?

Postby Pibbotley » Thu Feb 22, 2018 7:55 pm

I've been playing around with ADC too, trying out different resolutions and attenuations, and even bias voltages, but the script that you reference easily provides the most accurate calibration. It also confirms what I'd found that the default ADC setting tops out at around 3.14V. This also affects the attenuation settings where the reading tops out before the supposed max voltage for that attenuation.

Pibbotley
Posts: 45
Joined: Fri Feb 16, 2018 7:06 pm

Re: ADC Calibrated Value still not correct?

Postby Pibbotley » Fri Feb 23, 2018 5:55 pm

As a follow on inspired by G6EJD script, I derived my own third order polynomial to get end to end readings accurate to within 1%.
I recorded 6 readings and used an online curve fitting site.
You have to do this for each individual ESP32 however, but each ADC pin per ESP32 seems similar.
To overcome the deadspot below 200mV, you need to bias your ADC input with 200+mV, and divide it to keep the max voltage below 3.1V (assuming default 11db attenuation).

mehdi.na94rm
Posts: 10
Joined: Mon Jun 17, 2019 4:04 pm

Re: ADC Calibrated Value still not correct?

Postby mehdi.na94rm » Mon Jun 24, 2019 10:29 pm

Hi,

I am measuring a voltage of a resistor ladder using ESPWROOM32 Dev Kit. The measurement of the ADC with the calibrated code mentioned above is 364mV but the actual voltage measured by the multimeter is 422mV. Without the calibration is terrible and showing 100mV. Any idea how can I fix it?

Regards,
Mehdi

User avatar
HelWeb
Posts: 36
Joined: Sat Mar 23, 2019 8:39 am

Re: ADC Calibrated Value still not correct?

Postby HelWeb » Sat Aug 10, 2019 8:11 pm

Maybe you may want to test:

esp32.com/viewtopic.php?f=19&t=2881&start=30

Posted: Sat Aug 10, 2019 12:30 pm

You may calibrate your own ESP32( the nonlinear 11DB curve) with this program.<br>
All you need is a wire from pin 25 to pin 35 and a normal voltmeter.<br>

Calibration is done automatically.<br>
It produces a LookUpTable[4096] to correct your values like: <br>
CalibratedValue = LookUpTable[Read Value];<br>

I do NOT use a fitted curve but a real LookUpTable with 4096 values !

I get correct values +/- 0.01V compared to the voltmeter. :D
Fast is not fast enough :D

Who is online

Users browsing this forum: Majestic-12 [Bot] and 108 guests