Light Dependent USB Switch
For various holidays, I have some small windowed displays which feature LED lighting; all low voltage stuff powered by 5 volt USB, as well as some displays that are more year-round. Not wanting the displays lit during the day, and immediately tiring of plugging and unplugging the lighting each day, I decided that an automated switching device would be the way to go. Of course, there are timers like the ones frequently used while out of town where one wishes the lighting to be switched on and off at various intervals. This system however is bulky and limited to a preset schedule.
Ideally, the lighting would turn on when dark, and off when light, or vice versa. So, what devices can we exploit to achieve this goal? From an electronics standpoint, a light dependent resistor can be used to sense light levels, and a flip flop combined with some hysteresis can be used to initiate switching. With these building blocks, we can start to form a circuit that we can expand upon in order to achieve an automated switching device.
One desired aspect of the circuit be that it is composed of inexpensive, common and readily available components. For the type of switching we need, we can use an operational amplifier as a type of flip flop. The LM358 meets our qualifications here, although many similar op-amps would work. One problem with this choice however is that the supply voltage only being 5v, leads to a rather low output which leads to some difficulty in driving the gate of the MOSFET. This problem can be somewhat rectified through the use of a voltage doubler. For this circuit, we will use a 555 timer along with some discrete components which also fit our prerequisite conditions. We will also outfit the device with a simple switch, to be able to reverse the switching state, to enable either day, or night operation, as well as a potentiometer, to enable switching at differing light levels.
Now, along with the connectors and our power switching device, we have the building blocks of the circuit we need, we just have to combine and test them. Once we get everything working as it should, we can combine them on a circuit board and put it into use to solve the problem we started with.