ESP32-C6 ADC problem

HKPhysicist
Posts: 5
Joined: Thu Jul 17, 2025 3:40 pm

ESP32-C6 ADC problem

Postby HKPhysicist » Fri Mar 27, 2026 6:56 am

Dear ESP Technical Support,
I am developing a FireBeetle2 ESP32-C6 Board.
https://www.dfrobot.com/product-2771.html

I tested the ADC on Pin 1 (set up as attachment). The output is far from the allowed 4095 value.
firebeetle bad analog.jpg
firebeetle bad analog.jpg (283.88 KiB) Viewed 144 times

Here are the official example codes of Arduino IDE v2.3.8 to test the ADC of ESP32-C6, with ESP32 SDK v3.3.7:

--------------------------------------------------------------------

void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);

// ESP32-C6 ADC resolution is 12-bit (0-4095)
analogReadResolution(12);
}

void loop() {
// read the analog / millivolts value for Pin 1
int analogValue = analogRead(1);
int analogVolts = analogReadMilliVolts(1);

// print out the values you read:
Serial.printf("ADC analog value = %d\n", analogValue);
Serial.printf("ADC millivolts value = %d\n\n", analogVolts);

delay(100); // delay in between reads for clear read from serial
}
------------------------------------------------------


And the output from terminal are:
=============================
ADC analog value = 3262
ADC millivolts value = 3337

ADC analog value = 3269
ADC millivolts value = 3339

ADC analog value = 3256
ADC millivolts value = 3344

ADC analog value = 3275
ADC millivolts value = 3341
======================

What is the cause? How should I improve and utilise the full ADC width?


Yours faithfully.

lbernstone
Posts: 1132
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32-C6 ADC problem

Postby lbernstone » Fri Mar 27, 2026 3:11 pm

The ADC SAR is factory calibrated, and a reference value is burned into the eFuses. So, using the analogReadMillivolts value is highly recommended to get accurate values, as it uses the calibration curves for the sensor.
The values will always be at their least accurate at the top and bottom of the range. To get better accuracy, you should use a voltage divider to ensure your expected values are not pegging the top of the range. To get better precision, you should set the attenuation as low as possible (ie, 0db) and have your input voltage divided into the 0-750mV range.

HKPhysicist
Posts: 5
Joined: Thu Jul 17, 2025 3:40 pm

Re: ESP32-C6 ADC problem

Postby HKPhysicist » Mon Mar 30, 2026 5:28 am

The ADC SAR is factory calibrated, and a reference value is burned into the eFuses. So, using the analogReadMillivolts value is highly recommended to get accurate values, as it uses the calibration curves for the sensor.
The values will always be at their least accurate at the top and bottom of the range. To get better accuracy, you should use a voltage divider to ensure your expected values are not pegging the top of the range. To get better precision, you should set the attenuation as low as possible (ie, 0db) and have your input voltage divided into the 0-750mV range.
Ok, thanks for your opinions.

These are my new configuration of my ESP32-C6 ADC:
  1. Set the ADC in setup():
    analogSetPinAttenuation(AN_Pot1, ADC_0db);
  2. Use analogReadMilliVolts() instead of analogRead() to get the ADC voltage value.
  3. Add a potentiometer between 3.3V and Ground.
  4. Set the potentiometer to the point so that voltage on Pin #1 is close to 3.3V/5 = 1.65V.
  5. Limit the signal voltage in the range of 1.65V +/- 750mV

Please comment.

Who is online

Users browsing this forum: Qwantbot and 2 guests