I’m trying to use ESPHome to monitor if the power outlet on my sump pump (110V) has lost power. I used this guide to build an Optocoupler. I’ve built one of these before, but I used it on the Rpi GPIO pins. In this case, I want to use it on an ESP32 board. Below is my final schematic
And my code
binary_sensor:
#Main Power Supply on/off
- platform: gpio
pin:
number: GPIO17
mode: INPUT_PULLUP
inverted: true
name: "Sump Pump Master Outlet Power"
device_class: power
With it setup like this, ESPhome does not recognize whether there is 110V power or not.
I measured voltage with a multimeter, I’m getting 3.3V from GND to GPIO17 when there is no 110V power and 2.9V when there is 110V power. So, the Opto sensor is sensing light, but it’s a minimal voltage change.
If I take out the 110V pilot light I’m using and instead shine my cell phone flashlight LED at the sensor then ESPhome will switch the binary sensor to “on”. I’m guessing this means I have an issue with my resistors, but I’m not smart enough to know how to figure that out.
Any idea how I can get this to work?