I assistance in creating PCBs and for ordering

I declare that this project “3D LED Display” is my own
personal effort and has not been submitted anywhere else for any other degree
or diploma. I took reasonable care to ensure that the work is original, and to
the best of my knowledge, does not breach copyright law, and has not been taken
from other sources except where such work has been cited and acknowledged
within the text.














Signature: _________________________________

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

Student Nr: _________ K00131219_____________

Date: _____________________________________




I dedicate this thesis and work to my family who supported
me throughout this process.




would like to sincerely thank my supervisor Kevin Carey for allowing me to take up this project and all the
advices received from him that greatly helped me in completing this work.

well I would like to thank technicians Sean, Alan and Niall for their
assistance in creating PCBs and for ordering all the parts for this project.

I would like to show my gratitude to everyone who has made even tiniest contribution to this
project and helped me along the way.





The goal of this project was to
design, build and program a 3 dimensional display which could be used to
display various 3D graphics (static and dynamic). The display itself consists
of 8x8x8 (512) unicolor LEDs controlled via bank of D-type flip-flops. A single
40 pin microcontroller updates flip-flops using multiplexing technique which
significantly reduces the requirements for the PIC pin count.

User can interact with the cube via
simple windows GUI. The program allows to set a desirable LED cube mode of the
operation, create a 3D drawing, save or load it to/from computer memory, or
upload it to LED cube.

All the required data is stored in
the internal microcontroller memory (EEPROM), so that when the cube is
restarted the mode of operation and 3D image can be retrieved from the
non-volatile memory.

Particular attention was paid to visual
attractiveness of the project. The housing was made of clear perspex to show
all the internal components without disassembling it. All displayed visual objects
had to be eye catching. Picture below (fig. 0.0) from Limerick Chronicle
newspaper shows LED cube at Southcourt Hotel during the Limerick for
Engineering showcase.

0.0 Engineering showcase at the Southcourt Hotel

Alan Place / Fusion Shooters).

Table of contents

Declaration.. 1
Dedication.. 2
Acknowledgements. 3
Abstract.. 4
Table of contents. 5
Nomenclature and acronyms. 7
1. Introduction and Project Outline.. 9
Literature survey.. 11
2.1 LED.. 11
2.2 Flip-Flop. 12
2.3 De-Mux. 14
PIC.. 15
2.5 Switching Voltage Regulators. 16
2.6 USB.. 17
2.7 Ultiboard. 18
2.8 Multisim.. 19
2.9 MPLAB.. 19
2.10 C Compiler for PIC18. 19
2.11 Microsoft Visual C#. 20
2.12 Flicker fusion threshold. 20
2.13 LED Cube. 21
3. Methodology (hardware) 24
3.1 LED Cube. 24
3.2 LED Cube Base. 29
3.3 Flip-Flop PCB board. 34
3.4 Controller Board. 38
3.6 Power Board. 44
3.7 Housing. 47
4. Methodology (software) 47
4.1 USB communication. 47
4.2 Host Software. 49
4.3 Firmware. 53
Communication. 55
received data to EEPROM.. 56
Using stored
data. 57
control 57
Image graphics
calculations. 58
5. Discussion
of results. 59
LED Cube
design and built. 59
PCB boards. 59
communication. 59
GUI. 59
Firmware. 60
6. Component List.. 60
6.1 Power Board. 60
6.2 Flip-Flop Board. 60
6.3 Controller Board. 60
6.4 Other components. 61
Troubleshooting.. 62
9. Conclusions/Recommendations
for future work. 66
10. References. 67
11. Appendices. 69
Appendix A (GUI Program) 69
Appendix B (Firmware) 80
LED Cube.c file. 80
Functions.h file. 85
Functions.c file. 86


Nomenclature and acronyms


CLK – Clock.

DC – Direct Current.

DIP – Dual Inline Package.

DXF – Drawing Exchange Format.

EEPORM – Electrically Erasable
Programmable Read-Only Memory.

F-f – Flip-flop.

FW – Firmware.

Gbps – Gigabit per second.

GND – Ground.

GUI – Graphical User Interface.

HID – Human Interface Device.

HW – Hardware.

I/O – Input/Output.

I2C – Inter-Integrated Circuit.

IC – Integrated Circuit.

ICSP – In-Circuit Serial

IDE – Integrated Development

ISR – Interrupt Service Routine.

LED – Light-Emitting Diode.

Mbps – Million bits per second.

MOSFET – Metal-Oxide Semiconductor
Field-Effect Transistor.

PC – Personal Computer.

PCB – Printed Circuit Board.

PIC – Programmable Interface

PID – Product ID.

PWM – Pulse Width Modulation.

RGB – Red, Green, Blue.

SPI – Serial Peripheral Interface.

SW – Software.

TDMA – Time Division Multiple

TMR – Timer.

UART – Universal Asynchronous

USART – Universal Synchronous
Asynchronous Receiver/Transmitter.

USB – Universal Serial Bus.

VID – Vendor ID.


1. Introduction and Project Outline


The aim of this project was to design and build an LED
cube capable of displaying 3D images and communicating with PC via USB 2.0
(fig. 1.0).

Figure 1.0 Project block diagram.


It involved designing three PCB boards:

Power board – for supplying 5V to the following two PCBs in
this list.

Flip-flop board – for switching cube LEDs ON and OFF at high
speed, this way generating 3D visual picture.

Controller board – containing PIC microcontroller which
manipulates flip-flops and performs data exchange with PC via USB connection.

However, beforehand a functioning prototype was built in
order to become familiar with all components involved in the project (fig 1.1).
After making sure that LED cube operates as expected all three PCB boards were
developed in Ultiboard program and printed.

The controller PCB board was designed to have ICSP
(In-Circuit Serial Programming) circuit with 5 pin socket for a PICKit2
programmer. That facilitated PIC microcontroller programming without physically
removing it from the board.

Figure 1.1 LED cube and controller prototype.


This report describes the main aspects of the software
(SW) and firmware (FW) development processes. The code for the user interface
was written in Visual C# 2010 Express program. A
special class was added to the C# project which contained
host software functions for performing USB HID communication. USB functions
were successfully used for data transmission between the host and PIC
controller. Firmware code was developed in the MPLAB program using C
programming language.

Both FW and SW codes with comments are available in
the appendix at the end of this report.


Literature survey


2.1 LED

Light-emitting diodes
(LEDs) are semiconductor devices that convert electrical current into light.
LED lighting is also called “solid state lighting” because the light is emitted
from a solid object rather than from a vacuum or gas tube, as in traditional incandescent
or fluorescent lights. Light-emitting diodes have significant potential
for energy savings compared to other illumination devices, for instance LEDs
are 10 times more efficient than incandescent lights. Even though LED
technology has existed in specialized applications since the 1960s but it
became widespread only after the invention of the blue LED which made white
light generation possible (Gereffi and Lowe, 2008).


LEDs have been used widely
to create the highly efficient red, green, and blue lights in devices such as
digital clocks, watches, televisions, dashboards, and traffic lights. In 1993
Japan’s Nichia Corporation devised a way to create white light from a single
diode. This discovery initiated the ongoing quest to develop an LED-based
technology that can produce a high-quality, “warm” white light suitable for
general illumination (Gereffi and Lowe, 2008).


General LED operation can
be described as follows: a current flows through a diode in the forward
direction, it consists of surplus electrons moving in one direc­tion in the
lattice and “holes” (voids in the lattice) moving in the other. Occasionally,
electrons can recombine with holes. When this happens the process releases
energy in the form of photons, i.e. light is produced. This is true of all
semiconductor junctions, but LEDs use materials that maximize the effect. The
colour of the light emitted (corresponding to the ener­gy of the photon) is
determined by the semiconduc­tor materials that form the diode junction (Tuite,
2013). A figure below shows internal parts of an LED.


Figure 2.1.0 Internal parts of an LED (Wikipedia, 2009).



2.2 Flip-Flop

D type flip-flops
(Fig. 2.2.0, a) are basic storage elements (memory cells) in digital
electronics. They transfer input data to the outputs on an edge (positive or
negative) transition of the clock input providing a robust interface between
asynchronous and synchronous systems (www.nxp.com, 2015).



Figure 2.2.0 D flip-flop block diagram
and logic diagram.


output Q (Fig. 2.20, b) tries to track the D input, but this happens only when
the CLK input is high. The instance when CLK signal becomes low the Q output
keeps the last D value until CLK becomes high again, then Q resumes tracking the
D input. The timing diagram on Fig. 2.2.1 shows that Q acquires D input value
only when CLK is high.

Figure 2.2.1 D flip-flop timing diagram.


However, octal
D flip-flops used in this project allow the Q to acquire value of the D input
only on the rising edge of the clock
as shown in Fig. 2.2.2 a and b.



2.2.2 D flip-flop truth table and timing diagram.


Octal D-type flip-flops (Fig. 2.2.3) have 3-state outputs and the capability to
drive 15 LSTTL (Low-Power Schottky Transistor-Transistor Logic) loads. The
eight edge-triggered flip-flops enter data through D0 to D7 pins into their
registers on the LOW to HIGH transition of clock (CLK) (Fig. 2.2.2 a). The output
enable (OE) controls the 3-state outputs (Q0 to Q7 pins) and is independent of
the register operation. When OE is HIGH, the outputs are in the high-impedance
state and when it is LOW the chip outputs values that were store in it (Texas
Instruments, 2014).

2.2.3 74HC374 Octal D-type flip-flop pinout.


2.3 De-Mux

A decoder is a device which does
the reverse operation of an encoder, undoing the encoding so that the original
information can be retrieved. It is a combinational circuit that converts
binary information from n input lines to a maximum of 2n unique
output lines (Wikipedia, 2015). The decoders are designed to be used in memory-decoding
or data routing applications requiring very short propagation delay times.

Figure 2.3.0 shows 3-line to 8-line
decoder pinout. The conditions at the binary-select inputs (A, B and C) and
three enable inputs select one of eight output lines. Two active-low and one
active-high enable inputs (G1,

2A and

2B) reduce the need for external gates or inverters when
expanding. An enable input can be used as a data input in demultiplexing
application, such as this project. It has a propagation delay time of only 15
ns (Texas Instruments, 2003).

2.3.0 S74HC138 De-Mux pinout.


The table below shows how inputs
can be decoded using S74HC138 chip.

2.3.0 S74HC138 De-Mux functional table.



A microcontroller
is a small computer on a single integrated circuit (IC) containing a processor
core, memory, and programmable input/output peripherals. Microcontrollers are
designed for embedded applications, in contrast to the microprocessors used in
personal computers or other general purpose applications.

Microcontrollers are used in automatically
controlled products and devices, such as automobile engine control systems,
implantable medical devices, remote controls, office machines, appliances,
power tools, toys and other embedded systems. By reducing the size and cost
compared to a design that uses a separate microprocessor, memory, and
input/output devices, microcontrollers make it economical to digitally control
even more devices and processes (Wikipedia,

Figure 2.4.0 displays 40 pin 18F4550 PIC
microcontroller which has high computational performance at an economical
price, with the addition of high endurance and enhanced Flash program memory.
This device incorporates a fully featured USB (Universal Serial Bus)
communications module that is compliant with the USB Specification Revision
2.0. The module supports both low-speed and full-speed communication for all
supported data transfer types. It also incorporates its own on-chip transceiver
and 3.3V regulator. The Flash cells for both program memory and data EEPROM are
rated to last for many thousands of erase/write cycles – up to 100,000 for
program memory and 1,000,000 for EEPROM (Microchip, 2006).


Figure 2.4.0 PIC 18F4550 Microcontroller (Microchip, 2006).


2.5 Switching
Voltage Regulators

A voltage regulator is designed to automatically maintain a constant
voltage level (Wikipedia, 2015). LM2576 voltage regulator (Fig. 2.5.0) is monolithic integrated circuit
that provides all the active functions for a step-down (buck) switching
regulator, capable of driving 3A load with excellent line and load regulation.
These devices are available in fixed output voltages of 3.3V, 5V, 12V, 15V, and
as adjustable output version. Requiring only a few external components, these
regulators are very simple to use and include internal frequency compensation
and a fixed-frequency oscillator. The LM2576 series offers a high-efficiency
replacement for popular three-terminal linear regulators. It substantially
reduces the size of the heat sink, and in some cases no heat sink is required
(Texas Instruments, 2013). A typical application of LM2576 is shown below in
Fig. 2.5.1.

Other features include a
specified ± 4% tolerance on output voltage within specified input voltages and
output load conditions, and ± 10% on the oscillator frequency. External
shutdown is included, featuring 50 ?A (typical) standby current. The output
switch includes cycle-by-cycle current limiting, as well as thermal shutdown for
full protection under fault conditions (Texas Instruments, 2013).


Figure 2.5.0
LM2576 IC (ti.com, 2015).



2.5.1 LM2576 Application circuit from datasheet (ti.com, 2013).


2.6 USB

USB is currently a very popular computer interface
specification used to connect various peripheral devices to computers and
microcontrollers. Some microcontrollers provide built-in USB modules. The
18F4550, for example, has built-in USB interface capabilities.

The USB is a high-speed serial interface that can also
provide power to devices connected to it. According to the specification, the
maximum distance of a device from its host is about thirty meters, accomplished
by using five hubs. For longer-distance bus communications, other methods such
as use of Ethernet are recommended.

The USB bus specification comes in three versions:

The earlier version, USB1.1, supports 11Mbps.

USB 2.0 supports up to 480Mbps.

While the new version USB 3.0 supports the payload
throughput up to 4 Gbps.

However, this project implements USB 2.0 and therefore all
further information is related only to USB 2.0 version.

The maximum power available to an external USB device is
limited to about 100mA at 5.0V (Ibrahim, 2008).

Figure 2.6.0 shows
typical USB connectors.

Figure 2.6.0 USB connector.


USB is a four-wire interface implemented using a four-core shielded
cable. Two types of connectors are specified and used: type A and type B. The
pin-out of each type is shown below in figure 2.6.1.

Figure 2.6.1 Type A and B connector.


All four wires have specified colours. The pins and wire
colours of a Type A or Type B connector are given in table 2.6.0 below.

Pin #




+ 5.0 V



Data –



Data +





Table 2.6.0 USB connector pins.


2.7 Ultiboard

Ultiboard is a rapid printed circuit board (PCB) prototyping
environment used by engineering professionals, educators, makers, and students
across many applications. Its seamless integration with Multisim helps circuit
designers save hours of development time with the ability to complete circuit
schematics, SPICE simulation, and PCB layout in the same environment. Ultiboard benefits include the following (National
Instruments, 2015):