I recently came across an LED Cube by Greg Davill. It's a great piece of artwork. Getting inspired by it, even I wanted to make something like that. But this one was way out of my league. I decided to take one step at a time and made a way smaller version of LED Cube as a Mood Lamp. It can be a good starting point to learn about the hardware, which are mostly LEDs and microcontrollers, and software to control them (creating animations).
In this tutorial, I will show you how I made an LED Cube using the popular WS2812 LEDs.
Let's get started!
96x WS2812 LEDs
1x Arduino Nano
1x 5V/1A Power Supply
The plan is to make a mood lamp. I wanted to keep it simple and so I decided to go with the popular WS2812 Individually Addressable LEDs. The LEDs are connected in cascade which means that you can control as many LEDs you want by just one signal line/wire from the microcontroller. This makes wiring a lot easy.
The LEDs are available only in SMD format. So, the next step will be to design the PCBs.
The next step is to design and 3D print a structure to hold the PCBs in the shape of a cube.
The LEDs will be controlled using Arduino Nano. The last step will be to design and 3D print an enclosure for Arduino.
You can use any software you like for designing PCBs. I am using EasyEDA as it is suitable for newbies like me. I have attached the schematic and PCB files.
LED has 4 pins:
- VDD - 5V
- DOUT - Signal Out
- VSS - Ground
- DIN - Signal In
As mentioned earlier, the LEDs are connected in cascade which means that the signal comes IN from the microcontroller to the 1st LED at the DIN pin. From DOUT pin, the signal goes to the DIN pin of the 2nd LED.
While designing the PCBs, I had thought of hand soldering the LEDs and so I have kept sufficient space between the LEDs for the soldering iron to reach the pads. But later, as you will see, I went with reflow soldering with my makeshift setup since this method is quick and neat (and satisfying to watch) if done correctly.
Once you have completed designing the PCB, get it fabricated from the manufacturer of your choice. I chose JLCPCB because of its quick service.
At first, I started hand soldering the LEDs one by one. The result was not good and the LEDs were getting overheated which is not a good sign. Also, it is a time-consuming process and soldering 96 LEDs will require a lot of time.
The most widely used method to solder SMD components is called Reflow Soldering. In this method, solder paste (a mixture of solder and flux) is applied to the pads on the PCB and the components are placed on it. The solder paste is then made to melt or 'reflow' by heating it in a reflow oven. This is a quick and neat method if done correctly.
Using this method means I would require a Reflow Oven. But then I remembered a project by Moritz König wherein he used an old flat iron and Wemos to control the temperature. The only thing I had on hand was a flat iron which was still being used. The temperature of the iron reached about 220 degree celsius at its maximum setting and the solder paste I bought melts at 183 degrees. Taking a look at the reflow soldering temperature profile from the datasheet of LED, we can see that the maximum temperature (Tp) is 240 degrees for 10 secs. Everything looks promising and so I gave it a try.
I applied the paste onto the pads using a toothpick and placed the components. The placement is not critical as the solder pulls the components in place when it melts. I placed the PCB on the iron as shown in the photo and turned ON the iron. I turned OFF the iron when all the solder has melted and removed the PCB from the iron.
It worked a treat!
I 3D printed a structure to hold the PCBs in place. The 3D files have been attached here. You need to print 1x Skeleton and 6x Holder. Attach the holders at the back of the PCB using superglue as shown in the picture. The PCBs can then be snapped into place on the skeleton structure. It is a friction fit. Sanding may be required.
Do the wiring as shown in the layout. Soldering can be a bit tricky here.
3D files for the base have been attached. The base will house the Arduino Nano. There will be a total of 3 wires going to the cube viz. DIN, 5V and GND. I am powering the cube through a USB Phone charger. Make sure that it is capable of handling at least 1A.
DIN pin can be connected to any of the digital pins on the Arduino. I chose D4.
For now, I will be using an example sketch from FastLED Library. Install the library using the Library Manager. Open up the DemoReel100 from the example sketches. File > Examples > FastLED > DemoReel100
Before uploading the code, make the following changes:
- Define DATA_PIN (pin on Arduino to which DIN of the cube is connected) to whatever you have chosen. In my case, 4 (Digital Pin 4)
- Define LED_TYPE as WS2812
- Define NUM_LEDS as 96
And, hit Upload!
Power up your lamp and enjoy staring at it!
Thank you for sticking to the end. Hope you all love this project and learned something new today. Let me know if you make one for yourself. Subscribe to my YouTube channel for more such projects. Thank you once again!
- Connecting the cube to the internet (IoT) using ESP8266 and to notify me whenever an 'event' occurs.
- Creating my own animations.