Close

Light State Detection

A project log for Smart Chain Puller

Yanking a fluorescent light fixture into the 21st century

henry-yorkHenry York 08/23/2022 at 15:120 Comments

In order to be truly smart, the chain puller needs to know if the light is on or off. I'm using two voltage dividers to accomplish this: one with normal resistors and the other with photoresistors. 

With two photoresistors, the state of the fluorescent fixture can be detected regardless of the amount of external light. As a photoresistor is exposed to more light, its resistance decreases. When there is much more light on the photoresistor facing the fluorescent light than the one facing away, the voltage on pin A0 is close to +1v. When there is less or the same amount of light on the photoresistor facing the fluorescent tubes, the output voltage is under +400mv. The ESP8266 is able to read this voltage and update the HomeKit state accordingly.

The second voltage divider with the normal resistors is needed to keep the voltage output range between 0-1v, which is what the ESP8266 is able to read on its A0 pin.

The photoresistors face in opposite directions, and light from the fluorescent tubes is mostly blocked from reaching the second one by the wood support. 

Discussions