// I am trying to get the ESP32's adc running but keep on getting inaccurate readings even after i measured Vref and calibrated it as below, any advice ?
#include "esp_adc_cal.h"
#include "driver/adc.h"
void setup() {
// put your setup code here, to run once:
ESP_ERROR_CHECK(adc2_vref_to_gpio(GPIO_NUM_25));
}
void loop() {
// put your main code here, to run repeatedly:
esp_adc_cal_characteristics_t characteristics;
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(ADC1_CHANNEL_0, ADC_ATTEN_DB_0);
esp_adc_cal_get_characteristics(1109, ADC_ATTEN_DB_0, ADC_WIDTH_BIT_12, &characteristics);
uint32_t voltage;
voltage = adc1_to_voltage(ADC1_CHANNEL_0, &characteristics);
printf("%d mV\n",voltage);
delay(1000);
}
inaccurate adc readings
Re: inaccurate adc readings
Inaccurate by how much?
Who is online
Users browsing this forum: Bing [Bot] and 77 guests