Ah, the classic Super Mario coin block. So tantalizing with its mysterious question mark - just a gentle bump with your fist will reveal its unknown contents. Will it be a lowly coin, the rare vine, or perhaps a power up? If only such a thing existed in real life...
WAIT - IT DOES!
OK, so it doesn't actually spew coins and mushrooms, but it does light up and play some sounds that are sure to make you smile.
This Instructable assumes you've bought one of the kits for sale on Etsy. Here's what it will contain:
- 6 yellow acrylic laser-cut exterior pieces
- 4 white acrylic laser-cut interior pieces
- a number of black "shadow" elements for the interior
- custom printed circuit board
- 4"x4" touch sensor plate
- ATTiny85 microcontroller
- 10 extremely bright LEDs
- 10 68-ohm resistors
- 2 NPN transistors
- an 8-ohm speaker
- 2 100-ohm resistors
- 1 10M-ohm resistor
- 5v USB wall wart
- 12' two-prong extension cord
You're going to need some tools and supplies to get this build done:
- a soldering iron and some solder
- a hot glue gun (preferred) or some double-stick tape
- superglue - the brush kind is best
- a pair of diagonal cutters or wire cutters
- a wire stripper or a knife
- a few short pieces of wire
- masking tape (optional)
- spring clamps (optional)
- a vise for holding things in place while you work (optional)
Step 1: Prep the Work Space
We're going to be working with superglue, hot glue, and solder, so there's significant opportunity to ruin the kitchen table your wife so carefully picked out. I covered my whole table with butcher paper to make sure that wouldn't be an issue... again.
Step 2: Assemble the Box Faces
The first thing we're going to do is assemble most, but not all, of the exterior of our lamp. The reason to do this first is that how you choose to assemble the sides will effect the rest of the construction.
You've got four pieces like that with square tabs at corners. Make sure that they are aligned with the tabs at the top right and bottom left (as seen in picture). Otherwise, the only way the box will fit together will leave you with upside-down or mirrored question marks.
(Note: you can align them the other way too if you'd like, just make sure it's the same every time)
At this point, if you have the new kit with the screen-printed sides, you can skip to the next step. If you've got the older kit, continue on below.
Line up a large white piece on top of the yellow one. The question mark should be facing to the right as seen in the picture (this will be revered when you look at the completed lamp from the outside). Pick it back up and apply a few dabs of superglue to the underside of the white piece. Line it up over the yellow piece and press down firmly for a few seconds. The glue should set after only 5 seconds, so if you're a little off, remove the piece immediately and realign.
Repeat this process on the other three faces.
Step 3: Assemble the Box Faces, Continued
Once you've gone through and glued all the white pieces to the yellow exterior pieces, adding the rest of the detail pieces is easy - the white piece should provide you with the template you need. Simply apply a little glue to each of the pieces, then place them into the outline where appropriate.
The one tricky part is the floating white piece at the center of the question mark. Do this piece last, after you've put in the long shadow that hugs the "inside" of the question mark's hook.
Step 4: Mark the Top and Bottom
The top and the bottom pieces will only connect to your box one way once you've decided which is the inside and which is the outside by gluing on the internal pieces. We can't close up the lamp yet, but it's really important that we figure out which side of the top and bottom will be facing in.
Take two of the side panels and fit them together by hand - no glue needed. Then locate the top - the panel with a hole in it - and try to fit it with the two sides. It will only join one way, so if it doesn't match, just flip it over. When it does match, you've found its final orientation. So that you can remember, put a small piece of masking tape on the outside of the piece.
Repeat this process for the bottom, noting that this time, you're going to be marking the bottom of the piece.
Step 5: Glue the Top and Sides Together
Locate two of your completed side panels and the top. With the top and one of the side panels, fit them together and then tape over the joint from the outside with a piece of masking tape. If you're careful to do it tightly, then it should make a pretty good right angle. Then, with the other side piece, apply superglue to the in-cut parts of the dovetail joint along one side. Then, just connect the pieces together.
(note: if you don't want to use tape, you can also apply superglue at the arrows seen in the picture, and then attach the three sides as shown. Everything should fit together nicely either way)
After pressing for a few seconds, the glue will have set, and your two sides should be joined at a very nice right angle. Now you can remove the tape and take the top off, then apply more superglue along the top edge of the two glued sides and actually glue the top on.
Congratulations, you've made a nice strong corner of your lamp! Now that you have this arrangement, it'll be easy for you to put the rest of the sides on. Note: do not glue the bottom on, only the sides!
Glue the other two sides onto the box, then stop and admire what you've made in front of a bright light source.
Step 6: Populate and Solder the Resistors
I like to do my boards starting with the lowest components first, especially if they're all the same height. That way, you can just flip the board over and put it component side down and let the table hold everything in place.
While your iron is heating up, we'll get started with the first bunch of components that need to be added: the resistors. Most of the resistors are there to control the amount of current flowing through the LEDs, but there are others that serve to do things like speaker volume control and sensor tuning.
For reference,note the detailed picture.
Locate your strip of 68 ohm resistors (color code: blue gray black gold). There are 10 of these blue resistors to place around the outside perimeter. For each one, remove it from the tape strip, bend the leads down 90 degrees, and then thread it through the holes in the right spot (see the picture as a guide). Resistors don't have any polarity, so you can't put them in backwards. I like to bend the lead over right next to the body of the resistor using my thumb, but fine needle nose pliers can work for this, too.
Once the 68-ohm resistors are done, let's add the 100-ohm resistors (color code: brown black brown). These resistors connect our microcontroller pins to a pair of transistors, one for the LEDs and one for the speaker. The ATTiny85's pins can only source about 50mA, which is pretty small, so we have to amplify that current to get bright lights and loud sounds, respectively.
These two resistors may be loose or in a short strip. They belong right in the center of the board, to the right of the microcontroller (see picture). Repeat the lead-bending and hole-threading process from above.
The last resistor to add is the 10M (10,000,000) ohm resistor (color code: brown black blue gold) that is used to help the microcontroller be touch sensitive. This project uses the CapSense library to implement capacitive touch sensing, and with a 10M-ohm resistor, it's tuned for direct touch only. Add this final resistor directly below the ATTiny85 spot (see picture).
Once you have all your resistors placed, carefully flip the board over and set it down with the resistors' legs pointing up. Gravity and your tabletop should keep them all in place while you solder all the legs. I like to do one leg of each resistor first just so I know they aren't going anywhere, but you can use whatever technique you like.
With all those legs down there, it can be hard to tell which ones still need to be soldered. It can be helpful to start from the top and work your way to the bottom. Another thing you can do is to solder a batch of leads and then clip them all short.
When all the leads are soldered, cut them down as short as you can.
Step 7: Solder on the IC Socket
Position the IC socket on the board with the little notched part facing to the left (make sure the board is properly oriented as shown in the picture). This will help you insert the ATTiny in the right direction later.
I tend to solder the pins on the opposite corners first, again just so that I know it's not going to come out of position if I happen to jostle it. Proceed to solder all the rest of the pins. You might notice that some of them aren't actually electrically connected to the rest of the board - you don't technically have to solder these, but it's nice to get them all for completeness' sake. Plus, later, you won't be wondering why you didn't solder something.
Step 8: Add the Transistors
However, they are both oriented differently! Note the proper orientation in the picture. Slot in the transistors, then flip the board over and solder them in. These little guys like to slide out of the holes while you're soldering, so it's easy to end up with the transistor standing taller than you expected. This isn't an issue, but if you notice while you are soldering the first leg, it's easy to put a little pressure on the transistor from the other side of the board with your finger, heat up the leg so the solder reflows, and push the transistor down. When you remove the iron, the transistor will usually stay put.
When you're done soldering the transistors, cut their legs short.
Step 9: Populate and Solder the LEDs
It's important that you put the LEDs in the right way, since they are polarized. Note the positive and negative indications in the annotations on the picture. The positive corresponds to the longer leg of the LED.
For the LEDs that run down the left and right edges of the board, the longer leg should go in the hole on the outside. For the two LEDs in the middle on the top and bottom, the long leg should be to the right on the top and to the left on the bottom.
Once you have all the LEDS through the holes - and you've doublechecked that the legs are pointing the right direction, carefully flip to board over and solder them down. This is another spot where placing the board face down on the table really makes things easy. You don't have to be too worried if the LEDS aren't all perfectly pointing upward - the inside of the lamp is pretty reflective, so the light will end up very even.
Once you've soldered all the legs, cut them short with your diagonal cutters.
Step 10: Prepare the Sensor Plate
To connect the sensor plate to the PCB, you'll need a short length of wire. I would recommend at least 3-4 inches. Extra doesn't hurt, since everything will be concealed inside the box.
Strip about 1/4" off of each end of the piece of wire, then pick a spot on the copper side of the sensor plate where you'll solder it. You can solder the connection anywhere along the edge of the plate. I put mine in the middle of one side, but a corner would work just fine, too. The sensor plate is a big piece of copper, which makes it hard to heat up a particular spot. If you're using an adjustable iron, it's nice to jack the temperature up a little bit here.
First, just heat up the spot on the board and apply a little solder until you have a solder blob on the board. Then, while keeping the solder blob liquid, stick one of the stripped ends into it, then remove your iron. Once its cooled, you should have a nice joint. Try to use the minimum amount of solder that gives you a good connection - the more low profile this joint, the better.
Step 11: Connect Everything Together and Test
First thing to do is prepare the power block. You should have a small USB male piece that should fit into the socket on the block. You can then attach a red and black lead wire into the ouside holes of the USB piece (see picture). Use a little bit of solder to keep these in place. Finally, use some hot glue to keep the USB securely in the block (you can also use super glue).
The speaker is the hardest piece to connect to the board, so let's do that next. It's located up and to the right of the microcontroller, marked SPKR (see picture). The left-hand pad (from the top of the board) is the negative (black) lead, and the right one is the positive (red) lead.
The wires are pretty fine, so they have a tendency not to stay where you put them. It's fidgety work one way or another, but one trick I've had some success with is:
- Unspool a little solder so its sticking out into mid air
- Grab one of the speaker wires, put it through the appropriate hole on the top of the board (copper side up), then flip the board over, holding the wire in place with one hand
- Pick up your soldering iron and touch it to the end of the unspooled solder, getting yourself a decent bead of liquid solder on the tip
- Apply the solder to the speaker wire and the board as best you can
This doesn't always work 100%, but you can often at least get a little solder ball onto the wire that makes it less likely to come out.
Next, let's connect the sensor plate. The sensor plate only has the one wire to connect, and it goes to the left of the two pads marked SENSOR below the microcontroller (see picture). Be careful not to mix up the sensor pad and the ground pad to the right! Put the sensor plate's wire through the hole and solder it from the bottom.
Finally, let's connect the power supply. Connect the red wire to the left hole in the connector marked POWER. The black wire connects to the right hole.
The last step is to insert the actual ATTiny microcontroller into the socket. Both the socket and the IC itself are marked so you know which way they go. On the socket, there's a little semicircular depression, and on the IC, there's a noticeable dot at one end. You want the depression and the dot to be facing the same way. The legs on the ATTiny are often just a little too wide to fit into the socket, so you can squeeze them inwards slightly between your thumb and forefinger. When you put the IC in the socket, make sure to push down firmly so that it makes good contact.
Hooray! You've completed the electronics portion of this kit.
Once you're satisfied that everything looks OK, you can plug the 5V adapter directly into an outlet. If all is well, the LED array should turn on and then off, and if that works, try giving the sensor plate a touch. The lights should toggle on and off and the speaker should play sounds.
Step 12: Attach the Permanent Power Cord
Next, make a little cut between the two wires so that you can split them back a few inches. Then strip 1/2" off the end of each.
Now, before we can solder these wires onto the prongs of our power supply, we need to thread the cord through the hole in the top of the box. Put the cut end through the hole and pull through a good 1-2 feet, then tie a knot in that end. The lamp is going to hang against this knot, so you want to use something that's going to stay in place. I'm partial to the figure 8 stopper knot. You can find instructions on tying that knot all over the web.
When your knot is done, you want there to be at least 6-8 inches of cord left over. We want there to be slack inside the lamp so that any physical forces applied to the lamp and the cord aren't translated directly onto the circuitry inside. Plus, the slack is invisible from the outside, so there are no concerns about extra being unsightly.
The last step is to solder the stripped wire ends onto the power supply's prongs. The only real challenge here is that since the prongs are such big pieces of metal, it's hard to get them hot enough to take solder. So crank your iron's temp up!
The prongs of our power supply conveniently have big holes in them. Stick one of the stripped wires through each of the prongs then solder away. It'll take a fair amount of solder to fill the joint, so if you happen to have a spool of bigger diameter solder, this would be a good place to use it.
When you think the connections are good and soldered, snip any excess wire with your wire cutters, and then go ahead and plug the cord into a socket. If you did your job right, the LEDs should blink once and the touch sensor should function. Awesome! You're almost there!
Step 13: Glue All the Electronics Together
The first step is to glue the power supply to the non-copper side of the touch sensor. To do this, apply a reasonable amount of hot glue to one of the big, flat sides of the power supply, then position it roughly in the center of the touch sensor and press down. Just to reiterate, it's very important that the copper side of the sensor plate is facing down - if you do it the other way, the lamp will almost definitely not work.
After the glue sets, the next step is to glue the circuit board to the top of the power supply. Because the bottom of the circuit board is all bumpy with all the solder points you made, it's not going to want to sit flat. That's OK, though - just apply a lot of hot glue to the top of the power supply, then squish the circuit board onto that, making sure that the LEDs are pointing up. You'll have to hold the circuit board in place for a few seconds while the hot glue cools.
The final job for the hot glue gun is to glue down the speaker. You can pick pretty much any convenient spot on the open areas of the sensor plate. Squirt a little blob of hot glue in that spot, then stick the edge of the speaker into it, making sure that the plastic membrane part is pointing up. Try not to get any glue into the inside through the back of the speaker - you just need edge contact to keep it in place. Note: board pictured is an older version, but the assembly in this step is the same.
This is another great time to stop assembly, plug the lamp in, and prove that everything is still working OK - you never know when you might have knocked a wire loose, and better safe than sorry. Once this thing is glued shut, it's permanent!
Step 14: Final Assembly
Locate the bottom piece of the lamp's exterior - it should be the only piece of acrylic that you haven't glued to something yet! Back in the dim history of step 2, we marked the outside of this piece. Position the piece so that the outside is down. Apply a generous amount of superglue to the copper side of the sensor plate and then fix the whole electronics stack to the center of the bottom piece.
It's important that the sensor makes the best contact possible with the plexiglass, as air between the sensor and the plastic will have an effect on its sensitivity to touch. It's best to press down firmly on all four corners of the sensor plate for about thirty seconds. At the end of this time, if one or more of the corners pops up when you let go, just apply a little more superglue and press down longer. If you have a pair of spring clamps, they make this part a lot less tedious.
Once the sensor is glued down, it's time to perform our final check of the lamp's functionality before sealing it up. Plug it in, watch the lights flash, and then prove that it's able to sense your hand's presence through the acrylic. Note that with the addition of the acrylic separating your hand and the sensor, it will appear much less sensitive than when you were touching the bare metal. The more skin contact you place on the sensor, the better. It should trigger with one or two knuckles, but it will definitely trigger if you give it your whole palm.
When you're satisfied that everything is still working fine, it's time for the ultimate step. Flip the unfinished box upside down, apply superglue in all the in-cut parts of the dovetail joint, and then put on the bottom plate. As you're putting on the bottom plate, there's a good chance that you'll have to much of the power cord pulled through the hole, so pull the slack back through as you bring the bottom plate closer. Once the bottom is on, apply 30 seconds of pressure to all four corners to get it good and set, and then you're done!
Step 15: Bonus Level: Hanging the Lamp
You can find all sorts of hooks at the hardware store that can be mounted into ceilings. Make sure you know how to install hooks like these properly, then affix the cord to it with a something like a clove hitch or a carabiner of some sort.
If you have exposed beams or pipes (but not sprinkler pipes!), then you can usually find a way to wrap the cord around them to keep the light in place. For small diameter things like pipes, a few zip ties close in color can provide a really secure, inconspicuous connection point.
If you have the luxury of being able to replace another existing pendant light or a recessed can light, you can snip the plug end off of the power cord and wire it directly into your abode's power grid. Make sure that you use some means of actually supporting the weight of the lamp other than the electrical connection you make - it might look OK, but hard to say if that wire nut will survive an earthquake...
Above all, be creative with where you put your lamps! I'm looking forward to seeing photos of the most interesting places you all find to pepper a little 8-bit style into your lives.
(Note: We're going to offering a lamp stand for placement on a table. Check out the etsy store if you're interested!)