Professional Documents
Culture Documents
Cubo en Raspberry
Cubo en Raspberry
PI FRAMBUESA
Hemos creado una serie de tutoriales de Raspberry Pi, en los que hemos cubierto la interfaz de
Raspberry Pi con todos los componentes básicos como LED, LCD, botón, motor de CC,
servomotor, motor paso a paso, ADC, registro de cambios, etc. También tenemos publicó
algunos proyectos sencillos de Raspberry Pi para principiantes, junto con algunos buenos
proyectos de IoT . Hoy, en esta sesión, haremos un CUBO LED 3x3x3 y lo controlaremos con
Raspberry Pi para obtener diferentes patrones utilizando la programación de Python.
Anteriormente hemos construido el mismo cubo LED de 3x3x3 con Arduino Uno .
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.
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:
27 LEDs
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:
Once everything is done you will have a cube like this one. Also check the Video given in the end.
Connections between Raspberry Pi and LED Cube are shown in below Circuit Diagram:
As shown in picture, we have a total of 12 pins from Cube, over which NINE are Common
Positive and THREE are Common Negative Pins. Remember each column represents a positive
terminal and each layer represents a negative terminal.
Now we will connect these 12 pins to Raspberry Pi exactly as given in the circuit diagram. Once
we have connected the terminals it’s time to write the PYTHON program.
You can check the Python program below to generate the pattern shown in the Demo Video
below.
Say, we want to turn on LED on the middle layer as indicated in below picture (red circled), then
we need to power the GPIO18 pin and ground the GPIO6 pin. This goes for every LED in the
cube.
We have written couple of loop programs in PYTHON to make simple flashes. Program is well
explained through the comments. If you want more patterns you can simple add more patterns
in to the program.
RECOMMENDED TI WHITEPAPERS
Taking charge of electric vehicles – both in the vehicle and on the grid
This paper will attempt to explain onboard chargers, how they work and why they’re used. It will
also explain charging stations and how they...
Which new semiconductor technologies will speed electric vehicle charging adoption?
Read this whitepaper to learn more about EV charging systems and their design.
Code
#working
import RPi.GPIO as IO #calling for header file which helps in using GPIO’s of PI
x=1
y=1
z=0
IO.setmode (IO.BCM)
IO.setup(24,IO.OUT)
IO.setup(23,IO.OUT)
IO.setup(18,IO.OUT)
IO.setup(25,IO.OUT)
IO.setup(12,IO.OUT)
IO.setup(16,IO.OUT)
IO.setup(5,IO.OUT)
IO.setup(6,IO.OUT)
IO.setup(13,IO.OUT)
while 1:
for y in range (3): #execute the loop 3 times incrementing y value from zero to three
for x in range (9): #execute the loop 9 times incrementing x value from zero to eight
IO.output(rows[2-y],0)
IO.output(columns[8-x],1)
time.sleep(0.1)
IO.output(columns[8-x],0)
IO.output(rows[2-y],1)
IO.output(columns[x],1)
time.sleep(0.1)
IO.output(columns[x],0)
IO.output(rows[y],1)
IO.output(rows[2-y],0)
IO.output(columns[8-x],1)
time.sleep(0.1)
IO.output(columns[8-x],0)
IO.output(rows[2-y],1)
IO.output(rows[y],0)
IO.output(random[x],1)
time.sleep(0.1)
IO.output(random[x],0)
IO.output(rows[y],1)
IO.output(rows[2-y],0)
IO.output(random[8-x],1)
time.sleep(0.1)
IO.output(random[8-x],0)
IO.output(rows[2-y],1)
Video
TAGS
RASPBERRY PI
LED CUBE
Subscribe below to receive most popular news, articles and DIY projects from Circuit Digest
Email Address *
Name
Country
PREVIOUS POST
NEXT POST
COMMENTS
LATEST POSTS
SPONSORED
Low Resistance Shunt Resistors With NiCr Resistive Element and Unique Termination Design
SPONSORED
NEWS
ARTICLES
PROJECTS
Low Resistance Shunt Resistors With NiCr Resistive Element and Unique Termination Design
High Efficiency 750W RF power transistor enables more compact power amplifier designs
Programmable 12-channel RGB LED Driver Enhances Lighting Effects for Smart Devices and
Wearables
My 2WD Car Is not Moving !!! I used Arduino Uno / Hc-05 Bluetooth /L298N motor drive
Alibak’s Replies: 1
Urgent Help- I am still facing the below issue though i installed the ArduinoJson (6.10.0) to
working with ESP8266 & DHT11
Kh Nuba Replies: 1
Generation of PWM signals on GPIO pins of the PIC microcontroller: Control of the servo motor
Vascalir Replies: 1
User login
E-mail or username *
Password *
CATEGORIES
Embedded Electronics
Power Electronics
Analog Electronics
Internet of Things
Audio Electronics
POPULAR
ROBOTICS
555 CIRCUITS
ARDUINO PROJECTS
RASPBERRY PI PROJECTS
ELECTRONICS NEWS
ELECTRONICS FORUM
CALCULADORAS
HOJA INFORMATIVA
¿Arranque de hardware?
Sumo
acciones3