Sie sind auf Seite 1von 53

Chapter 1

INTRODUCTION
1.1 Embedded System
An embedded system is a combination of software and hardware to perform a
dedicated task.
Some of the main devices used in embedded products are Microprocessors and
Microcontrollers.
Microprocessors are commonly referred to as general purpose processors as
they simply accept the inputs, process it and give the output. In contrast, a
microcontroller not only accepts the data as inputs but also manipulates it, interfaces
the data with various devices, controls the data and thus finally gives the result.
As everyone in this competitive world prefers to make the things easy and
simple to handle, this project sets an example to some extent.
Embedded system is a special-purpose computer system designed to perform
one or a few dedicated functions, sometimes with real-time computing constraints. It
is usually embedded as part of a complete device including hardware and mechanical
parts. In contrast, a general-purpose computer, such as a personal computer, can do
many different tasks depending on programming. Embedded systems have become
very important today as they control many of the common devices we use.Since the
Embedded system is dedicated to specific tasks, design engineers can optimize it,
reducing the size and cost of the product, or increasing the reliability and
performance. Some embedded systems are mass-produced, benefiting from
economies of scale.
Physically, Embedded systems range from portable devices such as digital
watches and MP3 players to large stationary installations like traffic lights, factory
controllers, or the systems controlling nuclear power plants. Complexity varies from
low, with a single microcontroller chip, to very high with multiple units, peripherals
and networks mounted inside a large chassis or enclosure. In general, "Embedded
system" is not an exactly defined term, as many systems have some element of
1

programmability. For example, Handheld computers share some elements with


embedded systems such as the operating systems and microprocessors which
power them but are not truly embedded systems, because they allow different
applications to be loaded and peripherals to be connected.
An embedded system is some combination of computer hardware and
software, either fixed in capability or programmable, that is specifically designed for a
particular kind of application device. Industrial machines, automobiles, medical
equipment, cameras, household appliances, airplanes, vending machines, and toys (as
well as the more obvious cellular phone and PDA) are among the myriad possible
hosts of an embedded system. Embedded systems that are programmable are provided
with a programming interface, and embedded systems programming is a specialized
occupation. Certain operating systems or language platforms are tailored for the
embedded market, such as Embedded Java and Windows XP Embedded. However,
some low-end consumer products use very inexpensive microprocessors and limited
storage, with the application and operating system both part of a single program. The
program is written permanently into the system's memory in this case, rather than
being loaded into RAM (random access memory), as programs on a personal
computer are.

1.2 Applications of Embedded System


We are living in the Embedded World. We are surrounded with many
embedded products and our daily life largely depends on the proper functioning of
these gadgets. Television, Radio, CD player of your living room, Washing Machine or
Microwave Oven in our kitchen, Card readers, Access Controllers, Palm devices of
our work space enable us to do many of our tasks very effectively. Apart from all
these, many controllers embedded in our car take care of car operations between the
bumpers and most of the times we tend to ignore all these controllers.
In recent days, we are showered with variety of information about these
embedded controllers in many places. All kinds of magazines and journals regularly
dish out details about latest technologies, new devices; fast applications which make
us believe that our basic survival is controlled by these embedded products. Now we
can agree to the fact that these embedded products have successfully invaded into our
world. We must be wondering about these embedded controllers or systems.

The computer we use to compose our mails, or create a document or analyze


the database is known as the standard desktop computer. These desktop computers are
manufactured to serve many purposes and applications. We need to install the relevant
software to get the required processing facility. So, these desktop computers can do
many things. In contrast, embedded controllers carryout a specific work for which
they are designed. Most of the time, engineers design these embedded controllers with
a specific goal in mind. So these controllers cannot be used in any other place.
Theoretically, an embedded controller is a combination of a piece of microprocessor
based hardware and the suitable software to undertake a specific task.
These days designers have many choices in microprocessors/microcontrollers.
Especially, in 8 bit and 32 bit, the available variety really may overwhelm even an
experienced designer. Selecting a right microprocessor may turn out as a most
difficult first step and it is getting complicated as new devices continue to pop-up very
often. In the 8 bit segment, the most popular and used architecture is Intel's 8031.
Market acceptance of this particular family has driven many semiconductor
manufacturers to develop something new based on this particular architecture. Even
after 25 years of existence, semiconductor manufacturers still come out with some
kind of device using this 8031 core.

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, X-ray scanners; equipment used in blood analysis,
radiation, colonscopy, endoscopy etc. Developments in medical electronics have
paved way for more accurate diagnosis of diseases.

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
3

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
. 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 lowcost voice communication over the Internet.
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.

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 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.

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.

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.3 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

Fig.1.1 layered architecture of embedded system


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. 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
6

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
Fig.1.2 Hardware of an embedded system

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.

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.

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 inputs from sensors or transducers 1fnd
produce electrical signals that are in turn fed to other systems.

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.

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.

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.

1.4 Microcontrollers for Embedded Systems


In the Literature discussing microprocessors, we often see the term Embedded
System. Microprocessors and Microcontrollers are widely used in embedded system
products. An embedded system product uses a microprocessor (or Microcontroller) to
do one task only. A printer is an example of embedded system since the processor
inside it performs one task only; namely getting the data and printing it. Contrast this
with a Pentium based PC. A PC can be used for any number of applications such as
word processor, print-server, bank teller terminal, Video game, network server, or
Internet terminal. Software for a variety of applications can be loaded and run. Of
course the reason a pc can perform myriad tasks is that it has RAM memory and an
operating system that loads the application software into RAM memory and lets the
CPU run it.
In an Embedded system, there is only one application software that is typically
burned into ROM. An x86 PC contains or is connected to various embedded products
such as keyboard, printer, modem, disk controller, sound card, CD-ROM drives,
mouse, and so on. Each one of these peripherals has a Microcontroller inside it that
performs only one task. For example, inside every mouse there is a Microcontroller to
perform the task of finding the mouse position and sending it to the PC.

10

Chapter 2
BLOCK DIAGRAM
LCD Display
Power supply

Micro
controller
Finger
Print
Module

M
A
X
2
3
2

BUZZER

EEPROM

Fig. 2.1 Block Diagram of atm security based on finger print recognition

11

Chapter 3
CIRCUIT DIAGRAM

Fig. 3.1 Project Setup


The interfacing diagram of LCD and Finger print Module to the Arduino is
shown in the Figure. Here the LCD pins 9, 8, 5, 4, 3, 2 are connected to digital pins of
the Arduino. And Finger print module is connected to D0 and D1 pin as shown in the
figure.VCC is given from 5v output pin .

12

Chapter 4
EXPLANATION OF EACH BLOCK
The block diagram mainly consists of Aurdino Board which has inbuilt
microcontroller (ATmega328) and the Analog to Digital converting pins. The
description is given in detail below. And the block diagram consists of hardware
components, which are finger print module, LCD, power supply.

4.1 Introduction to the Arduino Board


The Arduino is a family of microcontroller boards to simplify electronic
design, prototyping and experimenting for artists, hackers, hobbyists, but also many
professionals. People use it as brains for their robots, to build new digital music
instruments, or to build a system that lets your house plants tweet you when theyre
dry. Arduinos (we use the standard Arduino Uno) are built around an ATmega
microcontroller essentially a complete computer with CPU, RAM, Flash memory,
and input/output pins, all on a single chip. Unlike, say, a Raspberry Pi, its designed to
attach all kinds of sensors, LEDs, small motors and speakers, servos, etc. directly to
these pins, which can read in or output digital or analog voltages between 0 and 5
volts. The Arduino connects to your computer via USB, where you program it in a
simple language (C/C++, similar to Java) from inside the free Arduino IDE by
uploading your compiled code to the board. Once programmed, the Arduino can run
with the USB link back to your computer, or stand-alone without it no keyboard or
screen needed, just power.

13

Fig. 4.1 Structure of Arduino Board


Looking at the board from the top down, this is an outline of what you will see
(parts of the board you might interact with in the course of normal use are
highlighted)

14

Fig. 4.2 Arduino Board


Starting clockwise from the top center:

Analog Reference pin (orange)

Digital Ground (light green)

Digital Pins 2-13 (green)

Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be
used for digital i/o (Digital Read and Digital Write) if you are also using serial
communication (e.g. Serial.begin).

Reset Button - S1 (dark blue)

In-circuit Serial Programmer (blue-green)

Analog In Pins 0-5 (light blue)

Power and Ground Pins (power: orange, grounds: light orange)

External Power Supply In (9-12VDC) - X1 (pink)

Toggles External Power and USB Power (place jumper on two pins closest to
desired supply) - SV1 (purple)

15

USB (used for uploading sketches to the board and for serial communication
between the board and the computer; can be used to power the board) (yellow)

4.1.1 Digital Pins


In addition to the specific functions listed below, the digital pins on an
Arduino board can be used for general purpose input and output via the pin Mode(),
Digital Read(), and Digital Write() commands. Each pin has an internal pull-up
resistor which can be turned on and off using digital Write() (w/ a value of HIGH or
LOW, respectively) when the pin is configured as an input. The maximum current per
pin is 40mA.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial
data. On the Arduino Diecimila, these pins are connected to the corresponding
pins of the FTDI USB-to-TTL Serial chip. On the Arduino BT, they are
connected to the corresponding pins of the WT11 Bluetooth module. On the
Arduino Mini and LilyPad Arduino, they are intended for use with an external
TTL serial module (e.g. the Mini-USB Adapter).
External Interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low value, a rising or falling edge, or a change in value. See the
attach Interrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11 Provide 8-bit PWM output with the analog Write()
function. On boards with an ATmega8, PWM output is available only on pins
9, 10, and 11.
BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth
module.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which, although provided by the underlying hardware, is not
currently included in the Arduino language.

LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to
digital pin 13. When the pin is HIGH value, the LED is on, when the pin is
LOW, it's off.

4.1.2 Analog Pins


In addition to the specific functions listed below, the analog input pins support
10-bit analog-to-digital conversion (ADC) using the analog Read() function. Most of
the analog inputs can also be used as digital pins: analog input 0 as digital pin 14
16

through analog input 5 as digital pin 19. Analog inputs 6 and 7 (present on the Mini
and BT) cannot be used as digital pins.

I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire
library (documentation on the Wiring website).

4.1.3 Power Pins

VIN (sometimes labeled "9V"): The input voltage to the Arduino board when
it's using an external power source (as opposed to 5 volts from the USB
connection or other regulated power source). You can supply voltage through
this pin, or, if supplying voltage via the power jack, access it through this pin.

Also note that the Lily Pad has no VIN pin and accepts only a regulated input.
5V: The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board

regulator, or be supplied by USB or another regulated 5V supply.


3V3 (Diecimila-only) : A 3.3 volt supply generated by the on-board FTDI

chip.
GND: Ground pins.

4.1.4 Other Pins

AREF: Reference voltage for the analog inputs. Used with analog Reference().
Reset: (Diecimila-only) Bring this line LOW to reset the microcontroller.
Typically used to add a reset button to shields which block the one on the
board.

17

4.2 Atmega328
4.2.1 Pin diagram

18

Fig. 4.3 Pin Configuration of Atmega328


Pin Description
VCC:
Digital supply voltage.
GND:
Ground.
Port A (PA7-PA0):
Port A serves as the analog inputs to the A/D Converter. Port A also serves as an
8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can
provide internal pull-up resistors (selected for each bit). The Port A output buffers
have symmetrical drive characteristics with both high sink and source capability.
When pins PA0 to PA7 are used as inputs and are externally pulled low, they will
source current if the internal pull-up resistors are activated. The Port A pins are
tri-stated when a reset condition becomes active, even if the clock is not running.
19

Port B (PB7-PB0):
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port B output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs, Port B pins that are
externally pulled low will source current if the pull-up resistors are activated. The
Port B pins are tri-stated when a reset condition becomes active, even if the clock
is not running. Port B also serves the functions of various special features of the
ATmega32.
Port C (PC7-PC0):
Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port C output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs, Port C pins that are
externally pulled low will source current if the pull-up resistors are activated. The
Port C pins are tri-stated when a reset condition becomes active, even if the clock
is not running. If the JTAG interface is enabled, the pull-up resistors on pins
PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.
The TD0 pin is tri-stated unless TAP states that shift out data are entered. Port C
also serves the functions of the JTAG interface.
Port D (PD7-PD0):
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port D output buffers have symmetrical drive characteristics
with both high sink and source capability. As inputs, Port D pins that are
externally pulled low will source current if the pull-up resistors are activated. The
Port D pins are tri-stated when a reset condition becomes active, even if the clock
is not running. Port D also serves the functions of various special features of the
ATmega32.
Reset (Reset Input):
A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running. Shorter pulses are not guaranteed to
generate a reset.
XTAL1:
Input to the inverting Oscillator amplifier and input to the internal clock
operating circuit.
XTAL2:
20

Output from the inverting Oscillator amplifier.


AVCC:
AVCC is the supply voltage pin for Port A and the A/D Converter. It should be
externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter.
AREF:
AREF is the analog reference pin for the A/D Converter.

4.2.2 Features

1.8-5.5V operating range


Up to 20MHz
Part: ATMEGA328P-AU
32kB Flash program memory
1kB EEPROM
2kB Internal SRAM
2 8-bit Timer/Counters
16-bit Timer/Counter
RTC with separate oscillator
6 PWM Channels
8 Channel 10-bit ADC
Serial USART
Master/Slave SPI interface
2-wire (I2C) interface
Watchdog timer
Analog comparator
23 IO lines
Data retention: 20 years at 85C/ 100 years at 25C
Digital I/O Pins are 14 (out of which 6 provide PWM output)
Analog Input Pins are 6.
DC Current per I/O is 40 mA
DC Current for 3.3V Pin is 50mA

4.3 AVR CPU Core


The AVR core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic Logic
Unit (ALU), allowing two independent registers to be accessed in one single
instruction executed in one clock cycle. The resulting architecture is more code
efficient while achieving throughputs up to ten times faster than conventional CISC
microcontrollers.

21

Fig. 4.4 Block Diagram

4.3.1 Overview
This section discusses the AVR core architecture in general. The main function
of the CPU core is to ensure correct program execution. The CPU must therefore be
able to access memories, perform calculations, control peripherals, and

22

handleinterrupts.

Fig. 4.5 AVR core architecture


In order to maximize performance and parallelism, the AVR uses a Harvard
architecture with separate memories and buses for program and data. Instructions in
the program memory are executed with a single level pipelining. While one
instruction is being executed, the next instruction is pre-fetched from the program
memory. This concept enables instructions to be executed in every clock cycle. The
program memory is In-System Reprogrammable Flash memory. The fast-access
Register File contains 32 x 8-bit general purpose working registers with a single clock
23

cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In
a typical ALU operation, two operands are output from the Register File, the
operation is executed, and the result is stored back in the Register File in one clock
cycle.
Six of the 32 registers can be used as three 16-bit indirect address register
pointers for Data Space addressing enabling efficient address calculations. One of
these address pointers can also be used as an address pointer for look up tables in
Flash program memory. These added function registers are the 16-bit X-, Y-, and Zregister, described later in this section. The ALU supports arithmetic and logic
operations between registers or between a constant and a register. Single register
operations can also be executed in the ALU. After an arithmetic operation, the Status
Register is updated to reflect information about the result of the operation. Program
flow is provided by conditional and unconditional jump and call instructions, able to
directly address the whole address space. Most AVR instructions have a single 16-bit
word format. Every program memory address contains a 16- or 32-bit instruction.
Program Flash memory space is divided in two sections, the Boot Program
section and the Application Program section. Both sections have dedicated Lock bits
for write and read/write protection. The SPM instruction that writes into the
Application Flash memory section must reside in the Boot Program section. During
interrupts and subroutine calls, the return address Program Counter (PC) is stored on
the Stack. The Stack is effectively allocated in the general data SRAM, and
consequently the Stack size is only limited by the total SRAM size and the usage of
the SRAM. All user programs must initialize the SP in the Reset routine (before
subroutines or interrupts are executed). The Stack Pointer (SP) is read/write accessible
in the I/O space. The data SRAM can easily be accessed through the five different
addressing modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory
maps. A flexible interrupt module has its control registers in the I/O space with an
additional Global Interrupt Enable bit in the Status Register. All interrupts have a
separate Interrupt Vector in the Interrupt Vector table. The interrupts have priority in
accordance with their Interrupt Vector position. The lower the Interrupt Vector
address, the higher the priority.

4.3.2 ALU Arithmetic Logic Unit


24

The high-performance AVR ALU operates in direct connection with all the 32
general purpose working registers. Within a single clock cycle, arithmetic operations
between general purpose registers or between a register and an immediate are
executed. The ALU operations are divided into three main categories arithmetic,
logical, and bit functions. Some implementations of the architecture also provide a
powerful multiplier supporting both
signed/unsigned multiplication and fractional format. See the Instruction Set section
for a detailed description.

4.3.3 Status Register


The Status Register contains information about the result of the most recently
executed arithmetic instruction. This information can be used for altering program
flow in order to perform conditional operations. Note that the Status Register is
updated after all ALU operations, as specified in the Instruction Set Reference. This
will in many cases remove the need for using the dedicated compare instructions,
resulting in faster and more compact code. The Status Register is not automatically
stored when entering an interrupt routine and restored when returning from an
interrupt. This must be handled by software.
The AVR Status Register SREG is defined as:

Fig. 4.6 AVR status register


Bit 7 I: Global Interrupt Enable
The Global Interrupt Enable bit must be set for the interrupts to be enabled.
The individual interrupt enable control The Global Interrupt Enable bit must be set for
the interrupts to be enabled. The individual interrupt enable control is then performed
in separate control registers. If the Global Interrupt Enable Register is cleared, none of
the interrupts are enabled independent of the individual interrupt enable settings. The
I-bit is cleared by hardware after an interrupt has occurred, and is set by the RETI
instruction to enable subsequent interrupts. The I-bit can also be set and cleared by the
application with the SEI and CLI instructions, as described in the instruction set
reference.
25

Bit 6 T: Bit Copy Storage


The Bit Copy instructions BLD (Bit Load) and BST (Bit Store) use the T-bit as
source or destination for the operated bit. A bit from a register in the Register File can
be copied into T by the BST instruction, and a bit in T can be copied into a bit in a
register in the Register File by the BLD instruction.
Bit 5 H: Half Carry Flag
The Half Carry Flag H indicates a Half Carry in some arithmetic operations
The Half Carry Flag H indicates a Half Carry in some arithmetic operations. Half
Carry Is useful in BCD arithmetic. See the Instruction Set Description for detailed
information.
Bit 4 S: Sign Bit, S = N V
The S-bit is always an exclusive or between the Negative Flag N and the
Twos Complement Overflow Flag V. See the Instruction Set Description for
detailed information.
Bit 3 V: Twos Complement Overflow Flag
The Twos Complement Overflow Flag V supports twos complement
arithmetic.
Bit 2 N: Negative Flag
The Negative Flag N indicates a negative result in an arithmetic or logic
operation.
Bit 1 Z: Zero Flag
The Zero Flag Z indicates a zero result in an arithmetic or logic operation.
Bit 0 C: Carry Flag
The Carry Flag C indicates a carry in an arithmetic or logic operation.

4.3.4 General Purpose Register File


The Register File is optimized for the AVR Enhanced RISC instruction set. In
order to achieve the required performance and flexibility, the following input/output
schemes are supported by the Register File:
One 8-bit output operand and one 8-bit result input
Two 8-bit output operands and one 8-bit result input
Two 8-bit output operands and one 16-bit result input
One 16-bit output operand and one 16-bit result input

26

Most of the instructions operating on the Register File have direct access to
all registers, and most of them are single cycle instructions. As shown in Figure 6-2,
each register is also assigned a data memory address, mapping them directly into the
first32 locations of the user data space. Although not being physically implemented as
SRAM locations, this memory organization provides great flexibility in access of the
registers, as the X-, Y-, and Z-pointer registers can be set to index any register.

Fig. 4.7 Structure of the 32 general purpose working registers in the CPU
X-, Y-, and Z-register
The registers R26:R31 have some added functions to their general purpose
usage. These registers are 16-bit address pointers for indirect addressing of the data
space. The three indirect address registers X, Y, and Z are defined as described in

27

Fig. 4.8 X-, Y-, and Z-Registers


In the different addressing modes these address registers have functions as fixed
displacement, automatic increment, and automatic decrement.

4.3.5 Stack Pointer


The Stack is mainly used for storing temporary data, for storing local variables
and for storing return addresses after interrupts and subroutine calls. Note that the
Stack is implemented as growing from higher to lower memorylocations. The Stack
Pointer Register always points to the top of the Stack. The Stack Pointer points to the
data SRAM Stack area where the Subroutine and Interrupt Stacks are located. A Stack
PUSH command will decrease the Stack Pointer.
The Stack in the data SRAM must be defined by the program before any
subroutine calls are executed or interrupts are enabled. Initial Stack Pointer value
equals the last address of the internal SRAM and the Stack Pointer must be set to
point above start of the SRAM
Table 4.1 Stack Pointer instructions

28

The AVR ATmega128A Stack Pointer is implemented as two 8-bit registers in


the I/O space. The number of bits actually used is implementation dependent. Note
that the data space in some implementations of the AVR architecture is so small that
only SPL is needed. In this case, the SPH Register will not be present.SPH and SPL Stack Pointer High and Low Register.

Fig 4.9 SPH and SPL - Stack Pointer High and Low Register

4.3.6 Interrupt Response Time


The interrupt execution response for all the enabled AVR interrupts is four
clock cycles minimum. After four clock cycles the program vector address for the
actual interrupt handling routine is executed. During this four clock cycle period, the
Program Counter is pushed onto the Stack. The vector is normally a jump to the
interrupt routine, and this jump takes three clock cycles. If an interrupt occurs during
execution of a multi-cycle instruction, this instruction is completed before the
interrupt is served. If an interrupt occurs when the MCU is in sleep mode, the
interrupt execution response time is increased by four clock cycles. This increase
comes in addition to the start-up time from the selected sleep mode.

4.3.7 AVR Memories


This section describes the different memories in the ATmega328. The AVR
architecture has two main memory spaces, the Data Memory and the Program
Memory space. In addition, theATmega328 features an EEPROM Memory for data
storage. All three memory spaces are linear and regular.
In-System Reprogrammable Flash Program Memory:
The

ATmega328

contains

4/8/16/32Kbytes

On-chip

In-System

Reprogrammable Flash memory for program storage. Since all AVR instructions are
16 or 32 bits wide, the Flash is organized as 2/4/8/16K x 16. For software security, the
Flash Program memory space is divided into two sections, Boot Loader Section and
29

Application Program Section. The Flash memory has an endurance of at least 10,000
write/erase cycles. The ATmega328 Program Counter (PC) is 11/12/13/14 bits wide,
thus addressing the 2/4/8/16K program memory locations.
SRAM Data Memory:
ATmega328 is a complex microcontroller with more peripheral units than can
be supported within the 64 locations reserved in the Opcode for the IN and OUT
instructions. For the Extended I/O space from 0x60 - 0xFF in SRAM, only the
ST/STS/STD and LD/LDS/LDD instructions can be used.
The lower 768/1280/1280/2303 data memory locations address both the
Register File, the I/O memory, Extended I/O memory, and the internal data SRAM.
The first 32 locations address the Register File, the next 64 location the standard I/O
memory,

then

160

locations

of

Extended

I/O

memory,

and

the

next

512/1024/1024/2048 locations address the internal data SRAM. The five different
addressing modes for the data memory cover: Direct, Indirect with Displacement,
Indirect, Indirect with Pre-decrement, and Indirect with Post-increment. In The
Register File, Registers R26 to R31 Feature the indirect addressing pointer registers.
The direct addressing reaches the entire data space. The Indirect with Displacement
mode reaches 63 address locations from the base address given by the Y- or Z register.
When using register indirect addressing modes with automatic pre-decrement
and post-increment, the address registers X, Y, and Z are decremented or incremented.
The 32 general purpose working registers, 64 I/O Registers, 160 Extended I/O
Registers, and the 512/1024/1024/2048 bytes of internal data SRAM in the
ATmega328 are all accessible through all these addressing modes.

Fig 4.10 Data Memory Map

4.3.8 Interrupts

30

This section describes the specifics of the interrupt handling as performed in


the Atmega328. In Atmega328Each Interrupt Vector occupies two instruction words
and the Reset Vector is affected by the BOOTRST fuse, and the Interrupt Vector start
address is affected by the IVSEL bit in MCUCR.

Table 4.2 Reset and Interrupt Vectors in ATMEGA 328 and ATMEGA 328P
Vector
No.
1

Program
Address
0x0000

Source

Interrupt Definition

RESET

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

0x0002
0x0004
0x0006
0x0008
0x000A
0x000C
0x000E
0x0010
0x0012
0x0014
0x0016
0x0018
0x001A
0x001C
0x001E
0x0020
0x0022
0x0024
0x0026
0x0028
0x002A
0x002C
0x002E
0x0030
0x0032

INT0
INT1
PCINTO
PCINT1
PCINT2
WDT
TIMER2 COMPA
TIMER2 COMPB
TIMER2 OVF
TIMER1 CAPT
TIMER1 COMPA
TIMER1 COMPB
TIMER 1 OVF
TIMER0 COMPA
TIMER0 COMPB
TIME0 OVF
SPI, STC
USART, RX
USART, UDRE
USART, TX
ADC
EE READY
ANALOG COMP
TWI
SPM READY

External Pin, Power-on Reset,


Brown-out Reset and Watchdog
System Reset
External Interrupt Request 0
External Interrupt Request 0
Pin Change Interrupt Request 0
Pin Change Interrupt Request 1
Pin Change Interrupt Request 2
Watchdog Time-out Interrupt
Timer/Counter2 Compare Match A
Timer/Counter2 Compare Match B
Timer/Counter 2 Overflow
Timer/Counter 2 Capture Event
Timer/Counter1 Compare Match A
Timer/Counter1 Compare Match B
Timer/Counter1 Overflow
Timer/Counter0 Compare Match A
Timer/Counter0 Compare Match B
Timer/Counter0 Overflow
SPI Serial Transfer Complete
USART RX Complete
USART, Data Register Empty
USART, TX Complete
ADC Conversion Complete
EEPROM Ready
Analog Comparator
2-wire Serial Interface
Store Program Memory Ready

When the IVSEL bit in MCUCR is set, Interrupt Vectors will be moved to the
start of the Boot Flash Section. The address of each Interrupt Vector will then be the
address in this table added to the start address of the Boot Flash Section.Table below
shows reset and Interrupt Vectors placement for the various combinations of
BOOTRST and IVSEL settings. If the program never enables an interrupt source, the
31

Interrupt Vectors are not used, and regular program code can be placed at these
locations. This is also the case if the Reset Vector is in the Application section while
the Interrupt Vectors are in the Boot section or vice versa.

Table 4.3 Reset and Interrupt Vectors Placement in ATmega328 and


ATmega328P

4.4 Arduino with ATmega328


The Arduino Uno is a microcontroller board based on the ATmega328
(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM
outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power
jack, an ICSP header, and a reset button. It contains everything needed to support the
microcontroller; simply connect it to a computer with a USB cable or power it with a
AC-to-DC adapter or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI
USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to
versionR2) programmed as a USB-to-serial converter.
Pin out: Added SDA and SCL pins that are near to the AREF pin and two other
new pins placed near to the RESET pin, the IOREF that allow the shields to
adapt to the voltage provided from the board. In future, shields will be
compatible with both the board that uses the AVR, which operates with 5V and
with the Arduino. Due that operates with 3.3V. The second one is a not
connected pin that is reserved for future purposes.
Stronger RESET circuit.
Atmega 16U2 replace the 8U2.
32

"Uno" means one in Italian and is named to mark the upcoming release of
Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino,
moving forward. The Uno is the latest in a series of USB Arduino boards, and the
reference model for the Arduino platform; for a comparison with previous versions,
see the index of Arduino boards.

4.4.1 Arduino Characteristics


Power
The Arduino Uno can be powered via the USB connection or with an external
power supply. The power source is selected automatically. External (non-USB)
power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter
can be connected by plugging a 2.1mm center-positive plug into the board's power
jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the
POWER connector. The board can operate on an external supply of 6 to 20 volts. If
supplied with less than 7V, however, the 5V pin may supply less than five volts and
the board may be unstable. If using more than 12V, the voltage regulator may
overheat and damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:

VIN: The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.

5V: This pin outputs a regulated 5V from the regulator on the board. The
board can be supplied with power either from the DC power jack (7 - 12V),
the USB connector (5V), or the VIN pin of the board (7-12V). Supplying
voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your
board. We don't advise it.

3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.

GND. Ground pins.

IOREF. This pin on the Arduino board provides the voltage reference with
which the microcontroller operates. A properly configured shield can read the
IOREF pin voltage and select the appropriate power source or enable voltage
translators on the outputs for working with the 5V or 3.3V.
33

Memory:
The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has
2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the
EEPROM library).
Serial Communication:
The Arduino Uno has a number of facilities for communicating with a
computer, another Arduino, or other microcontrollers. The ATmega328 provides
UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and
1 (TX). An ATmega16U2 on the board channels this serial communication over USB
and appears as a virtual com port to software on the computer. The '16U2 firmware
uses the standard USB COM drivers, and no external driver is needed. However, on
Windows, a .inf file is required. The Arduino software includes a serial monitor
which allows simple textual data to be sent to and from the Arduino board. The RX
and TX LEDs on the board will flash when data is being transmitted via the USB-toserial chip and USB connection to the computer (but not for serial communication on
pins 0 and 1).
A Software Serial library allows for serial communication on any of the Uno's
digital pins. The ATmega328 also supports I2C (TWI) and SPI communication. The
Arduino software includes a Wire library to simplify use of the I2C bus. For SPI
communication, use the SPI library.

4.5 Conclusion
In this chapter Arduino, ATmega328, and also about the Embedded system and
its application was dicussed.

34

Chapter 5
HARDWARE DESCRIPTION
5.1 Introduction
In the previous chapter Arduino, Atmega328 was studied and also about
Embedded systems. Now in this chapter hardware components used for solar power
tracking and its implementation i.e. about Dc motor, L293D, Finger print module and
power supply are studied.

5.2 Finger print Module

Fig. 5.1 Finger print Module

Fingerprint recognition or fingerprint authentication refers to the automated method of


verifying a match between two human fingerprints. Fingerprints are one of many
forms of biometricsused to identify individuals and verify their identity. This article
touches on two major classes of algorithms (minutia and pattern) and four sensor
designs (optical, ultrasonic, passive capacitance, and active capacitance).

Background
The analysis of fingerprints for matching purposes generally requires the
comparison of several features of the print pattern. These include patterns, which are
35

aggregate characteristics of ridges, and minutia points, which are unique features
found within the patterns. It is also necessary to know the structure and properties of
human skin in order to successfully employ some of the imaging technologies.

5.2.1 Patterns
The three basic patterns of fingerprint ridges are the arch, loop, and whorl:
arch: The ridges enter from one side of the finger, rise in the center forming an arc,
and then exit the other side of the finger.
loop: The ridges enter from one side of a finger, form a curve, and then exit on that
same side.
whorl: Ridges form circularly around a central point on the finger.
Scientists have found that family members often share the same general fingerprint
patterns, leading to the belief that these patterns are inherited.

The whorl pattern.

The arch pattern.


The loop pattern.

36

5.2.2 Minutia features


The major minutia features of fingerprint ridges are ridge ending, bifurcation,
and short ridge (or dot). The ridge ending is the point at which a ridge terminates.
Bifurcations are points at which a single ridge splits into two ridges. Short ridges (or
dots) are ridges which are significantly shorter than the average ridge length on the
fingerprint. Minutiae and patterns are very important in the analysis of fingerprints
since no two fingers have been shown to be identical.

Bifurcation.

Short Ridge (Dot).

37

5.2.3 Fingerprint sensors


A fingerprint sensor is an electronic device used to capture a digital image of
the fingerprint pattern. The captured image is called a live scan. This live scan is
digitally processed to create a biometric template (a collection of extracted features)
which is stored and used for matching. This is an overview of some of the more
commonly used fingerprint sensor technologies.

Optical
Optical fingerprint imaging involves capturing a digital image of the print
using visible light. This type of sensor is, in essence, a specialized digital camera. The
top layer of the sensor, where the finger is placed, is known as the touch surface.
Beneath this layer is a light-emitting phosphor layer which illuminates the surface of
the finger. The light reflected from the finger passes through the phosphor layer to an
array of solid state pixels (a charge-coupled device) which captures a visual image of
the fingerprint. A scratched or dirty touch surface can cause a bad image of the
fingerprint. A disadvantage of this type of sensor is the fact that the imaging
capabilities are affected by the quality of skin on the finger. For instance, a dirty or
marked finger is difficult to image properly. Also, it is possible for an individual to
erode the outer layer of skin on the fingertips to the point where the fingerprint is no
longer visible. It can also be easily fooled by an image of a fingerprint if not coupled
with a "live finger" detector. However, unlike capacitive sensors, this sensor
technology is not susceptible to electrostatic discharge damage.
Fingerprints can be read from a distance.

Ultrasonic
Ultrasonic sensors make use of the principles of medical ultrasonography in
order to create visual images of the fingerprint. Unlike optical imaging, ultrasonic
sensors use very high frequency sound waves to penetrate the epidermal layer of skin.
The sound waves are generated using piezoelectric transducers and reflected energy is
also measured using piezoelectric materials. Since the dermal skin layer exhibits the
same characteristic pattern of the fingerprint, the reflected wave measurements can be
38

used to form an image of the fingerprint. This eliminates the need for clean,
undamaged epidermal skin and a clean sensing surface.

Capacitance
Capacitance sensors use principles associated with capacitance in order to
form fingerprint images. In this method of imaging, the sensor array pixels each act as
one plate of a parallel-platecapacitor, the dermal layer (which is electrically
conductive) acts as the other plate, and the non-conductive epidermal layer acts as a
dielectric.

Passive capacitance
A passive capacitance sensor use the principle outlined above to form an
image of the fingerprint patterns on the dermal layer of skin. Each sensor pixel is used
to measure the capacitance at that point of the array. The capacitance varies between
the ridges and valleys of the fingerprint due to the fact that the volume between the
dermal layer and sensing element in valleys contains an air gap. The dielectric
constant of the epidermis and the area of the sensing element are known values. The
measured capacitance values are then used to distinguish between fingerprint ridges
and valleys

Active capacitance
Active capacitance sensors use a charging cycle to apply a voltage to the skin
before measurement takes place. The application of voltage charges the effective
capacitor. The electric fieldbetween the finger and sensor follows the pattern of the
ridges in the dermal skin layer. On the discharge cycle, the voltage across the dermal
layer and sensing element is compared against a reference voltage in order to
calculate the capacitance. The distance values are then calculated mathematically, and
used to form an image of the fingerprint. Active capacitance sensors measure the ridge
patterns of the dermal layer like the ultrasonic method. Again, this eliminates the need
for clean, undamaged epidermal skin and a clean sensing surface.

39

5.2.4Algorithms
Matching algorithms are used to compare previously stored templates of
fingerprints against candidate fingerprints for authentication purposes. In order to do
this either the original image must be directly compared with the candidate image or
certain features must be compared.
Pattern-based (or image-based) algorithms
Pattern based algorithms compare the basic fingerprint patterns (arch, whorl,
and loop) between a previously stored template and a candidate fingerprint. This
requires that the images be aligned in the same orientation. To do this, the algorithm
finds a central point in the fingerprint image and centers on that. In a pattern-based
algorithm, the template contains the type, size, and orientation of patterns within the
aligned fingerprint image. The candidate fingerprint image is graphically compared
with the template to determine the degree to which they match.

5.3 Power Supply


Power supply is a supply of electrical power. A device or system that
supplies electrical or other types of energy to an output load or group of loads is
called a power supply unit or PSU. The term is most commonly applied to electrical
energy supplies, less often to mechanical ones, and rarely to others. A power supply
may include a power distribution system as well as primary or secondary sources of
energy such as
Conversion of one form of electrical power to another desired form and
voltage, typically involving converting AC line voltage to a well-regulated
lower-voltage DC for electronic devices.
Low voltage, low power DC power supply units are commonly integrated with

the devices they supply, such as computers and household electronics.


Batteries.
Chemical fuel cells and other forms of energy storage systems.
Solar power.
Generators or alternators.
.

5.3.1 Voltage Regulator


40

A voltage regulator (also called a regulator) with only three terminals


appears to be a simple device, but it is in fact a very complex integrated circuit. It
converts a varying input voltage into a constant regulated output voltage. Voltage
Regulators are available in a variety of outputs like 5V, 6V, 9V, 12V and 15V. The
LM78XX series of voltage regulators are designed for positive input. For applications
requiring negative input, the LM79XX series is used. Using a pair of voltage-divider
resistors can increase the output voltage of a regulator circuit.

Fig.5.2 Voltage Regulator


It is not possible to obtain a voltage lower than the stated rating. You cannot
use a 12V regulator to make a 5V power supply. Voltage regulators are very robust.
These can withstand over-current draw due to short circuits and also over-heating. In
both cases, the regulator will cut off before any damage occurs. The only way to
destroy a regulator is to apply reverse voltage to its input. Reverse polarity destroys
the regulator almost instantly. Fig: 5.2 shows voltage regulator.

5.4 Liquid Crystal Display (LCD)


LCD is a type of display used in digital watches and many portable computers.
LCD displays utilize to sheets of polarizing material with a liquid crystal solution
between them. An electric current passed through the liquid causes the crystals to
align so that light cannot pass through them. LCD technology has advanced very
rapidly since its initial inception over a decade ago for use in lap top computers.
Technical achievements has resulted in brighter displace, higher resolutions, reduce
response times and cheaper manufacturing process.
The liquid crystals can be manipulated through an applied electric voltage so
that light is allowed to pass or is blocked. By carefully controlling where and what
wavelength (color) of light is allowed to pass, the LCD monitor is able to display
images. A backlight provides LCD monitors brightness. Over the years many
41

improvements have been made to LCD to help enhance resolution, image, sharpness
and response times .One of the latest such advancement is applied to glass during acts
as switch allowing control of light at the pixel level, greatly improving LCDs ability
to display small-sized fonts and image clearly . And other advances have allowed
LCDs to greatly reduce liquid crystal cell response times. Response time is basically
the amount of time it takes for a pixel to change colors, in reality response time is
the amount of time it takes a liquid crystal cell to go from being active to inactive.
This is due to following reasons:

The declining prices of LCDs.


The ability to display numbers, characters and graphics. This is in contrast to
LEDs, which are limited to numbers and a few characters.
An intelligent LCD display of two lines, 20 characters per line is interfaced to the
microcontroller. Most of the LCD modules conform to a standard interface
specification. A 14-pin access is provided having eight data lines, three control lines
and three power lines. The connections are laid out in one of the two common
configurations, either two rows of seven pins, or a single row of 14 pins. One of these
pins is numbered on the LCDs printed circuit board (PCB), but if not, it is quite easy
to locate pin1. Since this pin is connected to ground, it often has a thicker PCB track,
connected to it, and it is generally connected to metal work at same point.

Fig. 5.3 LCD

42

Table 5.1 Pin Description of LCD

5.4.1 Pin Descriptions


Vcc, Vss and Vee: While Vcc and Vss provide +5V and ground respectively, Vee is
used for controlling LCD contrast.
RS Register Select: There are two very important registers inside the LCD.
The RS pin is used for their selection as follows. If RS=0, the instruction
command code register is selected, allowing the user to send a command such
as clear display, cursor at home, etc. If RS=1, the data register is selected,
allowing the user to send data to be displayed on the LCD.
R/W, read/write: R/W input allows the user to write information to the LCD or
read information from it. R/W = 1 for reading and R/W = 0 for writing.
EN, enable: The LCD to latch information presented to its data pins uses the
enable pin. When data is supplied to data pins, a highto-low pulse must be
applied to this pin in order for the LCD to latch in the data present at the data
pins. This pulse must be a minimum of 450 ns wide.

43

D0 D7: The 8bit data pins, DO D7, are used to send information to the
LCD or read the contents of the LCDs internal registers. To display letters and
numbers, we send ASCII codes for the letters AZ, a-z numbers 0-9 to these
pins while making RS=1. There are also instruction command codes that can
be sent to the LCD to clear the display or force the cursor to home position or
blink the instruction command codes.
We also use RS = 0 to check the busy flag bit to see if the LCD is ready to
receive information. The busy flag is D7 and can be read when R/W=1 and RS=0, as
follows: if R/W = 1, RS = 0. When D7= 1 (busy flag = 1), the LCD is busy taking
care of internal operations and will not accept any information.

5.4.2 Sending Commands to LCD


To send commands we simply need to select the command register. Everything
is same as we have done in the initialization routine. But we will summarize the
common steps and put them in a single subroutine. Following are the steps:

Move data to LCD port

select command register

select write operation

send enable signal

wait for LCD to process the command

5.5 Conclusion
In this the other hardware components used in finger print module and
implementation power supply are studied.

44

Chapter 6
SOFTWARE DESCRIPTION
6.1 Introduction
In this chapter the circuit diagram, working of the arduino board and also the
software implementation will be studied.

6.2 Arduino Software


6.2.1 Programming
The Arduino Uno can be programmed with the Arduino software (download).
Select "Arduino Uno from the Tools > Board menu (according to the microcontroller
on your board). For details, see the reference and tutorials. The ATmega328 on the
Arduino Uno comes pre burned with a boot loader that allows you to upload new code
to it without the use of an external hardware programmer. It communicates using the
original STK500 protocol (reference, C header files). You can also bypass the boot
loader and program the microcontroller through the ICSP (In-Circuit Serial
Programming) header; see these instructions for details. The ATmega16U2 (or 8U2 in
the rev1 and rev2 boards) firmware source code is available. The ATmega16U2/8U2
is loaded with a DFU boot loader, which can be activated by:

On Rev1 boards: connecting the solder jumper on the back of the board (near

the map of Italy) and then resetting the 8U2.


On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB
line to ground, making it easier to put into DFU mode.
You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac
OS X and Linux) to load a new firmware. Or you can use the ISP header with an
external programmer (overwriting the DFU boot loader). See this user-contributed
tutorial for more information.

6.2.2 Automatic (Software) Reset


Rather than requiring a physical press of the reset button before an upload, the
Arduino Uno is designed in a way that allows it to be reset by software running on a
connected computer. One of the hardware flow control lines (DTR) of the
45

ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100 nano
farad capacitor. When this line is asserted (taken low), the reset line drops long
enough to reset the chip. The Arduino software uses this capability to allow you to
upload code by simply pressing the upload button in the Arduino environment. This
means that the boot loader can have a shorter timeout, as the lowering of DTR can be
well-coordinated with the start of the upload.
This setup has other implications. When the Uno is connected to either a
computer running Mac OS X or Linux, it resets each time a connection is made to it
from software (via USB). For the following half-second or so, the boot loader is
running on the Uno. While it is programmed to ignore malformed data (i.e. anything
besides an upload of new code), it will intercept the first few bytes of data sent to the
board after a connection is opened. If a sketch running on the board receives one-time
configuration or other data when it first starts, make sure that the software with which
it communicates waits a second after opening the connection and before sending this
data. The Uno contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace can be soldered together to re-enable it. It's labeled "RESETEN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor
from 5V to the reset line; see this forum thread for details.

6.2.3 USB Over current Protection


The Arduino Uno has a resettable polyfuse that protects your computer's USB
ports from shorts and overcurrent. Although most computers provide their own
internal protection, the fuse provides an extra layer of protection. If more than 500
mA is applied to the USB port, the fuse will automatically break the connection until
the short or overload is removed.

6.3 Installing the Software


For software installation, go all the way through the steps to where you see the
pin 13 LED blinking. This is the indication that you have all software and drivers
successfully installed and can start exploring with your own programs.

6.3.1 The Integrated Development Environment (IDE)


You use the Arduino IDE on your computer (picture following) to create,
open, and change sketches (Arduino calls programs sketches. We will use the two
words interchangeably in this book.). Sketches dene what the board will do. You can
either use the buttons along the top of the IDE or the menu items.
46

Parts of the IDE: (from left to right, top to bottom)

Compile-Before your program code can be sent to the board, it needs to be


converted into instructions that the board understands. This process is called
compiling.
Stop - This stops the compilation process. (I have never used this button and
you probably wont have a need to either.)
Create new Sketch - This opens a new window to create a new sketch.
Open Existing Sketch - This loads a sketch from a le on your computer. Save
Sketch - This saves the changes to the sketch you are working on.
Upload to Board - This compiles and then transmits over the USB cable to
your board.
Serial Monitor - We will discuss this in section 5.1
Tab Button - This lets you create multiple les in your sketch. This is for more
advanced programming than we will do in this class.
Sketch Editor - This is where you write or edit sketches
Text Console - This shows you what the IDE is currently doing and is also
where error messages display if you make a mistake in typing your program.
(often called a syntax error)
Line Number - This shows you what line number your cursor is on. It is useful
since the compiler gives error messages with a line number

6.3.2 Connecting a Battery


For stand-alone operation, the board is powered by a battery rather than
through the USB connection to the computer. While the external power can be
anywhere in the range of 6 to 24 V (for example, you could use a car battery), a
standard 9 V battery is convenient. While you could jam the leads of a battery snap
into the Vin and Gnd connections on the board, it is better to solder the battery snap
leads to a DC power plug and connect to the power jack on the board. A suitable plug
is part number 28760 from www.jameco.com. Here is what this looks like.

47

Fig.6.1 Connecting a Battery to the Arduino Board


Warning: Watch the polarity as you connect your battery to the snap as reverse
orientation could blow out your board.
Disconnect your Arduino from the computer. Connect a 9 V battery to the
Arduino power jack using the battery snap adapter. Confirm that the blinking program
runs. This shows that you can power the Arduino from a battery and that the program
you download runs without needing a connection to the host PC.

6.3.3 Connecting Arduino To PC


Connect your Arduino to the computer with the USB cable. You do not need
the battery for now. The green PWR LED will light. If there was already a program
burned into the Arduino, it will run.
Warning: Do not put your board down on a conductive surface; you will short out the
pins on the back!
Start the Arduino development environment. In Arduino-speak, programs are
called sketches, but here we will just call them programs.In the editing window that
comes up, enter the following program, paying attention to where semi-colons appear
at the end of command lines.

Click the Upload button

or Ctrl-U to compile the

program and load on the Arduino board. Click the Serial Monitor button . If all has
gone well, the monitor window will show your message and look something like this
Push the Arduino reset button a few times and see what happens.

48

Hint: If you want to check code syntax without an Arduino board connected, click the
Verify button or Ctrl-R. And if you want to see how much memory your program
takes up, Verify then look at the message at the bottom of the programming window.

6.3.4 Troubleshooting
If there is a syntax error in the program caused by a mistake in typing, an error
message will appear in the bottom of the program window. Generally, staring at the
error will reveal the problem. If you continue to have problems, try these ideas

Run the Arduino program again


Check that the USB cable is secure at both ends.
Reboot your PC because sometimes the serial port can lock up
If a Serial portalready in use error appears when uploading
Ask a friend for help

6.3.5 Arduino Programming Language


The Arduino runs a simplified version of the C programming language, with
some extensions for accessing the hardware. In this guide, we will cover the subset of
the programming language that is most useful to the novice Arduino designer. For
more information on the Arduino language, see the Language Reference section of the
Arduino web site, http://arduino.cc/en/Reference/HomePage.All Arduino instructions
are one line. The board can hold a program hundreds of lines long and has space for
about 1,000 two-byte variables. The Arduino executes programs at about 300,000
source code lines per sec.

6.3.6 Creating a Program


Programs are created in the Arduino development environment and then
downloaded to the Arduino board. Code must be entered in the proper syntax which
means using valid command names and a valid grammar for each code line. The
compiler will catch and flag syntax errors before download. Sometimes the error
message can be cryptic and you have to do a bit of hunting because the actual error
occurred before what was flagged.
Although your program may pass cleanly through the syntax checker, it still
might not do what you wanted it to. Here is where you have to hone your skills at
code debugging. The Arduino did what you told it to do rather than what you wanted
it to do. The best way to catch these errors is to read the code line by line and be the
computer. Having another person go through your code also helps. Skilled debugging
takes practice.
49

6.3.7 Program Formatting and Syntax


Programs are entered line by line. Code is case sensitive which means
"myvariable" is different than

"MyVariable". Statements are any command.

Statements are terminated with a semi-colon. A classic mistake is to forget the semicolon so if your program does not compile, examine the error text and see if you
forgot to enter a colon. Comments are any text that follows // on a line. For multiline block comments, begin with /* and end with */ Constants are fixed numbers
and can be entered as ordinary decimal numbers (integer only) or in hexadecimal
(base 16) or in binary (base 2)Labels are used to reference locations in your program.
They can be any combination of letters, numbers and underscore (_), but the first
character must be a letter. When used to mark a location, follow the label with a
colon. When referring to an address label in an instruction line, don't use the colon.
Variables are allocated by declaring them in the program. Every variable must be
declared. If a variable is declared outside the braces of a function, it can be seen
everywhere in the program. If it is declared inside the braces of a function, the
variable can only be seen within that function.

6.3.8 Program Structure


All Arduino programs have two functions, setup() and loop(). The instructions
you place in the startup() function are executed once when the program begins and are
used to initialize. Use it to set directions of pins or to initialize variables. The
instructions placed in loop are executed repeatedly and form the main tasks of the
program. Therefore every program has this structure.

6.4 Interfacing Hardware Components


6.4.1 Interfacing Finger print module to Arduino
In this case finger print Transmitter pin is connected to arduino Do pin which
is receiver pin of Arduino and Receiver pin of finger print module connected to D1
pin of Arduino which is Transmitter pin. The +5v and GND output pin of Arduino is
connected to +ve supply and GND pin of finger print module.

50

6.4.2 Interfacing LCD to Arduino


Before wiring the LCD screen to your Arduino we suggest to solder a pin
header strip to the 14 (or 16) pin count connector of the LCD screen, as you can see in
the image above. To wire your LCD screen to your Arduino, connect the following
pins:

LCD RS pin to digital pin 12


LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2

Additionally, wire a 10K pot to +5V and GND, with it's wiper (output) to LCD
screens VO pin (pin3).

Fig. 6.2 Interfacing Arduino to LCD

Chapter 7
51

ADVANTAGES AND FUTURE SCOPE


ADVANTAGES:
1.Highly secured
2.Safe ,reliable and easy to use
3.More stable
4.Cost implementation to banks will be decreased.

FUTURE SCOPE:
Performance can be increased in terms of speed and memory.
A speaking voice alarm can be used to indicate unauthorized person accessing
the ATM.
The system can be made to communicate with modems or mobile phones

Chapter 8
CONCLUSION
52

With this project we can provide security to banks / ATM s from the UN authorized
actions and can provide the complete access control of account to the real account
holder only.

53

Das könnte Ihnen auch gefallen