Page 1 of 1

ESP32 DevKit C V4 - ADC - Pull Up?

Posted: Thu Feb 29, 2024 9:24 am
by Ronnie Eriksson
Hi everyone,

I'm haveing this issue - My ADC inputs seems to have a pullup at ADC inputs at my ESP32 DevKit C V4 and I'd like the them float.

I've tested ADC1_0 and ADC2_6 both inputs gives me a currentreading of 0.5 mA with a DMM set to a range of 2mA. Measuring the voltage I get 3.7 VDC. I've searched internet and it seems like this is what many users would like. Me I'm thinking of connecting a relatively high impedance sorce to the ADC input, and there fore a floating input would be aprciated.

I've used the folowing code:

Pin setup:

Code: Untitled.c Select all

#define PHOTO_ADC_INPUT 14

Code: Untitled.c Select all

    gpio_reset_pin(PHOTO_ADC_INPUT); 
gpio_set_direction(PHOTO_ADC_INPUT, GPIO_MODE_INPUT);
gpio_set_direction(PHOTO_ADC_INPUT, GPIO_FLOATING);
ADC setup:

Code: Untitled.c Select all

    //-------------ADC1 Init---------------//
adc_oneshot_unit_handle_t adc2_handle;
adc_oneshot_unit_init_cfg_t init_config2 = {
.unit_id = ADC_UNIT_2,
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
ESP_ERROR_CHECK(adc_oneshot_new_unit(&init_config2, &adc2_handle));

//-------------ADC1 Config---------------//
adc_oneshot_chan_cfg_t config = {
.bitwidth = ADC_BITWIDTH_DEFAULT,
.atten = ADC_ATTEN_DB_11,
};
ESP_ERROR_CHECK(adc_oneshot_config_channel(adc2_handle, ADC_CHANNEL_6, &config));
Reading ADC:

Code: Untitled.c Select all

    static int ADC_Reading;
ESP_ERROR_CHECK(adc_oneshot_read(adc2_handle, ADC_CHANNEL_6, &ADC_Reading));
Can some one please help me get the inputs float?