Sei sulla pagina 1di 81

CHAPTER 1

INTRODUCTION TO 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. The embedded software is also called firm ware. The desktop/laptop computer
is a general purpose computer. You can use it for a variety of applications such as playing
games, word processing, accounting, software development and so on. In contrast, the
software in the embedded systems is always fixed listed below:
Embedded systems do a very specific task, they cannot be programmed to do different
things. Embedded systems have very limited resources, particularly the memory. Generally,
they do not have secondary storage devices such as the CDROM or the floppy disk.
Embedded systems have to work against some deadlines. A specific job has to be completed
within a specific time. In some embedded systems, called real-time systems, the deadlines are
stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property.
Embedded systems are constrained for power. As many embedded systems operate through a
battery, the power consumption has to be very low.
Some embedded systems have to operate in extreme environmental conditions such as
very high temperatures and humidity.

1.1 APPLICATION AREAS


Nearly 99 per cent of the processors manufactured end up in embedded systems. The
embedded system market is one of the highest growth areas as these systems are used in very
market segment- consumer electronics, office automation, industrial automation, biomedical
engineering,

wireless

communication,

data

transportation, military and so on.

communication,

telecommunications,

A .Consumer Appliances:
At home we use a number of embedded systems which include digital camera, digital
diary, DVD player, electronic toys, microwave oven, remote controls for TV and airconditioner, VCO player, video game consoles, video recorders etc. Todays high-tech car has
about 20 embedded systems for transmission control, engine spark control, air-conditioning,
navigation etc. Even wristwatches are now becoming embedded systems. The palmtops are
powerful embedded systems using which we can carry out many general-purpose tasks such
as playing games and word processing.
B .Office Automation:
The office automation products using embedded systems are copying machine, fax
machine, key telephone, modem, printer, scanner etc.
C. Industrial Automation:
Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and
transmission. The embedded systems for industrial use are designed to carry out specific
tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and then
take appropriate action based on the monitored levels to control other devices or to send
information to a centralized monitoring station. In hazardous industrial environment, where
human presence has to be avoided, robots are used, which are programmed to do specific
jobs. The robots are now becoming very powerful and carry out many interesting and
complicated tasks such as hardware assembly.
D. Medical Electronics:
Almost every medical equipment in the hospital is an embedded system. These
equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices, Xray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc.
Developments in medical electronics have paved way for more accurate diagnosis of
diseases.

E. Computer Networking:
Computer networking products such as bridges, routers, Integrated Services Digital
Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are
embedded systems which implement the necessary data communication protocols. For
example, a router interconnects two networks. The two networks may be running different
protocol stacks. The routers function is to obtain the data packets from incoming pores,
analyze the packets and send them towards the destination after doing necessary protocol
conversion. Most networking equipments, other than the end systems (desktop computers) we
use to access the networks, are embedded systems
F. Telecommunications:
In the field of telecommunications, the embedded systems can be categorized as
subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The
network equipment includes multiplexers, multiple access systems, Packet Assemblers
Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the
latest embedded systems that provide very low-cost voice communication over the Internet.
G. Wireless Technologies:
Advances in mobile communications are paving way for many interesting
applications using embedded systems. The mobile phone is one of the marvels of the last
decade of the 20h century. It is a very powerful embedded system that provides voice
communication while we are on the move. The Personal Digital Assistants and the palmtops
can now be used to access multimedia services over the Internet. Mobile communication
infrastructure such as base station controllers, mobile switching centers are also powerful
embedded systems.
H. Insemination:
Testing and measurement are the fundamental requirements in all scientific and
engineering activities. The measuring equipment we use in laboratories to measure
parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all
embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic analyzer,
protocol analyzer, radio communication test set etc. are embedded systems built around
3

powerful processors. Thank to miniaturization, the test and measuring equipment are now
becoming portable facilitating easy testing and measurement in the field by field-personnel.
I.Security:
Security of persons and information has always been a major issue. We need to
protect our homes and offices; and also the information we transmit and store. Developing
embedded systems for security applications is one of the most lucrative businesses nowadays.
Security devices at homes, offices, airports etc. for authentication and verification are
embedded systems. Encryption devices are nearly 99 per cent of the processors that are
manufactured end up in~ embedded systems. Embedded systems find applications in every
industrial segment- consumer electronics, transportation, avionics, biomedical engineering,
manufacturing,

process

control

and

industrial

automation,

data

communication,

telecommunication, defense, security etc. Used to encrypt the data/voice being transmitted on
communication links such as telephone lines. Biometric systems using fingerprint and face
recognition are now being extensively used for user authentication in banking applications as
well as for access control in high security buildings.
J. Finance:
Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any
Time Money) machines. Smart card, of the size of a credit card, has a small micro-controller
and memory; and it interacts with the smart card reader! ATM machine and acts as an
electronic wallet. Smart card technology has the capability of ushering in a cashless society.
Well, the list goes on. It is no exaggeration to say that eyes wherever you go, you can see, or
at least feel, the work of an embedded system!

1.2 OVERVIEW OF EMBEDDED SYSTEM ARCHITECTURE


Every embedded system consists of custom-built hardware built around a Central
Processing Unit (CPU). This hardware also contains memory chips onto which the software
is loaded. The software residing on the memory chip is also called the firmware. The
embedded system architecture can be represented as a layered architecture as shown in Fig.

The operating system runs above the hardware, and the application software runs
above the operating system. The same architecture is applicable to any computer including a
desktop computer.

Fig 1.1: Layered Architecture of an Embedded System


However, there are significant differences. It is not compulsory to have an operating
system in every embedded system. For small appliances such as remote control units, air
conditioners, toys etc., there is no need for an operating system and you can write only the
software specific to that application. For applications involving complex processing, it is
advisable to have an operating system. In such a case, you need to integrate the application
software with the operating system and then transfer the entire software on to the memory
chip. Once the software is transferred to the memory chip, the software will continue to run
for a long time you dont need to reload new software.
Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are;
Central Processing Unit (CPU)
Memory (Read-only Memory and Random Access Memory)
Input Devices
Output devices
Communication interfaces
Application-specific circuitry
5

Fig 1.2: Building Blocks of the hardware of an embedded system


1.2.1 CENTRAL PROCESSING UNIT (CPU)
The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is a
low-cost processor. Its main attraction is that on the chip itself, there will be many other
components such as memory, serial communication interface, analog-to digital converter etc.
So, for small applications, a micro-controller is the best choice as the number of external
components required will be very less. On the other hand, microprocessors are more
powerful, but you need to use many external components with them. D5P is used mainly for
applications in which signal processing is involved such as audio and video processing.
1.2.2 MEMORY
The memory is categorized as Random Access 11emory (RAM) and Read Only
Memory (ROM). The contents of the RAM will be erased if power is switched off to the chip,
whereas ROM retains the contents even if the power is switched off. So, the firmware is
stored in the ROM. When power is switched on, the processor reads the ROM; the program is
program is executed.
1.2.3 INPUT DEVICES
Unlike the desktops, the input devices to an embedded system have very limited
capability. There will be no keyboard or a mouse, and hence interacting with the embedded
system is no easy task. Many embedded systems will have a small keypad-you press one key
to give a specific command. A keypad may be used to input only the digits. Many embedded
systems used in process control do not have any input device for user interaction; they take
6

inputs from sensors or transducers 1fnd produce electrical signals that are in turn fed to other
systems.
1.2.4 OUTPUT DEVICES
The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status
of the system modules, or for visual indication of alarms. A small Liquid Crystal Display
(LCD) may also be used to display some important parameters.
1.2.5 COMMUNICATION INTERFACES
The embedded systems may need to, interact with other embedded systems at they
may have to transmit data to a desktop. To facilitate this, the embedded systems are provided
with one or a few communication interfaces such as RS232, RS422, RS485, Universal Serial
Bus (USB), IEEE 1394, Ethernet etc.
1.2.6 APPLICATION-SPECIFIC CIRCUITRY
Sensors, transducers, special processing and control circuitry may be required fat an
embedded system, depending on its application. This circuitry interacts with the processor to
carry out the necessary work. The entire hardware has to be given power supply either
through the 230 volts main supply or through a battery. The hardware has to design in such a
way that the power consumption is minimized.

CHAPTER 2
7

DESCRIPTION OF HARDWARE COMPONENTS


2.1 ARM LPC2148
2.1 GENERAL DESCRIPTION
The

LPC2141/42/44/46/48

microcontrollers

are

based

on

16-bit/32-bit

ARM7TDMI-S CPU with real-time emulation and embedded trace support, that combine
microcontroller with embedded high speed flash memory ranging from 32 kB to 512 kB. A
128-bit wide memory interface and a unique accelerator architecture enable 32-bit code
execution at the maximum clock rate. For critical code size applications, the alternative 16-bit
Thumb mode reduces code by more than 30 % with minimal performance penalty. Due to
their tiny size and low power consumption, LPC2141/42/44/46/48 are ideal for applications
where miniaturization is a key requirement, such as access control and point-of-sale. Serial
communications interfaces ranging from a USB 2.0 Full-speed device, multiple UARTs, SPI,
SSP to I2C-bus and on-chip SRAM of 8 kB up to 40 kB, make these devices very well suited
for communication gateways and protocol converters, soft modems, voice recognition and
low end imaging, providing both large buffer size and high processing power. Various 32-bit
timers, single or dual 10-bit ADC(s), 10-bit DAC, PWM channels and 45 fast GPIO lines
with up to nine edge or level sensitive external interrupt pins make these microcontrollers
suitable for industrial control and medical systems.

2.2 ARM LPC 2148 INTRODUCTION


The ASK 16/32-bit ARM7TDMI-S microcontroller Training board is specifically
designed to help students to master the required skills in the area of embedded systems. The
kit is designed in such way that all the possible features of the microcontroller will be easily
used by the students. The kit supports in system programming (ISP) which is done through
serial port. ASK Board has new and advance options which will give user the liberty of
implementing complex logic used in the design of Embedded Systems. The development
experience on the ASK Board will posed an opportunity to excel in the field of Embedded
Systems.

2.3 ASK ARM PROJECT KIT (LPC 2148)


2.3.1 BOARD FEATURES

Processor: LPC2148

2xSerial ports(One for ISP and other for Serial Communication)

12.00 MHz crystal

On board Reset Circuit with a switch.

Dual Power supply (either through USB or using external power adapter).

Power on LED supply.

Three on-board voltage regulators 1.8V, 3.3V and 5V with up to 800mA current

Extension headers for C ports.

Graphic LDC display interfacing port.

USB Ports.

CAN controller Interfacing.

MMC/SD card interfacing.

8 Bit LED interfacing.

EEPROM Interfacing.

On board UART.

2.3.2 LPC2148 CHIP FEATURES

16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.

8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of on-chip flash memory.

128-bit wide interface/accelerator enables high-speed 60 MHz operation.

In-System Programming/In-Application Programming (ISP/IAP) via on-chip boot


loader software. Single flash sector or full chip erase in 400 ms and programming
256 bytes in 1 ms.

Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with
the on-chip Real Monitor software and high-speed tracing of instruction execution.

USB 2.0 Full-speed compliant device controller with 2 kB of endpoint RAM.

Single 10-bit DAC provides variable analog output (LPC2142/44/46/48 only).

Two 32-bit timers/external event counters (with four capture and four compare
channels each), PWM unit (six outputs) and watchdog.

Low power Real-Time Clock (RTC) with independent power and 32 kHz clock input.

Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus (400
kbit/s),

SPI and SSP with buffering and variable data length capabilities.

2.4 BRIEF HISTORY OF ARM

ARM is short for Advanced Risc Machines Ltd.

Founded 1990, owned by Acorn, Apple and VLSI

Known before becoming ARM as computer manufacture Acorn which developed a


32-bit RISC processor for its own use (used in Acorn Archimedes)

2.5 WHY ARM HERE

ARM is one of the most licensed and thus widespread processor cores in the world

Used especially in portable devices due to low power consumption and reasonable
performance (MIPS / watt)

Several interesting extensions available or in development like Thumb instruction set


and Jazelle Java machine

10

2.6 ARM

Processor cores: ARM6, ARM7, ARM9, ARM10, ARM11

Extensions: Thumb, El Segundo, Jazelle etc.

IP-blocks: UART, GPIO, memory controllers, etc

CPU

Description

ISA

Process

Voltage

Area

Power

Clock/

Mips/

ARM7TDMI
ARM7TDMI-

Core
Synthesizable

V4T
V4T

0.18u
0.18u

1.8V
1.8V

mm2
0.53
<0.8

mW
<0.25
<0.4

MHz
60-110
>50

MHz
0.9
0.9

S
ARM9TDMI

core
Core

V4T

0.18u

1.8V

1.1

0.3

167-

1.1

ARM920T

Macrocell

V4T

0.18u

1.8V

11.8

0.9

220
140-

1.05

16+16kB

200

ARM940T

cache
Macrocell

V4T

0.18u

1.8V

4.2

0.85

140-

1.05

ARM9E-S

8+8kB cache
Synthesizable

V5TE

0.18u

1.8V

~1

170
133-

1.1

ARM 1020E

core
Macrocell

~0.85

200
200-

1.25

V5TE

0.15u

1.8V

32+32kB

~10

400

cache
Table 2.1: Types of ARM

2.7 ARM ARCHITECTURE

32-bit RISC-processor core (32-bit instructions)

37 pieces of 32-bit integer registers (16 available)

Pipelined (ARM7: 3 stages)

Cached (depending on the implementation)

Von Neuman-type bus structure (ARM7), Harvard (ARM9)

8 / 16 / 32 -bit data types

11

7 modes of operation (usr, fiq, irq, svc, abt, sys, und)

Simple structure -> reasonably good speed / power

consumption ratio

2.8 ARM AS A STANDARD COMPONENT

Even tough ARM is mostly used as a processor core in SoC and other ASICs have
some manufacturers brought ARM based standard products to market

Examples of manufacturers: Atmel, Cirrus Logic, Hyundai, Intel, Oki, Samsung,


Sharp

Most of the products are based on 7TDMI-core, some to 720Tand 920T-cores

ARM + FPGA: Altera and Triscend

In addition, there are a number of ASSP (Application Specific Standard Product)


-chips available for example to communication applications (Philips VWS22100 =
ARM7 based GSM baseband chip).

Type Number

Flash

RAM

Endpoint ADC

Memory
LPC2141FBD64

32kB

8kB

DAC Temperature

USB

(channels

RAM

overall)

2kB

(6 -

range (o C)
-40 to +85

channels)
LPC2142FBD64

64kB

16kB

2kB

(6 1

-40 to +85

channels)
LPC2144FBD64

128kB

16kB

2kB

(14 1

-40 to +85

channels)
LPC2146FBC64

256kB

32kB+8kB
shared

2kB

(14 1

channels)

with USB
DMA

12

-40 to +85

LPC2148FBD64

512kB

32kB+8kB

2kB

shared

(14 1

channels)

with USB
DMA

Table 2.2: Ordering Options

2.9 PINNING INFORMATION

Fig2.1: Pin Information

2.10 PIN DESCRIPTION


P0.0 to P0.31 : General Purpose bidirectional digital I/Os except P0.31 is output pin
Pins P0.24, P0.26 and P0.27 are not available
Symbol

Pin

Type
13

Description

-40 to +85

Port0: Port0 is a 32-bit I/O port


with individual direction controls
for each bit. Total of 31 pins of the
Port0 can be used as a general
purpose bidirectional digital I/Os
P0.0 to P0.31

I/O

while P0.31 is output only pin.


The operation of port0 pins
depends upon the pin function
selected via the pin connect block.
Pins P0.24, P0.26 and P0.27 are

I/O
P0.0/TXD0/PWM1

19

O
O
I/O

P0.1/RXD0/PWM3/EINT0

21

I
O

P0.2/SCL0/CAP0.0

22

for

UART0.
PWM1-Pulse Width Modulator
output 1.
P0.1-General purpose input/output
digital pin (GPIO).
RXD0-Receiver input for UART0.
PWM3-Pulse Width Modulator

I/O

Open-drain output (for I2C-bus

O
33
O
I
26

output

output 3.
EINT0-External interrupt 0 input
P0.2-General purpose in(GPIO).
SCL0-I2 C0 clock input/output.

I/O

P0.3/SDA0/MAT0.0/EINT1

digital pin (GPIO).


TXD0-Transmitter

I
I/O

P0.8/TXD1/PWM4/AD1.1

not available.
P0.0-General purpose input/output

I/O
14

compliance).
CAP0.0-Capture input for Timer
0, channel 0.
P0.8-General purpose input/output
digital pin (GPIO).
TXD1-Transmitter

output

for

UART 1.
PWM4-Pulse Width Modulator
output 4.
AD1.1-ADC 1, input1. Available
in LPC2144/46/48 only.
P0.3-General purpose input/output

digital pin (GPIO).


SDA0-I2C0 data
I/O

O
I
I/O

P0.4/SCK0/CAP0.1/AD0.6

27

I/O

I
I
I/O

P0.5/MISO0/MAT0.1/AD0.7

29

I/O

O
I
I/O

I/O
P0.6/MOSI0/CAP0.2/AD1.0

30
I
I

P0.7/SSEL0/PWM2/EINT2

31

I/O

input/output.

Open-drain output (for I2C-bus


compliance).
MAT0.0-Match output for Timer0,
channel 0.
EINT1-External interrupt 1 input.
P0.4General
purpose
input/output digital pin (GPIO).
SCK0-Serial clock for SPI0. SPI
clock output from master or input
to slave.
CAP0.1-Capture input for Timer
0, channel 0.
AD0.6-ADC 0, input 6.
P0.5General

purpose

input/output digital pin (GPIO).


MISO0-Master In Slave OUT for
SPI0. Data input to SPI master or
data output from SPI slave.
MAT0.1-Match output for Timer
0, channel 1.
AD0.7-ADC 0, input 7.
P0.6General

purpose

input/output digital pin (GPIO).


MOSI0-Master Out Slave In for
SI0. Data output from SPI master
or data input from SPI slave.
CAP0.2-Capture input for Timer
0, channel 2.
AD1.0-ADC 1, input 0. Available
in LPC2144/46/48 only.
P0.7General

purpose

input/output digital pin (GPIO).


SSEL0-Slave Select for SPI0.

Selects the SPI interface as a

slave.
PWM2-Pulse Width Modulator
output 2.

15

I
I/O
P0.9/RXD1/PWM6/EINT3

34

I
O
I
I/O
O

P0.10/RTS1/CAP1.0/AD1.2

35
I
I
I/O

I
P0.11/CTS1/CAP1.1/SCL1

37
I
I/O
I/O

I
P0.12/DSR1/MAT1.0/AD1.3

38
O
I

P0.13/DTR1/MAT1.1/AD1.4

39

I/O

EINT2-External interrupt 2 input.


P0.9General
purpose
input/output digital pin (GPIO).
RXD1-Receiver input for UART1.
PWM6-Pulse Width Modulator
output 6.
EINT3-External interrupt 3 input.
P0.10General
purpose
input/output digital pin (GPIO).
RTS1-Request to send output for
UART1. LPC2144/46/48 only.
CAP1.0-Capture input for Timer
1, channel 0.
AD1.2-ADC 1, input 2. Available
in LPC2144/46/48 only.
P0.11General

purpose

input/output digital pin (GPIO).


CTS1-Clear to Send input for
UART

1.

Available

in

LPC2144/46/48 only.
CAP1.1-Capture input for Timer
1, channel 1.
SCL 1-I2C1 clock input/output for
Timer 1, channel 1.
P0.12General

purpose

input/output digital pin (GPIO).


DSR1-Data Set Ready input for
UART

1.

Available

in

LPC2144/46/48 only.
MAT1.0-Match output for Timer
1, channel 0.
AD1.3-ADC input 3. Available in
LPC2144/46/48 only.
P0.13General

purpose

input/output digital pin (GPIO).


DTR1-Data
Terminal
Ready

output

LPC2144/46/48 only.
MAT1.1-Match output for Timer

16

for

UART1,

I
I/O
I
I
P0.14?DCD1/EINT1/SDA1

41

1, channel 1.
AD1.4-ADC input 4. Available in
LPC2144/46/48 only.
P0.14General

purpose

input/output digital pin (GPIO).


DCD1-Data Carrier Detect input
for UART1. LPC2144/46/48 only.
EINT1-External interrupt 1 input.
SDA1-I2C1 data input/output.
Open-drain output (for I2C-bus
compliance)

I/O

Note: Low on this pin while


RESET is LOW forces on-chip
boot loader to take over control of

I/O
I
P0.15/RI1/EINT2/AD1.5

I
I/O
I
46

O
I
I/O
I

P0.17/CAP1.2/SCK1/MAT1.2

47

I/O

purpose

input/output digital pin (GPIO).


RI1-Ring Indicator input for
UART1.

45
I

P0.16/EINT0/MAT0.2/CAP0.2

the part after reset.


P0.15General

Available

in

LPC2144/46/48 only.
EINT2-External interrupt 2 input.
AD1.5-ADC 1, input 5. Available
in LPC2144/46/48 only.
P0.16General

purpose

input/output digital pin (GPIO).


EINT0-External interrupt 0 input.
MAT0.2-Match output for Timer
0, channel 2.
CAP0.2-Capture input for Timer
0, channel 2.
P0.17General

purpose

input/output digital pin (GPIO).


CAP1.2-Capture input for Timer
1, channel 2.
SCK1-Serial Clock for SSP,Clock
output from master or input to

O
17

slave.
MAT1.2-Match output for Timer
1, channel 2.

I/O
I
P0.18/CAP1.3/MISO1/MAT1.3

53
I/O

O
I/O
O
P0.19/MAT1.2/MOSI1/CAP1.2

54
I/O

I
I/O
O
P0.20/MAT1.3/SSEL1/EINT3

55

input/output digital pin (GPIO).


CAP1.3-Capture input for Timer
2, channel 3.
MISO1-Master In Slave Out for
SSP. Data input to SPI master or
data output from SSP slave.
MAT1.3-Match output for Timer
1, channel 3.
P0.19General

purpose

input/output digital pin (GPIO).


MAT1.2-Match output for Timer
1, channel 2.
MOSI1-Master Out Slave In for
SSP. Data output from SSP master
or data input to SSP slave.
CAP1.2-Capture input for Timer
1, channel 2.
P0.20General

purpose

input/output digital pin (GPIO).


MAT1.3-Match output for Timer
1, channel 3.
SSEL1-Slave

Select

for

slave.
EINT3-External interrupt 3 input.
P0.21General
purpose

1
I
I
2

purpose

SSP,Selects the SSP interface as a

P0.22/AD1.7/CAP0.0/MAT0.0

General

I/O

P0.21/PWM5/AD1.6/CAP1.3

P0.18-

I/O
I
I
18

input/output digital pin (GPIO).


PWM5-Pulse Width Modulator
output 5.
AD1.6-ADC 1, input 6. Available
in LPC2144/46/48 only.
CAP1.3-Capture input for Timer
1, channel 3.
P0.22General

purpose

input/output digital pin (GPIO).


AD1.7-ADC 1, input 7. Available
in LPC2144/46/48 only.
CAP0.0-Capture input for Timer

O
I/O
P0.23/VBUS

58
I

I/O
P0.25/AD0.4/AOUT

I
O
I/O
I

P0.28/AD0.1/CAP0.2/MAT0.2

13

I
O
I/O
I

P0.29/AD0.2/CAP0.3/MAT0.3

14

I
O
I/O

P0.30/AD0.3/EINT3/CAP0.0

15

I
I
I

P0.31/UP_LED/CONNECT

17

O
O

0, channel 0.
MAT0.0-Match output for Timer
0, channel 0.
P0.23General

purpose

input/output digital pin (GPIO).


VBUS-Indicates the presence of
USB bus power.
Note: This signal must be HIGH
for USB reset to occur.
P0.25General

purpose

input/output digital pin (GPIO).


AD0.4-ADC 0, input 4.
DAC output. Available in
LPC2144/46/48 only.
P0.28General

purpose

input/output digital pin (GPIO).


AD0.1-ADC 0, input 1.
CAP0.2-Capture input for Timer
0, channel 2.
MAT0.2-Match output for Timer
0, channel 2.
P0.29General

purpose

input/output digital pin (GPIO).


AD0.2-ADC 0, input 2.
CAP0.3-Capture input for Timer
0, channel 3.
MAT0.3-Match output for Timer
0, channel 3.
P0.30General

purpose

input/output digital pin (GPIO).


AD0.3-ADC 0, input 3.
EINT3-External interrupt 3 input.
CAP0.0-Capture input for Timer
0, channel 0.
P0.31General

purpose

input/output digital pin (GPIO).


UP_LED-USB Good Link LED
indicator. It is LOW when device
is

configured

(non-control

endpoints enabled).It is HIGH


19

when the device is not configured


or during global suspend.
CONNECT-Signal used to switch
an external 1.5k resistor under
the software control. Used with
the SoftConnect USB feature.
O

Important: This is an digital


output only pin. This pin MUST
NOT be externally pulled LOW

when

pun is LOW or the

JTAG port will be disabled.


Port 1: Port 1 is a 32-bit
bidirectional

I/O

port

with

individual direction controls for


P1.0 to P1.31

I/O

each bit. The operation of port 1


pins

depends

upon

the

pin

function selected via the pin


connect block. Pin 0 through 15 of

I/O
P1.16/TRACEPKT0

16
O

I/O
P1.17/TRACEPKT1

12
O

I/O
P1.18/TRACEPKT2

8
O

port 1 are not available.


P1.16General

input/output digital pin (GPIO).


TRACEPKT0-Trace Packet, bit 0.
Standard I/O port with internal
pull-up.
P1.17-

General

purpose

input/output digital pin (GPIO).


TRACEPKT1-Trace Packet, bit 1.
Standard I/O port with internal
pull-up.
P1.18-

General

purpose

input/output digital pin (GPIO).


TRACEPKT2-Trace Packet, bit 2.
Standard I/O port with internal
pullup.

20

purpose

I/O
P1.19/TRACEPKT3

4
O

I/O

P1.19-

General

purpose

input/output digital pin (GPIO).


TRACEPKT3-Trace Packet bit3.
Standard I/O port with internal
pull-up.
P1.20-

General

purpose

input/output digital pin (GPIO).


TRACESYNC-Trace
Synchronization.

Standard

I/O

port with internal pull-up.


P1.20/TRACESYNC

48
O

Note: LOW on this pin while

is LOW enables pins


P1.25:16 to operate as Trace port

I/O
P1.21/PIPESTAT0

44
O

I/O
P1.22/PIPESTAT1

40
O

I/O
P1.23/PIPESTAT2

36
O

I/O
P1.24/TRACECLK

P1.25/EXTIN0

32

28

after reset.
P1.21General

purpose

input/output digital pin (GPIO).


PIPESTAT0-Pipeline Status, bit 0.
Standard I/O port with internal
pull-up.
P1.22-

General

purpose

input/output digital pin (GPIO).


PIPESTAT1- Pipeline Status, bit
1. Standard I/O port with internal
pull-up
P1.23-

General

purpose

input/output digital pin (GPIO).


PIPESTAT2- Pipeline Status, bit
0. Standard I/O port with internal
pull-up
P1.24-

General

purpose

input/output digital pin (GPIO).


TRACECLK-Trace
Clock.

Standard I/O port with internal

I/O

pull-up.
P1.25-

General

purpose

input/output digital pin (GPIO).


21

EXTIN0-External Trigger input.


I

I/O

Standard I/O port with internal


pull-up.
P1.26-

General

purpose

input/output digital pin (GPIO).


RTCK-Returned
Test
Clock
output. Extra signal added to the
JTAG

port.

Assists

debugger

synchronization when processor


P1.6/RTCK

frequency varies. Bidirectional pin

24
I/O

with internal pull-up.


Note: LOW on RTCK while

is LOW enables pins


P1.31:26 to operate as Debug port

I/O
P1.27/TDO

64
O
I/O

P1.28/TDI

60
I
I/O

P1.29/TCK

56
I
I/O

P1.30/TMS

52
I
I/O

P1.31/
D+

after reset.
P1.27General

purpose

input/output digital pin (GPIO).


TDO-Test Data out for JTAG
interface.
P1.28-

General

purpose

input/output digital pin (GPIO).


TDI-Test Data in for JTAG
interface.
P1.29-

General

purpose

input/output digital pin (GPIO).


TCK-Test Clock for JTAG
interface.
P1.30-

General

purpose

input/output digital pin (GPIO).


TMS-Test Mode Select for JTAG
interface.
P1.31-

General

purpose

input/output digital pin (GPIO).

20
I
10

I/O
22

-Test Reset for JTAG


interface.
USB bidirectional D+ line.

D-

11

I/O

USB bidirectional D- line.


External reset Input: A LOW on
this pin resets the device, causing
I/O ports and peripherals to take

57

on

their

default

states,

and

processor execution to begin at


address 0. TTL with hysteresis,

XTAL1

62

XTAL2

61

RTXC1

RTXC2

VSS

6,18,25,42,5
0

5V tolerant.
Input to the oscillator circuit and
internal clock generator circuits.
Output from the oscillator
amplifier.
Input to the RTC oscillator circuit.
Output from the RTC oscillator
circuit.
Ground: 0 V reference.
Analog ground: 0 V reference.
This should nominally be the

VSSA

59

same voltage as VSS, but should be


isolated to minimize noise and
error.
3.3 V power supply: This is the

VDD

23,43,51

power supply voltage for the core


and I/O ports.
Analog 3.3V power supply: This
should be nominally the same
voltage as VDD but should be

VDDA

isolated to minimize noise and


error. This voltage is only used to
power the on-chip ADC(s) and

VREF

63

DAC.
ADC reference: This should be
nominally less than or equal to the
VDD

voltage but should be

isolated to minimize noise and


error. Level on this pin is used as a
23

VBAT

49

reference for ADC(s) and DAC.


RTC power supply: 3.3V on this
pin supplies the power to the RTC.

Table 2.3: Pin Description


1. 5 V tolerant pad providing digital I/O functions with TTL levels and hysteresis and
10ns slow rate control.
2. 5 V tolerant pad providing digital I/O functions with TTL levels and hysteresis and
10ns slow rate control. If configured for an input function, this pad utilizes built-in
glitch filter that blocks shorter than 3s.
3. Open-drain 5 V tolerant digital I/O I 2C bus-400 kHz specification compatible pad. It
requires external pull-up to provide an output functionality.
4. 5 V tolerant pad providing digital I/O (with TTL levels and hysteresis and 10ns slow
rate control) and analog output function. If configured for an input function, this pad
utilizes built-in glitch filter that blocks pulses shorter than 3 ns. When configured as
an ADC input, digital section of the pad is disabled.
5. 5 V tolerant pad providing digital I/O (with TTL levels and hysteresis and 10ns slow
rate control) and analog output function. When configured as an DAC output, digital
section of the pad is disabled.
6. 5 V tolerant pad with built-in pull-up resistor providing digital I/O with TTL levels
and hysteresis and 10ns slow rate control. The pull-up resistors value typically ranges
from 60k to 300k.
7. Pad is designed in accordance with the Universal Serial Bus (USB) specification,
revision 2.0 (Full-speed and Low-speed mode only).
8. 5 V tolerant pad providing digital input (with TTL levels and hysteresis) function
only.
9. Pad provides special analog functionality.

2.11 ARCHITECTURAL OVERVIEW


The ARM7TDMI-S is a general purpose 32-bit microprocessor, which offers high
performance and very low power consumption. The ARM architecture is based on Reduced
Instruction Set Computer (RISC) principles, and the instruction set and related decode
mechanism are much simpler than those of microprogrammed Complex Instruction Set
Computers (CISC). This simplicity results in a high instruction throughput and impressive
real-time interrupt response from a small and cost-effective processor core. Pipeline
techniques are employed so that all parts of the processing and memory systems can operate
continuously. Typically, while one instruction is being executed, its successor is being

24

decoded, and a third instruction is being fetched from memory. The ARM7TDMI-S processor
also employs a unique architectural strategy known as Thumb, which makes it ideally suited
to high-volume applications with memory restrictions, or applications where code density is
an issue. The key idea behind Thumb is that of a super-reduced instruction set. Essentially,
the ARM7TDMI-S processor has two instruction sets:

The standard 32-bit ARM set.

A 16-bit Thumb set.

The Thumb sets 16-bit instruction length allows it to approach twice the density of
standard ARM code while retaining most of the ARMs performance advantage over a
traditional 16-bit processor using 16-bit registers. This is possible because Thumb code
operates on the same 32-bit register set as ARM code. Thumb code is able to provide up to 65
% of the code size of ARM, and 160 % of the performance of an equivalent ARM processor
connected to a 16-bit memory system. The particular flash implementation in the
LPC2141/42/44/46/48 allows for full speed execution also in ARM mode. It is recommended
to program performance critical and short code sections (such as interrupt service routines
and DSP algorithms) in ARM mode. The impact on the overall code size will be minimal but
the speed can be increased by 30% over Thumb mode.
2.11.1 ON-CHIP FLASH PROGRAM MEMORY
The LPC2141/42/44/46/48 incorporate a 32 kB, 64 kB, 128 kB, 256 kB and 512 kB
flash memory system respectively. This memory may be used for both code and data storage.
Programming of the flash memory may be accomplished in several ways. It may be
programmed In System via the serial port. The application program may also erase and/or
program the flash while the application is running, allowing a great degree of flexibility for
data storage field firmware upgrades, etc. Due to the architectural solution chosen for an onchip boot loader, flash memory available for users code on LPC2141/42/44/46/48 is 32 kB,
64 kB, 128 kB, 256 kB and 500 kB respectively. The LPC2141/42/44/46/48 flash memory
provides a minimum of 100,000 erase/write cycles and 20 years of data-retention.
2.11.2 ON-CHIP STATIC RAM
On-chip static RAM may be used for code and/or data storage. The SRAM may be
accessed as 8-bit, 16-bit, and 32-bit. The LPC2141, LPC2142/44 and LPC2146/48 provide 8
kB, 16 kB and 32 kB of static RAM respectively. In case of LPC2146/48 only, an 8 kB
25

SRAM block intended to be utilized mainly by the USB can also be used as a general purpose
RAM for data storage and code storage and execution.
2.11.3 MEMORY MAP
The LPC2141/42/44/46/48 memory map incorporates several distinct regions. In
addition, the CPU interrupt vectors may be remapped to allow them to reside in either flash
memory (the default) or on-chip static RAM. This is described in System control.

Fig 2.2: Memory Map


2.11.4 INTERRUPT CONTROLLER
The Vectored Interrupt Controller (VIC) accepts all of the interrupt request inputs and
categorizes them as Fast Interrupt Request (FIQ), vectored Interrupt Request (IRQ), and nonvectored IRQ as defined by programmable settings. The programmable assignment scheme
means that priorities of interrupts from the various peripherals can be dynamically assigned
and adjusted. Fast interrupt request (FIQ) has the highest priority. If more than one request is
26

assigned to FIQ, the VIC combines the requests to produce the FIQ signal to the ARM
processor. The fastest possible FIQ latency is achieved when only one request is classified as
FIQ, because then the FIQ service routine does not need to branch into the interrupt service
routine but can run from the interrupt vector location. If more than one request is assigned to
the FIQ class, the FIQ service routine will read a word from the VIC that identifies which
FIQ source(s) is (are) requesting an interrupt. Vectored IRQs have the middle priority. Sixteen
of the interrupt requests can be assigned to this category. Any of the interrupt requests can be
assigned to any of the 16 vectored IRQ slots, among which slot 0 has the highest priority and
slot 15 has the lowest. Non-vectored IRQs have the lowest priority.
The VIC combines the requests from all the vectored and non-vectored IRQs to
produce the IRQ signal to the ARM processor. The IRQ service routine can start by reading a
register from the VIC and jumping there. If any of the vectored IRQs are pending, the VIC
provides the address of the highest-priority requesting IRQs service routine, otherwise it
provides the address of a default routine that is shared by all the non-vectored IRQs. The
default routine can read another VIC register to see what IRQs are active.
2.11.5 INTERRUPT SOURCES
Each peripheral device has one interrupt line connected to the Vectored Interrupt
Controller, but may have several internal interrupt flags. Individual interrupt flags may also
represent more than one interrupt source.
2.11.6 PIN CONNECT BLOCK
The pin connect block allows selected pins of the microcontroller to have more than
one function. Configuration registers control the multiplexers to allow connection between
the pin and the on chip peripherals. Peripherals should be connected to the appropriate pins
prior to being activated, and prior to any related interrupt(s) being enabled. Activity of any
enabled peripheral function that is not mapped to a related pin should be considered
undefined. The Pin Control Module with its pin select registers defines the functionality of
the microcontroller in a given hardware enviroment. After reset all pins of Port 0 and 1 are
configured as input with the following exceptions: If debug is enabled, the JTAG pins will
assume their JTAG functionality; if trace is enabled, the Trace pins will asume their trace
functionality. The pins associated with the I2C0 and I2C1 interface are open drain.

2.12 ARM FEATURES


27

2.12.1 LOAD-STORE ARCHITECTURE


A load-store architecture focus on the process, i.e. reading a value by copying from the
memory to the register (load instructions) or writing a value from the register to the memory
(store instructions). ARM does not support memory-to-memory operations like a CISC
(Complex Instruction Set Computer) machine. The processor works as follow:

Data processing instructions: for dealing with the registers only

Data transfer instructions: for copying data from the memory to the register or from
the register to the memory

Control flow instructions: for controlling the order of execution

2.12.2 ARM PROCESSOR INSTRUCTION SET


The size of ARM processor instruction is 32-bit, excluding the 16-bit Thumb instruction
set (for the microcontroller only) that has the following features:

Support load-store architecture

Process 3 registers at a time (2 address registers and 1 data register)

Support various registers

Took 1 instruction (or 1 clock cycle) to transfer and process arithmetic and logic
operations.

Is an open instruction set; more registers or data can be added

2.12.3 PIPELINING
An instruction cycle has 3 stages:
During the execution of the 1 st instruction, the 2nd instruction being decode and the 3 rd instruction is
being fetch. See the Figure 1 below.

28

Fetch
Decode
Execute

Fig 2.3: Pipelining


2.12.4 LPC2148 TECHNICAL FEATURES CPU AND DATA BUS
LPC2148 used ARM7TDMI-S as its core and two types of buses to increase the
boards performance. The modules inside are connected by the CPU high-performance bus
called Advance High-Performance Bus (AHB) and the peripheral are connected by VLSI
Peripheral Bus (VPB). The data between the two buses are exchange at the AHB and VPB
bus connection. ARM7TDMI-S has two sets of instruction set: the 32-bit Standard and 16-bit
Thumb instruction set. The used of Thumb instruction set can reduced the size of the control
program up to 65% and increases the performance up to 160%
2.12.5 MEMORY
LPC2148 has 2 types of memory
2.12.5.1 FLASH MEMORY 512 KB (0X0000 0000 0X0007 FFFF)

12 kb used for storing the boot loader firmware (software resided in a chip)

500 kb working space that can store the program or data

2.12.5.2 STATIC RAM 40 KB (0X4000 0000 0X4000 7FFF)

32 kb for the program or data

8 kb for DMA when USB is in use (this space can also be used to store the program or
data) Memory at the address range of (0xE000 0000 0xFFFF FFFF) is for the AHB
and APB peripherals. Each peripheral has 16kb in size. Also, all peripheral register are
aligned to 32-bit (regardless of their original size).

2.12.6 MEMORY MAP CONCEPTS AND OPERATING MODES


29

LPC2148 used the concept that each memory area has a natural location. Also, the
bulk remains at fixed position, thus, there is no need to design code to run at different address
range.
2.12.7 MEMORY RE-MAPPING
The Boot Block is mapped to the top of the on-chip memory space, thus, there is no
need to change the location of the Boot Block or changing the mapping of the interrupt
vectors. Memory space other than interrupt vector remains at fix location.
2.12.8 VECTORED INTERRUPT CONTROLLER
Vectored Interrupt Controller (VIC) receives all interrupt signals initiated. The priority of
the interrupt is changeable by software. There are 3 types of interrupt request:

Fast Interrupt Request (FIQ): Has the highest priority out of 3 types

Vectored Interrupt Request (IRQ): Has the 2nd highest priority out of 3 types Has 16
interrupt sources in total, called slot (slot 0 has the highest priority and slot 15 has the
lowest priority)

Non-vectored IRQ: Has the lowest priority out of 3 types

2.12.9 FAST I/O PORT


Each of LPC2148 pins can be configured to various peripheral modules. When the
values of all pins are reset, by default, it is set as input. Moreover, if the pins are configured
as input/output digital, the GPIO register takes charge of the control.
2.12.10 ANALOGY TO DIGITAL MODULE
This module has 2 analogy signal input from ADC0 and ADC1. ADC0 has 6 channels and
ADC1 has 8 channels. The output is a 10-bit digital signal. The functional of this module is as
listed below:

Conversion process used is Successive Approximation

Input Analog signal 0 to Voltage reference value (+3.3V)

Sampling Rate of 400,000 per second

30

Analog to Digital converted value are stored in a register

2.12.11 DIGITAL TO ANALOG MODULE


This module has 1 10-bit digital input and 1 output analogy signal. The functional of this
module is as listed below:

10-bit conversion

Buffer at the output

Power-save mode supported

The rate of conversion configuration

2.12.12 USB 2.0 MODULE


The USB module consisted of the register interface, the serial interface engine, the
endpoint buffer memory and DMA controller. The functional of this module is as listed
below:

Compatibility with USB 2.0 Full-Speed port

Support 32 physical end-points (or 16 logical end-points)

Support control, bulk, interrupt and asynchronous

End-point package can be selected from software

Size of buffer depends on the types of end-points and the size of package

USB connection status shown on LED

Power by bus supported

Support DMA
31

Buffer size can be doubled to support bulk end-points and asynchronous

2.12.13 UNIVERSAL ASYNCHRONOUS RECEIVER TRANSMITTER (UART)


MODULE
2 UART ports are available: UART0 and UART1. Part of UART0 is designed to support
program download through ISP process. UART1, on the other hand, is fully designed as a
parallel communication port. The baud rate of both ports can be configured separately. The
functional of this module is as listed below:

FIFO buffer for receiving or transmitting 16-byte size data

FIFO trigger point at the 1st, 4th, 8th and 14th byte

The source of the baud rate is inside the board

The baud rate can be configured through software

UART1 port signal configuration is fully arranged, including DTR, DSR, CTS,

RTS, DCD, RI

2.12.14 I2C BUS MODULE


This module has 2 set of I2C Buses: the Clock (SCL) bus and Data (SDA). SDAs
maximum data transfer rate is 400 Kbit/s. The I2C module can be configured as a master or
slave mode. It also supported multi-master and other communication devices that have
different data transfer rate. In addition, the clock frequency can be also be configured.
2.12.15 SPI & SSP BUS COMMUNICATION MODULE
LPC2148 has 1 set of SPI that support 2-way communication and Synchronous Serial
Peripheral (SSP) can communication with SPI, SSI 4 lines and Micro wire Bus.
2.12.16 TIMER / COUNTER MODULE
This module has 2 set of Timer/Counter: Timer0 and Timer1. The size of both
Timer/Counter is 32-bit. The timer uses the Clock peripheral signal (PCLK) or outer source
clock signal as reference. The functional of this module is as listed below:

2 sets of Timer/Counter 32-bit with 32 bit prescaler

32

Able to use the clock signal to increment the timer. The clock source can be from the
peripheral clock (PCLK) or outer source clock.

Timer1 has 4 slots input source for detecting or capturing signal. The slots can detect
a change in logic of the input signal that is use to trigger an interrupt (if enable before
hand).

4 32-bit registers for storing comparison values

The timer can be configured to reset itself, continuing or stop working after an
interrupt occur

An output generates a signal when the count matches or when an interrupt occur.

2.12.17 WATCH DOG TIMER


Watch Dog Timer prevents the microcontroller from stop functioning as a result from
errors. It can be configured through a 32-bit timer and enabled through software and reset
through hardware control only.
2.12.18 REAL TIME CLOCK
LPC2148 has a Real Time Clock in itself that uses a 3V reserved battery. Unlike other
microprocessors, there is no need for an extra RTC IC. To read the RTC values, a program to
access is not needed, just connect some registers and enable the RTC. Thus, LPC2148
consumes less memory space when accessing the RTC values.
2.12.19 PWM SIGNAL MODULE
LPC2148 has 6 channels for generating the PWM signal (the Timer generates the signal).
The PCLK increment the Timer and the Master Reset register set the period of the signal. In
addition, the PWN signal can be configured as active high or low, thus, it can be use to
control a 3 phase motor. 2 MR register are in use: one to control the signal cycle, the other for
active edge configuration. The functional of this module is as listed below:

7 MR registers

MR register is in use when the timer continues to increment, stops or is reset.

The edge of the active signal can be configured


33

32-bit Timer/Counter is used along with 32-bit prescaler

6 output slots for PWM signal

2.12.20 SYSTEM CONTROL


Crystal Oscillator:
Crystal Oscillator is the CPU clock signal generator; the range is at 1MHz to 25MHz

2.12.21 PHASE LOCK LOOP (PLL)


Phase Lock Loop received an input CLK signal of the range 10MHz-25MHz then
convert the range 10MHz-60MHz
2.12.22 RESET AND WAKEUP TIMER
LPC2148 can be reset in 2 ways; from the RESET button or Watch Dog Timer. Once
the reset signal is initiated, the wake up timer starts. During this time, the board setup itself. If
the latches longer than the time taken for the board to setup, once the signal is gone, the CPU
starts immediately. However, if the reset signal latches shorter than the time taken for the
board to setup, once the signal is gone, the board waits for the wake up time to finish its first
loop before starting the CPU (See Figure 3).

Fig 2.4: Reset and Wakeup Timing Diagram


Low power supply / Brownout Detector If power supply is less than 2.9V, the
Brownout Detector will generate an interrupt signal. However, if the power supply is less
34

than 2.6V, the Brownout Detector (BOD) generates a signal to reset the microprocessor.
Signal Separator Bus VPB bus has 2 usages: to allot the PCLK signal on the VPB bus
(usually the frequency is 0.5-0.25 times lower than CPU clock) and to monitor the power on
the bus, if the peripheral is not in use, that peripheral will be set on power safe mode.
2.12.23 TESTING / DEBUGGING CONNECTOR
LPC2148 supports testing or debugging through JTAG port up to tracing from TRACE port.
Both ports use P1 therefore, if P1 in use, P0 should be use for work purpose instead.

3.LIQUID CRYSTAL DISPLAY (LCD)


3.1 INTRODUCTION
LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs
(seven segment LEDs or other multi segment LEDs) because of the following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters and graphics. This is in contrast to LEDs,
which are limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of
the task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to
keep displaying the data.
4. Ease of programming for characters and graphics.

35

These components are specialized for being used with the microcontrollers, which
means that they cannot be activated by standard IC circuits. They are used for writing
different messages on a miniature LCD.
A model described here is for its low price and great possibilities most frequently used
in
practice.

Fig 3.1: LCD Display


It is based on the HD44780 microcontroller (Hitachi) and can display messages in two
lines with 16 characters each. It displays all the alphabets, Greek letters, punctuation marks,
mathematical symbols etc. In addition, it is possible to display symbols that user makes up on
its own. Automatic shifting message on display (shift left and right), appearance of the
pointer, backlight etc. are considered as useful characteristics.

3.2 PINS FUNCTIONS


There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background
light is built in). Their function is described in the table below:
Function
Ground
Power supply
Contrast
Control
of
operating

Pin Number
1
2
3

Name
Vss
Vdd
Vee

Logic State
-

RS

0
1

R/W

0
1

0
36

Description
0V
+5V
0 Vdd
D0 D7 are
interpreted
as
commands
D0 D7 are
interpreted
as
data
Write data (from
controller
to
LCD)
Read data (from
LCD
to
controller)
Access to LCD

1
From 1 to 0

Data / commands

7
8
9
10
11
12
13
14

D0
D1
D2
D3
D4
D5
D6
D7

0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1

disabled
Normal operating
Data/commands
are transferred to
LCD
Bit 0 LSB
Bit 1
Bit 2
Bit 3
Bit 4
Bit 5
Bit 6
Bit 7 MSB

Table 3.1: Pin Functions

3.3 LCD SCREEN


LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied
on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some versions
of displays have built in backlight (blue or green diodes). When used during operating, a
resistor for current limitation should be used (like with any LE diode).

37

Fig 3.2: LCD Screen

3.4 LCD BASIC COMMANDS


All data transferred to LCD through outputs D0-D7 will be interpreted as commands
or as data, which depends on logic state on pin RS:RS = 1 - Bits D0 - D7 are addresses of
characters that should be displayed. Built in processor addresses built in map of characters
and displays corresponding symbols. Displaying position is determined by DDRAM address.
This address is either previously defined or the address of previously transferred character is
automatically incremented.
RS = 0 - Bits D0 - D7 are commands which determine display mode. List of commands
which LCD recognizes are given in the table below:

Command

RS

Execution

RW

D7

D6

D5

D4

D3

D2

D1

D0

Clear display
0
Cursor home
0
Entry mode set 0
Display on/off
0
control
Cursor/Display
0
Shift
Function set
0
Set CGRAM
0
address
Set DDRAM
0
address
Read BUSY
0
flag (BF)
Write
to

0
0
0

0
0
0

0
0
0

0
0
0

0
0
0

0
0
0

0
0
1

0
1
I/D

1
X
S

Time
1.64mS
1.64mS
40uS

40uS

D/C

R/L

40uS

DL

40uS

CGRAM address

DDRAM address

40uS

BF

DDRAM address

CGRAM

D7

D6

D5

D4

D3

D2

D1

D0

40uS

D7

D6

D5

D4

D3

D2

D1

D0

40uS

or 1

40uS

DDRAM
Read
from
CGRAM

or 1

DDRAM

38

Table 3.2: LCD Basic Commands


I/D 1 = Increment (by 1)

R/L 1 = Shift right

0 = Decrement (by 1)
S 1 = Display shift on

0 = Shift left
DL 1 = 8-bit interface

0 = Display shift off

0 = 4-bit interface

D 1 = Display on

N 1 = Display in two lines

0 = Display off

0 = Display in one line

U 1 = Cursor on

F 1 = Character format 5x10 dots

0 = Cursor off

0 = Character format 5x7 dots

B 1 = Cursor blink on

D/C 1 = Display shift

0 = Cursor blink off

0 = Cursor shift

3.5 LCD CONNECTION


Depending on how many lines are used for connection to the microcontroller, there
are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the
process in a phase called initialization. In the first case, the data are transferred through
outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the sake of
saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for
communication, while other may be left unconnected.
Consequently, each data is sent to LCD in two steps: four higher bits are sent first
(that normally would be sent through lines D4-D7), four lower bits are sent afterwards. With
the help of initialization, LCD will correctly connect and interpret each data received.
Besides, with regards to the fact that data are rarely read from LCD (data mainly are
transferred from microcontroller to LCD) one more I/O pin may be saved by simple
connecting R/W pin to the Ground. Such saving has its price. Even though message
displaying will be normally performed, it will not be possible to read from busy flag since it
is not possible to read from display.

3.6 LCD INITIALIZATION

39

Once the power supply is turned on, LCD is automatically cleared. This process lasts
for approximately 15mS. After that, display is ready to operate. The mode of operating is set
by default. This means that:
1. Display is cleared
2. Mode
DL = 1 Communication through 8-bit interface
N = 0 Messages are displayed in one line
F = 0 Character font 5 x 8 dots
3. Display/Cursor on/off
D = 0 Display off
U = 0 Cursor off
B = 0 Cursor blink off
4. Character entry
ID = 1 Addresses on display are automatically incremented by 1
S = 0 Display shift off
Automatic reset is mainly performed without any problems. Mainly but not always! If
for any reason power supply voltage does not reach full value in the course of 10mS, display
will start perform completely unpredictably. If voltage supply unit can not meet this condition
or if it is needed to provide completely safe operating, the process of initialization by which a
new reset enabling display to operate normally must be applied.
Algorithm according to the initialization is being performed depends on whether
connection to the microcontroller is through 4- or 8-bit interface. All left over to be done after
that is to give basic commands and of course- to display messages.

40

Fig 3.3: Procedure on 8-bit initialization

3.7 CONTRAST CONTROL


3.7.1 VARIABLE RESISTIOR: To have a clear view of the characters on the LCD, contrast
should be adjusted. To adjust the contrast, the voltage should be varied. For this, a preset is
used which can behave like a variable voltage device. As the voltage of this preset is varied,
the contrast of the LCD can be adjusted.

Fig 3.4: Variable resistor


3.7.2 POTENTIOMETER
Variable resistors used as potentiometers have all three terminals connected. This
arrangement is normally used to vary voltage, for example to set the switching point of a
circuit with a sensor, or control the volume (loudness) in an amplifier circuit. If the terminals
at the ends of the track are connected across the power supply, then the wiper terminal will
provide a voltage which can be varied from zero up to the maximum of the supply.

Fig 3.5: Potentiometer Symbol

3.8 PRESETS
These are miniature versions of the standard variable resistor. They are designed to be
mounted directly onto the circuit board and adjusted only when the circuit is built. For

41

example to set the frequency of an alarm tone or the sensitivity of a light-sensitive circuit. A
small screwdriver or similar tool is required to adjust presets.
Presets are much cheaper than standard variable resistors so they are sometimes used
in projects where a standard variable resistor would normally be used.
Multiturn presets are used where very precise adjustments must be made. The screw
must be turned many times (10+) to move the slider from one end of the track to the other,
giving very fine control.

Fig 3.6: Preset Symbol

Fig 3.7: Preset

4.LIGHT EMITTING DIODE (LED)


4.1 INTRODUCTION
Light emitting diodes are diodes (electronic components that let electricity pass in
only one direction) that emit visible light when electricity is applied, much like a light bulb.
When many LEDs are side-by-side, they can create pictures, such as the scrolling red LED
signs found everywhere.

42

Fig 4.1: LED


Early leds produced only red light, but modern leds can produce several different
colors, including red, green, and blue (RGB) light. Recent advances in led technology have
made it possible for leds to produce white light as well. Leds are commonly used for
indicator lights (such as power on/off lights) on electronic devices. They also have several
other applications, including electronic signs, clock displays, and flashlights.

4.2 WORKING
A light-emitting diode (LED) is a two-lead semiconductor light source. It is a
basic pn-junction diode, which emits light when activated. When a fitting voltage is applied
to the leads, electrons are able to recombine with electron holes within the device, releasing
energy in the form of photons. This effect is called electroluminescence, and the color of the
light (corresponding to the energy of the photon) is determined by the energy band gap of the
semiconductor.
An LED is often small in area (less than 1 mm2) and integrated optical components
may be used to shape its radiation pattern.
LEDs have many advantages over incandescent light sources including lower energy
consumption, longer lifetime, improved physical robustness, smaller size, and faster
switching. Light-emitting diodes are now used in applications as diverse asaviation
lighting, automotive headlamps, advertising, general lighting, traffic signals, and camera
flashes. However, LEDs powerful enough for room lighting are still relatively expensive, and
43

require more precise current and heat management than compact fluorescent lamp sources of
comparable output.

4.3 COLOURS AND MATERIALS


Conventional LEDs are made from a variety of inorganic semiconductor materials.
The following table shows the available colors with wavelength range, voltage drop and
material:

Color

Wavelength [nm]

Voltage drop [V]

Semiconductor
material
Gallium

Infrared

> 760

V < 1.63

arsenide (GaAs)
Aluminium

gallium

arsenide (AlGaAs)
Aluminium

gallium

arsenide (AlGaAs)
Gallium

arsenide

phosphide (GaAsP)
Red

610 < < 760

1.63 < V < 2.03

Aluminium

gallium

indium
phosphide (AlGaInP)
Gallium(III)
phosphide (GaP)
Gallium

arsenide

phosphide (GaAsP)
Aluminium
Orange

590 < < 610

2.03 < V < 2.10

gallium

indium
phosphide (AlGaInP)
Gallium(III)
phosphide (GaP)

Yellow

570 < < 590

2.10 < V < 2.18

Gallium

arsenide

phosphide (GaAsP)
44

Aluminium

gallium

indium
phosphide (AlGaInP)
Gallium(III)
phosphide (GaP)
Traditional

green:

Gallium(III)
phosphide (GaP)
Aluminium

gallium

indium
Green

500 < < 570

1.9 < V < 4.0

phosphide (AlGaInP)
Aluminium

gallium

phosphide (AlGaP)
Pure

green:

Indium

gallium

nitride (InGaN) / Galli


um(III) nitride (GaN)
Zinc selenide (ZnSe)
Indium

gallium

nitride (InGaN)
Blue

450 < < 500

2.48 < V < 3.7

Silicon carbide (SiC)


as

substrate

Silicon (Si)

as

substrateunder
development
Violet

400 < < 450

2.76 < V < 4.0

Indium

gallium

nitride (InGaN)
Dual blue/red LEDs,
blue

Purple

Multiple types

2.48 < V < 3.7

with

red

phosphor,
or white with purple
plastic

45

Diamond (235 nm)


Boron
nitride (215 nm)
Aluminium
nitride (AlN)
Ultraviolet

< 400

3.1 < V < 4.4

(210 nm)
Aluminium

gallium

nitride (AlGaN)
Aluminium

gallium

indium
nitride (AlGaInN)
down to 210 nm
Blue with one or two
phosphor

Pink

Multiple types

V ~ 3.3

layers:

yellow

with

red,

orange

or

pink

phosphor

added

afterwards,
or white phosphors
with pink pigment or
dye over top.
White

Broad spectrum

V = 3.5

Blue/UV diode with


yellow phosphor

Table 4.1: Colours and Materials

4.4 ADVANTAGES

Efficiency: LEDs emit more lumens per watt than incandescent light bulbs. The
efficiency of LED lighting fixtures is not affected by shape and size, unlike fluorescent
light bulbs or tubes.

Color: LEDs can emit light of an intended color without using any color filters as
traditional lighting methods need. This is more efficient and can lower initial costs.
46

Size: LEDs can be very small (smaller than 2 mm2) and are easily attached to printed
circuit boards.

On/Off time: LEDs light up very quickly. A typical red indicator LED will achieve
full brightness in under a microsecond. LEDs used in communications devices can have
even faster response times.

Cycling: LEDs are ideal for uses subject to frequent on-off cycling, unlike fluorescent
lamps that fail faster when cycled often, or High-intensity discharge lamps (HID lamps)
that require a long time before restarting.

Dimming: LEDs can very easily be dimmed either by pulse-width modulation or


lowering the forward current. This pulse-width modulation is why LED lights viewed on
camera, particularly headlights on cars, appear to be flashing or flickering. This is a type
of stroboscopic effect.

Cool light: In contrast to most light sources, LEDs radiate very little heat in the form
of IR that can cause damage to sensitive objects or fabrics. Wasted energy is dispersed as
heat through the base of the LED.

Slow failure: LEDs mostly fail by dimming over time, rather than the abrupt failure
of incandescent bulbs.

Lifetime: LEDs can have a relatively long useful life. One report estimates 35,000 to
50,000 hours of useful life, though time to complete failure may be longer. Fluorescent
tubes typically are rated at about 10,000 to 15,000 hours, depending partly on the
conditions of use, and incandescent light bulbs at 1,000 to 2,000 hours.
Several DOE demonstrations have shown that reduced maintenance costs from this
extended lifetime, rather than energy savings, is the primary factor in determining the
payback period for an LED product.

Shock resistance: LEDs, being solid-state components, are difficult to damage with
external shock, unlike fluorescent and incandescent bulbs, which are fragile.

47

Focus: The solid package of the LED can be designed to focus its light. Incandescent
and fluorescent sources often require an external reflector to collect light and direct it in a
usable manner. For larger LED packages total internal reflection (TIR) lenses are often
used to the same effect. However, when large quantities of light are needed many light
sources are usually deployed, which are difficult to focus or collimate towards the same
target.

4.5 APPLICATIONS

Visual signals where light goes more or less directly from the source to the human

eye, to convey a message or meaning.


Illumination where light is reflected from objects to give visual response of these

objects.
Measuring and interacting with processes involving no human vision.
Narrow band light sensors where LEDs operate in a reverse-bias mode and respond to

incident light, instead of emitting light. See LEDs as light sensors.


Indicators and signs
Lighting
Data communication and other signaling
Sustainable lighting
Energy consumption

Economically sustainable

Light sources for machine vision systems

5. TEMPERATURE SENSOR (LM35)


The LM35 sensor series are precision integrated-circuit temperature sensors, whose output voltage is
linearly proportional to the Celsius (Centigrade) temperature.

Fig 5.1. TEMPERATURE SENSOR (LM35)

5.1 LM35 Sensor Specification

48

The LM35 series are precision integrated-circuit LM35 temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 sensor
thus has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not
required to subtract a large constant voltage from its output to obtain convenient Centigrade
scaling. The LM35 sensor does not require any external calibration or trimming to provide
typical accuracies of C at room temperature and C over a full -55 to +150C
temperature range. Low cost is assured by trimming and calibration at the wafer level. The
LM35's low output impedance, linear output, and precise inherent calibration make
interfacing to readout or control circuitry especially easy. It can be used with single power
supplies, or with plus and minus supplies. As it draws only 60 A from its supply, it has very
low self-heating, less than 0.1C in still air. The LM35 is rated to operate over a -55 to
+150C temperature range, while the LM35C sensor is rated for a -40 to +110C range (-10
with improved accuracy). The LM35 series is available packaged in hermetic TO-46
transistor packages, while the LM35C, LM35CA, and LM35D are also available in the plastic
TO-92 transistor package. The LM35D sensor is also available in an 8-lead surface mount
small outline package and a plastic TO-220 package.

Fig 5.2.LM35 Sensor Circuit Schematic

49

Fig.5.3.LM35 Sensor Pinouts and Packaging

5.2.LM35 Sensor Sources:


There are several manufacturers of this popular part and each has LM35 sensor specs,
datasheets and other free LM35 downloads. This amplifier is available from the following
manufacturers.
National Semiconductor
On Semiconductor
Texas Instruments
Fairchild Semiconductor
STMicroelectronics
Jameco Electronics
Analog Devices

5.3 LM35 Sensor Background and Applications


Most commonly-used electrical temperature sensors are difficult to apply. For example,
thermocouples have low output levels and require cold junction compensation. Thermistors
50

are nonlinear. In addition, the outputs of these sensors are not linearly proportional to any
temperature scale. Early monolithic sensors, such as the LM3911, LM134 and LM135,
overcame many of these difficulties, but their outputs are related to the Kelvin temperature
scale rather than the more popular Celsius and Fahrenheit scales. Fortunately, in 1983 two
I.C.s, the LM34 Precision Fahrenheit Temperature Sensor and the LM35 Precision Celsius
Temperature Sensor, were introduced. This application note will discuss the LM34, but with
the proper scaling factors can easily be adapted to the LM35.
The LM35/LM34 has an output of 10 mV/F with a typical nonlinearity of only 0.35F over
a 50 to +300F temperature range, and is accurate to within 0.4F typically at room
temperature (77F). The LM34s low output impedance and linear output characteristic make
interfacing with readout or control circuitry easy. An inherent strength of the LM34 sensor
over other currently available temperature sensors is that it is not as susceptible to large errors
in its output from low level leakage currents. For instance, many monolithic temperature
sensors have an output of only 1 A/K. This leads to a 1K error for only 1 -Ampere of
leakage current. On the other hand, the LM34 sensor may be operated as a current mode
device providing 20 A/F of output current. The same 1 A of leakage current will cause an
error in the LM34s output of only 0.05F (or 0.03K after scaling).
Low cost and high accuracy are maintained by performing trimming and calibration
procedures at the wafer level. The device may be operated with either single or dual supplies.
With less than 70 A of current drain, the LM34 sensor has very little self-heating (less than
0.2F in still air), and comes in a TO-46 metal can package, a SO-8 small outline package and
a TO-92 plastic package.
The LM35/LM34 is a versatile device which may be used for a wide variety of applications,
including oven controllers and remote temperature sensing. The device is easy to use (there
are only three terminals) and will be within 0.02F of a surface to which it is either glued or
cemented. The TO-46 package allows the user to solder the sensor to a metal surface, but in
doing so, the GND pin will be at the same potential as that metal. For applications where a
steady reading is desired despite small changes in temperature, the user can solder the TO-46
package to a thermal mass. Conversely, the thermal time constant may be decreased to speed
up response time by soldering the sensor to a small heat fin.

6. DC MOTOR
51

Fig.6.1.DC MOTOR
DC motors are configured in many types and sizes, including brush less, servo, and
gear motor types. A motor consists of a rotor and a permanent magnetic field stator. The
magnetic field is maintained using either permanent magnets or electromagnetic windings.
DC motors

are most commonly used in variable speed and torque.

Motion and

controls cover a wide range of components that in some way are used to generate and/or
control motion. Areas within this category include bearings and bushings, clutches and
brakes, controls and drives, drive components, encoders and resolves, Integrated motion
control, limit switches, linear actuators, linear and rotary motion components, linear
position sensing, motors (both AC and DC motors), orientation position sensing,
pneumatics and pneumatic components, positioning stages, slides and guides, power
transmission (mechanical), seals, slip rings, solenoids, springs.
Motors are the devices that provide the actual speed and torque in a drive
system. This family includes AC motor types (single and multiphase motors, universal,
servo motors, induction, synchronous, and gear motor) and DC motors (brush less, servo
motor, and gear motor) as well as linear, stepper and air motors, and motor contactors and
starters.
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).

52

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator,
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 rotor (together with the axle and attached commutator)
rotates with respect to the stator. The rotor consists of windings (generally on a core), the
windings being electrically connected to the commutator. The above diagram shows a
common motor layout -- with the rotor inside the stator (field) magnets.
In real life, though, DC motors will always have more than two poles (three is a
very common number). In particular, this avoids "dead spots" in the commutator. You can
imagine how with our example two-pole motor, if the rotor is exactly at the middle of its
rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile,
with a two-pole motor, there is a moment where the commutator shorts out the power
supply (i.e., both brushes touch both commutator contacts simultaneously). This would be
bad for the power supply, waste energy, and damage motor components as well. Yet
another disadvantage of such a simple motor is that it would exhibit a high amount of
torque ripple" (the amount of torque it could produce is cyclic with the position of the
rotor).

So since most small DC motors are of a three-pole design, let's tinker with the workings of
one via an interactive animation (JavaScript required):

53

You'll notice a few things from this -- namely, one pole is fully energized at a
time (but two others are "partially" energized). As each brush transitions from one
commutator contact to the next, one coil's field will rapidly collapse, as the next coil's field
will rapidly charge up (this occurs within a few microsecond). We'll see more about the
effects of this later, but in the meantime you can see that this is a direct result of the coil
windings' series wiring:

There's probably no better way to see how an average dc motor is put together, than by just
opening one up. Unfortunately this is tedious work, as well as requiring the destruction of a
perfectly good motor.

7. MQ-5 GAS SENSOR:


7.1 FEATURES
*

High sensitivity to LPG, natural gas , town gas

Small sensitivity to alcohol, smoke.

Fast response . * Stable and long life * Simple drive circuit

7.2 APPLICATION

54

They are used in gas leakage detecting equipments in family and industry, are suitable
for detecting of LPG, natural gas , town gas, avoid the noise of alcohol and cooking fumes
and cigarette smoke.
7.3 SPECIFICATIONS
Symbol
Vc
VH
PL

Parameter name
Circuit voltage
Heating voltage
Load resistance

Technical condition
5V0.1
5V0.1
20KQ

Remarks
AC OR DC
ACOR DC

RH
PH

Heater resistance
Heating consumption

31 10%
less than 800mw

Room Tem

Table.7.1.A. Standard work condition


Symbol
Tao
Tas
RH
O2

Parameter name
Using Tem
Storage Tem
Related humidity
Oxygen concentration

Technical condition
-10C-50C
-20C-70C
less than 95%Rh
21%(standard

Remarks

condition)Oxygen

2%

concentration

can

minimum value is over


affect

sensitivity
Table.7.2.B. Environment condition

Symbol
Rs
A

Parameter name
Sensing Resistance

Technical parameter
10KQ60KQ

Remarks
Detecting concentration
scope:

Concentration slope rate

(5000ppm methane )
^0.6

(5000ppm/100

200-10000ppm
LPG,LNG Natural gas,

0 ppm CH4)
Standard

Temp: 20 C 2C Vc:5V0.1

detecting

Humidity: 65%5% Vh: 5V0.1

condition
Preheat time Over 24 hour
Table.7.3.C. Sensitivity characteristic

55

iso-butane,
Town gas

propane

Fig7.1.D. Structure and configuration, basic measuring circuit


Fig. 1

56

Structure and configuration of MQ-5 gas sensor is shown as Fig. 1 (Configuration A or B),
sensor composed by TEL: micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer,
measuring electrode and heater are fixed into a crust made by plastic and stainless steel net.
The heater provides necessary work conditions for work of sensitive components. The
enveloped MQ-5 have 6 pin ,4 of them are used to fetch signals, and other 2 are used for
providing heating current.
Electric parameter measurement circuit is shown as Fig.2
E. Sensitivity characteristic curve
Fig.7.2 sensitivity characteristics of the MQ-5

Fig.3 is shows the typical sensitivity characteristics of the MQ-5 for several gases. in their:
Temp: 20 C,
Humidity: 65%,
O2 concentration 21 %
RL=20k 0
Ro: sensor resistance at 1000ppm of
H2 in the clean air.
Rs:sensor resistance at various concentrations of gases.

57

Fig.4 is shows the typical dependence of the MQ-5 on temperature and humidity.
Ro: sensor resistance at 1000ppm of H2 in air at 33%RH and 20 degree.
Rs: sensor resistance at different temperatures and humiditys.

7.4 SENSITVITY ADJUSTMENT


Resistance value of MQ-5 is difference to various kinds and various concentration
gases. So, When using this components, sensitivity adjustment is very necessary. we
recommend that you calibrate the detector for 1000ppm H2 or LPG concentration in air and
use value of Load resistance ( RL) about 20 K 0 (10K 0 to 47K 0).When accurately
measuring, the proper alarm point for the gas detector should be determined after considering
the temperature and humidity influence.

2.8. RF Tx AND RF Rx:


2.8.433 MHZ RF TRANSMITTER STT-433
2.8.1 Overview
The STT-433 is ideal for remote control applications where low cost and longer range is
required. The transmitter operates from a1.5-12V supply, making it ideal for battery-powered
applications. The transmitter employs a SAW-stabilized oscillator, ensuring accurate
frequency control for best range performance. Output power and harmonic emissions are easy
to control, making FCC and ETSI compliance easy. The manufacturing-friendly SIP style
package and low-cost make the STT-433 suitable for high volume applications.

58

FIG.8.1.433

MH Z RF TRANSMITTER STT-433

2.8.2.Features
433.92 MHz Frequency
Low Cost
1.5-12V operation
11mA current consumption at 3V
Small size
4 dBm output power at 3V
2.8.3.Applications
Remote Keyless Entry (RKE)
Remote Lighting Controls
On-Site Paging
Asset Tracking
Wireless Alarm and Security Systems
Long Range RFID
Automated Resource Management

59

Table.8.1.Specification

TABLE.8.2.PIN DESCRIPTION

2.8.4.OPERATION
Theory
OOK(On Off Keying) modulation is a binary form of amplitude modulation. When a logical
0 (data line low) is being sent, the transmitter is off, fully suppressing the carrier. In this state,
the transmitter current is very low, less than 1mA. When a logical 1 is being sent, the carrier
is fully on. In this state, the module current consumption is at its highest, about 11mA with a
3V power supply.
OOK is the modulation method of choice for remote control applications where power
consumption and cost are the primary factors. Because OOK transmitters draw no power
when they transmit a 0, they exhibit significantly better power consumption than FSK
transmitters. OOK data rate is limited by the start-up time of the oscillator. High-Q oscillators
which have very stable center frequencies take longer to start-up than low-Q oscillators. The
start-up time of the oscillator determines the maximum data rate that the transmitter can send.
Data Rate
The oscillator start-up time is on the order of 40uSec, which limits the maximum data rate to
4.8 kbit/sec.
SAW stabilized oscillator
The transmitter is basically a negative resistance LC oscillator whose center frequency is
tightly controlled by a SAW resonator. SAW (Surface Acoustic Wave) resonators are
fundamental frequency devices that resonate at frequencies much higher than crystals.

2.8.5.433 MHZ RF RECEIVER STR-433


The STR-433 is ideal for short-range remote control applications where cost is a
primary concern. The receiver module requires no external RF components except for the
antenna. It generates virtually no emissions, making FCC and ETSI approvals easy. The
super-regenerative design exhibits exceptional sensitivity at a very low cost. The

60

manufacturing-friendly SIP style package and low-cost make the STR-433 suitable for high
volume applications.

FIG.8.2.433

MH Z RF RECEIVER STR-433

2.8.6.Features
Low Cost
5V operation
3.5mA current drain
No External Parts are required
Receiver Frequency: 433.92 MHZ
Typical sensitivity: -105dBm
IF Frequency: 1MHz

2.8.7.Applications
Car security system
Sensor reporting
Automation system
Remote Keyless Entry (RKE)
Remote Lighting Controls
On-Site Paging
Asset Tracking
Wireless Alarm and Security Systems
Long Range RFID
Automated Resource Management

Table.8.2.Specification

61

Table.8.3.Pin description
2.8.8.OPERATION
Super-Regenerative AM Detection
The STR-433 uses a super-regenerative AM detector to demodulate the incoming
AM carrier. A super regenerative detector is a gain stage with positive feedback greater than
unity so that it oscillates. An RC-time constant is included in the gain stage so that when the
gain stage oscillates, the gain will be lowered over time proportional to the RC time constant
until the oscillation eventually dies. When the oscillation dies, the current draw of the gain
stage decreases, charging the RC circuit, increasing the gain, and ultimately the oscillation
starts again. In this way, the oscillation of the gain stage is turned on and off at a rate set by
the RC time constant. This rate is chosen to be super-audible but much lower than the main
oscillation rate. Detection is accomplished by measuring the emitter current of the gain stage.
Any RF input signal at the frequency of the main oscillation will aid the main oscillation in
Restarting. If the amplitude of the RF input increases, the main oscillation will stay on for a
longer period of time, and the emitter current will be higher. Therefore, we can detect the
original base-band signal by simply low-pass filtering the emitter current.
The average emitter current is not very linear as a function of the RF input level. It
exhibits a 1/ln response because of the exponentially rising nature of oscillator start-up. The
steep slope of a logarithm near zero results in high sensitivity to small input signals.

2.8.9.Data Slicer
The data slicer converts the base-band analog signal from the super-regenerative
detector to a CMOS/TTL compatible output. Because the data slicer is AC coupled to the
audio output, there is a minimum data rate. AC coupling also limits the minimum and
maximum pulse width. Typically, data is
62

encoded on the transmit side using pulse-width modulation (PWM) or non-return-to-zero


(NRZ). The most common source for NRZ data is from a UART embedded in a microcontroller. Applications that use NRZ data encoding typically involve microcontrollers. The
most common source for PWM data is from a remote control IC such as the HC-12E from
Holtek Data is sent as a constant rate square-wave. The duty cycle of that square wave will
generally be either 33% (a zero) or 66% (a one). The data slicer on the STR-433 is optimized
for use with PWM encoded data, though it will work with NRZ data if certain encoding rules
are followed.

2.8.10.Power Supply
The STR-433 is designed to operate from a 5V power supply. It is crucial that this
power supply be very quiet. The power supply should be bypassed using a 0.1uF low-ESR
ceramic capacitor and a 4.7Uf tantalum capacitor. These capacitors should be placed as close
to the power pins as possible. The STR- 433 is designed for continuous duty operation. From
the time power is applied, it can take up to 750mSec for the data output to become valid.

Antenna Input
It will support most antenna types, including printed antennas integrated directly onto the
PCB and simple single core wire of about 17cm. The performance of the different antennas
varies. Any time a trace is longer than 1/8th the wavelength of the frequency it is carrying, it
should be a 50 ohm microstrip.
Typical Application
Remark: Antenna length about: 17cm for 433MHz

2.9.PIEZOELECTRIC BUZZER
9.1 INTRODUCTION
A buzzer or beeper is

an audio signaling

device, which

may

be mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and beepers


include alarm devices, timers and confirmation of user input such as a mouse click or
keystroke.
A piezoelectric element may be driven by an oscillating electronic circuit or
other audio signal source, driven with a piezoelectric audio amplifier. Sounds commonly used
to indicate that a button has been pressed are a click, a ring or a beep.
Piezo buzzer is an electronic device commonly used to produce sound. Light weight,
simple construction and low price make it usable in various applications like car/truck
reversing indicator, computers, call bells etc. Piezo buzzer is based on the inverse principle of
63

piezo electricity discovered in 1880 by Jacques and Pierre Curie. It is the phenomena of
generating electricity when mechanical pressure is applied to certain materials and the vice
versa is also true. Such materials are called piezo electric materials. Piezo electric materials
are either naturally available or manmade. Piezoceramic is class of manmade material, which
poses piezo electric effect and is widely used to make disc, the heart of piezo buzzer. When
subjected to an alternating electric field they stretch or compress, in accordance with the
frequency of the signal thereby producing sound.

.
Fig 9.1: Piezoelectric buzzer

Fig 9.2: Internal view of buzzer


A buzzer or beeper is

an audio signalling

device,

which

may

be mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and beepers

64

include alarm devices, timers and confirmation of user input such as a mouse click or
keystroke.

2.9.2 WORKING
The piezo buzzer produces sound based on reverse of the piezoelectric effect. The
generation of pressure variation or strain by the application of electric potential across a
piezoelectric material is the underlying principle. These buzzers can be used alert a user of an
event corresponding to a switching action, counter signal or sensor input. They are also used
in alarm circuits.
The buzzer produces a same noisy sound irrespective of the voltage variation applied
to it. It consists of piezo crystals between two conductors. When a potential is applied across
these crystals, they push on one conductor and pull on the other. This, push and pull action,
results in a sound wave. Most buzzers produce sound in the range of 2 to 4 kHz. The Red lead
is connected to the Input and the Black lead is connected to Ground.

2.9.3 AUDIBLE SOUND TRANSDUCERS (PIEZO BUZZERS)


Simple, compact, and reliable, piezoelectric audible sound transducersalso called
tone generators, or buzzerscan deliver a high sound output from a small (milliwatt) energy
input. Emitted sounds range from soft hums to strident alarms. These devices are well suited
for use in portable, battery powered equipment, and are employed in a wide variety of
products, including timers, smoke alarms, games, telephone ringers, metal detectors, watches,
automobile alarms, and many others.
The working component in most audible sound transducers is a thin disk of
piezoelectric ceramic bonded to a similarly thin metal diaphragm. When a voltage is applied
to the ceramic disk, the disk deforms, causing the metal diaphragm to bend. When a recurring
voltage is applied the ceramic / metal bending element vibrates at the frequency of the
applied voltage, and produces an audible sound. If the mechanical resonance frequency of the
ceramic / metal element and the frequency of the applied electrical signal are matched, the
amplitude of the vibrations will be greatest, and sound output will be maximum. (The
resonance frequency of the ceramic element alone is too high to produce audible sound,
hence the need for the metal diaphragm.)
The construction of a buzzer greatly affects the level of the sound it emits -- and the
cost of the device. Nodal support mounting minimizes mechanical restriction on the
65

movement of the sound-producing mechanism, so the amplitude of the vibrations is highest.


On the other hand, signal originating from beyond the nodal ring will be in antiphase with
signal from the central part of the element, and can reduce the sound output. To prevent this
interference, the housing must absorb all output from the periphery of the element.

2.9.4 ADVANTAGES

Wide

variety

self-oscillating

of

buzzers

available

sizes

buzzers
without

frequencies
with

/
signal

signal

- multi-tone sound generators /sirens


Cow cost / high sound outputs
Can be mounted in printed circuit boards
Competitive pricing
Fast delivery

2.9.5 TYPICAL APPLICATIONS OF A PIEZO BUZZER

Alarms / warning devices / automobile alarms


Pest deterrents
Computer devices
Telephones
Toys / games

66

sound

outputs:
generators
generators

CHAPTER - 3
SOFTWARE TOOLS
3.1 KEIL SOFTWARE
Keil compiler is a software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which is to
be dumped into the microcontroller for further processing. Keil compiler also supports C
language code.

3.2 STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN


KEIL AND HOW TO COMPILE IT
Step1: Click for KEIL VISION4 Icon which appears after Installing Keil KEIL
VISION4.

67

Step2: Click on Project Menu, Then New Vison Project.

Step3: Create New Project Folder named as Keil Test.

68

Step 4: Select Target Device Vendor (i.e.).

Step 5: Then select specific chip LPC2148.

69

Step 6: Then select specific chip i.e. LPC2148.

Step 7: Then you will see following window.

Step 8: Now you see Startup.s is already added which is necessary for running code for
Keil.
Note: Code wills Not Run without Startup.s
Startup.s is available in C:\Keil\ARM\Startup\Philips.
70

The startup-code executes immediately upon reset of the target system and performs the
following operations:
1. Defines interrupt and exception vectors.
2. Configures the CPU clock source (on some devices).
3. Initializes the external bus controller.
4. Copies the exception vectors from ROM to RAM for systems with memory
remapping.
5. Initializes other low level peripherals, if necessary.
6. Reserves and initializes the stack for all modes.
7. Reserves the heap.
8. Transfers control to the main C function.

Step 9: Now Click on File Menu and Click on New.

Step 10: Write Code for Blink LED in C and FileName.c Save.
Note: Dont forget to save .c Extension.
71

Step 11: Now you Window in C Syntax.

Step 12: Now you add LED.c file by adding Sourse Group 1 Add files to Group Source
Group 1.

72

Step 13: Add LED.C file.

73

Step 14: Now Click on Options for Target Target 1.

Step 15: Go to Options for Target Target 1. Click on Check Box Create HEX File.

Step 16: Then go to Linker. Click on Use Memory Layout for Target Dialog.

74

Step 17: Then Click on Rebuild All Target Files

Step 18: Now you see 0 Error(s), 0 Warning (s). Then Hex File will create in Specific Folder.
Now to download it for you target hardware.

75

3.3 PROLOAD
Proload is a 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 placed in
the programmer kit and this is done by the Proload. Programmer kit contains a
microcontroller on 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 this 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 or from an
adapter connected to 230 V AC.
1. Install the Proload Software in the PC.
2. Now connect the Programmer kit to the PC (CPU) through serial cable.
3. Power up the programmer kit from the ac supply through adapter.
4. Now place the microcontroller in the GIF socket provided in the programmer kit.
5. Click on the Proload icon in the PC. A window appears providing the information like
Hardware model, com port, device type, Flash size etc. Click on browse option to
select the hex file to be dumped into the microcontroller and then click on Auto
program to program the microcontroller with that particular hex file.
6. The status of the microcontroller can be seen in the small status window in the bottom
of the page.
7. After this process is completed, remove the microcontroller from the programmer kit
and place it in your system board. Now the system board behaves according to the
program written in the microcontroller.

76

CHAPTER-4
PROJECT SCHEMATIC

77

CHAPTER-5
5.1 Advantages:
1. Wireless control appliances
2. Effectively utilize wireless technology
3. Save energy
78

5.2 Applications:
1. Home automation
2. Industrial automation and Office management system

CHAPTER-6
CONCLUSION
This project focuses on monitoring and controlling the transformer using sensors and
RF transceiver circuit. In most of the industries mainly transformer life decreases due to
improper maintenance and manual operation. If every industry installs the proposed system
transformer controlling and maintaining can be made easier. Proposed system is a micro
controller based wireless system. PIC micro controller is used because of its low cost and
high efficiency. It provides an effective measure to save man power by providing automation
of transformer monitoring and controlling.

FUTURE SCOPE:
A server module can be included to this system for receiving and storing transformer
parameters information periodically about all the distribution transformers of a particular

79

utility in a database application. This database will be a useful source of information on the
utility transformers. Analysis of these stored data helps the utility in monitoring the
operational behaviour of their distribution transformers and identify faults before any
catastrophic failures thus resulting in significant cost saving as well as improving system
reliability.

CHAPTER-7
REFERENCES
[1] Nagargoje Surekha ,Abhishek Kumar ,Mr. Daniel A.Figueiredo, Monitoring and
controlling of distribution transformer using gsm modem in International Journal of
Advanced Research in Computer Science and Software Engineering, Volume 4, Issue 7, July
2014.
[2] Szabo, R. Embedded temperature monitoring system with a microcontroller used in the
automotive industry in Telecommunications Forum (TELFOR), 2012.
[3] Jialong Sun, Monitoring and control system of transformer temperature rising test in
International Conference of Electrical and Control Engineering (ICECE), 2011.
[4] Mei- sung kang, ZigBee wireless network for transformer load monitoring and
temperature sensitivity analysis Industry applications in transactions, and 2011.
80

[5] International Journal Research and Review in Applied Science, V. Thiyagarajan & T.G.
Palanivel,An,An efficient monitoring of substations using microcontroller based
monitoring system, July 2010.
[6] GaoYanPing,Microcomputer protection into the quantity of the open loop problem
analysis power automation equipment Proceedings of IEEE, 2008.
[7] Gockburg,Condition monitoring and diagnosis of power transformers CMD
international conference, 2008.
[8] Garcia.B,A moisture-in-oil model for power transformer monitoring IEEE international
conference, 2005.
[9] Tomsovic.K,Designing the Next Generation of Real-Time Control, Communication, and
Computations for Large Power Systems, 2005.
[10] YangQingBao,Modern sensing technology foundation in Industrial Electronics, 2001

81

Potrebbero piacerti anche