ADC inconsistent ESP32-WROOM

orbitcoms
Posts: 149
Joined: Fri Aug 03, 2018 10:08 pm
Location: Sydney, Australia

ADC inconsistent ESP32-WROOM

Postby orbitcoms » Tue Aug 08, 2023 9:04 pm

Hi,
I am using the Analog input on GPIO32 (ADC1 Channel4) and having issues with variation in reading between devices.
I have 2 devices and both measure 0.855 V at the ADC input. However, when the code runs I get a value of 855 mV for one device but 872 mV for the other. This type of variation makes the adc inputs unusable for my project.The cal type read is "eFuse Vref".

The code should be using the calibration from eFuse?

My code is below. Any help appreciated, thanks in advance.

uint32_t reading;
uint32_t voltage;

adc1_config_channel_atten(ADC1_CHANNEL_4, ADC_ATTEN_DB_6);
adc1_config_width(ADC_WIDTH_BIT_12);
esp_adc_cal_characteristics_t *adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t));
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_6, ADC_WIDTH_BIT_12, ESP_ADC_CAL_VAL_DEFAULT_VREF, adc_chars);
reading = adc1_get_raw(ADC1_CHANNEL_4); //
voltage = esp_adc_cal_raw_to_voltage(reading, adc_chars);

felixcollins
Posts: 125
Joined: Fri May 24, 2019 2:02 am

Re: ADC inconsistent ESP32-WROOM

Postby felixcollins » Sun Aug 13, 2023 10:36 pm

You may want to post details of the IDF version you are using and more importantly the hw revision of the two devices you are using. If you have debug logging set to Info I think you can get the hw revision out during boot.

Who is online

Users browsing this forum: Majestic-12 [Bot], romboidale, sohaib.q and 92 guests