3X3X3 LED Cube with Raspberry Pi and Python Program

We have created a series of Raspberry Pi Tutorials, in which we have covered Interfacing of Raspberry Pi with all the basic components like LED, LCD, button, DC motor, Servo Motor, Stepper Motor, ADC, shift Register, etc. We have also published some simple Raspberry Pi projects for beginners, along with some good IoT projects. Today, in this session, we are going to make a 3x3x3 LED CUBE and control it by Raspberry Pi to get different patterns using the Python Programming. We have previously build the same 3x3x3 LED Cube with Arduino Uno.

3x3x3 led cube with raspberry pi and python program
3X3X3 LED Cube with Raspberry Pi

A typical 3*3*3 LED cube connected to Raspberry Pi is shown in the image above. This LED CUBE is made of 27 Light Emitting Diodes, these 27 LEDs are arranged in rows and columns to form a cube. Hence the name is LED CUBE.

There are many types of cubes that can be designed. The simplest one of them is 3*3*3 LED cube. For 4*4*4 LED CUBE, the work is almost triple times because we need to do work for 64 LED. With each higher number the work almost doubles or triples. But every cube more or less works on the same way. For a beginner, 3*3*3 LED cube is the simplest LED CUBE and also there are some advantages of 3x3x3 LED Cube over other higher Cubes like,

  • For this cube you need not worry about power consumption or dissipation.
  • Power supply demand is less.
  • We don’t need any switching electronics for this cube.
  • We need lesser logic terminals so we don’t need shift registers or anything like that.
  • Best suited for +3.3v logic operated electronics like Raspberry Pi.

Components Required:

Here we are using Raspberry Pi 2 Model B with Raspbian Jessie OS. All the basic Hardware and Software requirements are previously discussed, you can look it up in the Raspberry Pi Introduction and Raspberry PI LED Blinking for getting started, other than that we need:

  • Raspberry Pi 2 B (any model)
  • 220Ω resisters (3 pieces)
  • 27 LEDs
  • Soldering tools for building LED Cube

Building 3x3x3 LED Cube:

We have previously discussed the building of 3*3*3 LED cube in detail in this article: 3x3x3 LED Cube with Arduino. You should check this one for learning how to solder LEDs for forming LED Cube. Here we are mentioning 9 Common positive terminals (columns) and 3 common negative terminals (Negative Rows or layers) in LED Cube. Each column represents a positive terminal and each layer represents a negative terminal.

We can see 9 Common Positive Terminals from the Top View as numbered in the below picture, we have numbered them as per the GPIO pin no of Raspberry Pi, on which these positive terminals are connected.

9 Common Positive Terminals: 4, 17, 27, 24, 23, 18, 25, 12, 16

And the 3 Common Negative Terminals can be seen from Front View as numbered in the below Picture:

Top Layer common negative pin: 13
Middle Layer common negative pin: 6
Bottom Layer common negative pin: 5

Once everything is done you will have a cube like this one. Also check the Video given in the end.

Circuit Diagram and Explanation:

Connections between Raspberry Pi and LED Cube are shown in below Circuit Diagram:schematic 3x3x3 led cube with raspberry pi and python program

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top