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.
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.
ESP32-C6 ADC problem
-
lbernstone
- Posts: 1132
- Joined: Mon Jul 22, 2019 3:20 pm
Re: ESP32-C6 ADC problem
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.
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
Ok, thanks for your opinions.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.
These are my new configuration of my ESP32-C6 ADC:
- Set the ADC in setup():
analogSetPinAttenuation(AN_Pot1, ADC_0db); - Use analogReadMilliVolts() instead of analogRead() to get the ADC voltage value.
- Add a potentiometer between 3.3V and Ground.
- Set the potentiometer to the point so that voltage on Pin #1 is close to 3.3V/5 = 1.65V.
- Limit the signal voltage in the range of 1.65V +/- 750mV
Please comment.
Who is online
Users browsing this forum: No registered users and 3 guests