Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Vertigoxx
#94984 I'm trying to read capacitor voltage via A0 pin. Reading works fine, but now I want to trigger the reading only at specific intervals to avoid capacitor discharge. Positive capacitor output is always conected to A0. Negative is connected to ESP8266 via a transistor - only when I send a high signal to the base of this NPN transistor. However, I always get a capacitor voltage reading on A0 - even when transistor is off. What could be the issue

Image
User avatar
By Wim7
#95243 When you built this circuit exactly as drawn, you see the capacitor is permanently connected to GND.
The pin at pin GND ESP8266 connects to a pin from the ESP. The A0 pin as well.
But the voltage the ESP is measuring is referenced to the ESP GND, the same GND used to set a pin high to trigger your transistor. This is the PWR-GND of the complete ESP. All GND pins on the ESP are connected internally.
Regarding your ESP is working correctly; you get a voltage readout on a terminal, the GND of the ESP is connected to the PWR-GND. and will not be switched, according to your circuit
Meaning the GND at the cap is somewhere in the rest of your circuit connected to GND ESP8266.
The transistor is shorted by yourself.
Try using a CD4066