I first came up with the idea for the Girlfriend Nightlight when my significant other
revealed that she was afraid of the dark and couldn't sleep without the television on.
Being easily distracted, I can't sleep when the television is on. After several disagreements, she proposed that we purchase some kind of a nightlight. I inquired what kind of a nightlight she had in mind, to which she replied that it would be extremely cool if I could find a blue one.
Find? Possibly. Invent? Oh yes. Several days later, I showed up with the prototype Girlfriend Nightlight, and she absolutely loved it. It does an excellent job of permeating a room with just the right amount of atmospheric blue light, draws plenty of interest at parties, and ended all disagreements about sleeping with the television on.
My girlfriend also thereafter swore that I was some kind of genius. The truth is that after selecting all of the electronics and materials, assembling the Girlfriend Nightlight is pretty straightforward. I built the first one in a few nights' worth of spare time... and so can you.
Step 1: A Few Things Before Getting Started...
Let's begin by listing a few things you want to do before getting started.
1.) I'll assume that you know how to solder, and that you have a basic understanding of electrical circuits as well as a basic understanding of electronic components. You shouldn't need to thoroughly understand the physics going on inside a resistor or a capacitor or be able to recite the mathematical formulae that govern their use, but you should have a concept of what these things are and what they do. If you're starting with electronics for the very first time, this is a great project for you to try to build, but may I suggest you begin by first reading Sparkfun Electronics' excellent “Beginning Embedded Electronics” tutorial at:
2.) You'll want to make sure that you have a clean, well-lit space to spread out and build your nightlight.
3.) You'll need some basic tools - a pair of wire strippers, a pair of pliers, a small philips screwdriver, an electric drill, a simple multimeter, and a good soldering iron. I've built this nightlight using a cheap nine-dollar hobbyist soldering iron as well as a spectacular variable-temperature soldering iron. Trust me, it makes a massive difference.
4.) While this project could very easily be built using one single spool of wire, I'd strongly recommend using two different colors of wire. I used red wire for anything having a positive charge, and black wire for anything connected to ground. It is massively helpful to be able to look at all of the wires in your circuitry and be able to tell at a glance which wires are ground and which wires are not. Getting into this habit now will serve you well when you advance to more elaborate and complex electronics projects.
Step 2: List of Materials
Next, let's examine the list of materials that we'll be using. Most of this can be purchased directly from Sparkfun Electronics, some of the more obscure components can be purchased from an electronic components retailer like Mouser Electronics or Digi-Key, and for some of it, I found it more convenient to just drive over to my local Radio Shack. For the enclosure, I used an empty blank CD case I had just laying around.
1.) 2" round protoboard
2.) 2" round TQFP80 protoboard
3.) Center-positive 9 volt power supply
4.) LM7805 5 volt regulator
5.) 1000uF 25 volt capacitor
6.) 10uF 25 volt capacitor
8.) 47 ohm half-watt resistor
9.) On/off power button with half-inch mounting hole
10.) #4-40 screws (3)
11.) #4-40 hex nuts (3)
12.) #4-40 metal standoffs (6)
13.) 27 ohm half-watt resistors (12)
14.) 10mm blue LEDs (12)
15.) A spool of 22 gauge wire
16.) prototyping header pins (2)
17.) female two-pin jumper wire
18.) Empty 30-pack of blank CDs
Step 3: A Quick Look at the Finished Product - Part One
Let's take a look at what we'll be assembling. The Girlfriend Nightlight consists of two main parts, each of which is assembled separately and later joined together. The lower board contains all of the electronics for powering the nightlight.
Step 4: A Quick Look at the Finished Product - Part Two
The upper board contains the LEDs themselves.
Step 5: Let's Get Started!
Let's get started! We can begin by preparing the lower board, being as it is by far the more complex of the two. The protoboard that we will use has a great number of metal holes that allow us to easily solder in components or wires. Typically, only one wire or component will be inserted into each hole. Connections between wires or components in adjacent holes are easily made by using your soldering iron to melt some additional solder in between the two points while also heating the connection in the first hole. The blob of liquid solder can then be pulled over to touch the adjacent connection. When the solder cools, it bonds the two connections together and electrically connects them. It may be a good idea to practice this a few times on a spare protoboard if this will be your first time soldering one.
Step 6: Solder the Voltage Regulator
Here we see that we start by soldering in the LM7805 voltage regulator on the edge of the protoboard. Bend the legs of the regulator so that it will stick out over the outer edge of the board. This keeps it isolated as well as helps to keep the regulator cool, as it will be more exposed to the air.
Step 7: Fit the Resistors
Push the twelve 27 ohm resistors through the holes of the protoboard and make sure that they all fit properly. Resistors are not polarized, meaning you can insert them in any direction and it won't matter. You will notice here that I found it easiest to group them into four sets of three. Being half-watt resistors, each one is much fatter than the typical resistor that you'll use in electronics projects, and the board can get crowded much more easily. I found that grouping them like this makes it much easier to fit them onto the board than trying to set them all adjacent to one another. Once you have them all properly laid out, solder them into position and clip off the excess legs underneath the board. Notice in this photo that I have not yet clipped the excess legs nor soldered the resistors into place.
Step 8: Add the 1000uF Capacitor
Add the 1000uF capacitor to the left of the regulator. Studying the regulator's datasheet tells us that the left pin is the input voltage, the center pin is ground, and the right pin is the regulated five-volt output. This capacitor will help to steady the input voltage coming from our power supply by “holding up” the input should the power supply momentarily produce an insufficient amount of power. Be careful to orient the capacitor correctly - the positive terminal of the capacitor should be soldered adjacent to the input pin of the regulator, and the two should then be soldered together.
Step 9: Solder the Top Sides of the Resistors Together
Being as all of our LEDs will be powered equally, our resistors need to be joined together, but only
on the side facing the regulator! Notice in this detail view that each group of resistors has been
connected together. Also notice the capacitor connected to the input pin of the regulator at the top of the photo.
Step 10: Add a 47 Ohm Resistor
Here, I've added a half-watt 47 ohm resistor and connected one end to the array of twelve 27 ohm resistors. This is to dim the finished nightlight a bit, as the blue LEDs that we are using are shockingly bright at full power, and are a bit excessive for the purposes of a nightlight. This little bit of added resistance will make the finished product much more suitable for use as an ordinary nightlight. Also, I have added a short wire on the reverse side of the board. One end of the wire is pushed through the board in between the first and second resistor group, and the other end is in between the second and third resistor group. This wire is used to connect the “groups” of resistors together - you'll notice now that in this photo there is now a straight, unbroken line of solder connecting all of the resistors together at the top.
Step 11: Add a 10uF Capacitor
See that tiny circular component next to our newly added 47 ohm resistor? That's the 10uF capacitor. This serves the same purpose as the much larger capacitor on the other side of the board (slightly visible here at the top of the picture) only this capacitor will serve to filter the regulator's output voltage. The regulator itself should already do an excellent job of providing a consistent, steady five volt output - this capacitor will just serve to make things even cleaner. Again, note the orientation here - the capacitor only can be used one way. The positive terminal of the capacitor should be soldered to the top of the resistor, as they both will be fed directly from the regulator's five volt output. The capacitor I used in this photo has a light blue band identifying the negative terminal. The band is visible facing downwards in this photo.
Step 12: A Quick Status Check.
So far, a schematic of the circuit that we have constructed might look like this photo. Here we see the LM7805 regulator, the two capacitors we have already soldered into place, as well as the 47 ohm dimming resistor. Not shown in this picture is where the twelve 27 ohm resistors are all connected to the right side of the 47 ohm resistor. See all those lines hanging down in this picture? Those all need to be connected to ground, and we need to provide a way to switch our nightlight on and off as well. Time to clip a few short lengths of wire!
Step 13: A Few Wiring Connections to Be Made
In this photo, we can see six wires have actually been added. First, two red wires approximately six
inches long should be placed adjacent to one another but should NOT be connected together - these
wires will serve as the switch. The first of these will be connected to the positive wire from our DC
power adapter, and the second of these is connected to the input pin of the voltage regulator by a third
wire which we have added in this photo. Next, a fourth and fifth wire are added to connect all of our
grounds together - the negative terminal of the 1000uF capacitor, the negative terminal of the 10uF capacitor, and the negative center pin of our voltage regulator. Lastly, a sixth wire is added to connect the output pin of the voltage regulator - the right pin - to the top of the 47 ohm resistor.
Step 14: Solder Connections on the Bottom Side of the Board
All of these connections are getting to be too close together for us to easily reach with our soldering iron, so in order to solder these new wires into their holes and attach them to their adjacent components in the right places, we have to flip this board over and use the underside to create our solder joints. Remember - electricity doesn't care whether the connections are on the top or bottom of the board, just as long as there is a direct connection between the two points. Here we see the underside of one of my finished nightlights. You can see clearly the three connections in the center are the three pins of the voltage regulator, each pin is connected to a wire that was added to the board in the previous step. In the lower-right of this photo, you can see two horizontal solder joints which are the two red wires that we're using for our switch - one side is connected to the input of the voltage regulator, and the other side is connected to the positive terminal of the power adapter, which we will come to discuss shortly. On the left side of the photo, there are two reverse-L shaped solder joints, each of which connect three adjacent wires or components. These are the connection points for the 10uF capacitor, the 47 ohm resistor, and the wires that connect them to the output pin of the regulator and to ground. Lastly, at the bottom of this photo, notice the short red wire which connects together the two groups of 27 ohm resistors that was installed during a previous step.
Step 15: Status Check Number Two
Now that last step was a bit tricky, so let's backpedal a moment to the circuit diagram we just looked at. If we add to the diagram the switch wires that we just soldered, as well as all of the grounds that we have connected together, our schematic diagram now looks like this. Note that all of the grounds are not connected in the drawing, but electrically, they are all connected together. If you have a good multi-meter that has a circuit continuity setting, you can verify this by using your multi-meter to “buzz out” the connections, touching one probe to the ground leg of the 1000uF capacitor and then touching the other probe to the center pin of the voltage regulator. The meter should buzz or beep or provide some feedback to let you know that the two points are connected. If it does not, go back and check your solder joint connections.
Step 16: Solder Header Pins to the Ends of the Switch Wires
Solder the loose ends of our two “switch” wires onto a a two-pin header. These two pins will now allow us to switch our input voltage on and off. For the time being, I shorted these two pins together by using a spare jumper I had in my toolbox. With the jumper in place, the circuit would be powered on as soon as I plugged in the power adapter.
Step 17: Prepare the Power Adapter
Speaking of the power adapter, let's get it ready to be installed next! Start by clipping the barrel jack adapter off the end of the wire. The remaining cable consists of two wires, one red and one black, inside the long black cable coming out of the power adapter. Carefully cut about an inch or so of the insulation off of the end of the cable, exposing the red and black wires inside. Strip the insulation off each of those smaller wires to expose the copper metal wire inside.
Step 18: Solder the Power Adapter Wires to the Board
The red wire from the power supply is the positive wire, so it should be soldered to the first of our switch wires. You can see in this photo the red power supply wire adjacent to the left red switch wire. The black wire from the power supply should be connected a hole adjacent to the negative terminal of the 1000uF capacitor. Solder joints on the bottom of the board connect the power supply wires to their neighboring connections, as visible in the previous photo of the underside of a completed nightlight. At this point, if you're feeling brave and you have a multi-meter handy, now would be a good time to plug in the power adapter and to check some voltages. You should be able to place the negative probe of the meter on the negative terminal of the 1000uF capacitor and touch the meter's positive probe to the input pin of the voltage regulator and see a reading of approximately nine volts. Next, leaving the negative probe where it is, you should be able to touch the meter's positive probe to the output pin of the regulator and see a reading of nearly precisely 5 volts. You should also measure nearly 5 volts at the top of the twelve 27 ohm resistors. This tells us that the regulator is doing it's job and is producing a steady 5 volt output, and that all of the resistors are hooked up correctly as well.
Step 19: Solder a Five Inch Long Wire to the Bottom of Each 27 Ohm Resistor
Now that we know that our twelve resistors are connected to precisely the correct voltage, it's time to give that power someplace to go. Cut twelve strips of wire, each about five inches long, and solder one length to the hole adjacent to the bottom of each 27 ohm resistor. Add a solder joint on the bottom of the board to connect the wire to the resistor, making certain to not short any resistor or wire to it's neighbor. One single five inch long wire also needs to be added for ground, and can be connected to any easily reachable ground we have established so far. I connected mine to the negative terminal of the 10uF capacitor.
Step 20: More Solder Joints on the Bottom of the Board
Here we see the twelve solder joints on the bottom of the board, each one connecting a length of wire to an individual 27 ohm resistor. Each one of these wires will eventually supply electricity to one of the
nightlight's twelve LED lights. The bottom board is now complete! Set it aside for the moment.
Step 21: Prepare the Top Board
The top board begins it's life as this protoboard. This is designed to accommodate an 80 pin processor chip called a TQFP, or Flat Pack. We will be using this chip's two rings of solder holes, but have no need for the solder pads in the center of the board where the TQFP chip would usually go. Also, we will be threading the twelve red wires from the previous step upwards to connect to holes on this board, which means that we need to drill a hole through the center of this board so we have somewhere the run the wires.
Step 22: Drill a 3/4" Hole Through the Center of the Top Board
Here, I am using a drill press with a 3/4” bit to cut out the center of the protoboard. When lined up correctly, this size drill bit almost perfectly cuts out all of the solder pads for the TQFP chip, leaving behind just the copper traces behind. After the drilling was complete, I used a sharp razor to slice through those copper traces to make absolutely certain that none of the traces on the board accidentally got pushed into one another by the drill bit.
Step 23: Solder the LEDs Into the Top Board
The 10mm sized LEDs that we are using fit into the upper board in groups of four, as seen here. Insert the LEDs into the board as shown, testing for proper fit. Take notice that each LED has legs of different lengths - the longer leg is the anode, or positive terminal. When inserting the LEDs into the board, make sure that each one is oriented in the same way. Going around the circular board in a clockwise motion, the LEDs should all be anode on the left, cathode on the right. Solder the LEDs into place, and clip off the legs' excess length.
Step 24: Solder Wires to the Negative Terminal of Each LED
We need to connect the negative terminal, or cathode, of each LED to ground. Four short wires, one for each LED, need to be soldered into the outer ring of holes in the proto board. Each of these wires should be connected via a solder joint on the bottom of the board to the negative terminal of the adjacent LED. The wire should then be folded backwards and have it's other end soldered to the inner ring of holes. This enables us to more easily connect all of those grounds together. Here we see two sets of wires which have been added and still need to be connected to the inner ring of holes, as well as one set of wires which has been properly connected.
Step 25: Check the New Connections to Ground
Here we see that all of the ground wires properly installed. The connections on the inner ring should all be connected together via solder joints on the bottom of the board, creating three “bundles” of connections to ground. We need to add two wires to the inner ring to connect these “bundles” together, making one single uniform connection to ground for the entire top board and all 12 LEDs.
Step 26: Solder Two Wires Onto the Top Board to Connect Together All the Grounds
Here we can see the upper board with the two additional wires installed. This is another good time to use the circuit continuity feature of your multi-meter if you have one - you should be able to put the negative probe on any negative terminal of any LED and the positive probe on any other negative terminal of any other LED, and your meter should beep to indicate that the two points are connected together.
Step 27: Solder the Wires From the Bottom Board to the Top Board
At last, we're in the home stretch! Unfortunately, the last step is also the trickiest one. The twelve red wires and one black ground wire from the bottom board need to be threaded up through the hole in the center of the top board. The ground wire needs to be soldered to a hole in the top board's inner ring and then connected to any of the ground connections that we made in the previous step. Since we connected every ground pin of every LED together, any ground point on the entire top board will work properly as a place to attach the ground wire from the bottom board. Lastly, each red wire has to be soldered into a hole in the outer ring of the top board adjacent to the positive terminal, or anode, of any LED. The red wire then needs to be connected to the anode with a solder joint, but since reaching the bottom of the board at this point is nearly impossible, this joint has to be made on the top of the board.
Step 28: Solder All of the Red Wires to the LEDs
Here we see an enlargement of a section of the photo from the previous step, clearly showing the red wire from the bottom board and the solder joint connecting it to the anode of the LED. I found that the remaining red wires may need to be pushed out of the way to properly reach the anode of the LED with the soldering iron.
Step 29: Screw the Two Boards Together
Using six metal standoffs and three matching screws, attach the two boards to one another permanently as shown in this photo.
Step 30: Test Your Nightlight
Once you've screwed the two boards together, the nightlight itself is now complete! Test your nightlight by plugging in the power adapter. If your switch wires (visible at the top of this photo) are still jumpered together, your nightlight should immediately switch on and all of the LEDs should be glowing brightly.
Step 31: Prepare the Enclosure
While you can use anything you like for an enclosure, I liked the idea of using an empty case of blank CDs that I had laying around, as the round shape of the CD case would perfectly complement the round shape of the nightlight. I cut off the round cylinder in the center that the CDs usually are placed on with a hobby knife, and set the finished nightlight circuit down on the center of the bottom of the CD case, marking the spots where the metal standoffs touched the plastic case.
Step 32: Attach the Nightlight to the Enclosure
Drilling holes into the plastic CD case at those three spots enables us to push the standoffs through the holes and attach them to the case with three hex nuts.
Step 33: Prepare the On/off Switch and Install It Into the Enclosure
The push on / push off button that I used required a half-inch mounting hole, which fits perfectly in the top of the CD case I used for an enclosure. Drill the mounting hole through the center of the top of the CD case, then thread the button through the hole, tighten it with the included hex nut and washer, and solder on a female two-pin jumper wire.
Step 34: Connect the Switch and Re-assemble the Enclosure
Attach the jumper wire to the pins of our switching wires, connecting the button to the switching wires and allowing it to control the flow of electricity to the nightlight. Screw or snap the top of the CD case into the bottom of the CD case, plug in your creation, fire up your new nightlight, and never again argue with your significant other over sleeping with the television on.