I'd had my eye on Adafruit's NeoPixels and the Arduino Yun for a while, looking for the right project, and these smart strip lights seemed to fit the bill. The project goal was pretty straightforward: Integrate wall mount lights into the bunk bed with a Night Light mode, Visual Alarm Mode, and User enabled reading lights. The project was about 50% software and 50% mechanical/electrical manufacturing. I've attached the software, so if you choose to use the same electrical and mechanical setup, half the work is done!
Step 1: Buy Your Supplies!
You can purchase most of the electronics from Adafruit.com, everything but the NeoPixels can be sourced from elsewhere though. Here's what you need:
- 2 meters of 144 LED/m Neopixels
- 1 x Arduino Yun
- 1 x 4700 uF Capacitor
- 1 x 5 V - 10 Amp Power Supply
- 1 x 2.1 mm Panel Mount Barrel Plug DC Power Connector
- 2 x Female DMX Connectors (Similar to XLR Mic Audio Connectors)
- 2 x Male DMX Connectors
- 1 x Electronic Enclosure
- 15 ' 5 Conductor Cable
- 2 x LED Backlight Momentary Switch
If you haven't already, make sure to read the Adafruit Uberguide for NeoPixels.
You'll also need some wood -- I happened to have an 8/4 (Woodworking nerd speak for 2" thick) walnut laying around. If you want to use aluminum end caps like I did, you can buy some 1/4 5086 Aluminum from McMaster.com
Step 2: Shape the Wood
So, I'm going to assume you have some table saw experience and know how to use the saw safely -- you could certainly do the same thing with a router if you're feeling ambitious and have the right bits. But for me, the easiest way to cut the dados and angles was on the table saw. First, cut two pieces of 8/4 stock down to squares, then trim one side to a slightly downward angle. The angled side will be the one with the lights on it, and will help angle the light towards the mattress (for reading). I choose 20 degrees, but feel free to choose whatever suits you. Next, measure the width and thickness of the LED strip -- you'll want to add some extra width and depth to ensure the fit isn't too tight and the epoxy will completely cover the LEDs. You can see I took most of measurements relatively by eye-balling it. Again, make sure to use your table saw safely and use push blocks to maintain good finger retention. I really enjoy grasping objects, so I plan to keep all my fingers and thumbs.
I then cut a groove on the bottom to make space for wires, about 1/2" x 1/2" worked good for me. Then I cut the necessary grooves to get a 1/8" Thick 3/4" x 3/4" angle aluminum stock to fit flush on the back. This will be how we mount it invisibly to the wall, and allow for centering of the light regardless of 2x4 stud spacing behind the light. Check that everything fits (LED strip and angle aluminum) then cut to length.
I had initially drilled a hole on both ends of the LED strip thinking I would want to run power to both sides of the strip to ensure even lighting, but I found that was unnecessary, so pick your favorite side and put a clearance hole for three wires on one side, doesn't have to be perfect, but try to keep it close to the end.
Step 3: LED Strip Preparation
First things first, you'll need to remove the LED strip from the weather seal that it comes in. Pick your favorite sharp knife and start cutting it off, taking care not to cut the LED strip. Then set the LED in the groove you cut in the wood and figure out how long you want it. Next, cut it to length.
Now you'll get to start soldering, hopefully it's obvious which pins are which, but if not read the NeoPixel Uberguide again. Also, make sure to note the directions of the arrows, your wires need to be connected to the non-pointy side of the arrows -- that's the way the data will flow. Solder a couple wires to the LED strip, pick a color scheme and stick with it. I'm a big fan of red = 5V, black = ground, Yellow = data. Once you have a good solder for each, stick the LED strip in the wood and hot glue the strip in place. I put a dab of hot glue every 6" underneath the LED strip in the slot as I set it in place. Also, you'll want to hot glue the wire hole shut now. Make sure it's good and closed because once the epoxy starts in the next step, it's a very bad time to find it's not closed well.
Now TEST!!! You will be filled with regret and unkind words if you epoxy this in place and you had a bad solder. So load up a test program and verify your work. I put a dab of hot glue ever 8" or so on the bottom side of the wire channel to make sure the wires stayed out of the way.
Step 4: Make It Rain (epoxy)!
Don't actually make it rain epoxy, that'd be a terrible idea.
This is the part where you go to town with epoxy filling in the LED channel. This will help the final light have smooth surfaces, provide some light diffusion, and heat distribution.
Now that you've got the LED strip in place, apply masking tape vigorously on both ends -- don't skimp and don't buy super cheap stuff.
Now you'll need to get the top edges of the LED Dado you cut earlier nice and flat, so get out your level and some shims and get it flat in both directions. If you don't get it flat, all the epoxy will pool on one end (as it did for me on my first round) and you'll have to level it with the epoxy wet, which is less fun.
Once you've got it level, mix up some epoxy, I generally use the "West Systems" slow cure stuff, which works well. Keep in mind you'll need a fair amount depending on the size of the dados you cut -- I used around 6 oz. Wear gloves and mix well, then just poor it over the LED strip. If you prepared well, it should be a single pass to get it working. Make sure to pop any bubbles you can see so you get a nice finish. You'll want to target a little over full, use the suface tension to overfill it so you have a crown of epoxy above the surface of the wood.
Once it's fully cured, pull off the tape and scrape and sand it flush. A good card scraper works spectacularily for epoxy smoothing.
Step 5: Add Some End Caps
So you certainly could use a contrasting wood for the end caps, I was looking for a modern vibe, so I ended up using aluminum.
I cut the flat stock down to size using a regular old miter saw, so long as you have reasonable high tooth blade and take the cut slow, you can cut aluminum without any problems -- just don't rush it. Next I marked each plate with a number that correlated to the end of the wood I was going to mate it with. Marked the outline with a sharpie and cut it out on the bandsaw.
Next you'll need to locate some holes -- one end has a larger hole for the momentary button and the other has a smaller hole that is the diameter of the wire/cable you're using to feed power and signals to the LEDs. You'll want your cable hole to match up roughly with the wire channel and the button hole you'll want to make sure isn't too far away from the channel. Mark the holes, center punch them so your drill bit doesn't wander, and camfer or countersink the holes as needed. Don't forget the 4 screw holes on each plate to affix them to the wood substrate.
Now that you've got your plates mostly done, attach them to the wood, and hit them with the belt sander to get them nice and flush with the wood. Then sand all the endges by hand to break the sharp corners and clean everything up.
Step 6: Wiring the LED Bar
Now that you've got the end caps in place, you can use the holes you cut in the plate to position the holes needed for clearance on the button and cable. I marked the center with a forstner bit while the place was in place, removed the plate and drilled a sligtly larger hole for the button (to allow clearance for the panel mount nut) and a slightly larger hole for the cable exit as well.
Next you'll need to start wiring. The LED should be wired with ground on one side of the switch (so you can use the internal pullup on the arduino to get a deterministic switch state), and the other side returning signal to the arduino. Then you need a Arduino Digital Output to drive the LED backlight, and a ground on the other side. Solder, then cover with heatshrink each joint you make. All the connections will be pretty innaccesible after installation, so do them right the first time. Feed one end of the cable through the exit plate, and trim back the casing so you can solder the connections. If you happened to purchase the same cable I did, it has two heavier gauge wires for power and ground and three thin signal wires. Pick a strategy for wire colors and stick with it. I documented mine on a scrap of MDF.
Step 7: Finish the LED Strip Out
Now you'll need to solder on the DMX (XLR) connectors on one side. Make sure you get the backshell on the cable before you do your soldering... otherwise you'll get to practice more by re-doing it. The clamping piece for my connector was intended for a thinner cable, so I got out the old sandpaper on a screw in a drill routine to sand it out some so it wouldn't be too tight. Solder it all up and you're done with the electical on the LED strip side. Now go to town with a hot glue gun securing all your wires to the channel so nothing sticks out or falls out.
One final thing to do is to drill and tap some holes that will grab onto angle aluminum after it's mounted on the wall. I put three tapped holes on the top side of the walnut and put a 1/4-20 set screw in each. Tapping wood isn't always a good call, but with a course thread and limited clamping force it's no problem.
Next cut the angle aluminum pieces to 18" long (if your studs are 16" on center) and drill and counter sink two holes at 16" into the aluminum.
In the future when you go to fix it to the wall you can find two studs, screw the angle aluminum to the wall. Once it's on the wall you have 15" of play either direction to center the light. I've used this technicque a number of times and it works great!
Now, mask off all the metal and the cables and apply your favorite finish (mine is a spray on waterbased topcoat by General Finishes)
Step 8: Nerd Time
Now make the other side of your DMX connector to cable assembly, and bring the loose end of the wires into your electronics enclosure. Bring in the power connector on the other side and get soldering. The pins are all clearly called out in the software, using #defines at the top, so just match it up to your hardware pins. Make sure you pull your power directly to the LED strips, not through the Arduino unless you're trying to make a single use Arduino toaster, which kinda suck.
I would recommend reading up about the arduino Yun's setup on the arduino.cc website or many other great resources out there.
I've attached the software as a starting point (or a one stop shop if you do 2 of them like me). I'm not exactly the most efficient coder, so it could probably be written much better, but it gets the job done. But, it does take about 99% of the program memory and 50% of the RAM, so don't expect to add much software without removing some first.
All the settings are stored in EEprom so the user can adjust them as desired (my kids have frequent requests to change colors) and you can set those over Wifi using any device with a web browser. It's using the rest api, so if you don't have a password setup you can just use the command 192.168.xx.xx/arduino/UserRed/255, where UserRed is the variable you want to set and the value after the / is the desired value. You can see in the screenshot any time I send a command, it'll tell me what the other parameters are currently set too -- which is a great way to debug.
The software has a visual alarm, nightlight mode, and user chosen light color -- each one has an independant color. There's fading between on/off and time syncronization with internet time as well. I had initially planned on setting up a web server to ease the use of the REST api --- but since I found I don't often need to change the settings I haven't bothered.
Hope you enjoyed my first instructable!
If you're interested in the bunk beds, I have them and a bunch of other woodworking projects on LumberJocks.com