Electronics | 3x3x3 LED Cube

This 3x3x3 LED cube consists of 27 LEDs, of which 14 are red and 13 are green, all positioned at alternating positions such that every red one is surrounded by green ones and vice versa.

The cube consists of three planes, each one containing nine LEDs. For these LEDs, all the cathodes are soldered together, so we have a common cathode per plane. All three planes are then stacked on top of each other, whereby we solder the anodes per column together. There is a 150 ohm resistor put in series with each of the nine columns to limit the current on the anodes. They are then connected to nine output pins on the Arduino.

Furthermore, we use three BC547B NPN transistors with their bases put in serial with three 22K resistors to control the cathodes. Each plane's cathode is then connected to a transistor's collector; all the emitters are connected to ground. The bases are connected to three output pins on the Arduino.

In order to turn on a single LED, we select the correct pin in the XY plane, and the pin for the respective Z plane. This technique has one side effect though: if we light a LED in one layer, and another one from another column in another layer, then all LEDs in both columns and planes are lit. To tackle this, we use persistence of vision (POV), whereby we only light one plane at a time, but very rapidly cycle between successive planes. If we do this fast enough (on the order of milliseconds), then we create the illusion of a single image.

Arduino sketch

LinkedList library

Demonstration (mp4, 36.2 MiB)

Electrical diagram:

Assembled and soldered perfboard: