Introduction: Moon Night Light
The Moon Night Light is a back-lit moon decal that lights up when it gets dark. The transistor circuit senses the light dimming and turns on
the LED strip in response. This is a great project for anyone who has a
problem seeing in the dark.
If — like some people I know — you are afraid of the moon, you can easily replace the graphic or modify this to suit your mood. Aside from a host of potential graphics — emoji nightlight anyone? — this can easily be turned into a mirror, a cork board, or even a picture frame.
To learn more about the transistors used in this project, check out the Electronics Class.
Step 1: Materials
For the Moon Night Light you will need:
(x1) TIP31 transistor
(x1) TIP42 transistor
(x1) Photocell
(x1) 1M resistor
(x1) 10K resistor
(x1) PCB
(x1) Power jack
(x1) White LED strip
(x1) Moon decal
(x1) 8" wooden disc
(x1) 6" letter "O"
(x1) 10' twisted pair fabric cord
(x1) Adhesive-backed Velcro squares
Step 2: The Transistor Circuit
In this circuit we are using two transistors to fade an LED strip on and off. In short, the first transistor responds to changes of light, and triggers the second transistor which responds by turning on and off the LED strip.
By using a two transistor NPN/PNP DC amplifier circuit, we can amplify the input from a photocell to control a relatively high current LED strip. When the base of the NPN gets toggled on via the photocell, the base of the PNP gets toggled off and allows the lights to glow. The default setting for the NPN is to be off when it's light, and on when it's dark. The PNP transistor is obviously the opposite.
This is considered is a two-stage transistor circuit because each transistor connected together is considered a stage. All this basically means is that each adds some level of amplification to the next transistor. In the first stage, there is a voltage divider on the base pin of the NPN transistor consisting of a 1M ohm resistor connected to power and a photocell connected to ground. This divider provides a varied amount of current to the base pin depending on levels of light. As the light goes down, for instance, the resistance of the photocell increases, and in turn more power is able to flow to the transistor's base. This enables more current to flow between the collector and emitter of the NPN.
In the second stage, a PNP transistor has its base pin connected to the collector of the NPN through a 10K resistor. The resistor is just there to provide a little protection and prevent the PNP transistor from being damaged since the first transistor is amplifying the current on the second transistor's base pin. More significantly, the current flowing through the NPN transistor is actually varying the base pin of the PNP based on the light input from the photocell. By using the gain of the first transistor to increase the power to the base of the second, we are able to provide it with more current and get the LED strip to glow more brightly when the lights go out.
Step 3: Drill the O
To begin, drill a hole slightly slanted towards the outer edge from the top to the bottom of the O. This will be used for hanging the night light on a nail, so the slant will help keep it from falling off.
Opposite the first hole, drill a 5/16" hole from the "bottom" edge of the O inwards. This hole will be used to pass the wire up into the center of the O from the bottom.
Step 4: Wood Glue
Glue the O centered upon the 8" round wooden disc.
The surface of the O that was drilled down into in the previous step should still be facing upwards when you are done gluing them together.
Step 5: Measure and Cut
Wrap the LED strip around the edge of the wooden O starting next to the 5/16 hole and continuing all the way around until you reach the other side of the hole.
Look at the LED strip and find the nearest marked cut line to the edge of the hole, and cut the strip in half with a pair of scissors.
Step 6: Attach Wires
Now is time to carefully solder two wires to either edge of the trimmed LED strip.
A red wire should be soldered to power, and black wire soldered to ground.
Step 7: Wire the Power Jack
Twist apart the power jack and wire the white wire from one end of the twisted pair fabric cord to the center pin on the jack, and the black ground wire to the outer terminal on the jack.
When done, twist the protective casing back together with the front of the jack.
Step 8: Apply the Decal
Apply the moon vinyl decal over the wooden surface.
Fold the extra bits of moon decal over onto the back.
Step 9: Drill the Moon
Drill a 3/16" hole on the front surface of the moon in a location where the hole will end up on the inside of the inner ring of the wooden O in the back.
Step 10: Attach the LED Strip
Peel the adhesive backing off the back of the LED strip and stick it around the edge of the wooden O.
If your LED strip does not have an adhesive backing, you can use a strong double-sided tape, glue, or contact adhesive to connect them together.
Step 11: Insert the Wires
Pass the fabric cord and the wires from the LED strip through the 5/16" from the outside in.
On the inside of the frame, fasten the wires together with a zip tie, and then trim away the excess plastic. This zip tie will eliminate strain from the wires and keep them from getting ripped out.
Step 12: Build the Circuit
[Now is time to build the circuit board. As a reminder, always go by the schematic and not my pictures. These are more of a loose visual guide of my process than a blueprint.
To begin, I soldered the transistors to the board at a slight angle in order to make sure they would fit between the back of the wooden ring and the wall. However, I was careful not to lay them flat because the metal tab in the back is connected to the collector, and I did not want to risk shorting them together (or to any other part) on any of the solder bus pads.
I then attached the resistors to the board.
To figure out which pin was which, I used the following pin diagram for the TIP31 and TIP42 transistors.
Finally, I connected all of the remaining wiring.
The photocell is going to be wired in separately next.
Step 13: Attach and Insulate
Attach a 4" stranded ground and a 4" stranded signal wire to the photocell and insulate the connections with shrink tube.
Step 14: Attach the Photocell
Connect the photocell's ground wire to ground, and the photocell's signal wire to the base pin of the NPN transistor.
Step 15: Wire the Power
Solder the black wire from the power cable to ground bus and the white wire to the power bus on the PCB.
I also wrapped the ends of the fabric cord with tape to keep them from unraveling.
Step 16: Finish It Up
Once the board is complete, the PCB should be mounted flush to the backside of the 8" wooden disc using adhesive back velcro.
Step 17: Insert the Photocell
The one last thing to do before you hang it and plug it in is to insert the photocell into the 1/4" hole from back to front.
Apply a small dab of glue to hold it in place.
Step 18: Hang It Up
Hang the moon and your wall, and plug it in.
Never be in the dark about transistors again.