inaccurate adc readings

Rickert
Posts: 1
Joined: Fri May 10, 2019 11:09 am

inaccurate adc readings

Postby Rickert » Fri May 10, 2019 11:49 am

// 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);


}

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: inaccurate adc readings

Postby WiFive » Sat May 11, 2019 3:20 am

Inaccurate by how much?

Who is online

Users browsing this forum: Google [Bot] and 108 guests