ESP32 - ADC doesn't detect voltage if high on bootup (reads 0.07500 V), works if cycled

I’m using ADC to detect if my generator is running.

I read 0.07500 when the generator is off (12v voltage divider) and 1.02600 when on. It works as expected, unless upon ESP32 bootup, the voltage is 1.02600, then ESPHome reads it as 0.07500 (off) until the voltage changes on my GPIO pin, (such as cycling the generator).

Also tried with raw: true and same behavior, sits at 0.0v

Is this expected behavior of ESP32, or a bug?

If you using a adc2 channel and have wifi on this is probably expected due to hardware limitations mentioned here.

1 Like

Thanks for that!

I’m using GPIO33, which is on adc1.

I may try to replicate on other boards and see if it’s specific to this lilygo t-relay 4

May I ask if you use the 12v input on the relay board?

I’m using the same board, and would like to monitor my 12v battery supply voltage. But i’m unsure if it is a 12v-3v stepdown, and if the variation on the 12v side will affect the 3v side.