Automatic Dimming Nightlight

15,668

83

23

Posted

Introduction: Automatic Dimming Nightlight

In this project, I designed a nightlight that automatically dims and turns itself off. A lot of people find it difficult to fall asleep when they suddenly transition from a brightly lit room to complete darkness. A dim source of light such as a nightlight helps them to adjust to a lower brightness and fall asleep more easily. But the down side of most nightlights is that they waste electricity because they are on all night when you really only need them to be on while you are falling asleep. So I designed a nightlight that will automatically dim and turn itself off after a certain period of time that is set by the user

Step 1: Materials

Materials:
Jumper wires
Printed circuit board
IC1: 741 OP AMP
IC2: 741 OP AMP
Terminal Connectors
R1: 1MΩ
R2: 5kΩ variable
R3: 2.2kΩ
R4: 3.3MΩ
C1: 2200µF 10V
C2: 2200µF 10V
D1: 1N4001
D2: D3: D4: 3.5V LED
S1: SPST latching switch
S2: momentary switch
Plastic project box
T1: 6V 400mA DC power supply
It may also be helpful to have some glue and heat shrink tubing.

Tools:
Drill
Soldering Iron
Wire cutters
Pliers
Screw driver

Step 2: Circuit

This is the circuit that I designed for this project. To power this project, I am using a 6V 400 mA DC power supply. Its open-circuit voltage (no load) measured by a volt meter is approximately 10V. With the load of this project the operating voltage is about 9.5V. The circuit can be broken into two main parts, a timer circuit and a dimming circuit. The timer is made from a 741 OP AMP wired as a comparator. It compares the voltage across a capacitor with a reference voltage that is set by R2 and R3. When S2 is pressed C1 is charged to the supply voltage. C1 then gradually discharges through R1. As long as the voltage across C1 is greater than the reference voltage, the output of the OP AMP is high (about 8.7V). This keeps C2 charged. When the voltage across C1 drops below the reference, the output of the OP AMP goes low (about 1.9V). This can take 0-45 minutes depending on how the variable resistor is set.

When this happens, C2 begins to slowly discharge through R4. This begins the dimming cycle. The second 741 OP AMP is wired as a unity gain amplifier. The output mirrors the voltage across C2. As the voltage across C2 drops, so does the output voltage and the LEDs dim. It should take about 45 minutes for the LEDs to go from full brightness to full darkness. Pressing the button at any point will reset the whole cycle. A SPST sliding switch turns the power on and off.

The duration of time that the lights are on at full brightness and the time that they dim can be modified by changing the values of R1, C1, R4 and C2. By changing the ratios of the resistors and capacitors you change how quickly the capacitors will discharge. For a decent estimate of how the capacitors will discharge you can use the formula Vc=Vo*e^(-t/RC).

Testing your circuit on a breadboard before soldering can help work out bugs.

Step 4: Circuit Board Assembly

Then if the breadboard prototype works, solder it onto a circuit board. I am using a style of printed circuit board that is laid out just like a breadboard. So I don’t have to change my layout very much. In order to conserve space I am stacking some components. So it is important to make sure that there are no shorts. To connect the variable resistor, I am using a strip of PC jumper wires with some of the wires trimmed off. For my light source I am using three LEDs in series whose combined voltages is close to the supply voltage so I am forgoing adding a resistor. I tend to use a lot of heat shrink tubing to insulate my solder connections. I find that it helps avoid unwanted shorts.

Step 5: Housing Assembly

Once you have the circuit constructed, find a suitable housing. Then drill some holes for the LEDs, the switches, the dial and the power cord. Trim your circuit board so that it is only as big as it has to be. This will really help when it comes to fitting everything in the housing. Finally, load in all the components and your project is complete.

Step 6: Setup

The last step is making it look nice. If you want, you can added a diffuser or something to scatter the light. You can tint the LEDs gels or just liquid highlighter. The final aesthetic details are up to you. I put mine in a decorative lantern.

Recommendations

• Large Motors Class

7,845 Enrolled

• Space Challenge

We have a be nice policy.

Questions

I have made the circuit on breaboard and checked several times to make identical to this one. I have provided 9V-10V in power supply from DC adapter. The problem is that, the Op-Amp (from timing circuit) is giving a fixed output of about 0.38 V in pin 6. That means it is not working as a comparator and this voltage is not enough to charge C2 and lit the LEDs up. What could be the possible reason behind this? Thanks in advance.

Keep in mind that the output is of the first op amp is supposed to be low until the button is pressed. When you do press the button, hold it down for a while to ensure that the capacitor charges all the way. If that still doesn't fix it, check each of the components individually to make sure that they are all working at the correct values.

Oh I'm sorry, I didn't mention that I got the low voltage even after pushing the button (momentary), the C1 (pin 3) charged to about 8.68 V and the voltage dividing network (pin 2) was providing 2.3 V. So it should work as a comparator but it doesn't. Still low voltage (0.38 V) output at pin 6 (tried with 3 different 741s). Did you face similar problem?

This isn't explicitly show in the diagram, but pin 7 should be connected to Vcc and pin 4 should be connected to GND. These pins supply power to the IC.

sir instead of potentiometer.. i would like to use a fixed time (0, 15, 30, 45) using selector switch. what would be the timer circuit look like?

The circuit would be identical except instead of a variable resistor, you would put a set of fixed resistors and a selector switch.

Thanks sir! ?

This project has a built-in light source. Sir, is it possible to use LM741 as a dimmer to any light bulbs (e.g. lamp dimmer)?

the LM741 is a very low power device. It can only out put 40 max. So you can directly control only lights that draw 40 mA or less. If you want to control higher current lights you will need power transistors.

Really nice idea. I'll be building this before too long. Thanks!