Vous êtes sur la page 1sur 49

Chapter 1

1.1 Introduction

These mesmerizing structures built by formatting light emitting diodes (LED) into a cube,
have become all the rage within the electronic hobbyist community. Cubes starting from
2x2x2 in dimension can become as large as 32x32x32 LEDs. They serve no functional
purpose other than to be aesthetically pleasing and to wow friends and family. Majority of
these LED cubes, leave the user standing at a distance admiring the three dimensional
patterns. Our goal was to bring a new twist to the LED cube and make it an interactive user
experience. Bringing different technologies together, the user is be able to pick it up and
do more than just observe from a distance.

The plan was to construct an 8x8x8 cube of single colored LEDs. The cubes main function
would be to simulate three dimensional animations by lighting up the LEDs in a pattern
dictated by a microcontroller. Upon completion of the primary task, two more functions
were added. The second function made the LED Cube’s lights mimic liquid in a cube based
on the input from an accelerometer. The third function had the LED Cube become a
Volume Unit (VU) meter. Due to the success of the prototypes, more features were added.
This gave way to construct the physical RGB cube. The Challenge was having the different
technologies providing input to work in unison and give the proper visual output, as well
as to make the cube itself sturdy enough to be picked up and handled by individuals.

This document discusses the development processes undertaken for the completion of this
project. This includes research, architecture, software and construction. Technical
background knowledge in digital and embedded systems is required to fully understand the
ideas discussed in this document.

1.2 Motivation for the Project

Interest came about when hearing about the nearly failed attempt to create a 16x16x16 LED
cube by a previous senior design group last summer. Also to top the non-impressive LED
1
cube that was picked up and showcased this spring. Never having heard of such a
contraption, the group searched the internet for further information. Having seen various
LED cube projects of varying magnitudes, and the amazing capabilities of the grand
32x32x32 LED cubes. It was decided that this was a very captivating project if managed
correctly. The LED cube seemed a little too simplistic at first glance, so we thought of
different ways of make this project more interesting. The VU meter and color organ found
on many audio electronic devices inspired us to apply this feature to the LED cube. This
would make it an interesting center piece display at parties as the cube reacts to the sound
of music. Another idea was based on a previous group that integrated an accelerometer to
an LED cube. This allowed users to pick up the cube and shake it around having the lights
mimic a liquid physics based on the outputs from the accelerometer. Another reason for
selecting this project was that it would be programming intensive. This would allow for
equal distribution of work since the group consists of three computer engineers and one
electrical engineer. Being poor college students, a monetarily feasible project was of great
desire. The Multi-Functional Hexahedron will require personal spending since sponsor was
unobtainable at the time. But it is perceived that this project will cost significantly less than
some $1,500 automated chess project to build. This will probably run about a few hundred
dollars the most, the printed circuit boards be the most expensive components. Ultimately
this seems like a reasonable, flexible, inexpensive and fun project to take on as we spend
our final semesters in undergradua

2
1.3 Goals and Objective
The ultimate goal was to create an interactive RGB LED cube, encased in a clear acrylic
glass container that would allow anyone to pick it up and rotate it around; as well as have
the cube react to sound. A single pole triple throw switch would be located at the top or
side of the casing which would allow the user to change the state of the cube’s behavior
(display pre-programmed animations, a liquid physics simulator and a sound reactor). An
extremely difficult part of this project will be in regards to the programming of the
microcontroller. The programming language used will probably be C due to familiarity.
With three computer engineers in the group, it should be manageable task to handle.
Another important feature would be to have an input method for uploading animations.

This was achieved by dividing the project into sub-goals. The first was to perform extensive
research on the subject matter. This included researching past projects and tutorials, as well
as researching possible components. Following the research, a prototype of a 3x3x3 LED
cube was constructed to test components and learn how to implement the ICs. The goal
here was to obtain an understanding as to how the entire process works. This also provided
a platform to achieve the next set of goals. The following objective is to gain complete
understanding as to how the accelerometer, VU meter and LED sink drivers function. We
can use the 3x3x3 cube to test these devices individually before application to the 8x8x8
cube. Once the final design with breadboards was functional, the printed circuit diagram
was finalized and ordered. Once that was accomplished, construction of the final prototype
commenced. After completion of the RGB cube, it was tested to make sure it met all the
requirements set at the beginning of our class.

1.4 Project Requirements and Specifications

There are five major components in the system. The first being the LED cube which
displays the output of the computed input from the sensing devices. The LEDs light up
based on the calculated input data from the surrounding

3
environment. The computations and processes are dealt with in the second major
component being the embedded electronics, which includes the microcontroller, IC units
and SPTT switch. The next three components deal with input into the entire system. This
includes the accelerometer, the VU meter and the image code. Figure 1.1 below
demonstrates how the components relate to each other as a whole in a simple block
diagram.

Accelerometer

Embedded
LED Cube
VU meter Electronic
Display
Components

Main

Animations

Figure 1 : Block Diagram of the System

4
Chapter-2

2.1 Hardware Requirement

The list of components mentioned here are specifically for controlling 4 different loads.

 Arduino Uno with ATmega328P microcontroller


 64 * LED lights
 4*220 ohm resistors
 Connecting wires
 9 V Power supply
 PCB

2.2 Software Requirement

 Arduino 1.6.9 compiler


 Android application

2.3 Description of Hardware Required

2.3.1 Arduino Uno


Arduino is open-source computer hardware and software company, project and user community
that designs and manufactures ingle-board microcontrollers and microcontroller kits for building
5
digital devices and interactive objects that can sense and control objects in the physical and digital
world. The project's products are distributed as open-source hardware and software, which are
licensed under the GNU Lesser General Public License (LGPL) or the GNU General Public
License (GPL), permitting the manufacture of Arduino boards and software distribution by
anyone. Arduino boards are available commercially in preassembled form or as do-it-yourself
(DIY) kits. Arduino board designs use a variety of microprocessors and controllers. The boards
are equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to
various expansion boards or breadboards (shields) an other circuits. The boards feature serial
communications interfaces, including Universal Serial Bus (USB) on some models, which are also
used for loading programs from personal computers. The microcontrollers are typically
programmed using a dialect of features from the programming languages C and C++. In addition
to using traditional compiler tool chains, the Arduino project provides an integrated development
environment (IDE) based on the Processing language project. The Arduino project started in 2003
as a program for students at the Interaction Design Institute Ivrea in Ivrea, Italy, aiming to provide
a low-cost and easy way for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices intended for beginner
hobbyists include simple robots, thermostats and motion detectors. The Arduino Uno is a
microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6
can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a
power jack, an ICSP header, and a reset button. It contains everything needed to support the
microcontroller; simply connect it to a computer with a USB cable or power it with an AC-to-DC
adapter or battery to get started. The Uno differs from all preceding boards in that it does not use
the FTDI USB-to- serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-
to- serial converter.

2.3.2 Hardware

2.3.2.1 Arduino Uno

6
Arduino is open-source hardware. The hardware reference designs are distributed under a Creative
Commons Attribution Share-Alike 2.5 license and are available on the Arduino website. Layout
and production files for some versions of the hardware are also available.
Although the hardware and software designs are freely available under copy left licenses, the
developers have requested the name Arduino to be exclusive to the official product and not be used
for derived works without permission. The official policy document on use of the Arduino name
emphasizes that the project is open to incorporating work by others into the official product.
Several Arduino-compatible products commercially released have avoided the project name by
using various names ending in-duino.
An early Arduino board with an RS-232 serial interface (upper left) and an Atmel ATmega8
microcontroller chip (black, lower right); the 14 digital I/O pins are at the top, the 6 analog input
pins at the lower right, and the power connector at the lower left.
Most Arduino boards consist of an Atmel 8-bit AVR microcontroller (ATmega8, ATmega168,
ATmega328, ATmega1280, ATmega2560) with varying amounts of flash memory, pins, and
features. The 32-bit Arduino Due, based on the Atmel SAM3X8E was introduced in 2012.
The boards use single or double-row pins or female headers that facilitate connections for
programming and incorporation into other circuits. These may connect with add-on modules
termed shields. Multiple and possibly stacked shields may be individually addressable via an I²C
serial bus. Most boards include a 5 V linear regulator and a 16 MHz crystal oscillator or ceramic
resonator. Some designs, such as the Lily Pad, run at 8 MHz and dispense with the onboard voltage
regulator due to specific form-factor restrictions.
Arduino microcontrollers are pre-programmed with a boot loader that simplifies uploading of
programs to the on-chip flash memory. The default bootloader of the Arduino UNO is the optiboot
bootloader. [28] Boards are loaded with program code via a serial connection to another computer.
Some serial Arduino boards contain a level shifter circuit to convert between RS-232 logic levels
and transistor–transistor logic (TTL) level signals. Current Arduino boards are programmed via
Universal Serial Bus (USB), implemented using USB-to-serial adapter chips such as the FTDI
FT232. Some boards, such as later-model Uno boards, substitute the FTDI chip with a separate
AVR chip containing USB-to-serial firmware, which is reprogrammable via its own ICSP header.
Other variants, such as the Arduino Mini and the unofficial Boarding, use a detachable USB-to-
serial adapter board or cable, Bluetooth or other methods. When used with traditional
microcontroller tools, instead of the Arduino IDE, standard AVR in-system programming (ISP)
programming is used.

7
An official Arduino Uno R2 with descriptions of the I/O locations. The Arduino board exposes
most of the microcontroller's I/O pins for use by other circuits. The Decimal, Duemilanove, and
current Uno provide 14 digital I/O pins, six of which can produce pulse-width modulated signals,
and six analog inputs, which can also be used as six digital I/O pins. These pins are on the top of
the board, via female 0.1-inch (2.54 mm) headers. Several plug-in application shields are also
commercially available. The Arduino Nano, and Arduino-compatible Bare Bones Board and
Boarduino boards may provide male header pins on the underside of the board that can plug into
solderless breadboards.
Many Arduino-compatible and Arduino-derived boards exist. Some are functionally equivalent to
an Arduino and can be used interchangeably. Many enhance the basic Arduino by adding output
drivers, often for use in school-level education, to simplify making buggies and small robots.
Others are electrically equivalent but change the form factor, sometimes retaining compatibility
with shields, sometimes not. Some variants use different processors, of varying compatibility.

Figure 2 :- Pin configuration of Arduino Uno

8
Some Technical Specification of Arduino Uno is

1. Microcontroller ATmega328P
2. Operating Voltage 5V
3. Input Voltage (recommended) 7-12V
4. Input Voltage (limits) 6-20V
5. Digital I/O Pins 14
6. Analog Input Pins 6
7. DC Current per I/O Pin 40 Ma
8. DC Current for 3.3V Pin 50 mA
9. Flash Memory 32 KB of which 0.5 KB used by bootloader
10. SRAM 2 KB
11. EEPROM 1 KB
12. Clock Speed 16 MHz

2.3.2.2 Pin Description

Pin Category Pin Name Details

Power Vin, 3.3V, 5V, GND Vin: Input voltage to Arduino


when using an external power
source.
5V: Regulated power supply used
to power microcontroller and other
components on the board.

9
3.3V: 3.3V supply generated by
on-board voltage regulator.
Maximum current draw is 50mA.
GND: ground pins.

Reset Reset Resets the microcontroller.

Analog Pins A0 – A5 Used to provide analog input in the


range of 0-5V

Input/output Pins Digital Pins 0 – 13 Can be used as input or output


pins.

Serial 0(Rx), 1(TX) Used to receive and transmit TTL


serial data.

External Interrupts 2 2, 3 To trigger an interrupt.

PWM 3, 5, 6, 9, 11 Provides 8-bit PWM output.


SPI 10 (SS), Used for SPI communication.
11 (MOSI),
12 (MISO) and
13 (SCK)
Inbuilt LED 13 To turn on the inbuilt LED.
TWI A4 (SDA), A5 (SCA) Used for TWI communication
AREF AREF To provide reference voltage for
input voltage.

2.3.2.3 Communication

Arduino can be used to communicate with a computer, another Arduino board or other
microcontrollers. The ATmega328P microcontroller provides UART TTL (5V) serial

10
communication which can be done using digital pin 0 (Rx) and digital pin 1 (TX). An
ATmega16U2 on the board channels this serial communication over USB and appears as a virtual
com port to software on the computer. The ATmega16U2 firmware uses the standard USB COM
drivers, and no external driver is needed. However, on Windows, an .inf file is required. The
Arduino software includes a serial monitor which allows simple textual data to be sent to and from
the Arduino board. There are two RX and TX LEDs on the Arduino board which will flash when
data is being transmitted via the USB-to-serial chip and USB connection to the computer (not for
serial communication on pins 0 and 1). A Software Serial library allows for serial communication
on any of the Uno's digital pins. The ATmega328P also supports I2C (TWI) and SPI
communication. The Arduino software includes a Wire library to simplify use of the I2C bus.

2.3.2.3.1 Arduino Uno to ATmega328 Pin Mapping

When ATmega328 chip is used in place of Arduino Uno, or vice versa, the image below shows
the pin mapping between the two.

Figure 3 :- ATmega328 pin configuration

2.3.2.4 ATmega328

11
The ATmega328 is a single-chip microcontroller created by Atmel in the megaAVR family (later
Microchip Technology acquired Atmel in 2016). It has a modified Harvard architecture 8-bit RISC
processor core.

2.3.2.4.1 Specifications

The Atmel 8-bit AVR RISC-based microcontroller combines 32 kB ISP flash memory with read-
while-write capabilities, 1 kB EEPROM, 2 kB SRAM, 23 general purpose I/O lines, 32 general
purpose working registers, three flexible timer/counters with compare modes, internal and external
interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, 6-
channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF packages), programmable
watchdog timer with internal oscillator, and five software selectable power saving modes. The
device operates between 1.8-5.5 volts. The device achieves throughput approaching 1 MIPS per
MHz.

2.3.2.4.2 Key parameters

Parameter Value

CPU type 8-bit AVR

Performance 20 MIPS at 20 MHz

Flash memory 32 kB

SRAM 2 kB

EEPROM 1 kB

Pin count 28 or 32 pin: PDIP-28, MLF-28, TQFP-32, and MLF-32

Maximum operating frequency 20 MHz

Number of touch channels 16


12
Hardware QTouch Acquisition No

Maximum I/O pins 23

External interrupts 2

USB Interface No

USB Speed –

2.3.2.4.3 Series alternatives

A common alternative to the ATmega328 is the "picoPower" ATmega328P. A comprehensive list


of all other members of the megaAVR series can be found on the Atmel website.

2.3.2.4.4 Applications

As of 2013 the ATmega328 is commonly used in many projects and autonomous systems where
a simple, low-powered, low-cost micro-controller is needed [citation needed]. Perhaps the most
common implementation of this chip is on the popular Arduino development platform, namely the
Arduino Uno and Arduino Nano models.

2.3.2.4.5 Programming

Pinout of ATmega 48A/PA/88A/PA/168A/PA/328/P in 28-PDIP (datasheet)


13
Reliability qualification shows that the projected data retention failure rate is much less than 1
PPM over 20 years at 85 °C or 100 years at 25 °C.

2.4 Arduino coding

Coding for 4*4*4 led cube is shown here

int layer[4]={A3,A2,A1,A0}; //initializing and declaring led layers

int column[16]={13,12,11,10,9,8,7,6,5,4,3,2,1,0,A5,A4}; //initializing and declaring led rows

int time = 250;

void setup()

for(int i = 0; i<16; i++)

pinMode(column[i], OUTPUT); //setting rows to ouput

for(int i = 0; i<4; i++)

14
pinMode(layer[i], OUTPUT); //setting layers to output

randomSeed(analogRead(10)); //seeding random for random pattern

void loop()

turnEverythingOff();

flickerOn();

turnEverythingOn();

delay(time);

turnOnAndOffAllByLayerUpAndDownNotTimed();

layerstompUpAndDown();

spiralInAndOut();

turnOnAndOffAllByColumnSideways();

delay(time);

aroundEdgeDown();

turnEverythingOff();

randomflicker();

randomRain();

diagonalRectangle();

goThroughAllLedsOneAtATime();

propeller();

spiralInAndOut();
15
flickerOff();

turnEverythingOff();

delay(2000);

//turn all off

void turnEverythingOff()

for(int i = 0; i<16; i++)

digitalWrite(column[i], 1);

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 0);

//turn all on

void turnEverythingOn()

for(int i = 0; i<16; i++)

digitalWrite(column[i], 0);
16
}

//turning on layers

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 1);

//turn columns off

void turnColumnsOff()

for(int i = 0; i<16; i++)

digitalWrite(column[i], 1);

//flicker on

void flickerOn()

int i = 150;

while(i != 0)

turnEverythingOn();

delay(i);

turnEverythingOff();

delay(i);
17
i-= 5;

//turn everything on and off by layer up and down NOT TIMED

void turnOnAndOffAllByLayerUpAndDownNotTimed()

int x = 75;

for(int i = 5; i != 0; i--)

turnEverythingOn();

for(int i = 4; i!=0; i--)

digitalWrite(layer[i-1], 0);

delay(x);

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 1);

delay(x);

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 0);

delay(x);

}
18
for(int i = 4; i!=0; i--)

digitalWrite(layer[i-1], 1);

delay(x);

//turn everything on and off by column sideways

void turnOnAndOffAllByColumnSideways()

int x = 75;

turnEverythingOff();

//turn on layers

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 1);

for(int y = 0; y<3; y++)

//turn on 0-3

for(int i = 0; i<4; i++)

digitalWrite(column[i], 0);

delay(x);

}
19
//turn on 4-7

for(int i = 4; i<8; i++)

digitalWrite(column[i], 0);

delay(x);

//turn on 8-11

for(int i = 8; i<12; i++)

digitalWrite(column[i], 0);

delay(x);

//turn on 12-15

for(int i = 12; i<16; i++)

digitalWrite(column[i], 0);

delay(x);

//turn off 0-3

for(int i = 0; i<4; i++)

digitalWrite(column[i], 1);

delay(x);

//turn off 4-7


20
for(int i = 4; i<8; i++)

digitalWrite(column[i], 1);

delay(x);

//turn off 8-11

for(int i = 8; i<12; i++)

digitalWrite(column[i], 1);

delay(x);

//turn off 12-15

for(int i = 12; i<16; i++)

digitalWrite(column[i], 1);

delay(x);

//turn on 12-15

for(int i = 12; i<16; i++)

digitalWrite(column[i], 0);

delay(x);

//turn on 8-11

for(int i = 8; i<12; i++)


21
{

digitalWrite(column[i], 0);

delay(x);

//turn on 4-7

for(int i = 4; i<8; i++)

digitalWrite(column[i], 0);

delay(x);

//turn on 0-3

for(int i = 0; i<4; i++)

digitalWrite(column[i], 0);

delay(x);

//turn off 12-15

for(int i = 12; i<16; i++)

digitalWrite(column[i], 1);

delay(x);

//turn off 8-11

for(int i = 8; i<12; i++)

{
22
digitalWrite(column[i], 1);

delay(x);

//turn off 4-7

for(int i = 4; i<8; i++)

digitalWrite(column[i], 1);

delay(x);

//turn off 0-3

for(int i = 0; i<4; i++)

digitalWrite(column[i], 1);

delay(x);

//up and down single layer stomp

void layerstompUpAndDown()

int x = 75;

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 0);

}
23
for(int y = 0; y<5; y++)

for(int count = 0; count<1; count++)

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 1);

delay(x);

digitalWrite(layer[i], 0);

for(int i = 4; i !=0; i--)

digitalWrite(layer[i-1], 1);

delay(x);

digitalWrite(layer[i-1], 0);

for(int i = 0; i<4; i++)

digitalWrite(layer[i], 1);

delay(x);

for(int i = 4; i!=0; i--)

digitalWrite(layer[i-1], 0);
24
delay(x);

//flicker off

void flickerOff()

turnEverythingOn();

for(int i = 0; i!= 150; i+=5)

turnEverythingOff();

delay(i+50);

turnEverythingOn();

delay(i);

//around edge of the cube down

void aroundEdgeDown()

for(int x = 200; x != 0; x -=50)

turnEverythingOff();

for(int i = 4; i != 0; i--)

digitalWrite(layer[i-1], 1);
25
digitalWrite(column[5], 0);

digitalWrite(column[6], 0);

digitalWrite(column[9], 0);

digitalWrite(column[10], 0);

digitalWrite(column[0], 0);

delay(x);

digitalWrite(column[0], 1);

digitalWrite(column[4], 0);

delay(x);

digitalWrite(column[4], 1);

digitalWrite(column[8], 0);

delay(x);

digitalWrite(column[8], 1);

digitalWrite(column[12], 0);

delay(x);

digitalWrite(column[12], 1);

digitalWrite(column[13], 0);

delay(x);

digitalWrite(column[13], 1);

digitalWrite(column[15], 0);

delay(x);

digitalWrite(column[15], 1);

digitalWrite(column[14], 0);

delay(x);
26
digitalWrite(column[14], 1);

digitalWrite(column[11], 0);

delay(x);

digitalWrite(column[11], 1);

digitalWrite(column[7], 0);

delay(x);

digitalWrite(column[7], 1);

digitalWrite(column[3], 0);

delay(x);

digitalWrite(column[3], 1);

digitalWrite(column[2], 0);

delay(x);

digitalWrite(column[2], 1);

digitalWrite(column[1], 0);

delay(x);

digitalWrite(column[1], 1);

//random flicker

void randomflicker()

turnEverythingOff();

int x = 10;

for(int i = 0; i !=750; i+=2)


27
{

int randomLayer = random(0,4);

int randomColumn = random(0,16);

digitalWrite(layer[randomLayer], 1);

digitalWrite(column[randomColumn], 0);

delay(x);

digitalWrite(layer[randomLayer], 0);

digitalWrite(column[randomColumn], 1);

delay(x);

//random rain

void randomRain()

turnEverythingOff();

int x = 100;

for(int i = 0; i!=60; i+=2)

int randomColumn = random(0,16);

digitalWrite(column[randomColumn], 0);

digitalWrite(layer[0], 1);

delay(x+50);

digitalWrite(layer[0], 0);

digitalWrite(layer[1], 1);
28
delay(x);

digitalWrite(layer[1], 0);

digitalWrite(layer[2], 1);

delay(x);

digitalWrite(layer[2], 0);

digitalWrite(layer[3], 1);

delay(x+50);

digitalWrite(layer[3], 0);

digitalWrite(column[randomColumn], 1);

//diagonal rectangle

void diagonalRectangle()

int x = 350;

turnEverythingOff();

for(int count = 0; count<5; count++)

//top left

for(int i = 0; i<8; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[3], 1);

digitalWrite(layer[2], 1);
29
delay(x);

turnEverythingOff();

//middle middle

for(int i = 4; i<12; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[1], 1);

digitalWrite(layer[2], 1);

delay(x);

turnEverythingOff();

//bottom right

for(int i = 8; i<16; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[0], 1);

digitalWrite(layer[1], 1);

delay(x);

turnEverythingOff();

//bottom middle

for(int i = 4; i<12; i++)

digitalWrite(column[i], 0);

}
30
digitalWrite(layer[0], 1);

digitalWrite(layer[1], 1);

delay(x);

turnEverythingOff();

//bottom left

for(int i = 0; i<8; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[0], 1);

digitalWrite(layer[1], 1);

delay(x);

turnEverythingOff();

//middle middle

for(int i = 4; i<12; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[1], 1);

digitalWrite(layer[2], 1);

delay(x);

turnEverythingOff();

//top right

for(int i = 8; i<16; i++)

{
31
digitalWrite(column[i], 0);

digitalWrite(layer[2], 1);

digitalWrite(layer[3], 1);

delay(x);

turnEverythingOff();

//top middle

for(int i = 4; i<12; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[2], 1);

digitalWrite(layer[3], 1);

delay(x);

turnEverythingOff();

//top left

for(int i = 0; i<8; i++)

digitalWrite(column[i], 0);

digitalWrite(layer[3], 1);

digitalWrite(layer[2], 1);

delay(x);

turnEverythingOff();
32
}

//propeller

void propeller()

turnEverythingOff();

int x = 90;

for(int y = 4; y>0; y--)

for(int i = 0; i<6; i++)

//turn on layer

digitalWrite(layer[y-1], 1);

//a1

turnColumnsOff();

digitalWrite(column[0], 0);

digitalWrite(column[5], 0);

digitalWrite(column[10], 0);

digitalWrite(column[15], 0);

delay(x);

//b1

turnColumnsOff();

digitalWrite(column[4], 0);

digitalWrite(column[5], 0);

digitalWrite(column[10], 0);

digitalWrite(column[11], 0);
33
delay(x);

//c1

turnColumnsOff();

digitalWrite(column[6], 0);

digitalWrite(column[7], 0);

digitalWrite(column[8], 0);

digitalWrite(column[9], 0);

delay(x);

//d1

turnColumnsOff();

digitalWrite(column[3], 0);

digitalWrite(column[6], 0);

digitalWrite(column[9], 0);

digitalWrite(column[12], 0);

delay(x);

//d2

turnColumnsOff();

digitalWrite(column[2], 0);

digitalWrite(column[6], 0);

digitalWrite(column[9], 0);

digitalWrite(column[13], 0);

delay(x);

//d3

turnColumnsOff();

digitalWrite(column[1], 0);
34
digitalWrite(column[5], 0);

digitalWrite(column[10], 0);

digitalWrite(column[14], 0);

delay(x);

//d4

turnColumnsOff();

digitalWrite(column[0], 0);

digitalWrite(column[5], 0);

digitalWrite(column[10], 0);

digitalWrite(column[15], 0);

delay(x);

//spiral in and out

void spiralInAndOut()

turnEverythingOn();

int x = 60;

for(int i = 0; i<6; i++)

//spiral in clockwise

digitalWrite(column[0], 1);

delay(x);

digitalWrite(column[1], 1);
35
delay(x);

digitalWrite(column[2], 1);

delay(x);

digitalWrite(column[3], 1);

delay(x);

digitalWrite(column[7], 1);

delay(x);

digitalWrite(column[11], 1);

delay(x);

digitalWrite(column[15], 1);

delay(x);

digitalWrite(column[14], 1);

delay(x);

digitalWrite(column[13], 1);

delay(x);

digitalWrite(column[12], 1);

delay(x);

digitalWrite(column[8], 1);

delay(x);

digitalWrite(column[4], 1);

delay(x);

digitalWrite(column[5], 1);

delay(x);

digitalWrite(column[6], 1);

delay(x);
36
digitalWrite(column[10], 1);

delay(x);

digitalWrite(column[9], 1);

delay(x);

//spiral out counter clockwise

digitalWrite(column[9], 0);

delay(x);

digitalWrite(column[10], 0);

delay(x);

digitalWrite(column[6], 0);

delay(x);

digitalWrite(column[5], 0);

delay(x);

digitalWrite(column[4], 0);

delay(x);

digitalWrite(column[8], 0);

delay(x);

digitalWrite(column[12], 0);

delay(x);

digitalWrite(column[13], 0);

delay(x);

digitalWrite(column[14], 0);

delay(x);

digitalWrite(column[15], 0);

delay(x);
37
digitalWrite(column[11], 0);

delay(x);

digitalWrite(column[7], 0);

delay(x);

digitalWrite(column[3], 0);

delay(x);

digitalWrite(column[2], 0);

delay(x);

digitalWrite(column[1], 0);

delay(x);

digitalWrite(column[0], 0);

delay(x);

//spiral in counter clock wise

digitalWrite(column[0], 1);

delay(x);

digitalWrite(column[4], 1);

delay(x);

digitalWrite(column[8], 1);

delay(x);

digitalWrite(column[12], 1);

delay(x);

digitalWrite(column[13], 1);

delay(x);

digitalWrite(column[14], 1);

delay(x);
38
digitalWrite(column[15], 1);

delay(x);

digitalWrite(column[11], 1);

delay(x);

digitalWrite(column[7], 1);

delay(x);

digitalWrite(column[3], 1);

delay(x);

digitalWrite(column[2], 1);

delay(x);

digitalWrite(column[1], 1);

delay(x);

digitalWrite(column[5], 1);

delay(x);

digitalWrite(column[9], 1);

delay(x);

digitalWrite(column[10], 1);

delay(x);

digitalWrite(column[6], 1);

delay(x);

//spiral out clock wise

digitalWrite(column[6], 0);

delay(x);

digitalWrite(column[10], 0);

delay(x);
39
digitalWrite(column[9], 0);

delay(x);

digitalWrite(column[5], 0);

delay(x);

digitalWrite(column[1], 0);

delay(x);

digitalWrite(column[2], 0);

delay(x);

digitalWrite(column[3], 0);

delay(x);

digitalWrite(column[7], 0);

delay(x);

digitalWrite(column[11], 0);

delay(x);

digitalWrite(column[15], 0);

delay(x);

digitalWrite(column[14], 0);

delay(x);

digitalWrite(column[13], 0);

delay(x);

digitalWrite(column[12], 0);

delay(x);

digitalWrite(column[8], 0);

delay(x);

digitalWrite(column[4], 0);
40
delay(x);

digitalWrite(column[0], 0);

delay(x);

//go through all leds one at a time

void goThroughAllLedsOneAtATime()

int x = 15;

turnEverythingOff();

for(int y = 0; y<5; y++)

//0-3

for(int count = 4; count != 0; count--)

digitalWrite(layer[count-1], 1);

for(int i = 0; i<4; i++)

digitalWrite(column[i], 0);

delay(x);

digitalWrite(column[i], 1);

delay(x);

digitalWrite(layer[count-1], 0);

}
41
//4-7

for(int count = 0; count < 4; count++)

digitalWrite(layer[count], 1);

for(int i = 4; i<8; i++)

digitalWrite(column[i], 0);

delay(x);

digitalWrite(column[i], 1);

delay(x);

digitalWrite(layer[count], 0);

//8-11

for(int count = 4; count != 0; count--)

digitalWrite(layer[count-1], 1);

for(int i = 8; i<12; i++)

digitalWrite(column[i], 0);

delay(x);

digitalWrite(column[i], 1);

delay(x);

digitalWrite(layer[count-1], 0);
42
}

//12-15

for(int count = 0; count < 4; count++)

digitalWrite(layer[count], 1);

for(int i = 12; i<16; i++)

digitalWrite(column[i], 0);

delay(x);

digitalWrite(column[i], 1);

delay(x);

digitalWrite(layer[count], 0);

2.5 LED’s

Light emitting diodes are diodes which produce light when current passes through in the right
direction. Just like any diode the other direction is completely blocked. Led’s are nowadays
commonly used as light sources

because they are smaller, very efficient and have a longer lifetime.

c
43
Figure 4 :- simple diagram of LED

2.5 Resistors

A resistor is a component that ‘resists’ the flow of electricity. The flow of electricity is
called current. Every resistor has a certain value telling how much it resists the flow.

This resistance is called ohm, it’s most commonly shown with the omega Ω.

These resistors are needed on the breadboard to prevent a led from getting to much
current. This would kill the LED. It’s the same case with the Infrared LED.

44
Chapter-3

3.1 Design And Implementation

45
Figure 5 :- 4x4x4 DIY Blue LED Cube

Aside from the general direction of the project as de ned by the description and goals, specific targets
have been listed for the successful completion of the project. The primary intention of the project is to
complete a 3D LED cube capable of displaying visual animations. This will be accomplished by
designing a custom software suite to handle the input from the user and relay animation information to
a custom PCB containing an FPGA and embedded processor.

46
Chapter 4

4.1 Conclusion
The completion of this project documentation culminated in a clear and precise direction
moving toward the completion of a nal prototype of the 3D LED cube. Throughout the
research phase of development, each group member built a high level of pro ciency in each
of their respective areas of concentration, while maintaining competency across all the
areas of the project design. The design phase was where the individual skills of the group
members were put to the test - creating a highly detailed and formulated design plan to
achieve the required speci cations for the completed prototype. Each stage of this design
process was heavily documented and outlined in this paper, adding accountability to each
major decision made - as each step had to have speci cations and facts supporting that
particular directive.

The research stage of the senior design project led to a number of important decisions -
choosing parts as well as noticing and planning ahead for potential design concerns. When
the design was completed and documented, we had a clear and functional outline: a
software interface to send instructions to an on-board control PCB, containing an
embedded processor and FPGA operating in unison to control two separate driver boards
containing LED drivers and MOSFETs which in turn modulated the current to each
individual LED with a high level of speed and precision. A detailed testing procedure con
rms the operation of the 3D LED cube - leaving the group with a clear and nalized path
moving forward.

47
Chapter 5

5.1 References

http://www.instructables.com/id/LED-Cube-4x4x4/

http://www.dickbest.nl/webshop/index.php http://www.topled.nl/

http://www.circuitsonline.net/schakelingen/112/computer-en-
microcontroller/avr-programmer.html

http://www.zegeniestudios.net/ldc/

48
49

Vous aimerez peut-être aussi