# DIY 3D LED Cube With a Raspberry Pi

4,713

28

8

## 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.

## Supplies

1. ws2812b LED Bulbs - https://amzn.to/370NCK7
2. 5V Power Supply - https://amzn.to/36VDylP
3. Raspberry pi 3b I used (can use any) - https://amzn.to/36VDylP
4. SN74HCT125 Integrated Circuit - jumps voltage from raspberry pi signal to have proper voltage for led strip (I usually get my circuit parts from Digikey)
5. 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!

## Recommendations

3 1.2K
120 10K
63 5.9K
11 2.1K

• ### Rice & Grains Challenge

Hey I just finished my build of the cube and tested it with an Arduino and it works perfectly. I was having trouble with the raspberry pi part. I built the circuit and all but I cant seem to get the code to run. I ran a pip3 install for bibliopixel library and than a sudo python3 animate.py but I seem to get an import error. ImportError: cannot import name 'Cube' from 'bibliopixel.layout.cube'. I was wondering if you had any insight on the problem?

Interesting what version of BiblioPixel are you running? Feel free to DM us on Instagram @tyandgig, would be a bit faster response

Hey just checking in. I sent a message to your instagram. The version is bilbliopixel 3.4.46

Interesting I recently watched a video of a guy putting the kit together very cool

Hi, I am a bit new to circuits and wanted to clarify the wiring for the led data pins. So to confirm data in would be bottom right and data out would be top right. Also for the connection, I would connect the top right of the first layer to the bottom right of the 2nd layer. Any clarification would be appreciated.

Hey @sabeasta, yep, the data for ws281* leds flows in one direction so you need to make sure you hook them up in the correct orientation. And to answer your question yes, since the first layer is snaked and has 8 rows, the 8th row will end on the same side as the data in on the first row. That will contain the data out which will feed immediately into the start of the second layer. The start of the second layer will be the 8th row and the leds will be oriented so the data flows from the 8th row to the first row (opposite of the first layer). This was chosen to reduce the wire lengths connecting between layers.

To recap, each row is snaked with 8 rows per layer, and each layer is snaked with 8 layers in the cube. The leds are all hooked up so the data is flowing in the same direction, you can see on the LED itself what direction the data flows (it has an arrow)