Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ESP32 (WROOM-32D) ADC linearity

Status
Not open for further replies.

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
16,232
Helped
5,140
Reputation
10,309
Reaction score
5,120
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
137,370
I've been developing a product that utilizes the ADC inputs of a WROOM-32D module and found some quite alarming anomalies. The linearity seems to be horrible. To check, I've done this:
1. stepped the input voltage up in 100mV increments between 0V and 3.3V. The source is accurate to +/- 1mV.
2. used a low impedance voltage source (<10K).
3. used a stable 3.3V supply voltage.
4. Taken the average of 10 readings at 1 second intervals.

I'm seeing a dead zone below about 0.15V input and an FSD reading above 3.1V, possibly indicating it has an internal amplifier that can't manage rail-to-rail . Reading up on various internet articles I can see others are noticing this too. For my application, the input will typically be between 0.3V and about 2.0V so the extremes are not too important. For the range I'm interested in I can 'straighten' the non-linearity sufficiently by multiplying the ADC reading by 0.96 then adding a small constant. However, that is on the module used for development, when I repeated the tests on a different WROOM-32D, the results were wildly out. I plotted the readings for both modules on a graph and although they follow the same general shape, the lines were significantly (>5%) different.

Has anyone else used these modules and noticed the same problem? Maybe found a work-around? It is the difference in modules that concerns me most, I don't want to go into a lengthy calibration process on each one.

Brian.
 

Were both Wifi and Bluetooth h/w turned off during these experiments? I'm in the opinion that the ADC of this chip/module can be seen rather as a plus, than properly a reliable resource, since the power level of the radio circuitry can somehow generate interference not only throught the board itself, but also reflected from objects nearby. As per calibration itself, AFAIK it is not necessary to perform an interactive process, it is possible to use two points from internal reference and compute the correction factor for each module, e.g after startup or some time after chip get hot due to the RF stage.
 

Thanks Andre.

Yes, all RF interfaces were turned off. From reading Espressif's documents it appears the ADC reference is calibrated in the factory by setting 'eFuse' bits but they are permanent and can't be changed later. All my tests were carried out at stable 20C and after averaging 10 readings. The software uses a timer to read all the ADC channels very second and it keeps a circular buffer of the past 10 values for each channel. When requested, it returns the average of the buffer contents for that channel.

If the ADC reference alone was the source of problems it would be easy to calculate a correction factor but I'm seeing a curve when I plot V/reading. The curve is there on all the modules I have tested but varies from one to another. I don't want to resort to huge look-up tables so I think I'll have to work towards a 'best fit' algorithm. I can supply test voltages in production but the correction factors will have to be uploaded and stored in each device over an MQTT link.

The product will be controlling a fairly complicated water pumping system and includes a temperature monitor to prevent the system freezing in sub-zero conditions. The variation in ADC readings, when converted to temperature is more the +/- 5C at true 0C so it obviously can't be used unless calibrated.

Brian.
 

Do your tests again, with the A/D-input mux set permanantly to the right channel.
In a project with a PIC microcontroller I got some charge transfer between the input channels when going directly from one channel to another. The A/D-conversion done immediately after a MUX change was affected by this.
The project was cancelled before this was investigated in detail. I planned to select "no channel" first every time the MUX was changed, to avoid what seemed to be some kind of cross-conduction "spike".
The problem was visible with a scope probe directly on the A/D input pins of the microcontroller.
 

Thanks std_match but this isn't the same problem. My application allows sufficient time for the ADC input to settle and the inputs on other channels are not showing any effect.
It is a kind of non-linearity, either in the ADC or more likely the ESP32 has a pre-amplifier that isn't very good. As Andre points out, it is a device with lots of features but some of them don't work particularly well.

The graph is of two samples from the same batch, red is the calculated result and the others are measured results. The Y axis is the value returned from the ADC, X axis is the input voltage (shown x10).

Brian.
 

Attachments

  • ESP32_ADC.jpg
    ESP32_ADC.jpg
    28.6 KB · Views: 260

The A/D is low quality and goes non-linear, worse for the ESP8266. The Vref is also sloppy. There is a multi-point factory cal as well.
You need 0.1uF cap at the A/D input with multi-sampling, and do calibration, at the very least. Counts over 3,000 (2.450V) is seems to compress.
Overall I also think it's still not so great over temperature.
More here: https://docs.espressif.com/projects...eference/peripherals/adc.html#adc-calibration
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top