I have a small light bulb (3W LED, E27/110V) that I am controlling using based on ambient brightness (it comes on when it is dark, and goes off when it is light). The circuit uses a BT136 triac, a MOC3041 optoisolator, and an IR phototransistor (I don't have a part number for it - 2 pins, black cap, looks like an LED).
As built, it mostly works - it comes on when it is supposed to, and goes off when it is supposed to. D2 is included just as an indicator LED, SW1 is included so that the light can be turned on manually (bypassing the light activated circuit) if needed.
However, I have one issue with it:
The circuit is currently located fairly close to the light (around 1.5m under it - but the light faces upwards). When it gets dark enough, the light turns on and the light it produces turns off the phototransistor causing the light to flash. The light continues flashing for around 5 minutes (at varying frequencies), before it remains on. This implies that it doesn't take much additional darkness to offset the added light from the LED bulb. I chose the value for R1 that would let the light turn on at the appropriate time, and R2 is currently set around 50kohm (altering R2, changes the on time, but doesn't appear to help the flicker).
My indicator LED (D1), transitions to on when current through Q1 drops below 1.6uA to 1.3uA. (I am not confident enough in my meters to fully trust that number, but hopefully it provides an idea of the magnitude). In full direct sunlight the current through Q1 is up to 40mA.
Ideally, I would like to resolve this as simply as possible (e.g. with a minimum of ICs), however, my knowledge of electronic circuit design isn't yet where I want it to be in order to know the best course of action from here.
- I could resolve this with a microcontroller fairly easily, but this seems like an inelegant solution.
- I have considered implementing a circuit similar to one used to debounce a switch, but the time scale on those is normally on the order of milliseconds - whereas I need something over several minutes.
- I have seen some designs which use two phototransistors pointed in different directions but would like to have a design where positioning isn't critical.
- I have considered a soft-latching design, but am unsure how exactly to implement this. I was hoping for something which slightly changes the required input current once the light turns on - so that the added current flowing through the phototransistor when the light comes on, isn't enough to turn it off. I believe this would entail a feedback resistor, but unfortunately, am not sure how to implement this.
What would be the best way to resolve the flicker that occurs at dusk when the light turns on?