Light Bars - What are they?

The light pipes are the bars of light which you see going across the case. These bars are pieces of plastic, which have RGB LED's placed on the end...the resulting light gets reflected internally into the bars, making it look like a beam of light. This is another effect which really sets off this project, and can be used in quite a few different ways.

Before I go further, I want to credit where I got the idea...from the instructable Steampunk Network center by Raltel. He avoids micro controllers for his work, and went with a cool flickering yellow look, which gives the look of an aged bulb. If you're comfortable with electronics, I recommend looking into that approach to be aware of it.

Overall Design, and why I used an Arduino:

For my approach, I wanted the following in my design:

Bright at 5 volts - I wanted the LED solution to be bright, but wanted to stay in the 5v power range to minimize the amount of power supply work I'd have to do in the box Colorful - I wanted flexability to not be stuck to a single color...ideally I wanted to choose any color, or to blend between them or do light animations Programmable - I wanted flexibility to update the code at a later time in case I wanted to do light patterns, flickers, or make them react to what was happening on the raspberry pi. "Just work" - If I switched out the raspberry pi program, I didn't want to have to inject code into the raspberry pi each time to get the lights to work again. This is why I added the Arduino.

Very simply, I added Arduinos to the boxes I created with lights. These Arduinos are 5v microcontrollers which I power directly from the Raspberry pi. In this way, when the Raspberry pi gets power, the Arduinos immediately boot up and start running their program. Similarly, when the Raspberry pi shuts down, the Arduinos will lose power.

Approaches - Static pixels vs. Neopixels

I built one of my boxes with Green LED's, and then added flicker code to the Arduino. The second, bigger box that I built with lights I used Adafruit Neopixels (Here's an example). These are incredibly bright, but even better, they have in/out wiring which allows you to easily chain them. This means less wires (and a cleaner setup) when adding lights to the box. Wiring up the electronics is a bit out of scope for this instructable, but if you are looking to learn, Lady Ada and the Adafruit team have the Adafruit Neopixel Uberguide.





Building the light bar

To build the light bar, I cut a piece of plastic pipe the width of the box using a hacksaw. It doesn't matter if the ends are a bit uneven...they'll get covered. On one end I used Mechanical Lugs...when you remove the screw out of these, you get a nice hole which can hold the light pipe on one end. Using a hot glue gun, I attached these to the side of the box, and that gave me a solid mount point for my plastic pipe.

For the other side, I used Raltel's technique of using the end of a gold RCA speaker cable (Picture). I had these left over from some old wires, so I was able to clip the ends off, unscrew them, and use the outer ring. If you don't have a cheap source, then you can use Mechanical lugs on both sides, or even just small brass fittings. You just want something that can hold the pipe, and that your LED / neopixel can fit into. If you have a bass fitting, or something that is considerably bigger than the pipe, then using a glue gun to fill in the gaps will help tighten things up as you assemble it. Test fit your light bar and the ends, but don't glue this side till the wiring and soldering are done.

Other light effects you can add

Not everything has to be the 'light bar'...I also added a single 'lamp' effect which I created..by mistake! I had placed a neopixel inside of a brass piece of tube...and it didn't exactly look great. It really needed to be diffused, as the result at that point was a bright, almost flashlight, which pointed up out of the box.

The fix was to fill the brass tube with glue from a glue gun...this diffused the light, and created an unintentional cool effect. I've labeled this in the pictures for this step so you can see it.

Wiring, and soldering

First thing you'll want to do is look at the Raspberry pi pinout diagram. This will show where you'll need to pull power for the Arduino...you'll want to connect to 5v power (pin 2 or 4) and ground (pin 6). You'll want to run these over to the Arduino Micro (you'll want to connect to Vin and Ground). This will supply power to the arduino when the Pi boots automatically. Before you solder the wires, I recommend covering them with brown paracord...this gives them an 'old wire' feel while also helping keep things clean. The pictures show the end result of this, along with some closeup of the wiring.

Coming off of the Arduino, you'll want to wire in the LEDs or neopixels. If you're doing LED's, you'll want to wire it into the Arduino as you see fit. If you're doing neopixels, you'll want to wire off of 5v power and ground, and also run a data pin to your first 'pixel'. Then from that pixel, you'll chain power, ground, and data to the next, and so on. I only wired one pixel on the side of my light bar...they're plenty bright to light the entire thing evenly if you're lighting it while it's straight.

My other approach, used for the smaller box, was to bend the plastic using heat..then adding two lights to each side to light the bar. This also works...just make sure you test your bent plastic before you glue it down, as light gets severely diminished when going around a corner with this technique.

Programming the light effects

For the programming, if you chose neopixels, you should use whatever pattern/color you like best. For me, I chose the default Adafruit library, and then used the Rainbowcycle portion. You can find a breakdown of it here and the library here.

If you're simply doing an LED flicker...then the logic is simple..two random numbers...one for how long the lights on (I used 200ms to 3 seconds), and a random number for how long it's off. I looped through the on/off for each number pair 1-5 times, then grabbed two new random numbers. I've sadly lost this code, but that should be enough for someone to reconstruct it. I don't think that's the best flicker code out there, but it looked pretty nice for my smaller steampunk case.

Adding Switches to control power

Lights are fun, but sometimes it's nice to have them either stop changing colors, to force a change of color, or to turn off entirely. I added a button, and two switches to the side of the case. The first switch is for the servo that went to the gears...as fun as that is to watch, it can get distracting over time (and I worried about burning out the servo). The second switch controlled the lights...in my case it stops the rainbow effect from changing colors. I also wired up a button to the arduino in case I wanted to add a program later to control which light pattern was going on. You should feel fee to add buttons if you want more control, or remove them if you need less. My recommendation is to put all of these on the bottom of the book, where the USB ports are. This will allow you to stand the book up and hide most of the electronics, as they'll be facing down.

Drilling holes in the box results in the same challenge as cutting it...the holes end up a bit rough and sloppy. I found that by covering the holes with some gears, you'll easily cover these holes while also making the switches look much cooler than they would. A bit of Rustoleum on them will get rid of the bright silver look as well.

Things I learned:

One thing about the Arduino Micro..you'll want to mount it on a pedestal of some sort so that it's lifted...this allows for a microUSB cable to get to it so you can program it in the future.

One other effect I want to note...which I attempted and learned from...was my attempt to light the raspberry pi case. When I painted my clear pi case, I masked off the bottom and the lower sides in hopes of adding a neopixel inside the case and creating a glow around the bottom. There wasn't sufficient room between the case, the amount I masked off, and the edges to really show any light. Also when the box was open, it was typically light, and so there wasn't enough brightness. I note this to both give the idea, but also to relay what I learned in failing.