ESP32 How to correct the ADC
ESP32 How to correct the ADC
Is it possible to get precise results from ESP32-ADC ?
Here we build a LookUpTable to correct this behavior
Sense is:
Read value Y and correct it like:
Y = ADC_LUT[Y]
FOR ME IT WORKS VERY WELL. (See: Correct_with_LUT.jpg)
I estimate the ESP32-DAC produces correct values.
====================== NOTE ===================================================
We know that is not true, but it is linear upto (about) output-value = 200)
To be more precise: measure the ouput voltage of 200 with a good external voltmeter
and calculate a slope factor. See: ESP32_DAC_WITH_MY_LUT.ino
With that I get good real world values up to 2.5 V !
===============================================================================
Then I want to build a LUT:
Because the DAC uses 8 bit I have to interpolate to get the LookUpTable 0..4095.
But the errors caused by that are much less than the usual noise.
I am really surprised how good the results are. Look at the image.
Here is the program. How to use: (Arduino_IDE, ESP32, Esp32_Correct_DA2.ino)
In your source: (Y: 0...4095)
Y=readAnalog(); Y=ADC_LUT[Y]; (look at the program)
ESP32_WITH_MY_LUT.ino is a demo program (to use with Serial Plotter).
It contains MY corrections. If you start it you may see the differences of YOUR ESP32 to mine.
Then use it with your own built and replaced ADC_LUT.
Here you can set your measured value for DAC(200) and then all results will give you real world voltages
with a precision of +/- 0.01V upto 2.5 V
Advantages of a LookUpTable: Using it is much faster than using a fitted polynom and it should show better precision