ESP32 ADC Calibration curves?

brown_x
Posts: 12
Joined: Wed Mar 08, 2017 11:07 am

ESP32 ADC Calibration curves?

Postby brown_x » Mon Jul 03, 2017 8:22 am

Is there anything new about ADC calibration curves?

I need an ADC what works - the current raw value is dangling around but much worst is that I don't really know the maximum Voltage to which the ADC gives back 4095 on -11Db attenuation and neither how I can match the inner values to real voltages.

Found this forum entry: viewtopic.php?f=12&t=1045 on which ESP_Sprite promised some calibration curves after CNY but I still see nothing new in the source adcEnd function (https://github.com/espressif/arduino-es ... -hal-adc.c)

Ofc I can make a raw table with a voltage-source but the bad thing is: have no idea if it will be the same for every unit, on every temperature so to build a product onto this it is very risky.

Any news would be appreciated,
TY

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 ADC Calibration curves?

Postby ESP_Sprite » Mon Jul 03, 2017 9:00 am

We are characterizing the ADC curves of a bunch of ESP32s (vs temperature and supply voltage) as we speak. Designing hardware took a while and other priorities intervened, but compensation is scheduled to go into the next esp-idf release (3.0).

(Also, from what I can tell, the biggest difference between ESP32s seems to be the built-in reference voltage; the curves seem to be very much the same. I do not have enough information to say anything about temperature effects yet.)

brown_x
Posts: 12
Joined: Wed Mar 08, 2017 11:07 am

Re: ESP32 ADC Calibration curves?

Postby brown_x » Mon Jul 03, 2017 12:59 pm

Any ~date for the 3.0 release? Or is not known yet?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 ADC Calibration curves?

Postby WiFive » Tue Jul 04, 2017 4:36 pm


brown_x
Posts: 12
Joined: Wed Mar 08, 2017 11:07 am

Re: ESP32 ADC Calibration curves?

Postby brown_x » Thu Jul 06, 2017 10:31 am

Tested the formula for ADC digital value 1476, the voltage applied is 1.23V (measured with a multimeter).

If I use the formula from Your screenshot y=1.0052x+169.41 the resulting value will be 1653.09 mV.
Which is way off from 1.23V ...

Did I identified wrong y being the voltage, x the digital read from ADC?

Using the ADC with default arduino setup (-11Attenuation, 12 bit ADC) but as far as I see Your graph has the same values.
The board is an offical ESP32 devboard (ESP-WROOM-32), pin is 35. Taking 10 samples and averaging it as a simple filter, also tried without filter but the only difference is a bit noisier.

To eliminate fluctuating voltage connected a plain AAA battery, measured voltage with multimeter: 1.499V.
The digital value: 2031, Your formula=2.21V

I can make the same setup as Yours and measure but this is what I am afraid of: two units having different charateristics. And if it is I can't use it ...

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 ADC Calibration curves?

Postby WiFive » Mon Jul 10, 2017 7:25 am

Actually that isn't my data so I'm not sure.

brown_x
Posts: 12
Joined: Wed Mar 08, 2017 11:07 am

Re: ESP32 ADC Calibration curves?

Postby brown_x » Wed Jul 12, 2017 7:42 am

I really hope I'll get a feedback soon from Espressif since I need to know if I can use it for analog sensors (I can't use i2c sensors unless I use external AD but that will rise the price of the product which might push me towards another controller).

It's not a problem if it is not linear, even if I have a table for it, but must be the same for all units - I can't test many of them since I have only a few but the huge difference between other's data on the internet and mine is worrying.

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 ADC Calibration curves?

Postby ESP_Sprite » Wed Jul 12, 2017 9:48 am

I can give you some preliminary results and plans. (Emphasis on 'preliminary', tests are still on the way so we may find some gotchas later on that may need a change in plans.)

Effectively, the issue is twofold: first of all, as you can see the curve is not linear (but does have a pretty linear bit in the middle). We can correct this by making an inverse lookup table to map ADC values to effective voltages; the shape of the curve is mostly the same amongst different ESP32s. The second issue is that there is variation in the internal references from ESP to ESP. Essentially, due to process variation, the 1.1V reference voltage is slightly different in each ESP, with a spread of about 150mV (from memory). The reference voltage itself is constant, so if for a certain ESP the reference voltage is, say, 1.05V, it will stay that regardless of external circumstances.

The way we're planning to compensate for this is to essentially record the bias voltage in the EFuses during chip manufacturing and testing. With that done plus our linearization code in place, we should have a fairly good precision and accuracy for every ESP32. We'll also add a method so you can 'upgrade' older chips as well, either by also programming the value of the reference voltage in the Efuses on manufacturing or by allowing the measurement of an external, known-good, voltage and using that to calibrate the internal reference.

Does that help you a bit?

brown_x
Posts: 12
Joined: Wed Mar 08, 2017 11:07 am

Re: ESP32 ADC Calibration curves?

Postby brown_x » Wed Jul 12, 2017 10:17 am

The method seems to be fine.

The handlig of new chip/old chip is something we will need to take care - either ask for new batch, either do the calibration during our factory process I guess.

Ty for the feedback and we are waiting the new version.

Josegm
Posts: 10
Joined: Mon Dec 28, 2015 11:51 am

Re: ESP32 ADC Calibration curves?

Postby Josegm » Wed Jul 12, 2017 5:16 pm

ESP_Sprite wrote:I can give you some preliminary results and plans. (Emphasis on 'preliminary', tests are still on the way so we may find some gotchas later on that may need a change in plans.)Does that help you a bit?
Really great to have get some visibility into the ADC correction plans. Thank you for posting this! A reliable ADC is very important for many IoT applications.

Who is online

Users browsing this forum: No registered users and 58 guests