ESP32-S3 ADC Read Issue
Posted: Sat Dec 31, 2022 10:46 pm
am trying to test the ADC function in the ESP32-S3. Below is my test code. I am using GPIO4. When I try to run 0V into GPIO4, I am read a value of approximately zero for a while and then I read a raw value of approximately 400 for a while and then back to zero and this behavior repeats. Does any one have any idea have any idea what is going on here? Here is the serial output:
3
3
3
3
0
391
373
412
415
409
411
416
407
416
405
408
402
409
391
413
432
412
5
3
7
9
4
5
2
3
0
7
5
3
5
9
5
3
9
4
404
414
425
397
384
ARDUINO CODE:
3
3
3
3
0
391
373
412
415
409
411
416
407
416
405
408
402
409
391
413
432
412
5
3
7
9
4
5
2
3
0
7
5
3
5
9
5
3
9
4
404
414
425
397
384
ARDUINO CODE:
Code: Select all
#include <esp_adc_cal.h>
#include <esp32-hal-adc.h>
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
analogReadResolution(12);
pinMode(4, INPUT); //GPIO4
adcAttachPin(4); //GPIO4
}
void loop() {
int RawADC= adc1_get_raw(ADC1_CHANNEL_3); //GPIO4
Serial.println(RawADC,0); // Print Raw ADC Value
delay(200); // delay in between reads for clear read from serial
}