How do I adjust the ADCs for maximum accuracy?

A.H.Z123
Posts: 3
Joined: Tue Oct 19, 2021 4:46 pm

How do I adjust the ADCs for maximum accuracy?

Postby A.H.Z123 » Wed Oct 20, 2021 3:04 pm

I want to design a high accuracy voltage/ current monitoring for solar batteries using the esp32 ADCs but I was very confused by the datasheet and guides online on how to maximize ADC accuracy. As far as I know, the ADCs in the esp32 have an attenuator stage at their inputs; the suggested range for 11Db attenuation is 2600mV at best (even though the ADC's range is 0-3.3v). However, I did not manage to find any sort of in depth explanation as to why (or if ) that is the case. Also, I've read in the datasheet that "Multi-sampling" is good way of mitigating noise but it was very poorly explained; is multisampling the same as oversampling and averaging?

I was also not able to find any function/register bit that is responsible for setting the number of samples before DMA interrupt for the ADC , I've heard somewhere that it defaults to one (analogSetSamples() doesn't exist anymore apparently). One more thing , doesn't this MCU have an auto-calibration feature like the STM32? I do not have any power supplies / measurement devices capable of measuring Vref at a very high accuracy at the moment.
tld;dr : Can I not measure signals above 2.6V accurately using db11 attenuation?
What is multi-sampling and how does it differ from oversampling and averaging?
How do I set the number of samples before interrupt for the DMA?
Any tips for calibrating the ADC ref properly?
extra: Is there a method to modify sample rates of each pin individually ( like in the stm32 clock cycle selection) ?
Note: This is my first time using the ESP32-WROOM DevKit so I apologize if any of these questions seem awfully obvious.

vk3drb
Posts: 13
Joined: Wed Oct 20, 2021 9:42 am

Re: How do I adjust the ADCs for maximum accuracy?

Postby vk3drb » Sat Oct 23, 2021 10:19 am

Hi.

The ESP32's have a pretty lousy ADC. Not sure if the ESP32-C3 has improvements. Their internal Vref can vary a lot and the linearity is poor. However there are some ways to calibrate out the bad stuff. You can get with 1% accuracy apprarently.

https://w4krl.com/esp32-analog-to-digit ... -accuracy/
https://rntlab.com/question/the-adc-seems-terrible/
https://www.reddit.com/r/esp32/comments ... 32_boards/

There are calibration routines around on the web and on github. The problem with this is the calibration might vary over temperature, or between batches of devices and noise is an issue (you can use a cap, or better still a good op-amp as a voltage follower etc but that all adds cost.

One alternative is an external quality accurate ADC. Just check on the DIgikey website. If you went this way, use an external voltage reference, either with a voltage reference chip or tight tolerance LDO with plenty of filtering.

Good luck!
- Dave

Who is online

Users browsing this forum: Baidu [Spider] and 67 guests