Introduction: Stackable LED Cubes!
You might think, 'just another led cube project...', and you're right.
These 4cm x 4cm acrylic led cubes are all individually addressable and stackable, they snap together with the help of rare earth magnets, pretty simple huh? So enough chit chat, lets learn how to make 'em.
(if you think it's cool don't forget to vote for it!)
Step 1: Preparation
The design of the cubes is very simple and modular and is open to adaptation. In every 'tower' there is 1 master cube and up to roughly 4 'slave' cubes (for a total of 5 cubes). They can be individually addressable or all the same colour, its up to you. I chose to go with them being individually addressable. The reason for the 5 cube limitation is that after that the tower starts to get unstable and can topple over at any time but you can still choose to completely disregard this and build it to the roof if you really want.
For the cubes you will need:
1x Arduino- Arduino UNO R3 (however I am pretty sure that a nano would work)
(3x for the master cube and 6x for any other slave cubes) Rare Earth Magnets- 3mm x 1mm were the best I could find but any small size could work
LED's- I used WS2811 chipset based LEDs, if you want the cubes to be individually addressable, make sure that each LED has an IC on it or else it will not work. However if you want it to be a static colour then you will need to make sure to use a resistor and a lower voltage to accommodate for the LED.
Acrylic- I could only get clear acrylic and I had to 'frost' it myself, however if you are able to get it pre frosted or semi transparent acrylic it would look nicer.
Wire (duh) (but make sure its pretty thin so its hard to see)
USB Cable or Bluetooth Module- I bought this module from Hong Kong, but make sure not to get scammed into buying just the board, make sure it has the chip on it!
Power Supply- The LED's I use run off of 5v, so I am using a 12v plugpack that is regulated to 5v by the arduino.
There are many ways you can make these cubes, you could even buy pre-made hollow acrylic cubes(sadly I couldn't find any)
Hot glue gun
Mitre Saw with a grinding disc (no a normal blade wont work, it just snaps the acrylic) or something else that can cut acrylic at a 45 degree angle.
Cordless Drill or Drill Press
There are some other tools you may need, read on to find out what they are
Step 2: Costs
Here is the basic costs of the 2 cubes I made however it wouldn't cost that much more to make any additional ones. (also the prices listed are in AUD not USD)
Anything here that is in bold is something that I bought specifically for this project and not something that I already had.
Arduino - $15
A4 sheet of acrylic (makes 3 cubes if you are a robot and cut it perfectly) - $3.20
LED's - $0.05 - $2 depending on what you get
Power Supply - $5?
Hot Glue Sticks - $2 for a pack of 30 sticks (I used 2)
Magnets - $1.50 for a pack of 25
Now on to building it!
Step 3: Cutting the Acrylic
If you have never used acrylic before, don't take the paper off. Acrylic scratches really easily and the paper is there to protect it.
Back to this, if you are like me and can't get reasonably priced frosted acrylic near you then you have a bit more work to do. First things first we need to mark where to cut on the acrylic, I found that it is ALOT easier to get nice markings if I used a template that I printed and stuck onto the acrylic. I could then use my hobby knife set and a ruler to cut the markings into the paper covering the acrylic, its ok if it goes into the actual acrylic because that is where you will be cutting. The template I made and used is available here.
Now onto cutting it,
First, set aside an afternoon for this, it took wayyy longer than expected. Now is where the problems start appearing. My mitre saw cannot cut a full a4 sheet. So what I did was cut the squares I had marked into sets of 2 with a jigsaw with a fine cutting edge. Now all that is left is to cut the 45 degree angles into the edges of the acrylic.
You are going to need to cut it so that the blade goes into the acrylic from the marked edge, not ending at the marked edge. This is crucial so that the cubes are actually 4x4cm or else they will be bigger.
Once that is done you are ready to proceed to the next step.
Step 4: Frosting the Acrylic
So you have your 4x4cm acrylic squares, now what? well the title says it all, we need to frost it.(and no that doesn't mean putting it in the freezer). It means making the view through the acrylic blurry. This also helps light spread throughout the cubes and make them more 'glowy' so to speak. I used a multi-tool (not a dremel) that has a sandpaper attachment, the sandpaper was roughly around 120 grit. You need to spend some time on this, the longer you spend sanding it, the more 'frosted' it will be. Wait!, you should only frost the inside-side of the cube, the smaller side, or else it may look weird. But that is all up to you...
Use what you have learnt and go forth and frost all your squares, then proceed to the next step.
Step 5: The LEDS
The LEDs I used were extremely cheap ($7 for 50 of them) but that was just me being lucky. They use a WS2811 chip.(this is explained more in depth later)
They have 6 tabs but only 4 are used in this project, +5v, GND, DI, DO. They use a daisy chain technique, the first one gets the data and passes it onto the next one until it reaches the end and repeats that until all the LEDs on the chain are lit up. It does this extremely fast because it is not limited by the Arduino's power outputs. We are going to connect the LED's wires through magnets so that we can snap them on and off the tower as we please.
But before doing anything, read on...
Step 6: The Magnets!
These magnets are really good to work with, the ones pictured at the start were 3x1mm however I actually used 3x3mm ones as they are just better. I talked about before that we are going to need to connect the wires to the magnets so that the power can pass through them. Great, lets just solder them DONT,rare earth magnetslose their magnetism completely if heated up above ~80degrees celsius (170 degrees fahrenheit), and soldering is usually done at around 350 degrees celsius(~660 degrees fahrenheit) so soldering to them it out of the question. There are alternatives though, magnetic wires, conductive epoxy to name a few. I used the legs of some old diodes that were magnetic, and soldered them onto the ends of the wires and just let them stick to the magnets with the power of magnetism. (this is also really handy if you accidentally blow the LED's, you can just pull them out).
Step 7: Building It (finally)
So now my friends, it is time to use the knowledge you have just gained to start building these cubes.
For the master cube:
1. Glue all the sides together except the top using the hot glue, smaller side facing in. The 45 degree angles you cut should make them sit together nicely if you did them right.
2. Get the top square, and a drill bit that is the same or very slightly smaller than the diameter of your magnets, drill 3 holes (+5v, GND, Data) in a diagonal pattern, evenly spaced. Now clamp together that piece you just drilled on the top of another piece and drill through the holes so that it essentially copies the pattern from one to the other
3. On one of the sides of the master cube(that you want to be the back), drill a small hole at the bottom so that it is big enough to fit 3 wires through, these wires will connect the master cube's LED to the Arduino so it can control it.
4. Now you are going to want to solder the 6 wires, 3 long wires for +5v, GND and DATA in to come out through the hole and 3 wires about 5cm long for +5v, GND and DATA Out, these 3 also need to have something magnetic soldered on the end of them
5. Some bluetack is helpful for sticking down the LED to the bottom of the cube, but you also need to push the long wires through the hole you made and then solder some Arduino pins and whatnot onto them.
6. Now get those magnets of yours and stick em in the holes but wait! if you look at the diagram here, you will see that they have to be facing a specific way that cant change throughout the whole tower, A and B can be north or south, but they cannot be the same (e.g. ++-, aab or --+, aab not ++-, baa)
They shouldn't go through naturally, you should need to push them in with quite a bit of force, but don't push them in all the way, leave them sticking out less than a millimetre. If they do go through naturally, you have three options, redo the top with a smaller hole, drill the holes in another way or stick a tiny bit of hot glue in there, but not so much that you cover up the hole(thats what I did).
7. This is the painful part, you will need to use a multimeter here or else it will become even more painful. You essentially need to get all of the wires on their own magnet and stick down the top at the same time, but before you stick it down you should test the connections with the multimeter. You need to run some code through the arduino to test them, which is available on step 8. My LED's showed 5 volts across +5, GND and +5v, Data meaning that the Data pin is also a ground pin, but to get this to work you need to have the lights showing a color and connected to power (duh).
8. If they are all working, make sure that the magnets are sticking out of the top square about < 1mm and then get your hot glue and stick it down, make sure it is as square on as possible or else the tower will be slightly tilted.
Step 8: Building It! (continued)
Ta da! You now have 1 master cube! But this is where the real awesomeness comes in, it's time to build a...
You can almost make as many as these as you want (until the power runs out or the tower falls over)
1. Get that 1 spare side with the drilled holes in it and make another 2 copies using the steps shown before.
2. Glue 3 squares (not drilled) and glue them together so from the top it looks like this.
3. Get those magnets of yours and one of the drilled squares and you are basically going to invert the poles on the magnets from the top of the master cube. Once they are right they should all stick onto the top of the master cube and then you are good.
4. Now with another drilled square, push the magnets in so that they are facing the same direction as the top of the master cubes or the inverse of the one you made just before. This special placement of the magnets makes it so that the cubes can't be placed upside down or made to reverse the polarity (however the arduino does have built in reverse polarity protection)
5. Now glue the bottom and top pieces (the ones you just made with the magnets) but keep one side off.
6. Now you are going to need to do some soldering, similar to before, 3x 4.5 - 5cm wires and also 3x ~1-2cm wires for connecting the magnets on the bottom to the LED. I soldered them all with the magnetic diode legs I found and then I could let the magnets hold the ends of the wire while I used bluetack to stick down the LED board to the base of the cube. Some tweezers or small pliers are helpful for this.
7. Now the second cube should be functional, but before you stick the last square on, your should run some code and see if the LED lights up and test if the magnets on top of the cube are outputting voltage. If it isn't lighting up properly, go to the last step, Troubleshooting. (or go at it alone!)
8. So your cube is working huh? Well it ain't a cube without 6 faces. So go ahead and stick that last square on with some hot glue and then you're done! all that for 1 cube!
Step 9: The Code!
I am going to expect you have a basic knowledge of the arduino and the IDE. There are many online tutorials if you are unsure of anything. Otherwise ask in the comments below.
So now you have your fancy cubes and they are cool and all but they don't actually light up.
Thats where the arduino comes in. but first you will need to download an awesome library called FastLED. It has support for many types of LED IC's, one of which is the WS2811 chip which my LED's use. There is some test code in the examples of the library or there is a cool piece of code that makes the tower go rainbow which is available here (I just cleaned up this code to make it,credit to Craig Kessler for writing it though)
It is now up to you, the possibilities are endless.
Some ideas of things you could add to yours:
*Mobile Device Control
*Magnets on the other side of the cubes
Step 10: Troubleshooting!
This is for if the slave cube isn't lighting up
1.Is the master cube outputting voltage? 2. Are the magnets making contact? 3. Is the LED wired properly? 4. Are any of the wires touching? 5. Is the correct pin on the arduino being used? 6. Is the correct voltage being used? 7. Is the code writing colours to 2 LEDs and not 1? You will need to investigate what the problem is and what might cause it. Thing logically, if there is no power coming out of the master cubes data pin, what could that mean? etc. This is a good exercise because almost everything doesn't go exactly to plan. (also learn to check the obvious things like if the power is plugged in or if there is actually an LED in the cube)
We have a be nice policy.
Please be positive and constructive.