Introduction: Arduino Based 3x3 LED Cube

Hello and welcome to my first Instructable.

I present a simple, neat design for a beginners 3x3x3 LED cube. To make it easier to build, I provide details of acustom PCB, you can make yourself or buy, instructions and you can, like me, re-use the software from this great Arduino library LED cube and arduino lib.

One of the design aims was to only use through hole parts, they are easier for the beginner to solder and everything is readily available via the internet on your favourite auction/shopping sites.

The design can be powered from a USB cable or a 7.5-12V DC power adaptor.

The circuit uses a cut-down Arduino core design and you can program it in circuit using either a cheap In Circuit System Programmable (ICSP) programmer or a readily available USB to TTL adaptor. The only software you need is the venerable Arduino IDE.

This design is not revoloutionary it just builds on some previous work and I packaged it neatly. I hope you enjoy it.

Step 1: Parts Required

This design uses widely available through hole parts. Your favourite local distributor should stock the parts you need.

You do need an Atmega 168p or Atmega 328p with the Arduino bootloader flashed into it. You can find these on Ebay, search for "arduino bootloader", ensure you buy the Dual In Line (DIL) variant.
You also need a USB type B socket, the regular, older, fat one. I chose this as it's easy to solder.

The transistors, T1-T3 are general purpose NPN transistors, as well as the types listed, you can use BC108, 2N2222, 2N3904 etc, always check the transistor pinout against the PCB though.

For the all-important LEDs, ensure you buy high brightness or ultra bright LEDs. I used 10000-12000mcd LEDs from a seller on Ebay for the example cube shown here. You want bright ones so you can still see the cube in normal room lighting. If the item description details the viewing angle, typically its 20 degree but you can find one with a wider viewing angle, consider it. These ultrabright LEDs are not the clerest when viewed side on. You may have to try a few LEDs from different suppliers before you find ones that suit your needs.

Complete parts list:

Part Value Description
PCB The nice green PCB, make it or buy it.
27 3mm LEDs, colour of your choice.
C1 100n 100nF, 25V, 7.5mm pitch ceramic capacitor
C2 22p 22pF, 25V, 4.4mm pitch ceramic capacitor

C3 22p 22pF, 25V, 4.4mm pitch ceramic capacitor
C4 100n 100nF, 25V, 7.5mm pitch ceramic capacitor
C5 100n 100nF, 25V,7.5mm pitch ceramic capacitor
C6 10u 10uF 16V, 5.5mm case Electrolytic capacitor, 16V
C7 22u 10uF 16V, 5.5mm case Electrolytic capacitor, 16V
IC1 ATMEGA ATEMEGA168 or ATMEGA328 with Arduino bootloader
IC2 L7805T L7805CV 5V, 100mA linear regulator, TO92 package
ICSP ICSP Pin header strip, 0.1" pitch, 2x3 way.
J1 DCJ0202 DC power socket, 2.1mm inner diameter.
JP1 Pin header strip, 0.1" pitch, 1x3 way.
Q2 16MHz 16MHz, HC49 case crystal, 50ppm, low profile
R1 10k 10K 1/4W metal film resistor 1%
R2 1k 1K 1/4W metal film resistor 1%
R3 1k 1K 1/4W metal film resistor 1%
R4 1k 1K 1/4W metal film resistor 1%
R5 470 470 1/4W metal film resistor 1%
R6 1k 1K 1/4W metal film resistor 1%
R8 100 100R 1/4W metal film resistor 1%
R9 100 100R 1/4W metal film resistor 1%
R10 470 470R 1/4W metal film resistor 1%
R11 470 470R 1/4W metal film resistor 1%
R12 470 470R 1/4W metal film resistor 1%
R13 470 470R 1/4W metal film resistor 1%
R14 470 470R 1/4W metal film resistor 1%
R15 470 470R 1/4W metal film resistor 1%
R16 470 470R 1/4W metal film resistor 1%
R17 470 470R 1/4W metal film resistor 1%
R18 1k 1K 1/4W metal film resistor 1%
R19 LDR Optional LDR
S1 S1 4 pin, 6x6mm PCB mount PTH switch.
T1 BC547 BC547/BC548 low power NPN transistor, TO92
T2 BC547 BC547/BC548 low power NPN transistor, TO92
T3 BC547 BC547/BC548 low power NPN transistor, TO92
X4 USB type B socket, PCB mount through hole.
4 x 3-5mm high stick on rubber feet.

Step 2: Circuit Diagram and Explanation of Operation.

The schematic is shown above.

The design is based on the Arduino Duemilanove schematic, stripped down to the bare essentials. The USB to serial device was removed but there is a serial header, JP1, which allows a USB to TTL adaptor to program the device, more on programming later. There is also the ICSP header.

The board can operate from the USB plug, using the convenient 5V supply in the PC, or a cheap pound/dollar store mobile phone charger pack. The other option uses the DC plug input, this accepts a 7-15V DC input so you can use any plug adaptor you have. The circuit only uses 30mA so discarded adaptor off a dead gadget should work, check your junk box.

Resistors R12 to R17 set the current, which sets the brightness of the LEDs. With RED leds and the 470R resistors shown, the current is ~5mA per LED. To calculate the LED current you need the output voltage of the Atmega device (4.2V) and the forward voltage drop of the LED, for a red LED it is 1.7V. The formula is:

LED current = (Atmega output voltage - LED Voltage)/I Led

With the parts I used:
LED current = (4.2-1.7)/470
LED current = 5.31mA

Limit the current from the Atmega 168/328 to 10mA

Some common LED voltage drops:

Red 1.7V
Yellow 2.1V
Orange 2.1V
Green 2.2V
Blue 3.2V
Super blue 3.6V
White cool 3.6V

So you can use a high brightness blue LED, the resistor would drop to 270R. You can increase the current to 10mA, in my testing I found 5mA was sufficient.

Transistors T1-T3 are common NPN BJT transistors, BC547/BC548/2N2222 etc. They control the switching of each of the three layers. Resistors R2-R4 limit the base current of the resistor.

R6 and the PWR LED are optional, copied from the Arduino, it's kind of obvious if the power is on to the LED cube.

C2, C3 and Q2 form the clock circuit for the Atmega 168/328p device, pre-programmed with the bootloader. Ensure you fit the 22pF capacitors here and not elsewhere ot the chip will fail to start.
C1, C4 and C5 are power supply decoupling.
IC2, C6 and C7 form a simple linear regulator circuit. Not much to say about this but do ensure you fit the capacitors the correct way around. There are + symbols on the PCB drawing and the silkscreen.

SK1 and R8 and R9 are the serial interface. Using a USB to TTL adaptor, you can program the device, using the example here https://www.instructables.com/id/Program-Arduino-Mini-05-with-FTDI-Basic/

Step 3: Obtaining the Design Files and Making the PCB

The PCB design data can be downloaded from Github at https://github.com/istedman/LED_Cube3x3

There are processed Gerber files for sending to a PCB fabricator, schematic and PCB overlay in .png format and the original Eagle CAD files.

The PCB could be fabricated at home, I would have done this but I ran out of Etchant. The design can be fabricated using a single sided PCB and the top layer (RED in the images) can be implemented using tinned copper wire links. I used https://pcbshopper.com/ to find a suitable vendor, for the prototypes I used Elecrow.

The PCB design on Github has 3 changes to the prototype design shown here:

  1. The 7805CV regulator has been replaced by a smaller 78L05 regulator.
  2. The PCB shrunk by 5mm.
  3. I removed the polyfuse from the USB +5V feed.

Step 4: Assembling the PCB

The PCB is reasonably straight forward to assemble. I've added a photo of the assembled PCB and the layout above for reference. I always start by fitting the smallest parts first and working upward, especially important if you don't have a PCB stand.

  1. Start by fitting the resistors first, do not solder them yet. Ensure you insert the correct component in the right place. For ease of checking, fit them with the tolerance band to the right/bottom, it makes it easier to check afterwards. Look here if you need help identifying resistor colour codes. Once you have verified the correct parts are in the right place, solder the parts.
  2. Solder the crystal Q2 in place and capacitors C2 and C3.
  3. Solder the 28 pin socket for the Atmega168/328 in place, make sure you have the pin 1 notch uppermost, this helps prevent putting the device in backwards.
  4. Fit the ICSP and JP1 connectors.
  5. Fit the capacitors C1, C4 and C5, all 100nF (part code 104).
  6. The linear regulator IC2.
  7. Fit the transistors T1, T2 and T3. Ensure you have not swapped T1/T2/T23 and IC1 as they are all in the same package.
  8. Fit S1, the orientation does not matter.
  9. Fit C6 and C7, ensure you get the polarity correct!
  10. Fit the USB connector X4.
  11. Fit the DC power plug J1.

The final bit to assemble is the SIL turned pin header. I use a pair of fine cutters to carefully remove the plastic from each pin of the strip, I repeat this until I have 12 turned pin sockets, then using a pair of pliers and 3 hands, solder each one in turn to the PCB. As most people do not have 3 hands, tin each hole with some solder, to cover the pad, let it cool. Then apply the soldering iron to melt the solder and insert the pin, remove soldering iron for a joint. You may need some fresh solder if you have a dry joint.

Prior to checking your soldering, take a short break, perhaps for a beverage?
Inspect your soldering , check the USB connector as the pins are closely spaced and the pins on the Atmega168/328 device.

Once you are happy with your soldering, affix the self adhesive feet to the underside of the PCB.

Step 5: Assembling the LED Cube

This is the trickiest part of the assembly. Take your time, don't be afraid.

I've added notes to the pictures above as a picture says a thousand word.

A few important points.

  1. Ensure the positive lead (longer leg) points downward as the design switches +V to the 9 LEDs on each layer.
  2. Ensure the negative lead is bent at 90 degrees to the LED, to make the horizontal bars.
  3. Build each layer individually and double/triple check the build.
  4. Ensure the tinned copper wire, when used, is half way between each row of LEDs, this makes it easier to tack on the layer switch wire.

Step 6: Testing and Final Cube Assembly

Before plugging in the LED cube assembly or the Atmega168/328 device, you can do a few simple checks.

If you have a DMM (you should have one if you build a project like this), measure the resistance across pins 7 (positive) and 8 (negative) of the 28 pin socket, you should have >1K. If it is lower than this, check your soldering.

Next apply a 7-15V input to J1, going back to pins 7 & 8 of the 28 pin socket, measure the voltage, you should see 5V but it may be anywhere between 4.90V and 5.1V, this is fine. If you fitted R6 and the PWR LED, this should be lit.

Unplug J1, plug a USB lead into X4, plug the cable into a hub or mains to 5V USB adaptor, repeat the voltage reading on pins 7 & 8 of the 28 pin socket, is the reading around 5V?

The checks above were to ensure the supply voltages were correct and of the right polarity.

Next, carefully insert the Atmega168p/328p device. Bend the pins a little bit, if needed, to fit the socket. Using J1 and your 7-15V supply, switch on the power, see if IC2 gets hot soon after power on. If it does, switch off the power and check the orientation of IC1.

Next carefully insert the first row of the LED array. Ensure that one of the tinned copper wire support bars is close to PADL1, PADL2 and PADL3, you need this later on when you solder the wire for each layer. It's best to start with a corner pin and using a pair of needle nose pliers, carefully bend each pin slightly, row by row, to fit the socket on the PCB. I've added a photo of the first assembled layer above. Using a piece of single stranded 1/0.6 wire, cut it to a length suitable to go from PADL1/PADL2 or PADL3 to each layer of the cube. I found it easier to insert the first row of LEDs into the PCB and solder the first layer control wire (shown in white) then go back to the previous step, make another row, then assemble each layer onto the PCB as this provided a stable base.

Start by soldering the next layer by soldering one of the corner LEDs, Then solder the opposite corner. Now check the layer is level before you solder any more. Once you've adjusted the layer, solder the other two corner LEDs, the array should be levle but re-check it. Solder the remaining LEDs. Repeat the layer assembly for the final layer.

Step 7: Programming

Depending on your Atmega device, you may need to program the bootloader or just download the code. If you have a chip with the bootloader already programmed, you can use a USB to TTL adaptor. Follow this guide:

https://www.instructables.com/id/Program-Arduino-Mini-05-with-FTDI-Basic/

You can also use the 2x3 pin In Circuit System Programmable (ICSP) connector, you can use an another Arduino to do this:

https://www.instructables.com/id/How-to-use-Arduino-Mega-2560-as-Arduino-isp/

I use a Usbasp programmer which works with the Arduino IDE, configure this via the Tools->Programmer menu. You can pick Arduino/Atmel AVR programmers up cheaply via Ebay or other auction sites.

Download the LED cube library from https://github.com/gzip/arduino-ledcube, follow the instructions on the Github and look in your Examples directory for 'arduino-led-cube->ledcube'.

If you are using the ICSP programmer, hold shift before clicking upload to instruct the Arduino IDE to use the programmer. If you are using the USB-to TTL adaptor, press and release reset once the IDE finishes compiling.

Once the example code had been programmed, you should have an LED cube with pretty patterns.

This is my first instructable, comments and feedback are welcome.

Epilog Challenge 9

Participated in the
Epilog Challenge 9