Introduction: DIY 3D LED Cube With a Raspberry Pi
This project goes over how we made a DIY 3D LED Cube from ws2812b LEDs. The cube is 8x8x8 of LEDs, so 512 total, and the layers are made of acrylic sheets we got from home depot. The animations are powered by a raspberry pi and a 5V power source. The cube is a great piece to show off to friends and can act as a lamp. Ours is a little too big for a lamp (2ft x 2ft x 2ft), but you can scale this down to fit your needs.
- ws2812b LED Bulbs - https://amzn.to/370NCK7
- 5V Power Supply - https://amzn.to/36VDylP
- Raspberry pi 3b I used (can use any) - https://amzn.to/36VDylP
- SN74HCT125 Integrated Circuit - jumps voltage from raspberry pi signal to have proper voltage for led strip (I usually get my circuit parts from Digikey)
- 4ft x 8ft acrylic sheet - Home Depot
Step 1: Break Down the Acrylic Sheet
We are making an 8x8x8 cube with a string of ws2812b leds. The leds are separated by 3 inches, so the lights will be about 21inches by 21 inches long. We chose to make the acrylic sheets a little less than 2ft x 2ft to handle this. That means we can make 8 layers from a single sheet of 4ft x 8ft acrylic.
We started by breaking down the 4ft x 8ft piece into 2 pieces of equal widths (~2ft x 8ft) with a table saw. After that, we used one piece as a template to draw a line using a dry erase marker to make equal squares from the pieces. Then we used a straight edge and a circular saw to make the 8 square layers.
Step 2: Measure Out the Holes for the LEDs
After each of the 8 layers were cut to size, we drew out the measurements for where the LEDs should be. We used a dry erase marker and a straight edge to center the led square. Since we had an 8x8x8 led cube, there will be 64 LEDs on each layer aligned in a grid pattern with about 3 inches between adjacent LEDs.
Step 3: Drill Out Holes for the LEDs
Once the holes are marked out, drill out 1/2 inch holes with a step drill bit. This will make sure the acrylic does not crack. We had issues using a regular drill bit on this material and had to get a step drill bit to finish the cuts. Since the pieces were clamped together, we only had to drill out 64 holes. We also made a layer out of plywood that will be the bottom of the cube. After the holes were drilled out, we fed the LED bulbs through each hole. We used a serpentine pattern to orient the leds in each row.
Step 4: Combine the Layers
After the layers were made with the leds in each, go ahead and combine the layers using 3 inch pieces of acrylic as spacers. We hot glued all 8 layers together with 5 spacers per layer. Then we came back with longer 2 feet pieces of acrylic and reinforced the sides of the cube. This is the first step we really saw the cube come together, and it looked great.
Step 5: Connect the Layers, Solder Up the Circuit, and Download the Code
Now that the layers were all secured, we had to solder up the connections between layers. Since we had an even number of leds (8), in each layer we ended the serpentine strip of LEDs on the same side as the start of the strip. Then we connected each layer to the layer above, which in turn made vertical serpentine pattern connecting layers. After the layers were connected we made a simple circuit as seen in the attached photo to send data from the raspberry pi to the ws2812b leds. Since the raspberry pi outputs at a 3.3V signal and we need a 5V signal to correctly send data to the ws2812b leds, we use a SN74HCT125 integrated circuit to step up the voltage.
Once the circuit is setup go ahead and download the code from my github repository. We have a bunch of animations and more are coming, feel free to take a look. I used the BiblioPixel library to draw animations to the screen and BiblioPixelAnimations library to copy some of the animation code. Since BiblioPixel did not correctly handle a snaking vertical cube, I had to modify the code a bit to handle this. Once BiblioPixel is installed you should be able to run the animations without issue.
Step 6: Light It Up!
Enjoy the animations! There are some really cool ones and I suggest watching the youtube video to see them all in action. Thanks for reading!