ESP32-C3 ADC issue - reading 4095 at 2.8V

Hello, I would like to ask you for help with ESP32-C3 built in ADC.
ESP32-C3 have two 12bit ADCs: ADC1 channel 0-4 and ADC2 channel 5. (ADC2 is shared with WiFi).
I tested multiple channels on ADC1 and still reading 4095 at 2.8V

Regarding datasheet effective range for 11db attenuation (ATTEN3, which should be default) is 0-2500mv and reference voltage is somewhere between 1000-1200mV. I have no idea where the 2.8V is coming from. I tried 2 different C3 dev boards and both perform about same except ESP32-S3 or old Wroom32 which read 4095 at 3.3V as expected.

I need to figure out how to calculate ADC values properly because 2.8V is just rough value which fit best but overall ADC output seems to have quite big non-linear error and it looks like something is wrong there. I am not able to find any additional information in documentation.

Parameter Description Min Max Unit Total error
ATTEN0, effective measurement range of 0 ~ 750 –10 10 mV
ATTEN1, effective measurement range of 0 ~ 1050 –10 10 mV
ATTEN2, effective measurement range of 0 ~ 1300 –10 10 mV
ATTEN3, effective measurement range of 0 ~ 2500 –35 35 mV

I am using Arduino 1.8.16 with latest ESP32 v2.0.9.

that is not related to my issue. anyway tried code from that thread and result is same.

There is offset from reference voltage described in datasheet.

  • With ATTEN0 it is saturated (4095) at 0.83V instead 0,75V
  • With ATTEN3 it is saturated (4095) at 2.8V instead 2.5V

tried 2 different C3 boards both are same

Seems I got it already. analogRead or adc1_get_raw are not utilizing manufacturer calibration of ADC. analogReadMilliVolts(pin) solved the issue.

More info can be found here: https://deepbluembedded.com/esp32-adc-tutorial-read-analog-voltage-arduino/ ( ESP32 ADC Calibration – LAB)

Hi, How did you solve the problem? My adc is also saturating at 2.8V for ESP32-C3. Can you please post snippet of the arduino code here?
Regards, Sajjad

Saturation at 2.5V (or 2.8V) is normal and limited by design. You need to use function I mentioned above to obtain accurate calibrated results and also scale the input voltage to desired range (0-2.5V)

1 Like

Thanks for the quick reply.
I have to measure 0-48V, which i scaled to 0-3.3V (using voltage divider). So you mean, i should map 0-48v to 0-2.8v??
You mean the maximum voltage measured by ADC in case of ESP32C3 is 2.8v?

The function you are referring is also saturating at 2.8v (4095 adc value) in my case.
Regards,
Sajjad

It should be 2.5V but I guess due to some variations in manufacturing process it is 2.8V. After using function which call internal calibration you get accurate output. I suggest to scale input to 0-2.5V

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.