Electronic – Light activated switch – avoid flicker when turning on

light-sensorphototransistortriac

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).

schematic

simulate this circuit – Schematic created using CircuitLab

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?

Best Answer

You need to introduce some hysteresis (positive feedback) into the circuit.

This is done, below, by connecting the collector of Q2 to the base of Q1 through the network R1 R2 R3. You'll probably have to fiddle with the resistor values in order to make it work with your phototransistor.

I simulated it with LTspice, and if you want to play with it, the circuit list is here.

enter image description here

ALTERNATIVE:

U1 is an opamp functioning as a comparator with PT1 and R1 used to set the voltage on U1- to half of the supply when PT1 is illuminated enough to make its resistance equal to 1.2 megohms. R3 R4 and R5 are used to set PT1's low illumination trip level, with R3 and R5 limiting R4's range from about 2 to 3 volts, and R7 is used to provide hysteresis around the comparator and set the low and high switch points for the illumination incident on PT1.

The circuit has been simulated, appears to work nicely, and the LTspice circuit list is here.

enter image description here