Page 1 of 2

[Answered] What are the ADC input ranges?

Posted: Thu Jan 26, 2017 5:10 am
by kolban
I was reading through the DataSheet and Techref but was unable to find any descriptions of the electrical characteristics of the analog to digital inputs. Does anyone know what the maximum input voltage is that can be applied on input?

Re: What are the ADC input ranges?

Posted: Thu Jan 26, 2017 9:04 am
by Jakobsen
Hi Kolban

I did poke around with the ADC on the ESP32 and fund that 3V3 gave full house on the ADC output value. But the result was very noisy - also reported by others - and in the given setup not ok for my application (<10 mV resolution needed)

By the way thanks for the work you have put into your books - Grate resource. If you want I will be happy to help to on any thing audio if you want to cover that area as well.

Regards Jørgen

Re: What are the ADC input ranges?

Posted: Thu Jan 26, 2017 11:00 am
by mnemonix
Yeah the ADC of the ESP32 is a bit disappointing, compared to the rest. The result is not only noisy, but also not very linear. You can't measure values down to zero Volts, the ADC shows zero with an input of ~0.1V. Same problem at upper end, but that is not so important.

Here is what I have measured today:

Re: [Answered] What are the ADC input ranges?

Posted: Fri Jan 27, 2017 1:52 am
by kolban
What is the actual implication of the results. To my "eye" the line is "pretty" straight ... what kinds of applications do we have in mind where the deviations from optimal would cause unwanted effects?

Re: [Answered] What are the ADC input ranges?

Posted: Fri Jan 27, 2017 9:33 am
by loboris
You can hardly expect good results from embeded ADC on any microcontroller. Some software techniques must always be used to improve the results.
There are many documents about that, here are some links:
http://www.st.com/content/ccc/resource/ ... 004444.pdfhttp://www.st.com/content/ccc/resource/ ... 050879.pdf
http://www.atmel.com/images/doc8003.pdf
http://www.embedded.com/design/mcus-pro ... resolution
http://www.eurasip.org/Proceedings/Ext/ ... _III_5.pdf

Some of these techniques will eventually be used in esp-idf, or you can implement them yourself.

Re: [Answered] What are the ADC input ranges?

Posted: Sat Jan 28, 2017 1:35 am
by mnemonix
Sure, oversampling and filtering helps to reduce the noise and increase the resolution, but not helps for the non-linearity.

The datasheets for other microcontrollers normally say: non-linearity: + - 1 LSB, that is 1/4096 of the full range.
SAR ADCs (successive approximation) have this high linearity by design, and according to the datasheet the ESP32 works also with a SAR-ADC. So the problem must be the analog amplifier/attenuator, that does not work rail to rail.

I will try some filtering technics and other gains of the amplifier, perhaps I find some better modes.
The DACs are quite linear BTW, but also not rail-to-rail.

@kolban
Applications like industrial or automotive sensor measuring need much more precision. Also analog interface standards like 0-10V or 4-20mA current loops. These may not be the main application area for the ESP but peripherals like CAN show, that the chip is also intended for such things.
The current ADC performance is okay for Joysticks or Controller-potis for example. Not sure about Audio input.

Re: [Answered] What are the ADC input ranges?

Posted: Sat Jan 28, 2017 2:01 am
by ESP_Sprite
Fyi, the way we are going to fix this is by adding calibration curves to the ESP32. The idea is to have a lookup table or function that maps each ADC value to the value it should be. That should help with the linearity, at the cost of maybe a bit or two of precision. Not much we can do in software about the ADC/DAC not being rail-to-rail, unfortunately. The calibration curves will arrive somewhere after CNY; we'll need to test a bunch of different ESP32s in different temperatures with different supply voltages to be confident about the precision.

Re: [Answered] What are the ADC input ranges?

Posted: Sat Jan 28, 2017 4:52 am
by mnemonix
With 10 Bit resolution and averaging over 8 Samples, it looks now much better. The heavy linearity error is just in the -11dB range of the ADC. All ranges have the problem that they don't go down to zero, so input voltage under 0.04/0.08/0.1 Volt can't be measured without some analog offset generation at the input (2 resistors for example).

I think linearization of the -11dB curve can be done with some polynome for the range beginning from 2.5V, instead of a big RAM table.

Re: [Answered] What are the ADC input ranges?

Posted: Sat Jan 28, 2017 5:42 am
by ESP_Sprite
Aye, sure, obviously we'll make any correction algorithm we come up with as small as possible. Big-ass table if needed, simple math if possible. We also want to see if there are any effects with changing supply voltage, temperature, or specific chip, so the end result may get somewhat more complicated.

Re: [Answered] What are the ADC input ranges?

Posted: Wed May 24, 2017 9:13 pm
by HardwireIO
mnemonix wrote:With 10 Bit resolution and averaging over 8 Samples, it looks now much better. The heavy linearity error is just in the -11dB range of the ADC. All ranges have the problem that they don't go down to zero, so input voltage under 0.04/0.08/0.1 Volt can't be measured without some analog offset generation at the input (2 resistors for example).

I think linearization of the -11dB curve can be done with some polynome for the range beginning from 2.5V, instead of a big RAM table.
Could you post the numeric values of the graph, please?

It would be very helpful to increase error correction..