[Answered] What are the ADC input ranges?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

[Answered] What are the ADC input ranges?

Postby kolban » Thu Jan 26, 2017 5:10 am

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?
Last edited by kolban on Thu Jan 26, 2017 5:04 pm, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
Jakobsen
Posts: 89
Joined: Mon Jan 16, 2017 8:12 am

Re: What are the ADC input ranges?

Postby Jakobsen » Thu Jan 26, 2017 9:04 am

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
Analog Digital IC designer / DevOps @ Merus Audio, Copenhagen, Denmark.
We do novel and best in class Audio amplifiers for consumer products.
Programmed assembler for C-64 back in 1980's, learned some electronics - hacking since then

mnemonix
Posts: 9
Joined: Mon Jan 23, 2017 11:07 pm

Re: What are the ADC input ranges?

Postby mnemonix » Thu Jan 26, 2017 11:00 am

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:
Attachments
ADClinearity.png
ADClinearity.png (14.55 KiB) Viewed 83456 times

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

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

Postby kolban » Fri Jan 27, 2017 1:52 am

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?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

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

Postby loboris » Fri Jan 27, 2017 9:33 am

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.

mnemonix
Posts: 9
Joined: Mon Jan 23, 2017 11:07 pm

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

Postby mnemonix » Sat Jan 28, 2017 1:35 am

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.

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

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

Postby ESP_Sprite » Sat Jan 28, 2017 2:01 am

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.

mnemonix
Posts: 9
Joined: Mon Jan 23, 2017 11:07 pm

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

Postby mnemonix » Sat Jan 28, 2017 4:52 am

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.
Attachments
ADC_10Bit.png
ADC_10Bit.png (24.24 KiB) Viewed 83404 times

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

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

Postby ESP_Sprite » Sat Jan 28, 2017 5:42 am

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.

HardwireIO
Posts: 10
Joined: Mon Mar 06, 2017 5:34 pm

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

Postby HardwireIO » Wed May 24, 2017 9:13 pm

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..
Hardwire.io / The IoT Platform

Who is online

Users browsing this forum: No registered users and 32 guests