hello guys. i will really really appreciate if u can help me.
i have a problem with gpio 36. i use this pin to measure a voltage divider.
when i just connect my ESP32 Devkit, it writes 0 ADC.
but when i combine my ESP32 with another components on PCB Board, the ADC starts from +- 3029 and changed randomly.
so what should i do to calibrate the adc when it connected with another components?
the code:
Code: Select all
#define ADC_PIN 36
float Vmodul = 0.0;
float result = 0.0;
int value = 0;
float R1 = 68000.0; //68k
float R2 = 7500.0; //7500 ohm resistor,
void setup()
{
pinMode(ADC_PIN, INPUT);
Serial.begin(9600);
}
void loop()
{
value = analogRead(ADC_PIN);
Vmodul = (value * 3.3) / 4095.0;
result = Vmodul / (R2/(R1+R2));
Serial.print("module voltage = ");
Serial.print(Vmodul,2);
Serial.print("volt");
Serial.print(", real result = ");
Serial.print(result,2);
Serial.println("volt");
Serial.print(", ADC = ");
Serial.println(value);
Serial.println("");
delay(1000);
}
the image after i connect to my pcb board (i dont even measure anything with my voltage divider sensor) :