This nightlight appears, at first, to be nothing but a simple cube. Written on one side is the word "Off" and on the other is, as one might expect, is the word "On". By turning the cube upside down, you activate the light inside and reveal the cubes secret!Hidden within the cube are the emblems of four factions from the Star Wars universe. These emblems are inset on the inside faces of the four side panels of the cube, making the plastic thinner and allowing the light to shine through. A simple circuit consisting mainly of a tilt switch and four LEDs is all there is to this simple nightlight.
Below is a list of parts and tools needed for this project. For more information on where to buy parts online, their costs, and a little bit of discussion on my design process for this nightlight, follow this link.
- 3D Printing Filament, PLA - Used for printing the case of the nightlight
- LEDs - For the light part of "nightlight"
- Tilt Switch - Activates nightlight
- 150 Ohm Resistors - For current limiting the LEDs
- Perfboard - For soldering all of the components to
- Battery Connector - For connecting power to the circuit
- 9v Battery - Powers the LEDs
- Hook up wires - Used to hook everything up
- Screws* - For closing up the box and securing the circuitry
- 3D Printer
- Soldering Iron
*I highly recommend using self-tapping screws here since the holes we're creating will not have threads in them to begin with.
Step 1: Printing the Nightlight
The 3D model for this nightlight was made in Autodesk 123D Design and can be found at Thingiverse.
I printed it with a raft but without supports. I found that printing such large flat surfaces without a raft would cause them to cool unevenly and buckle. This in turn cause the panel to pull away from the print bed, leaving me with a ruined mass of plastic as the printer went on about its business. Adding the raft fixed this.
I printed these panels at 0.2mm precision and each side took about an hour. Once printed I removed the rafts and only had to do a little bit of clean up on the screw holes in the top.
Step 2: Constructing the Box
Before putting the box together, screw a screw into each of the standoffs on the top panel (the side marked "On") and then unscrew them. Doing so will tap the holes, i.e., add threads so that the screws have something to hold on to and can be easily attached/detached whenever necessary. Do the same thing with the standoffs on each side panel. Finally, add a piece of foil tape to the inside face of the bottom panel (the side marked "Off"). This is to reflect light inside of the box. Now to put the box together.
Since the panels won't print perfectly square (this just seems to be the nature of 3D printing) I screwed the four sides to the top first, made things as square as I could, and wrapped it in painter's tape to keep it from moving. I then added a bead of hot glue to the inside edges, securing the four sides to each other. Be careful not to glue the top down!
I then added hot glue around the beveled edge of the bottom, pressed it into place at the bottom of the box, and taped it up as well. After giving the hot glue some time to cool, I added super glue into all of the edges to reinforce everything. Again, make sure not to glue the top down!
Once the glue has dried, you'll need to unscrew the top in order to add the electronics.
Step 3: Creating the Electronics
For this step we'll be soldering all of the electronic components to the perf board. The circuit is laid out so that two LEDs are in series with a resistor in between them. There are two pairs of these LEDs and the pairs are hooked up in parallel with their cathodes connected to the negative lead from the battery. Their anodes are connected to the positive lead via the tilt switch. In the "Off" orientation, the tilt switch opens and disconnects the battery and in the "On" orientation the tilt switch closes, turning on the LEDs.
In picture 1 above, the resistors are in the upper left and bottom right corners, meaning that the North and West LEDs are in series and the East and South ones are as well. What this means is that the North and South LEDs should be soldered down with their anodes (longer lead) pointing to the East and the East and West LEDs should have their anodes pointing North.
Next, solder in the resistors so that they connect their respective pairs of LEDs. Using a small wire, connect the North and East LEDs together by their remaining leads (these should be their anodes or longer leads). Use a second wire to connect the West and South LEDs by their remaining leads (these should be the cathodes or shorter leads).
After this, you'll need to solder in the tilt switch. If you're tilt switch has only two leads, simply solder one of them to the anode side of the LED pairs. This is the wire you just added to the Northeast corner of the board. You'll need to orient your switch so that it is open when the circuit board is upright (i.e., the LEDs are pointing up) and closed when it's upside down.
If, like me, you're using a tilt switch with three leads then that likely means it senses tilt in two different directions. Since we really only care about closing the circuit in one orientation, you'll need to turn it on its side when you attach it and then use the top two leads (because we want the circuit closed when the board is turned upside down). To connect the switch, I soldered some short wires to the leads and ran them through the perf board so I could solder them appropriately. Solder the top most lead to the anode side of the LEDs
After soldering one lead to the anode side of the LED pairs we need to connect the battery. Solder the positive lead of the battery connector the other lead of the tilt switch (the middle lead if using a three-lead tilt switch). Solder the negative lead to the cathode side of the LED pairs (this is the wire that connects two LEDs in the Southwest corner).
That's it, you're now done with the electronics.
Step 4: Final Construction
Now that the electronics are complete we need to put everything together.
I added a little bit of tape to the bottom of the circuit board to make sure that the metal case of the battery doesn't short out the circuit in any way. This may not be necessary, but better safe than sorry.
Next, you'll need to attach the battery to the snap connector and slide it between the standoffs on the top panel. This battery will be held in place by the circuit board once it's screwed down. Since the leads for the connector were a little long, I rotated the circuit board before securing it in order to wrap the leads around the standoffs.
Screw the circuit board to the standoffs, turn the top panel over and drop it into the box, secure the top with the remaining screws, and you're done!
Check out the next step for some modifications to this project.
Step 5: Modifications
First, I found that the ball-bearing based tilt switch I used was not very reliable. It caused the light to flicker quite a bit and sometimes not even turn on without some severe jiggling. To be fair, I modified and used a tilt switch that was designed to work at a 45 degree angle and not at the 180 degree change this night light requires. This, combined with the relatively small ball bearing in the sensor (giving it less inertia and thus making it more prone to bounce around) made for a light that was less than spectacular.
In my second version I used a mercury switch, which is ideal as the mercury makes a more solid contact with the leads and is less sensitive to vibration. I knew all of this when I designed the light, but given that night lights are usually intended for children and mercury is fairly toxic, it seemed to be an inappropriate solution. As I will be using mine as a small desk light, I have replaced the original tilt switch and am much happier with the light's behavior.
The second modification that could be made is to the battery. A 9v battery is not really meant for any long term drain, they are really meant for low power, intermittent use. If you replaced the battery with a couple of AA batteries you should get some more battery life out of your light. Don't forget to change the resistors in order to adjust for the new source voltage too.