ADC inconsistent ESP32-WROOM
Posted: 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);
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);