You are on page 1of 60

PERSISTENCE OF VISION DISPLAY

CHAPTER ONE

INTRODUCTION
Overview
Background
Objective
Thesis

ESWAR COLLEGE OF ENGINEERING

outline

Page 1

PERSISTENCE OF VISION DISPLAY

1. INTRODUCTION
The purpose of this project is to design and to create a persistence of vision(POV)
display. This display will allow users to upload an image to be displayed through wireless
communication. A persistence of vision (POV) refers to the phenomenon of the human eye in
which an after image exits for a brief time(10ms). A POV display exploits this phenomena by
spinning a one dimensional row of LEDs through a two dimensional space at such a high
frequency that a two dimensional display is visible.

1.1. Overview
Our project uses two standards, serial peripheral interface(SPI) and IEEE 802.11 for
our wireless radio communication. The standard for SPI consists of a 4-wire serial bus that
allows a master/slave communication mode. The wires are the following:

SCLK :

serial clock (output from master)

MOSI :

master output, slave input (output from master)

MISO :

master input, slave output (output from slave)

SS

slave select (output from master)

The IEEE 802.11 standard is for the wireless radio which is controlled by the FCC
regulations for radio frequency devices. This regulation can be found in title 47 part 15
section 243. Since our radio transceiver was designed within the FCC regulations, it meets all
the specifications noted in the section, especially the 500 microvolts/meter at 30 meters.
Our project does not include any exiting patents, copyrights or trademarks. Weve
designed all the hardware from scratch and all the software is our original work with some
assistance from classmates and professor land.

1.2. Background
The original idea for this project came from the brilliant mind of David Bjanes who has
many projects in his project queue. The inspiration came when david saw a video of a similar
POV display on youtube.com. Next we started brainstorming about the orientation of our
POV display. Some ideas we had seen oriented the display on a propeller or circular clock
ESWAR COLLEGE OF ENGINEERING

Page 2

PERSISTENCE OF VISION DISPLAY


while others spun the display around a cylinder. We choose to build column style POV
display in order to reduce the complexity of mapping a Cartesian coordinate system (found in
most rectangular display) to a polar coordinate system.

1.3. Objective
The overall design of this project can be grouped in the following three categories:
electrical design, mechanical design and software design. The most labour intensive portion
of this project was the mechanical design. While the electrical schematics and software
design appear trivial, intregating the hardware with an adept firmware proved to the biggest
challenge of all. Mounting the electrical components onto the mechanical structure- i.e. the
spinning arm- was also quite a challenge. As one can forsee, the nature of our mechanical
design introduced various safety issues that we also had to take into consideration.

1.4. Organization of the Thesis:


In view of the proposed thesis work explanation of theoretical aspects and algorithms
used in this work are presented as per the sequence described below.
Chapter 1 : Describes a brief review of the objectives and goals of the work.
Chapter 2: Discusses the existing technologies and the study of various technologies in
detail.
Chapter 3: Describes the Block diagram, Circuit diagram of the project and its description.
The construction and description of various modules used for the application are described in
detail.
Chapter 4: Explains the Software tools required for the project, the Code developed for the
design.
Chapter 5: Presents the results, overall conclusions of the study and proposes possible
improvements and directions of future research work.
Chapter 6: Presents references.

ESWAR COLLEGE OF ENGINEERING

Page 3

PERSISTENCE OF VISION DISPLAY

CHAPTER TWO

Overview of the
Technologies Used

Embedded system

Bluetooth technology

ESWAR COLLEGE OF ENGINEERING

Page 4

PERSISTENCE OF VISION DISPLAY

2. OVERVIEW OF TECHNOLOGIES USED


Embedded systems are the technology which has lot of scope to develop at any time.
Here it is very much required since this project had wide range of applications wherever there
is a need to display. Embedded system is nothing but a targeted application or a targeting a
single application by using a program.

2.1 Embedded Systems


An embedded system can be defined as a computing device that does a specific
focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax
machine, mobile phone etc. are examples of embedded systems. Each of these appliances will
have a processor and special hardware to meet the specific requirement of the application
along with the embedded software that is executed by the processor for meeting that specific
requirement.
In general, "embedded system" is not an exactly defined term, as many systems have
some element of programmability. For example, Handheld computers share some elements
with embedded systems such as the operating systems and microprocessors which power
them but are not truly embedded systems, because they allow different applications to be
loaded and peripherals to be connected. Embedded systems span all aspects of modern life
and there are many examples of their use. Telecommunications systems employ numerous
embedded systems from telephone switches for the network to mobile phones at the end-user.
Computer networking uses dedicated routers and network bridges to route data.
2.1.1. Advantages of Embedded Systems:
1) They are designed to do a specific task and have real time performance constraints
which must be met.
2) They allow the system hardware to be simplified so costs are reduced.
3) They are usually in the form of small computerized parts in larger devices which
serve a general purpose.
4) The program instructions for embedded systems run with limited computer hardware
resources, little memory and small or even non-existent keyboard or screen.

ESWAR COLLEGE OF ENGINEERING

Page 5

PERSISTENCE OF VISION DISPLAY

2.1.2. Tools
As for other software, embedded system designers use compilers, assemblers, and
debuggers to develop embedded system software. However, they may also use some more
specific tools:
In circuit debuggers or emulators
Utilities to add a checksum or CRC to a program, so the embedded system can

check if the program is valid.


For systems using digital signal processing, developers may use a math workbench

such as MATLAB, Simulink, MathCad, or Mathematica to simulate the mathematics.


They might also use libraries for both the host and target which eliminates developing
DSP routines as done in DSPnano RTOS and Unison Operating System.
Custom compilers and linkers may be used to improve optimization for the

particular hardware.
An embedded system may have its own special language or design tool, or add

enhancements to an existing language such as Forth or Basic.


Another alternative is to add a Real-time operating system or Embedded operating

system, which may have DSP capabilities like DSP nano RTOS.

2.1.3 Software tools can come from several sources:


Software companies that specialize in the embedded market.
Ported from the GNU software development tools.
Sometimes, development tools for a personal computer can be used if the

embedded processor is a close relative to a common PC processor.


As the complexity of embedded systems grows, higher level tools and operating
systems are migrating into machinery where it makes sense. For example, cell phones,
personal digital assistants and other consumer computers often need significant software that
is purchased or provided by a person other than the manufacturer of the electronics. In these
systems, an open programming environment such as Linux, NetBSD, OSGi or Embedded
Java is required so that the third-party software provider can sell to a large market.

ESWAR COLLEGE OF ENGINEERING

Page 6

PERSISTENCE OF VISION DISPLAY

2.2 Bluetooth Technology


Bluetooth is an open specification that enables low-bandwidth, short-range wireless
connections between computers and peripherals, such as mice, cell phones, and personal data
assistants (PDAs).

2.2.1 What Is Bluetooth?


The appeal of the Bluetooth model lies in its convenience for wirelessly transferring
information and small data files between devices. Bluetooth is not a networking solution, so it
is not a competitor of AirPort, Apples wireless networking technology. Nor is it a
replacement for the cables needed by high-bandwidth peripherals, such as FireWire. Rather,
Bluetooth offers a replacement for IrDA (Infrared Data Association) technology, because it is
not constrained by IrDAs shorter range and line-of-sight requirements.

2.2.2 Bluetooth overview:


Bluetooth is a cable-replacement technology designed to wirelessly connect
peripherals, such as mice and mobile phones, to your desktop or laptop computer and to each
other. An inexpensive, low-power, short-range radio-based technology, Bluetooth is not a
wireless networking solution, such as AirPort. Rather, it is an alternative to the IrDA
(Infrared Data Association) standard. Although the IrDA standard, too, supports wireless
communication between peripherals and computers, it has two limiting requirements. First,
IrDA devices must be very close, no more than about 1 meter apart. Second, the
communicating devices must have a direct line of sight to each other. Because it relies on
radio waves, however, Bluetooth communication overcomes these strict.

2.2.3 Requirements:

Bluetooth devices can communicate at ranges of up to 10 meters.

Bluetooth devices do not need to be in direct sight of each other.

This makes Bluetooth communication much more flexible and robust. Its also
important to note that because Bluetooth excels at low-bandwidth data transfer, it is not

ESWAR COLLEGE OF ENGINEERING

Page 7

PERSISTENCE OF VISION DISPLAY


intended as a replacement for high-bandwidth cabled peripherals. For high-bandwidth
devices, such as external hard drives or video cameras, cables are still the best option.
Apple's Bluetooth support is integrated into Mac OS X, version 10.2 and later, and is
based on the Bluetooth Special Interest Group (SIG) specification (discussed in Bluetooth
Architecture). Apple also provides some high-level bridges between Mac OS X functionality
and the Bluetooth protocol stack. This means that many Bluetooth devices work transparently
with computers running Mac OS X version 10.2 and later. The Mac OS X HID Manager, for
example, handles a Bluetooth mouse just as it does a cabled mouse. In many cases, such
high-level bridges allow your application to handle Bluetooth devices without including any
Bluetooth-specific code.

2.2.4 Bluetooth Technology Basics:


Other applications may need to access Bluetooth-specific attributes and messages. For
them, Apple provides a comprehensive API that allows you to take advantage of Bluetooths
unique features. Be sure to read Bluetooth on Mac OS X for a description of the Bluetooth
API available in Mac OS X version 10.2 and later. For concrete examples showing how to
use Apples Bluetooth API, see Developing Bluetooth Applications

2.2.5 What Bluetooth Does Best


The characteristics of Bluetooth technology low cost, low power, and radio based
encouraged the concept of a personal area network (PAN). A PAN envelops the user in a
small, mobile bubble of connectivity that is effortlessly available at any time. Bluetooths
freedom from cables and potential ubiquity make it ideal for carrying your personal network
around with you. With a PAN, the possibilities are limitless:
Imagine being able to connect to the Internet on a dial-up connection you access
through your mobile phone. Surfing the Internet then becomes possible anywhere
your mobile phone can connect to your internet service provider.
Perhaps you prefer to use a traditional mouse with your laptop. Choose a Bluetooth
enabled mouse and you wont have to keep track of a mouse cable.

ESWAR COLLEGE OF ENGINEERING

Page 8

PERSISTENCE OF VISION DISPLAY


If you have a Bluetooth-enabled mobile phone that stores your business information in
the Vcard format, you can easily share this information with your colleagues. Swap
your Vcard with theirs, by wirelessly connecting to their Bluetooth-enabled mobile
phones.

2.2.6 Future Directions for Bluetooth


Industry analysts predict the growing popularity and availability of Bluetooth-enabled
devices. This in turn raises consumer expectations for mobile PANs and provides many
opportunities for vendors to create new products. At the end of 2003, the Bluetooth SIG
released the second version (version 1.2) of the Bluetooth specification. This successor to
version 1.1 provides a number of improvements, including:
Enhanced quality of service (QOS). This guarantees that your human-interface (and
other QOS) devices will get the time to transfer data when they need it.
A more adaptive frequency-hopping algorithm. The new algorithm increases
communication reliability and decreases interference from other wireless emitters
operating the same frequency range. Apples ongoing support for Bluetooth
communication is evidenced by frequent Bluetooth software updates and up-to-date
SDKs. Using the software frameworks and built-in support Apple provides, you can
bring your Bluetooth applications to Mac OS X with ease. Apple is committed to
helping you find ways to provide your customers with the wireless connectivity they
need.

2.2.7 How Bluetooth Works


This section seeks to give you an overview of the technology and specification that
will provide context for the Bluetooth implementation on Mac OS X. If youre already
familiar with the Bluetooth specification and how Bluetooth devices work, you might choose
to skip ahead to Bluetooth on Mac OS X.
Bluetooth devices operate at 2.4 GHz in the license-free, globally available ISM
(Industrial, Scientific, and Medical) radio band. The advantage of operating in this band is
worldwide availability and compatibility. A potential disadvantage is that Bluetooth devices
ESWAR COLLEGE OF ENGINEERING

Page 9

PERSISTENCE OF VISION DISPLAY


must share this band with many other RF emitters. These include automobile security
systems, other wireless communications standards (such as 802.11), and ordinary noise
sources (such as microwave ovens). To overcome this challenge, Bluetooth employs a fast
frequency-hopping scheme and uses shorter packets than other standards in the ISM band.
This scheme makes Bluetooth communication more robust and more secure.

2.2.8 Frequency Hopping


Frequency hopping is literally jumping from frequency to frequency within the ISM
band. After a Bluetooth device sends or receives a packet, it and the Bluetooth device or
devices it is communicating with hop to another frequency before the next packet is sent.

2.2.9 ADVANTAGES:
It allows Bluetooth devices to use the entirety of the available ISM band, while never
transmitting from a fixed frequency for more than a very short time This ensures that
Bluetooth conforms to the ISM restrictions on transmission quantity per frequency.
It ensures that any interference will be short-lived. Any packet that doesn't arrive
safely at its destination can be resent at the next frequency.
It provides a base level of security because it's very difficult for an eavesdropping
device to predict which frequency the Bluetooth devices will use next. Of course, the
connected devices must agree upon the next frequency to use. The Bluetooth
specification. ensures this in two ways. First, it defines a master-slave relationship
between Bluetooth devices. Second, it specifies an algorithm that uses device-specific
information to calculate frequency-hop sequences.
A Bluetooth device operating in master mode can communicate with up to seven
slave devices. To each of its slaves, the master Bluetooth device sends its own unique device
address (similar to an ethernet address) and the value of its internal clock. This information is
used to calculate the frequency-hop sequence. Because the master device and all its slaves
use the same algorithm with the same initial input, the connected devices always arrive
together at the next frequency.

ESWAR COLLEGE OF ENGINEERING

Page 10

PERSISTENCE OF VISION DISPLAY

2.2.10 Power Consumption


As a cable-replacement technology, its not surprising that Bluetooth devices are
usually battery-powered devices, such as wireless mice and mobile phones. To conserve
power, most Bluetooth devices operate as low-power, 1 mW radios (Class 3 radio power).
This gives Bluetooth devices a range of about 510 meters. This range is far enough for
comfortable wireless peripheral communication but close enough to avoid drawing too much
power from the devices power source.

2.2.11 Security
Security is a challenge faced by every communications standard. Wireless
communications present special security challenges. Bluetooth builds security into its model
on several different levels, beginning with the security inherent in its frequency-hopping
scheme (described in Frequency Hopping). At the lowest levels of the protocol stack,
Bluetooth uses the publicly available cipher algorithm known as SAFER+ to authenticate a
devices identity. The generic-access profile depends on this authentication for its devicepairing process. This process involves creating a special link to create and exchange a link
key. Once verified, the link key is used to negotiate an encryption mode the devices will use
for their communication. The topic of Bluetooth security is beyond the scope of this
document. For references that contain more information on Bluetooths encryption and
authentication processes.

2.2.12 Bluetooth Architecture


Bluetooth is both a hardware-based radio system and a software stack that specifies
the linkages between layers. This supports flexibility in implementation across different
devices and platforms. It also provides robust guidelines for maximum interoperability and
compatibility. In this section, youll learn about:
The Bluetooth protocol stack: The protocol stack is the core of the Bluetooth
specification that defines how the technology works.
The Bluetooth profiles: The profiles define how to use Bluetooth technology to
accomplish specific tasks.
ESWAR COLLEGE OF ENGINEERING

Page 11

PERSISTENCE OF VISION DISPLAY

2.2.13 The Bluetooth Protocol Stack


The heart of the Bluetooth specification is the Bluetooth protocol stack. By providing
well-defined layers of functionality, the Bluetooth specification ensures interoperability of
Bluetooth devices and encourages adoption of Bluetooth technology. these layers range from
the low-level radio link to the profiles.

Lower Layers
At the base of the Bluetooth protocol stack is the radio layer. The radio module in a
Bluetooth device is responsible for the modulation and demodulation of data into RF signals
for transmission in the air. The radio layer describes the physical characteristics a Bluetooth
devices receiver-transmitter component must have. These include modulation characteristics,
radio frequency tolerance, and sensitivity level.
Above the radio layer is the baseband and link controller layer. The Bluetooth
specification doesnt establish a clear distinction between the responsibilities of the baseband
and those of the link controller. The best way to think about it is that the baseband portion of
the layer is responsible for properly formatting data for transmission to and from the radio
layer. In addition, it handles the synchronization of links. The link controller portion of this
layer is responsible for carrying out the link managers commands and establishing and
maintaining the link stipulated by the link manager.
The link manager itself translates the host controller interface (HCI) commands it
receives into baseband-level operations. It is responsible for establishing and configuring
links and managing power-change requests, among other tasks. Youve noticed links
mentioned numerous times in the preceding paragraphs. The Bluetooth specification defines
two types of links between Bluetooth devices:

Synchronous,

Connection-Oriented

(SCO),

for

isochronous

and

voice

communication using, for example, headsets

Asynchronous, Connectionless (ACL), for data communication, such as the


exchange of vCards Each link type is associated with a specific packet type. A SCO
link provides reserved channel bandwidth for communication between a master and a
slave, and supports regular, periodic exchange of data with no retransmission of SCO

ESWAR COLLEGE OF ENGINEERING

Page 12

PERSISTENCE OF VISION DISPLAY


packets. An ACL link exists between a master and a slave the moment a connection is
established. The data packets Bluetooth uses for ACL links all have 142 bits of
encoding information in addition to a payload that can be as large as 2712 bits. The
extra amount of data encoding heightens transmission security. It also helps to
maintain a robust communication link in an environment filled with other devices and
common noise.

The HCI (host controller interface) layer acts as a boundary between the lower
layers of the Bluetooth protocol stack and the upper layers. The Bluetooth
specification defines a standard HCI to support Bluetooth systems that are
implemented across two separate processors. For example, a Bluetooth system on a
computer might use a Bluetooth modules processor to implement the lower layers of
the stack (radio, baseband, link controller, and link manager). It might then use its
own processor to implement the upper layers (L2CAP, RFCOMM, OBEX, and
selected profiles). In this scheme, the lower portion is known as the Bluetooth module
and the upper portion as the Bluetooth host. Of course, its not required to partition the
Bluetooth stack in this way. Bluetooth headsets, for example combine the module and
host portions of the stack on one processor because they need to be small and selfcontained. In such devices, the HCI may not be implemented at all unless device
testing is required.
Because the Bluetooth HCI is well defined, you can write drivers that handle different

Bluetooth modules from different manufacturers. Apple provides an HCI controller object
that supports a USB implementation of the HCI layer.

Upper layers
Above the HCI layer are the upper layers of the protocol stack. The first of these is the
L2CAP (logical link control and adaptation protocol) layer. The L2CAP is primarily
responsible for:

Establishing connections across existing ACL links or requesting an ACL link if one
does not already exist

Multiplexing between different higher layer protocols, such as RFCOMM and SDP, to
allow many different applications to use a single ACL link

ESWAR COLLEGE OF ENGINEERING

Page 13

PERSISTENCE OF VISION DISPLAY

Repackaging the data packets it receives from the higher layers into the form expected
by the lower layers. The L2CAP employs the concept of channels to keep track of
where data packets come from and where they should go. You can think of a channel
as a logical representation of the data flow between the L2CAP layers in remote
devices. Because it plays such a central role in the communication between the upper
and lower layers of the Bluetooth protocol stack, the L2CAP layer is a required part of
every Bluetooth system.
Above the L2CAP layer, the remaining layers of the Bluetooth protocol stack arent

quite so linearly ordered. However, it makes sense to discuss the service discovery protocol
next, because it exists independently of other higher-level protocol layers. In addition, it is
common to every Bluetooth device.
The SDP (service discovery protocol) defines actions for both servers and clients of
Bluetooth services. The specification defines a service as any feature that is usable by another
(remote) Bluetooth device. A single Bluetooth device can be both a server and a client of
services. An example of this is the Macintosh computer itself. Using the file transfer profile a
Macintosh computer can browse the files on another device and allow other devices to
browse its files.
An SDP client communicates with an SDP server using a reserved channel on an
L2CAP link to find out what services are available. When the client finds the desired service,
it requests a separate connection to use the service. The reserved channel is dedicated to SDP
communication so that a device always knows how to connect to the SDP service on any
other device. An SDP server maintains its own SDP database, which is a set of service
records that describe the services the server offers.
Along with information describing how a client can connect to the service, the service
record contains the services UUID, or universally unique identifier.
Also above the L2CAP layer is the RFCOMM layer. The RFCOMM protocol
emulates the serial cable line settings and status of an RS-232 serial port. By providing serialport emulation, RFCOMM supports legacy serial-port applications. It also supports the
OBEX protocol and several of the Bluetooth profiles.

ESWAR COLLEGE OF ENGINEERING

Page 14

PERSISTENCE OF VISION DISPLAY


OBEX (object exchange) is a transfer protocol that defines data objects and a
communication protocol two devices can use to easily exchange those objects. Bluetooth
adopted OBEX from the IrDA IrOBEX specification because the lower layers of the IrOBEX
protocol are very similar to the lower layers of the Bluetooth protocol stack. In addition, the
IrOBEX protocol is already widely accepted and therefore a good choice for the Bluetooth
SIG, which strives to promote adoption by using existing technologies. A Bluetooth device
wanting to set up an OBEX communication session with another device is considered to be
the client device.
1. The client first sends SDP requests to make sure the other device can act as a server
of OBEX services.
2. If the server device can provide OBEX services, it responds with its OBEX service
record. This record contains the RFCOMM channel number the client should use to establish
an RFCOMM channel.
3. Further communication between the two devices is conveyed in packets, which
contain requests and responses, and data. The format of the packet is defined by the OBEX
session protocol.
Although OBEX can be supported over TCP/IP, this document does not discuss this
option (nor is it described in the Bluetooth specification).

ESWAR COLLEGE OF ENGINEERING

Page 15

PERSISTENCE OF VISION DISPLAY

CHAPTER THREE

HARDWARE
IMPLEMENTATION OF
PROJECT

High Level Design


Electrical Design
AT89S52
Dc motors
Led
Max232
Switches

ESWAR COLLEGE OF ENGINEERING

Page 16

PERSISTENCE OF VISION DISPLAY

3.HARDWARE IMPLEMENTATION OF PROJECT


A persistent of vision display is able to receive images wirelessly to display in a two
dimensional grid. The purpose of this project is to design and to create a persistence of vision
(POV) display. This display will allow users to upload an image to be displayed through
wireless communication. A persistence of vision (POV) refers to the phenomenon of the
human eye in which an after image exists for a brief time (10 ms). A POV display exploits
this phenomena by spinning a one dimensional row of LED's through a two dimensional
space at such a high frequency that a two dimensional display is visible. In our case, we
created a cylindrical display by spinning a column of LED's around a central motor shaft .
The rotational speed of the LED's is fast enough such that the human eye perceives a two
dimensional image.

3.1 High Level Design


The overall design of this project can be grouped in the following three categories:
electrical design, mechanical design, and software design.

Fig1. Hardware setup of POV display

The most labor intensive portion of this project was the mechanical design. While the
electrical schematics and software design appear trivial, integrating the hardware with an
adept firmware proved to the biggest challenge of all. Mounting the electrical components
ESWAR COLLEGE OF ENGINEERING

Page 17

PERSISTENCE OF VISION DISPLAY


onto the mechanical structure - i.e. the spinning arm - was also quite a challenge. As one can
foresee, the nature of our mechanical design introduced various safety issues that we also had
to take into consideration.

Fig 2: Block diagram of POV

3.2 Electrical Design


The electrical components used are:

On-board AT89S52 microcontroller

MAX232

8 RED LEDs

1-9V battery

Bluetooth wireless module

LM7805 Linear Regulator

Various Resistors and capacitors

Various wires and header pins

ESWAR COLLEGE OF ENGINEERING

Page 18

PERSISTENCE OF VISION DISPLAY

3.3 AT89S52 Micro Controller


3.3.1 Features:

Compatible with MCS-51 Products

8K Bytes of In-System Programmable (ISP) Flash Memory

Endurance: 1000 Write/Erase Cycles

4.0V to 5.5V Operating Range

Fully Static Operation: 0 Hz to 33 MHz

Three-level Program Memory Lock

256K Internal RAM

Programmable I/O Lines

3 16-bit Timer/Counters

Eight Interrupt Sources

Full Duplex UART Serial Channel

Low-power Idle and Power-down Modes

Interrupt Recovery from Power-down Mode

Watchdog Timer

Dual Data Pointer

Power-off Flag

3.3.2 Description Of Microcontroller 89S52:


The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with
8Kbytes of in-system programmable Flash memory. The device is manufactured using
Atmels high-density nonvolatile memory technology and is compatible with the industrystandard 80C51 micro controller. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with in-system programmable flash one monolithic chip; the
Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and costeffective solution to many embedded control applications.
The device is manufactured using Atmels high-density nonvolatile memory
technology and is compatible with the industry-standard 80C51 micro controller.

ESWAR COLLEGE OF ENGINEERING

Page 19

PERSISTENCE OF VISION DISPLAY

Fig 3. Pin configuration of 89S52

The on-chip Flash allows the program memory to be reprogrammed in-system or by a


conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with insystem programmable flash one monolithic chip; the Atmel AT89S52 is a powerful micro
controller, which provides a highly flexible and cost-effective solution to many embedded
control applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes
of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, full
duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is
designed with static logic for perationdown to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM
timer/counters, serial port, and interrupt system to continue functioning. The Power-down
mode saves the RAM contents but freezes the oscillator, disabling all other chip functions
until the next interrupt Or hardware reset.

ESWAR COLLEGE OF ENGINEERING

Page 20

PERSISTENCE OF VISION DISPLAY

fig 4. Block diagram of 89S52

ESWAR COLLEGE OF ENGINEERING

Page 21

PERSISTENCE OF VISION DISPLAY

3.3.3. Pin Description Of Microcontroller 89S52

VCC

Supply voltage.

GND

Ground

Port 0
Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high
impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data
bus during accesses to external program and data memory. In this mode, P0 has internal pullups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes
during program verification. External pull-ups are required during program verification

Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 Output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled
high by the internal pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be
configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2
trigger input P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives
the low-order address bytes during Flash programming and verification.

Port Pin
P1.0
P1.1
P1.5
P1.6
P1.7

Alternate Functions
T2(External Count input to Timer/Counter 2), clock-out
T2EX (Timer/ Counter 2 capture/reload trigger and direction control)
MOSI (used for In-system Programming)
MISO (used for In-system Programming)
SCK (used for In-system Programming)
Table 1: Functions of Port1

Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled
high by the internal pull-ups and can be used as inputs. Port 2 emits the high-order address
byte during fetches from external program memory and during accesses to external data
ESWAR COLLEGE OF ENGINEERING

Page 22

PERSISTENCE OF VISION DISPLAY


memory that use 16-bit addresses (MOVX @DPTR). In this application, Port 2 uses strong
internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit
addresses (MOVX @ RI), Port 2emits the contents of the P2 Special Function Register. Port
2 also receives the high-order address bits and some control signals during Flash
programming and verification.

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are writt 1s are written to Port 3 pins, they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that
are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the AT89S52, as shown in the following
table. Port 3 also receives some control signals for Flash programming and verification.

Port Pin
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

Alternate Functions
RXD (serial input port)
TXD (serial output port)
INT0 (external interrupt 0)
INT1 (external interrupt 1)
T0 (timer 0 external input)
T1 (timer 1 external input)
WR (external data memory write strobe)
RD (external data memory read strobe)
Table2: Functions of Port3

RST
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.

ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse input (PROG)
during Flash programming. In normal operation, ALE is emitted at a constant rate of1/6 the
oscillator frequency and may be used for external timing or clocking purposes. Note,
however, that one ALE pulse is skipped during each access to external data Memory. If
ESWAR COLLEGE OF ENGINEERING

Page 23

PERSISTENCE OF VISION DISPLAY


desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set,
ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly
pulled high. Setting the ALE-disable bit has no effect if the micro controller is in external
execution mode.

PSEN
Program Store Enable (PSEN) is the read strobe to external program memory. When
the AT89S52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access to
external data memory.

EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be
strapped to VCC for internal program executions. This pin also receives the 12voltProgramming enables voltage (VPP) during Flash programming.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.

XTAL2
Output from the inverting oscillator amplifier.

Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
that can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an External clock source,
XTAL2 should be left unconnected while XTAL1 is driven.

ESWAR COLLEGE OF ENGINEERING

Page 24

PERSISTENCE OF VISION DISPLAY

Fig 5. Oscillator Connections

Special Function Register (SFR) Memory:


Special Function Registers (SFR s) are areas of memory that control specific
functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32
input/output lines. Another SFR allows the user to set the serial baud rate, control and access
timers, and configure the 8051s interrupt system.

Accumulator:
The Accumulator, as its name suggests is used as a general register to accumulate the
results of a large number of instructions. It can hold 8-bit (1-byte) value and is the most
versatile register.
The R registers: The R registers are a set of eight registers that are named R0, R1.
Etc up to R7. These registers are used as auxiliary registers in many operations.
The B registers: The B register is very similar to the accumulator in the sense
that it may hold an 8-bit (1-byte) value. Two only uses the B register 8051 instructions:
MUL AB and DIV AB.
The Data Pointer: The Data pointer (DPTR) is the 8051s only user accessible 16-bit
(2Bytes) register. The accumulator, R registers are all 1-Byte values. DPTR, as the name
suggests, is used to point to data. It is used by a number of commands, which allow the 8051
to access external memory.

ESWAR COLLEGE OF ENGINEERING

Page 25

PERSISTENCE OF VISION DISPLAY

The program counter and stack pointer:


The program counter (PC) is a 2-byte address, which tells the 8051 where the next
instruction to execute is found in memory. The stack pointer like all registers except DPTR
and PC may hold an 8-bit (1-Byte) value

3.3.4. Addressing modes:


An addressing mode refers that you are addressing a given memory location. In
summary, the addressing modes are as follows, with an example of each:
Each of these addressing modes provides important flexibility.

Immediate Addressing

MOV A, #20 H

Direct Addressing

MOV A, 30 H

Indirect Addressing

MOV A, @R0

Indexed Addressing
a. External Direct
b. Code In direct

MOVX A, @DPTR
MOVC A, @A+DPTR

Immediate Addressing:
Immediate addressing is so named because the value to be stored in memory
immediately follows the operation code in memory. That is to say, the instruction itself
dictates what value will be stored in memory. For example, the instruction:
MOV A, #20H
This instruction uses immediate Addressing because the accumulator will be loaded
with the value that immediately follows in this case 20(hexadecimal). Immediate addressing
is very fast since the value to be loaded is included in the instruction. However, since the
value to be loaded is fixed at compile-time it is not very flexible.

Direct Addressing:
Direct addressing is so named because the value to be stored in memory is obtained
by directly retrieving it from another memory location.
For example: MOV A, 30h

ESWAR COLLEGE OF ENGINEERING

Page 26

PERSISTENCE OF VISION DISPLAY


This instruction will read the data out of internal RAM address 30(hexadecimal) and
store it in the Accumulator. Direct addressing is generally fast since, although the value to be
loaded isnt included in the instruction, it is quickly accessible since it is stored in the 8051s
internal RAM. It is also much more flexible than Immediate Addressing since the value to be
loaded is whatever is found at the given address which may variable.
Also it is important to note that when using direct addressing any instruction that
refers to an address between 00h and 7Fh is referring to the SFR control registers that control
the 8051 micro controller itself.

Indirect Addressing:
Indirect addressing is a very powerful addressing mode, which in many cases
provides an exceptional level of flexibility. Indirect addressing is also the only way to access
the extra 128 bytes of internal RAM found on the 8052. Indirect addressing appears as
follows:
MOV A, @R0:
This instruction causes the 8051 to analyze Special Function Register (SFR) Memory:
Special Function Registers (SFRs) are areas of memory that control specific
functionality of the 8051 processor. For example, four SFRs permit access to the 8051s 32
input/output lines. Another SFR allows the user to set the serial baud rate, control and access
timers, and configure the 8051s interrupt system.

Timer 2 Registers:
Control and status bits are contained in registers T2CON and T2MOD for
Timer 2 . The register pair (RCAP2H , RCAP2L) are the Capture / Reload registers for
Timer 2 in 16-bit capture mode or 16-bit auto-reload mode .

Interrupt Registers:
The individual interrupt enable bits are in the IE register . Two priorities can
be set for each of the six interrupt sources in the IP register.
Timer 2 is a 16-bit Timer / Counter that can operate as either a timer or an
event counter. The type of operation is selected by bit C/T2 in the SFR T2CON .
Timer 2 has three operating Modes : capture , auto-reload ( up or down Counting ) , and
baud rate generator . The modes are selected by bits in T2CON . Timer 2 consists of
ESWAR COLLEGE OF ENGINEERING

Page 27

PERSISTENCE OF VISION DISPLAY


two 8-bit

registers , TH2 and TL2 . In

the Timer function , the

TL2 register is

incremented every machine cycle . Since a machine cycle consists of 12 oscillator


periods, the count rate is 1/12 of the oscillator frequency.In the Counter function , the
register is incremented in response to a 1-to-0 transition at its corresponding external
input pin , T2 .When the samples show a high in one cycle and a low in the next
cycle, the count is incremented . Since two machine cycles (24 Oscillator periods ) are
required to

recognize

1-to-0 transition , the maximum count rate

is 1 / 24 of the

oscillator frequency . To ensure that a given level is sampled at least once before
it changes , the level should be held for atleast

Symbol
EA

Position
IE.7

ET2
ES
ET1
EX1
ET0
EX0

IE.6
IE.5
IE.4
IE.3
IE.2
IE.1
IE.0

one full machine cycle .

Function
Disables all interrupts. If EA=0, no interrupt is acknowledged. If
EA=1, each interrupt source is individually enabled or disabled by
setting or clearing its enable bit.
Reserved
Timer2 interrupt enable bit
Serial port interrupt enable bit
Timer1 interrupt enable bit
External interrupt1 enable bit
Timer0 interrupt enable bit
External interrupt0 enable bit
Table3: Interrupt Register Functions

Capture Mode
In the capture mode , two options are selected by bit EXEN2 in T2CON . If
EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2
in T2CON . This bit can then be used to generate an interrupt . If EXEN2 = 1 , Timer
2 performs the same operation , but a 1-to-0 transition at external input T2EX also
causes the current value

in TH2

and

TL2

to be captured into RCAP2H and

RCAP2L , respectively Auto-reload (Up or Down Counter).


Timer 2 can be programmed to count up or down when configured in its 16bit auto-reload mode. This feature is invoked by the DCEN (Down Counter Enable)
bit located in the SFR T2MOD . Upon reset , the DCEN bit is set to 0 so that
timer 2 will default to count up. When DCEN is set , Timer 2 can count up or down
, depending on the value of the T2EX pin . In this mode , two options are selected
ESWAR COLLEGE OF ENGINEERING

Page 28

PERSISTENCE OF VISION DISPLAY


by bit EXEN2 in T2CON . If EXEN2 = 0 , Timer 2 counts up to 0FFFFH and then
sets the TF2 bit upon overflow . If EXEN2 = 1 , a 16-bit reload can be triggered
either by an overflow or by a 1-to-0 transition at external input T2EX.

3.5. Baud Rate Generator


Timer 2 is selected

as the baud rate generator

by setting

TCLK

and/or

RCLK in T2CON . Note that the baud rates for transmit and receive can be different
if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other
function .The baud rates in Modes 1 and 3 aredetermined by Timer 2s overflow rate
according to the following equation .
Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate16
The timer operation is different for Timer 2 when it is used as a baud rate
generator .Normally ,as a timer , it increments every machine cycle (at 1/12 the
oscillator frequency).As a baud rate generator , however, it increments every state time (
at 1/2 the oscillator frequency ) .

Timer 0
Timer 0 functions as either a timer or event counter

in four

modes of

operation . Timer 0 is controlled by the four lower bits of the TMOD register and
bits 0, 1, 4 and 5 of the TCON register

Mode 0 ( 13-bit Timer)


Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit
timer (TH0 register) with a modulo 32 prescaler implemented with the lower five
bits of the TL0 register . The upper three bits of TL0 register are indeterminate and
should be ignored . Prescaler overflow increments the TH0 register.

Mode 1 ( 16-bit Timer )


Mode 1 is the same as Mode 0, except that the Timer register is being
run with all 16 bits . Mode 1 configures timer 0 as a 16-bit timer with the TH0
and TL0 registers connected in cascade . The selected input increments the TL0
register .
ESWAR COLLEGE OF ENGINEERING

Page 29

PERSISTENCE OF VISION DISPLAY

Mode 2 (8-bit Timer with Auto-Reload)


Mode 2

configures

timer 0

as

an

8-bit timer ( TL0 register ) that

automatically reloads from the TH0 register . TL0 overflow sets TF0 flag in the
TCON register and reloads TL0

with the contents of TH0 , which is preset by

software .

Mode 3 ( Two 8-bit Timers )


Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate
8-bit timers. This

mode is provided

for applications requiring an additional 8-bit

timer or counter .

Timer 1
Timer 1 is identical to timer 0 , except for mode 3 , which is a hold-count
mode .

Mode 3 ( Halt )
Placing Timer 1 in mode 3 causes it to halt and hold its count . This can
be used to halt Timer 1 when TR1 run control bit is not available i.e. , when
Timer 0 is in mode 3 .

Baud Rates :
The baud rate in Mode 0 is fixed. The baud

rate in Mode 2 depends

on the value of bit SMOD in Special Function Register PCON. If SMOD = 0


(which is its value on reset), the baud

rate is 1/64 the oscillator

frequency . If

SMOD = 1, the baud rate is 1/32 the oscillator frequency. In the 89S52 , the baud
rates in Modes 1 and 3 are determined by the Timer 1 overflow rate. In case of
Timer 2 , these baud rates can be determined by Timer 1 , or by Timer 2 , or by
both (one for transmit and the other for receive ).

ESWAR COLLEGE OF ENGINEERING

Page 30

PERSISTENCE OF VISION DISPLAY

TCON REGISTER :

7
TF1

Bit
number
7

6
TR1

Timer/counter Control Register

5
TF0

4
TR0

Bit
Mnumonic
TF1

3
IE1

2
IT1

1
IE0

0
IT0

Description
Timer 1 Overflow flag
Cleared by hardware when processor vectors to interrupt routine
Set by hardware on timer/counter overflow, when the timer1
register overflows
Timer1 Run Control Bit
Clear to turn off timer/counter 1
Set to turn on timer/counter 1

TR1

TF0

TR0

Timer 0 Run Control Bit


Clear to turn off timer/counter 0
Set tot urn on timer/counter 0

IE1

Interrupt1 Edge Flag


Cleared by hardware when interrupt is processed if edge-triggered
Set by hardware when external interrupt is detected on NT1#pin

IT1

Interrupt1 Type Control Bit


Clear to select low level active for external interrupt 1
Set to select falling edge active for external interrupt 1

IE0

Interrupt 0 edge flag


Cleared by hardware when interrupt is processed if edge-triggered
Set by hardware when external interrupt is detected on NT0#pin

IT0

Interrupt0 Type Control Bit


Clear to select low level active for external interrupt0
Set to select falling edge active for external interrupt0

Timer 0 overflow flag


Cleared by hardware when processor vectors to interrupt routine
Set by hardware on timer/counter overflow, when the timer0
register overflows

Table 4: TCON Register functions


ESWAR COLLEGE OF ENGINEERING

Page 31

PERSISTENCE OF VISION DISPLAY

TMOD REGISTER:
7
GATE1

6
C/T1#

Bit
Number

Bit
Mnumonic

GATE1

C/T1#

M11

M01

GATE0

C/T0#

M10

M00

Timer/Counter 0 and 1 Modes

5
M11

4
M01

3
GATE0

2
C/T0#

1
M10

0
M00

Description
Timer1 Gain Control Bit
Clear to enable timer1 whenever the TR1 bit is set
Set to enable timer1 only when the INT1#pin is high and TR1 bit is
set
Timer1 Counter/timer Select Bit
Clear for timer operation:Timer0 counts the divided-down system
clock
Set for counter operation:timer1 counts negative transitions on
external pin T1
Timer1 mode select bits
M11 M01 Operating mode
0
0 Mode0:8-bit timer/counter(TH1) wuth 8-bit prescaler(TL1)
0
1 Mode 1: 16-bit timer/counter
1
0 Mode2:8bit auto reload timer/countert(TL1).
1
1 Mode 3: Timer1 hacked. Retains count

Timer1 gain Control Bit


Clear to enable timer0 whenever the TR0 bit is set
Set to enable timer/counter0 only when the INT0#pin is high and
the TR0 pin is set
Timer0 Counter/timer select bit
Clear for timer operation: timer0 counts the divided-down system
clock
Set for counter operation:Timer 0 counts negative transitions on
external pin T0
Timer0 Mode Select Bit
M10 M00 Operating mode
0
0 Mode0:8 bit timer/counter(TH0) with 8bit prescaler
0
1 Mode1:16-bit timer/counter
1
0 Mode2:8bit auto reload timer/counter(TL0)
1
1 Mode3:TL0 is an 8bit timer/counter

TH0 is an 8bit timer using timer1s TR0 and TF0 bits

Table 5: TMOD Register Functions


ESWAR COLLEGE OF ENGINEERING

Page 32

PERSISTENCE OF VISION DISPLAY

3.4. DC MOTORS
Industrial applications use dc motors because the speed-torque relationship can be
varied to almost any useful form for both dc motor and regeneration applications in either
direction of rotation. Continuous operation of dc motors is commonly available over a speed
range of 8:1. Infinite range (smooth control down to zero speed) for short durations or
reduced load is also common. Dc motors are often applied where they momentarily deliver
three or more times their rated torque. In emergency situations, dc motors can supply over
five times rated torque without stalling (power supply permitting). Dynamic braking (dc
motor-generated energy is fed to a resistor grid) or regenerative braking (dc motor-generated
energy is fed back into the dc motor supply) can be obtained with dc motors on applications
requiring quick stops, thus eliminating the need for, or reducing the size of, a mechanical
brake. Dc motors feature a speed, which can be controlled smoothly down to zero,
immediately followed by acceleration in the opposite direction without power circuit
switching. And dc motors respond quickly to changes in control signals due to the dc motor's
high ratio of torque to inertia. In any electric motor, operation is based on simple
electromagnetism. A current carrying conductor generates a magnetic field; when this is then
placed in an external magnetic field, it will experience a force proportional to the current in
the conductor, and to the strength of the external magnetic field. As you are well aware of
from playing with magnets as a kid, opposite (North and South) polarities attract, while like
polarities (North and North, South and South) repel. The internal configuration of a DC
motor is designed to harness the magnetic interaction between a current carrying conductor
and an external magnetic field to generate rotational motion. Let's start by looking at a simple
2-pole DC electric motor (here red represents a magnet or winding with a "North"
polarization, while green represents a magnet or winding with a "South" polarization).
Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator,
commentator, field magnet(s), and brushes. In most common DC motors (and all that
BEAMers will see), the external magnetic field is produced by high-strength permanent
magnets1. The stator is the stationary part of the motor this includes the motor casing, as well
as two or more permanent magnet pole pieces. The rotors (together with the axle and attached
commentator) rotate with respect to the stator. The rotor consists of windings (generally on a
core), the windings being electrically connected to the commentator. The above diagram
shows a common motor layout -- with the rotor inside the stator (field) magnets.
ESWAR COLLEGE OF ENGINEERING

Page 33

PERSISTENCE OF VISION DISPLAY

Fig 6. 2-pole DC electric motor

Theory of DC motor speed control:


The speed controller works by varying the average voltage sent to the motor. It could
do this by simply adjusting the voltage sent to the motor, but this is quite inefficient to do. A
better way is to switch the motor's supply on and off very quickly. If the switching is fast
enough, the motor doesn't notice it, it only notices the average effect. When you watch a film
in the cinema, or the television, what you are actually seeing is a series of fixed pictures,
which change rapidly enough that your eyes just see the average effect movement.
Your brain fills in the gaps to give an average effect. Now imagine a light bulb with a
switch. When you close the switch, the bulb goes on and is at full brightness, say 100 Watts.
When you open the switch it goes off (0 Watts). Now if you close the switch for a fraction of
a second, and then open it for the same amount of time, the filament won't have time to cool
down and heat up, and you will just get an average glow of 50 Watts.
This is how lamp dimmers work, and the same principle is used by speed controllers
to drive a motor. When the switch is closed, the motor sees 12 Volts, and when it is open it
sees 0 Volts. If the switch is open for the same amount of time as it is closed, the motor will
see an average of 6 Volts, and will run more slowly accordingly. As the amount of time that
the voltage is on increases compared with the amount of time that it is off, the average speed
of the motor increases.
This on-off switching is performed by power MOSFETs. A MOSFET (Metal-OxideSemiconductor Field Effect Transistor) is a device that can turn very large currents on and off
ESWAR COLLEGE OF ENGINEERING

Page 34

PERSISTENCE OF VISION DISPLAY


under the control of a low signal level voltage. For more detailed information, see the
dedicated chapter on MOSFETs) .The time that it takes a motor to speed up and slow down
under switching conditions is dependent on the inertia of the rotor (basically how heavy it is),
and how much friction and load torque there is. The graph below shows the speed of a motor
that is being turned on and off fairly slowly:

Fig 7. Speed of the motor

ESWAR COLLEGE OF ENGINEERING

Page 35

PERSISTENCE OF VISION DISPLAY

3.5. LED (LIGHT EMITTING DIODE)


A light-emitting diode (LED) is a semiconductor diode that emits light when an
electrical current is applied in the forward direction of the device, as in the simple LED
circuit. The effect is a form of electroluminescence. where incoherent and narrow-spectrum
light is emitted from the p-n junction..
LEDs are widely used as indicator lights on electronic devices and increasingly in
higher power applications such as flashlights and area lighting. An LED is usually a small
area (less than 1 mm2) light source, often with optics added to the chip to shape its radiation
pattern and assist in reflection. The color of the emitted light depends on the composition and
condition of the semi conducting material used, and can be infrared, visible, or ultraviolet.
Besides lighting, interesting applications include using UV-LEDs for sterilization of water
and disinfection of devices, and as a grow light to enhance photosynthesis in plants.

Basic principle:
Like a normal diode, the LED consists of a chip of semi conducting material
impregnated, or doped, with impurities to create a p-n junction. As in other diodes, current
flows easily from the p-side, or anode, to the n-side, or cathode, but not in the reverse
direction. Charge-carriers electrons and holes flow into the junction from electrodes with
different voltages. When an electron meets a hole, it falls into a lower energy level, and
releases energy in the form of a photon.
The wavelength of the light emitted, and therefore its color, depends on the band gap
energy of the materials forming the p-n junction. In silicon or germanium diodes, the
electrons and holes recombine by a non-radioactive transition which produces no optical
emission, because these are indirect band gap materials.
The materials used for the LED have a direct band gap with energies corresponding to
near-infrared, visible or near-ultraviolet light. LED development began with infrared and red
devices made with gallium arsenide. Advances in materials science have made possible the
production of devices with ever-shorter wavelengths, producing light in a variety of colors.
LEDs are usually built on an n-type substrate, with an electrode attached to the p-type layer

ESWAR COLLEGE OF ENGINEERING

Page 36

PERSISTENCE OF VISION DISPLAY


deposited on its surface. P-type substrates, while less common, occur as well. Many
commercial LEDs, especially GaN/InGaN, also use sapphire substrate.

Fig 8. Working of LED

3.5.1 LED Display types:

Bar graph

Seven segment

Star burst

Dot matrix

3.5.2 Basic LED types:


Miniature LEDs

Fig 9. Miniature LEDs


ESWAR COLLEGE OF ENGINEERING

Page 37

PERSISTENCE OF VISION DISPLAY


Different sized LEDs. 8 mm, 5mm and 3 mm. These are mostly single-die LEDs used as
indicators, and they come in various-size packages:
Surface mount

2 mm.

3 mm (T1).

5 mm(T1).

10 mm.

Other sizes are also available, but less common.

Common package shapes:

Round, dome top.

Round, flat top.

Rectangular, flat top (often seen in LED bar-graph displays)

Triangular or square, flat top

The encapsulation may also be clear or semi opaque to improve contrast and viewing angle.
There are three main categories of miniature single die LEDs:

Low current typically rated for 2mA at around 2V (approximately 4mW


consumption).

Standard 20 mA LEDs at around 2 V (approximately 40mW) for red, orange, yellow


& green, and 20 mA at 45 V (approximately 100mW) for blue, violet and white.

Ultra-high output 20 mA at approximately 2 V or 45 V, designed for viewing in


direct sunlight.

Five- and twelve-volt LEDs


These are miniature LEDs incorporating a series resistor, and may be connected
directly to a 5 V or 12 V supply.
Flashing LEDs
Flashing LEDs are used as attention seeking indicators where it is desired to avoid the
complexity of external electronics. Flashing LEDs resemble standard LEDs but they contain
an integrated multivibrator circuit inside which causes the LED to flash with a typical period
of one second. In diffused lens LEDs this is visible as a small black dot. Most flashing LEDs

ESWAR COLLEGE OF ENGINEERING

Page 38

PERSISTENCE OF VISION DISPLAY


emit light of a single color, but more sophisticated devices can flash between multiple colors
and even fade through a color sequence using RGB color mixing.
High power LEDs
High power LEDs from limitless mounted on a star shaped heat sink High power
LEDs (HPLED) can be driven at more than one ampere of current and give out large amounts
of light. Since overheating destroys any LED the HPLEDs must be highly efficient to
minimize excess heat, furthermore they are often mounted on a heat sink to allow for heat
dissipation. If the heat from a HPLED is not removed the device will burn out in seconds.
A single HPLED can often replace an incandescent bulb in a flashlight or be set in an
array to form a powerful LED lamp. LEDs have been developed that can run directly from
mains power without the need for a DC converter. For each half cycle part of the LED diode
emits light and part is dark, and this is reversed during the next half cycle. Current efficiency
is 80 lm/W..
Multi-color LEDs
A bi-color LED is actually two different LEDs in one case. It consists of two dies
connected to the same two leads but in opposite directions. Current flow in one direction
produces one color, and current in the opposite direction produces the other color. Alternating
the two colors with sufficient frequency causes the appearance of a third color. A tri-color
LED is also two LEDs in one case, but the two LEDs are connected to separate leads so that
the two LEDs can be controlled independently and lit simultaneously.RGB LEDs contain red,
green and blue emitters, generally using a four-wire connection with one common (anode or
cathode). The Taiwanese LED manufacturer. Ever light has introduced a 3 watt RGB
package capable of driving each die at 1 watt.
Alphanumeric LEDs
LED displays are available in seven-segment and starburst format. Seven-segment
displays handle all numbers and a limited set of letters. Starburst displays can display all
letters. Seven-segment LED displays were in widespread use in the 1970s and 1980s, but
increasing use of liquid crystal displays, with their lower power consumption and greater
display flexibility, has reduced the popularity of numeric and alphanumeric LED displays.

ESWAR COLLEGE OF ENGINEERING

Page 39

PERSISTENCE OF VISION DISPLAY

3.5.3 Applications:
Automotive applications with LEDS
Instrument Panels & Switches, Courtesy Lighting, CHMSL, Rear Stop/Turn/Tai,
Retrofits, New Turn/Tail/Marker Lights.
Consumer electronics & general indication
Household appliances, VCR/DVD/ tereo/Audio/Video devices,

Toys/Games

Instrumentation, Security Equipment, Switches.


Illumination with LEDs
Architectural Lighting, Signage (Channel Letters), Machine Vision, Retail Displays,
Emergency Lighting (Exit Signs), Neon and bulb Replacement, Flashlights, Accent Lighting
- Pathways, Marker Lights.
Sign applications with LEDs
Full Color Video, Monochrome Message Boards, Traffic/VMS, Transportation
Passenger Information.
Signal application with LEDs
Traffic, Rail, Aviation, Tower Lights, Runway Lights, Emergency/Police Vehicle
Lighting.
Mobile applications with LEDs
Mobile Phone, PDA's, Digital Cameras, Lap Tops, General Backlighting.
Photo sensor applications with LEDs
Medical Instrumentation, Bar Code Readers, Color & Money Sensors, Encoders,
Optical Switches, Fiber Optic Communication.

ESWAR COLLEGE OF ENGINEERING

Page 40

PERSISTENCE OF VISION DISPLAY

3.6 MAX 232


A standard serial interface for PC, RS232C, requires negative logic, i.e., logic 1 is 3V to -12V and logic 0 is +3V to +12V. To convert TTL logic, say, TxD and RxD pins of the
microcontroller thus need a converter chip. A MAX232 chip has long been using in many
microcontrollers boards. It is a dual RS232 receiver / transmitter that meets all RS232
specifications while using only +5V power supply. It has two onboard charge pump voltage
converters which generate +10V to -10V power supplies from a single 5V supply. It has four
level translators, two of which are RS232 transmitters that convert TTL/CMOS input levels
into +9V RS232 outputs. The other two level translators are RS232 receivers that convert
RS232 input to 5V. Typical MAX232 circuit is shown below.

Fig 10. Pin configuration of MAX232


ESWAR COLLEGE OF ENGINEERING

Page 41

PERSISTENCE OF VISION DISPLAY

Features:

Operates With Single 5-V Power Supply


LinBiCMOSE Process Technology
Two Drivers and Two Receivers
30-V Input Levels
Low Supply Current 8 mA Typical
Meets or Exceeds TIA/EIA-232-F and ITU Recommendation V.28
Designed to be Interchangeable With Maxim MAX232
Applications
TIA/EIA-232-F
Battery-Powered Systems
Terminals
Modems
Computers
ESD Protection Exceeds 2000 V Per MIL-STD-883, Method 3015
Package Options Include Plastic
Small-Outline (D, DW) Packages and
Standard Plastic (N) DIPs

Circuit connections:
A standard serial interfacing for PC, RS232C, requires negative logic, i.e., logic '1' is 3V to -12V and logic '0' is +3V to +12V. To convert a TTL logic, say, TxD and RxD pins of
the uC chips, thus need a converter chip. A MAX232 chip has long been using in many uC
boards. It provides 2-channel RS232C port and requires external 10uF capacitors.

Fig 9. MAX232

ESWAR COLLEGE OF ENGINEERING

Page 42

PERSISTENCE OF VISION DISPLAY

Fig 10. Pin configuration of MAX232

3.7 SWITCHES
A switch is a mechanical device used to connect and disconnect an electric circuit at
will. Switches cover a wide range of types, from subminiature up to industrial plant switching
megawatts of power on high voltage distribution lines. In applications where multiple
switching options are required (e.g., a telephone service).
The switch is referred to as a "gate" when abstracted to mathematical form. In the
philosophy of logic, operational arguments are represented as logic gates. The use of
electronic gates to function as a system of logical gates is the fundamental basis for the
computer i.e. a computer is a system of electronic switches which function as logical gates.

Fig 11. Switches

ESWAR COLLEGE OF ENGINEERING

Page 43

PERSISTENCE OF VISION DISPLAY

3.7.1 Types of switches


A pair of contacts is said to be 'closed' when there is no space between them, allowing
electricity to flow from one to the other. When the contacts are separated by an insulating air
gap, an air space, they are said to be 'open', and no electricity can flow at typical voltages.
Switches can be and are classified according to the arrangement of their contacts in
electronics field, but electricians in the electrical wiring service business and their electrical
supplier industries use different nomenclature, such as "one-way", "two-way", "three-way"
and "four-way" switches. We have types of switches also

SPST (single pole single through),

SPDT (single pole double through),

DPST (double pole single through),

DPDT (double pole double through).

In a multi-throw switch, there are two possible transient behaviors as you move from
one position to another. In some switch designs, the new contact is made before the old
contact is broken. This is known as make-before-break, and ensures that the moving contact
never sees an open circuit (also referred to as a shorting switch). The alternative is breakbefore-make, where the old contact is broken before the new one is made. This ensures that
the two fixed contacts are never shorted to each other. Both types of design are in common
use, for different applications.
Biased switches
The momentary push-button switch is a type of biased switch. In this contact is made
by spring. The most common type is a push-to-make switch, which makes contact when the
button is pressed and breaks when the button is released. A push-to-break switch, on the other
hand, breaks contact when the button is pressed and makes contact when it is released. An
example of a push-to-break switch is a button used to release a door held open by an
electromagnet. Changeover push button switches do exist but are even less common.
Mercury tilt switch
The mercury switch consists of a drop of mercury inside a glass bulb with 2 contacts.
The two contacts pass through the glass, and are connected by the mercury when the bulb is
tilted to make the mercury roll on to them. This type of switch performs much better than the
ESWAR COLLEGE OF ENGINEERING

Page 44

PERSISTENCE OF VISION DISPLAY


ball tilt switch, as the liquid metal connection is unaffected by dirt, debris and oxidation, it
wets the contacts ensuring a very low resistance bounce free connection, and movement and
vibration do not produce a poor contact.
Knife switch
Knife switches are unique, because rather than employing an enclosed circuit
connection area with a rubber- or plastic-insulated section for the user, the contacts and
bridge are fully exposed. The "knife", a flat metal swinging arm, oscillates via user operation
between a set of two or more contact areas. The knife and contacts are typically formed of
copper, steel, or brass, depending on the application. Although knife switches are inferior to
traditional switches in applications where user safety are paramount, knife switches are still
commonly employed in everyday high-voltage applcations such as building transformers,
large power relays, air-conditioning units, etc.
Changeover switch
A changeover switch provides two distinct events, the making of one contact and the
breaking of the other. These can be used to feed the inputs of a flip-flop. This way the press
will only be detected when the pressed contact is made and the release will only be detected
when the released contact is made. When the switch is bouncing around in the middle no
change is detected. To get a single logic signal from such a setup a simple SR latch can be
used.

Toggle switches are actuated by a lever angled in one of two or more positions. The
common light switch used in household wiring is an example of a toggle switch. Most toggle
switches will come to rest in any of their lever positions, while others have an internal spring
mechanism returning the lever to a certain normal position, allowing for what is called
"momentary" operation.
ESWAR COLLEGE OF ENGINEERING

Page 45

PERSISTENCE OF VISION DISPLAY

Pushbutton switches are two-position devices actuated with a button that is pressed
and released. Most pushbutton switches have an internal spring mechanism returning the
button to its "out," or "unpressed," position, for momentary operation. Some pushbutton
switches will latch alternately on or off with every push of the button. Other pushbutton
switches will stay in their "in," or "pressed," position until the button is pulled back out. This
last type of pushbutton switches usually have a mushroom-shaped button for easy push-pull
action.

Selector switches are actuated with a rotary knob or lever of some sort to select one of
two or more positions. Like the toggle switch, selector switches can either rest in any of their
positions or contain spring-return mechanisms for momentary operation.

A joystick switch is actuated by a lever free to move in more than one axis of motion.
One or more of several switch contact mechanisms are actuated depending on which way the
lever is pushed, and sometimes by how far it is pushed. The circle-and-dot notation on the
ESWAR COLLEGE OF ENGINEERING

Page 46

PERSISTENCE OF VISION DISPLAY


switch symbol represents the direction of joystick lever motion required to actuate the
contact. Joystick hand switches are commonly used for crane and robot control.
Some switches are specifically designed to be operated by the motion of a machine rather
than by the hand of a human operator. These motion-operated switches are commonly called
limit switches, because they are often used to limit the motion of a machine by turning off the
actuating power to a component if it moves too far. As with hand switches, limit switches
come in several varieties.

These limit switches closely resemble rugged toggle or selector hand switches fitted
with a lever pushed by the machine part. Often, the levers are tipped with a small roller
bearing, preventing the lever from being worn off by repeated contact with the machine part.

Proximity switches sense the approach of a metallic machine part either by a magnetic
or high-frequency electromagnetic field. Simple proximity switches use a permanent magnet
to actuate a sealed switch mechanism whenever the machine part gets close (typically 1 inch
or less). More complex proximity switches work like a metal detector, energizing a coil of
wire with a high-frequency current, and electronically monitoring the magnitude of that
current. If a metallic part (not necessarily magnetic) gets close enough to the coil, the current
will increase, and trip the monitoring circuit. The symbol shown here for the proximity
switch is of the electronic variety, as indicated by the diamond-shaped box surrounding the
ESWAR COLLEGE OF ENGINEERING

Page 47

PERSISTENCE OF VISION DISPLAY


switch. A non-electronic proximity switch would use the same symbol as the lever-actuated
limit switch. Another form of proximity switch is the optical switch, comprised of a light
source and photocell. Machine position is detected by either the interruption or reflection of a
light beam. Optical switches are also useful in safety applications, where beams of light can
be used to detect personnel entry into a dangerous area.
In many industrial processes, it is necessary to monitor various physical quantities
with switches. Such switches can be used to sound alarms, indicating that a process variable
has exceeded normal parameters, or they can be used to shut down processes or equipment if
those variables have reached dangerous or destructive levels. There are many different types
of process switches.

These switches sense the rotary speed of a shaft either by a centrifugal weight
mechanism mounted on the shaft, or by some kind of non-contact detection of shaft motion
such as optical or magnetic.

Gas or liquid pressure can be used to actuate a switch mechanism if that pressure is
applied to a piston, diaphragm, or bellows, which converts pressure to mechanical force.

ESWAR COLLEGE OF ENGINEERING

Page 48

PERSISTENCE OF VISION DISPLAY

An inexpensive temperature-sensing mechanism is the "bimetallic strip:" a thin strip


of two metals, joined back-to-back, each metal having a different rate of thermal expansion.
When the strip heats or cools, differing rates of thermal expansion between the two metals
causes it to bend. The bending of the strip can then be used to actuate a switch contact
mechanism. Other temperature switches use a brass bulb filled with either a liquid or gas,
with a tiny tube connecting the bulb to a pressure-sensing switch. As the bulb is heated, the
gas or liquid expands, generating a pressure increase which then actuates the switch
mechanism.
Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage regulator is an
electrical regulator designed to automatically maintain a constant voltage level. In this
project, power supply of 5V and 12V are required. In order to obtain these voltage levels,
7805 and 7812 voltage regulators are to be used.

ESWAR COLLEGE OF ENGINEERING

Page 49

PERSISTENCE OF VISION DISPLAY

CHAPTER FOUR

Firmware
Implementation of the
Project

Software Tools Required

Keil Compiler

Proload

ESWAR COLLEGE OF ENGINEERING

Page 50

PERSISTENCE OF VISION DISPLAY

4. FIRMWARE IMPLEMENTATION OF THE PROJECT


This chapter briefly explains about the firmware implementation of the project. The
required software tools are discussed in section 4.2. Section 4.3 shows the flow diagram of
the project design. Section 4.4 presents the firmware implementation of the project design.

4.1 Software Tools Required


Keil v3, Proload are the two software tools used to program microcontroller. The
working of each software tool is explained below in detail.

4.1.1 Programming Microcontroller


A compiler for a high level language helps to reduce production time. To program the
AT89S52 microcontroller the Keil v3 is used. The programming is done strictly in the
embedded C language. Keil v3 is a suite of executable, open source software development
tools for the microcontrollers hosted on the Windows platform.
The compilation of the C program converts it into machine language file (.hex). This
is the only language the microcontroller will understand, because it contains the original
program code converted into a hexadecimal format. During this step there are some warnings
about eventual errors in the program. This is shown in Fig 4.1. If there are no errors and
warnings then run the program, the system performs all the required tasks and behaves as
expected the software developed. If not, the whole procedure will have to be repeated again.
Fig 4.2 shows expected outputs for given inputs when run compiled program.
One of the difficulties of programming microcontrollers is the limited amount of
resources the programmer has to deal with. In personal computers resources such as RAM
and processing speed are basically limitless when compared to microcontrollers. In contrast,
the code on microcontrollers should be as low on resources as possible.

4.2. Keil Software:


Installing the Keil software on a Windows PC
1. Insert the CD-ROM in your computers CD drive
2. On most computers, the CD will auto run, and you will see the Keil installation
menu. If the menu does not appear, manually double click on the Setup icon, in
the root directory: you will then see the Keil menu.
ESWAR COLLEGE OF ENGINEERING

Page 51

PERSISTENCE OF VISION DISPLAY


3. On the Keil menu, please select Install Evaluation Software. (You will not
require a license number to install this software).
4. Follow the installation instructions as they appear.
4.2.1. Loading the Projects:
The example projects for this book are NOT loaded automatically when you install
the Keil compiler.These files are stored on the CD in a directory /Pont. The files are
arranged by chapter: for example, the project discussed in Chapter 3 is in the directory
/Pont/Ch03_00-Hello.
Rather than using the projects on the CD (where changes cannot be saved), please
copy the files from CD onto an appropriate directory on your hard disk.
Note: you will need to change the file properties after copying: file transferred from the CD
will be read only.
4.2.2. Steps for loading a project and getting resultant:
Configuring the Simulator
Open the Keil Vision2

Fig12. Opening a new Project

ESWAR COLLEGE OF ENGINEERING

Page 52

PERSISTENCE OF VISION DISPLAY

Fig13. Selecting Device for Target Target1

Fig 14. Selecting 8052(all variants) and click OK

ESWAR COLLEGE OF ENGINEERING

Page 53

PERSISTENCE OF VISION DISPLAY

Fig15. Make sure that the oscillator frequency is 12MHz

Fig 16. Building the Target

ESWAR COLLEGE OF ENGINEERING

Page 54

PERSISTENCE OF VISION DISPLAY


Running the Simulation
Having successfully built the target, we are now ready to start the debug session and
run the simulator.

Fig 17. Starting debug session


After debugging the program then RUN the program to get the required result which
we want

4.3 Proload:
Proload is software which accepts only hex files. Once the machine code is converted
into hex code, that hex code has to be dumped into the microcontroller and this is done by the
Proload. Proload is a programmer which itself contains a microcontroller in it other than the
one which is to be programmed. This microcontroller has a program in it written in such a
way that it accepts the hex file from the Keil compiler and dumps this hex file into the
microcontroller which is to be programmed. As the Proload programmer kit requires power
supply to be operated, this power supply is given from the power supply circuit designed
above. It should be noted that this programmer kit contains a power supply section in the
board itself but in order to switch on that power supply, a source is required. Thus this is
accomplished from the power supply board with an output of 12volts.

ESWAR COLLEGE OF ENGINEERING

Page 55

PERSISTENCE OF VISION DISPLAY

Fig 18. Atmel 8051 Device Programmer

4.3.1 Features:
1. Supports major Atmel 89 series devices
2. Auto Identify connected hardware and devices
3. Error checking and verification in-built
4. Lock of programs in chip supported to prevent program copying
5. 20 and 40 pin ZIF socket on-board
6. Auto Erase before writing and Auto Verify after writing
Informative status bar and access to latest programmed file
1. Simple and Easy to use
2. Works on 57600 speed

4.3.2 Description:
It is simple to use and low cost, yet powerful flash microcontroller programmer for
the Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase and
Blank Check. All fuse and lock bits are programmable. All devices have signature bytes that
the programmer reads to automatically identify the chip. No need to select the device type,
just plug it in and go! All devices also have a number of lock bits to provide various levels of
software and programming protection. These lock bits are fully programmable using this
programmer. Lock bits are useful to protect the program to be read back from microcontroller
only allowing erase to reprogram the microcontroller. The programmer connects to a host
computer using a standard RS232 serial port.

ESWAR COLLEGE OF ENGINEERING

Page 56

PERSISTENCE OF VISION DISPLAY

Figure 19: Proload cycle to load program


Programming Software:
Computer side software called 'Proload V4.1' is executed that accepts the Intel HEX
format file generated from compiler to be sent to target microcontroller. It auto detects the
hardware connected to the serial port.

Fig20. Writing the program bytes into Microcontroller

ESWAR COLLEGE OF ENGINEERING

Page 57

PERSISTENCE OF VISION DISPLAY

CHAPTER 5
RESULTS AND DISCUSSION
5.1 Result
Our project met all our requirements laid out in our proposal. We were successfully
able to spin a one dimensional array of LEDs through a two dimensional space(a cylinder) at
a high enough frequency. We can successfully communicate wirelessly to the spinning
onboard microcontroller to update the display and change any of the pixels at any time.

Fig 12. Output of persistence of vision display

Fig 21. Output of POV display


ESWAR COLLEGE OF ENGINEERING

Page 58

PERSISTENCE OF VISION DISPLAY

5.2 Conclusion and Future Scope


In conclusion, this project really demonstrated competence combining a difficult
integration of the mechanical and electrical systems to build a persistence of vision display.
We build a general stand alone system which can receive input from any device wirelessly to
print out a display based on the pixel information received. We demonstrated this by
connecting with the alphabet character recognition system. The onboard system is a fully
contained system, capable of outgoing the display at varying RPM speeds and not carrying
about what system interfaces with it as long as it follows a standardized wireless protocol
developed by us.
While we met all the specifications detailed in our proposal and pleased with the
performance we achieved, we have many plans for building on the initial foundation and
continuing with additional refinement of the project. We succeeded in building a proof of
concept, on the test bench, a rugged design; however our project is only a foundation on
while many other interesting projects could be built.
Improvements and areas of future exploration include upgrading to a faster motor to
eliminate the refresh or blinking of the display. This would involve some major
modifications to the design including figuring a better way to fix the PCB boards and battery
to the spinning cantilever. Perhaps, it would be better to just design our own PCB in which all
the components would be surface mounted. This would eliminate much of the heavy wires
and extra PCB board contributing to the weight of the arm as well as drastically reducing the
space (since every component would be surface mount) needed to contain all the components.
Reducing size and weight would also make it easier to spin the cantilever faster.
The RGB LEDs have done a great job, however I would like to either get defused
LEDs(we use clear LED casing) or LEDs in which each colour diode in the LED housing was
closer together. Sometimes, depending on the viewing angle it can be difficult to tell that two
different clour diodes in the same LED arent two side by side LEDs.

ESWAR COLLEGE OF ENGINEERING

Page 59

PERSISTENCE OF VISION DISPLAY

CHAPTER 6
BIBLIOGRAPHY
1. The 8051 Micro controller and Embedded System by Muhammad Ali Mazidi,
Janice Gillispie Mazidi
2. The 8051 Micro controller Architecture, Programming & Applications by Kenneth
J.Ayala
3. Fundamentals of Micro processors and Micro computers by B.Ram
4. Micro processor Architecture, Programming & Applications by Ramesh S.Gaonkar
5. Electronic Components by D.V.Prasad
6. www.national.com
7. www.atmel.com
8. www.microsoftsearch.com
9. www.geocities.com

ESWAR COLLEGE OF ENGINEERING

Page 60

You might also like