Photo transistor to read LED state

I recently installed new pool equipment (salt water generator) and wanted to read its status LEDs remotely.
Figured how to read them with a photo transistor and a resistor per LED, connecting to a ESP32 gpio pin. Instructions here.

The LEDs are inside a covered metal box, so no ambient light when the cover is closed, made it easy as I get almost zero when LED is off and close to full scale when LED is on.
If you have ambient light, it could still work but you’re more likely to need to use an ADC input. I tried the ADC too, and it works. But you have to go read the input periodically so not as nice as a binary input.

Could not really find any information on reading LEDs at this forum so posting this in case it helps someone.

Randy

You might find some reference to it regarding garage door openers that have leds to show status. Can’t find the thread now. Another option of course is to hack into the device and put an opto in parralel with the led, although that’s gonna void your warranty :slight_smile:

I had considered monitoring the voltage across the leds, but didn’t want to do anything to void warranty on my new SWG. Never found a garage opener led reader thread, probably didn’t search for the right thing. But I already figured it out anyway :grinning:

Hi Randy,

Are you still using this setup on your swg? Im looking to do the same thing but im wondring how do you make the difference between a flashing and solid led in esphome? Because I know that at least 4 of this of thess leds can either be solid or flashing depending on what issue the board detected i,e, the generating led will be solid when normal, will flash when system is normal but water temp is to cold to be generating chlorine.

Any idea what filter would have to be added in esphome to detect flashing or solid?

I am still using it, works great.
When building, I was worried about the blinking LEDs.
In use, when I check status on my Home Assistant dashboard, you see the state of the LED change constantly if the LED is blinking. In my system, its very obvious if there is a blinking LED
I didn’t do anything special, just display the state of each LED.

Randy

1 Like

To measure the flashing, see ESPHome — ESPHome

1 Like