Professional Documents
Culture Documents
FROM:
Engnr.shakeel@gmail.com
https://www.facebook.com/EngnrShakeel
https://www.facebook.com/Electrical4Electronics
The user has to show his voter ID card whenever he goes to the polling
booth to poll his vote. This is a time consuming process as the person has to
check the voter ID card with the list he has, confirm it as an authorized card
and then allow the person to poll his vote. Thus, to avoid this kind of problems,
we have designed a finger print based voting machine where the person no
need to carry his ID which contains his entire details.
The person at the polling booth has to show his Finger. This Finger print
reader reads the details from the tag. This data is passed to the controlling unit
for the verification. The controller reads the data from the reader and compares
this data with the already existing data. If the data matches with the already
stored information, the person is allowed to poll his vote. If not, a message is
displayed on LCD and the person is not allowed to poll his vote. The polling
mechanism carries out manually using the switches. LCD is used to display
the related messages.
also collects information from the master device and implements commands
that are directed by the master.
The objective of the project is to develop a microcontroller based security
and alert system. It consists of a Finger print reader, microcontroller, the
interfacing unit to allow the communication between the microcontroller and
Finger print module, and the LCD.
Chapter 2
OVERVIEW OF THE TECHNOLOGIES USED
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.
Chapter 3
Hardware Implementation of the Project
This chapter briefly explains about the Hardware Implementation of the
project. It discusses the design and working of the design with the help of block
diagram and circuit diagram and explanation of circuit diagram in detail. It
explains the features, timer programming, serial communication, interrupts of
Lpc 2148 microcontroller. It also explains the various modules used in this
project.
Hardware implementation
Firmware implementation
Filter:
Capacitive filter is used in this project. It removes the ripples from the
output of rectifier and smoothens the D.C. Output received from this filter is
constant until the mains voltage and load is maintained constant. However, if
either of the two is varied, D.C. voltage received at this point changes.
Therefore a regulator is applied at the output stage.
Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage
regulator is an electrical regulator designed to automatically maintain a
constant voltage level. In this project, power supply of 5V and 12V are required.
In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to
be used. The first number 78 represents positive supply and the numbers 05,
12 represent the required output voltage levels
LPC2148:
LPC2148 arm processor is used for controlling. ARM processor is used
because of its extra features when compared to microcontroller. It controls LCD
and finger print module. It receives input commands from switches and control
finger print module when to receive the data, performs comparison , gives
command to LCD to display messages to direct the users to use it properly and
also displays the results.
The switches are used to activate the controller for registration during
enrollment, for comparisons to the database while identifying the user, for
selecting the party while casting the vote, finally for display of results.
LCD screen functions as interface between the user and microcontroller,
which displays messages that facilitates the user to know when to register and
when to vote, and also whether their vote is valid are not.
It displays welcome messages initially and enrolling message during
enrollment, identifying message when controller is comparing the data base
whether the user is valid are not, if valid displays please vote message, if not
displays no access message, and finally displays the result with party name
with their respective number of votes.
The user, who wants to poll his vote, has to submit the identity proof at
the counter at the polling booth. In this project, the necessary and, upto an
extent, the sufficient material, the user no need to carry with him is the Voter
card.
Voter card is nothing but an Finger Print which stores the details of the
person like the name of the user, location of place, mobile number for contact
etc. When the user is asked to show his Finger print. The Finger print module
reads the data present.
Before casting the vote the candidate has to check for validity .so after
user pressing the identify button the controller displays identifying ..
message. During this mode the fingerprint of the candidate casting the vote is
compared with the finger prints already enrolled in the memory. If it is
matched a message PLEASE VOTE will be displayed on LCD. Once the
voter presses the button corresponding to the candidate of her/his choice, a
four-bit code is generated and sent to the control unit. Once the casting is
over message is displayed to whom they voted for.No ACCESS.. message will
be displayed if the same user tries to cast again. The machine returns to the
identifying mode and starts all over again for next voting.
RESULTS MODE
The contestant name and the secured votes will be displayed on the LCD
when the controller receives results instruction through the switches.
Chapter 4
Microcontroller
4.1.Definition of a Microcontroller
Microcontroller, as the name suggests, are small controllers. They are
like single chip computers that are often embedded into other systems to
Easy to Use
A serial I/O port to allow data to flow between the microcontroller and
other devices such as a PC or another microcontroller.
The heart of the microcontroller is the CPU core. In the past this has
traditionally been based on an 8-bit microprocessor unit. Figure 4.1 above
Shows a typical microcontroller device and its different subunits
to be all of that in one. No other external components are needed for its
application because all necessary peripherals are already built into it. Thus, we
save the time and space needed to construct devices.
4.3 LPC214x
4.3.1Key features
flexibility for data storage field firmware upgrades, etc. Due to the architectural
solution chosen for an on-chip 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.
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.
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.
Mask registers allow treating sets of port bits as a group, leaving other bits
unchanged.
All GPIO registers are byte addressable.
Entire port value can be written in one instruction.
Features
Bit-level set and clear registers allow a single instruction set or clear of any
number of bits in one port.
Direction control of individual bits.
Separate control of output set and clear.
All I/O default to inputs after reset.
10-bit ADC
Features
Measurement range of 0 V to VREF (2.0 V VREF VDDA).
Each converter capable of performing more than 400,000 10-bit samples per
second.
Every analog input has a dedicated result register to reduce interrupt
overhead.
Burst conversion mode for single or multiple inputs.
10-bit DAC
Features
10-bit DAC.
Buffered output.
Power-down mode available.
Selectable speed versus power.
Features
Compliant with standard I2C-bus interface.
Easy to configure as master, slave, or master/slave.
Programmable clocks allow versatile rate control.
Bidirectional data transfer between masters and slaves.
Features
Compliant with Serial Peripheral Interface (SPI) specification.
Synchronous, Serial, Full Duplex, Communication.
Combined SPI master and slave.
Maximum data bit rate of one eighth of the input clock rate.
flowing from the master to the slave and from the slave to the master. Often
only one of these data flows carries meaningful data.
Features
Compatible with Motorolas SPI, TIs 4-wire SSI and National Semiconductors
Microwire buses.
Synchronous serial communication.
Master or slave operation.
8-frame FIFOs for both transmit and receive.
Four bits to 16 bits per frame.
General purpose timers/external event counters
The Timer/Counter is designed to count cycles of the peripheral clock
(PCLK) or an externally supplied clock and optionally generate interrupts or
perform other actions at specified timer values, based on four match registers.
It also includes four capture inputs to trap the timer value when an input
signal transitions, optionally generating an interrupt. Multiple pins can be
selected to perform a single capture or match function, providing an
application with or and and, as well as broadcast functions among them.
The LPC2141/42/44/46/48 can count external events on one of the capture
inputs if the minimum external pulse is equal or longer than a period of the
PCLK. In this configuration, unused capture lines can be selected as regular
timer capture inputs, or used as external interrupts.
Features
A 32-bit timer/counter with a programmable 32-bit prescaler.
External event counter or timer operation.
Four 32-bit capture channels per timer/counter that can take a snapshot of
the timer value when an input signal transitions. A capture event may also
optionally generate an interrupt.
Four 32-bit match registers that allow:
Real-time clock
The RTC is designed to provide a set of counters to measure time when
normal or idle operating mode is selected. The RTC has been designed to use
little power, making it suitable for battery powered systems where the CPU is
not running continuously (Idle mode).
Features
Measures the passage of time to maintain a calendar and clock.
Ultra-low power design to support battery powered systems.
Provides Seconds, Minutes, Hours, Day of Month, Month, Year, Day of Week,
and Day of Year.
Can use either the RTC dedicated 32 kHz oscillator input or clock derived
from the external crystal/oscillator input at XTAL1. Programmable reference
clock divider allows fine adjustment of the RTC.
Dedicated power supply pin can be connected to a battery or the main 3.3 V.
System control
Crystal oscillator
On-chip integrated oscillator operates with external crystal in range of 1
MHz to 25 MHz. The oscillator output frequency is called fosc and the ARM
processor clock frequency is referred to as CCLK for purposes of rate
equations, etc. fosc and CCLK are the same value unless the PLL is running
and connected.
PLL
The PLL accepts an input clock frequency in the range of 10 MHz to 25
MHz. The input frequency is multiplied up into the range of 10 MHz to 60 MHz
with a Current Controlled Oscillator (CCO). The multiplier can be an integer
value from 1 to 32 (in practice, the multiplier value cannot be higher than 6 on
this family of microcontrollers due to the upper frequency limit of the CPU).
The CCO operates in the range of 156 MHz to 320 MHz, so there is an
additional divider in the loop to keep the CCO within its frequency range while
the PLL is providing the desired output frequency. The output divider may be
set to divide by 2, 4, 8, or 16 to produce the output clock. Since the minimum
output divider value is 2, it is insured that the PLL output has a 50 % duty
cycle. The PLL is turned off and bypassed following a chip reset and may be
enabled by software. The program must configure and activate the PLL, wait for
the PLL to Lock, then connect to the PLL as a clock source. The PLL settling
time is 100 s.
Reset and wake-up timer
Reset has two sources on the LPC2141/42/44/46/48: the RESET pin
and watchdog reset. The RESET pin is a Schmitt trigger input pin with an
additional glitch filter. Assertion of chip reset by any source starts the Wake-up
Timer (see Wake-up Timer description below), causing the internal chip reset to
remain asserted until the external reset is de-asserted, the oscillator is
running, a fixed number of clocks have passed, and the on-chip flash controller
has completed its initialization. When the internal reset is removed, the
processor begins executing at address 0, which is the reset vector. At that
point, all of the processor and peripheral registers have been
initialized to predetermined values. The Wake-up Timer ensures that the
oscillator and other analog functions required for chip operation are fully
functional before the processor is allowed to execute instructions. This is
important at power on, all types of reset, and whenever any of the
aforementioned functions are turned off for any reason. Since the oscillator and
other functions are turned off during Power-down mode, any wake-up of the
processor from Power-down mode makes use of the Wake-up Timer.
The Wake-up Timer monitors the crystal oscillator as the means of
checking whether it is safe to begin code execution. When power is applied to
the chip, or some event caused the chip to exit Power-down mode, some time is
required for the oscillator to produce a signal of sufficient amplitude to drive
the clock logic. The amount of time depends on many factors, including the
rate of VDD ramp (in the case of power on), the type of crystal and its electrical
characteristics (if a quartz crystal is used), as well as any other external
circuitry (e.g. capacitors), and the characteristics of the oscillator itself under
the existing ambient conditions.
Brownout detector
The LPC2141/42/44/46/48 include 2-stage monitoring of the voltage on
the VDD pins. If this voltage falls below 2.9 V, the BOD asserts an interrupt
signal to the VIC. This signal can be enabled for interrupt; if not, software can
monitor the signal by reading dedicated register. The second stage of low
voltage detection asserts reset to inactivate the LPC2141/42/44/46/48 when
the voltage on the VDD pins falls below 2.6 V. This reset prevents alteration of
the flash as operation of the various elements of the chip would otherwise
become unreliable due to low voltage. The BOD circuit maintains this reset
down below 1 V, at which point the POR circuitry maintains the overall reset.
Both the 2.9 V and 2.6 V thresholds include some hysteresis. In normal
operation, this hysteresis allows the 2.9 V detection to reliably interrupt, or a
regularly-executed event loop to sense the condition.
Code security
This feature of the LPC2141/42/44/46/48 allow an application to
control whether it can be debugged or protected from observation. If after reset
on-chip boot loader detects a valid checksum in flash and reads 0x8765 4321
from address 0x1FC in flash, debugging will be disabled and thus the code in
flash will be protected from observation. Once debugging is disabled, it can be
enabled only by performing a full chip erase using the ISP.
External interrupt inputs
The LPC2141/42/44/46/48 include up to nine edge or level sensitive
External Interrupt Inputs as selectable pin functions. When the pins are
combined, external events can be processed as four independent interrupt
signals. The External Interrupt Inputs can optionally be used to wake-up the
processor from Power-down mode. Additionally capture input pins can also be
used as external interrupts without the option to wake the device up from
Power-down mode.
Memory mapping control
The Memory Mapping Control alters the mapping of the interrupt vectors
that appear beginning at address 0x0000 0000. Vectors may be mapped to the
bottom of the on-chip flash memory, or to the on-chip static RAM. This allows
code running in different memory spaces to have control of the interrupts
Power control
The LPC2141/42/44/46/48 supports two reduced power modes: Idle
mode and Power-down mode. In Idle mode, execution of instructions is
suspended until either a reset or interrupt occurs. Peripheral functions
continue operation during Idle mode and may generate interrupts to cause the
processor to resume execution. Idle mode eliminates power used by the
processor itself, memory systems and related controllers, and internal buses.
In Power-down mode, the oscillator is shut down and the chip receives no
internal clocks. The processor state and registers, peripheral registers, and
internal SRAM values are preserved throughout Power-down mode and the
logic levels of chip output pins remain static. The Power-down mode can be
terminated and normal operation resumed by either a reset or certain specific
interrupts that are able to function without clocks. Since all dynamic operation
EmbeddedICE
Standard ARM EmbeddedICE logic provides on-chip debug support. The
debugging of the target system requires a host computer running the debugger
software and an EmbeddedICE protocol convertor. EmbeddedICE protocol
convertor converts the remote debug protocol commands to the JTAG data
needed to access the ARM core.
Real Monitor
Real Monitor is a configurable software module, developed by ARM Inc.,
which enables real-time debug. It is a lightweight debug monitor that runs in
the background while users debug their foreground application. It
communicates with the host using the DCC, which is present in the Embedded
ICE logic. The LPC2141/42/44/46/48 contains a specific configuration of Real
Monitor software programmed into the on-chip flash memory.
UARTs
The LPC2141/42/44/46/48 each contain two UARTs. In addition to
standard transmit and receive data lines, the LPC2144/46/48 UART1 also
provide a full modem control handshake interface. Compared to previous
LPC2000 microcontrollers, UARTs in LPC2141/42/44/46/48 introduce a
fractional baud rate generator for both UARTs, enabling these microcontrollers
to achieve standard baud rates such as 115200 with any crystal frequency
above 2 MHz In addition, auto-CTS/RTS flow-control functions are fully
implemented in hardware (UART1 in LPC2144/46/48 only).
Features
16 byte Receive and Transmit FIFOs.
Register locations conform to 550 industry standard.
Receiver FIFO trigger points at 1, 4, 8, and 14 bytes
Built-in fractional baud rate generator covering wide range of baud rates
without a need for external crystals of particular values.
Transmission FIFO control enables implementation of software (XON/XOFF)
flow control on both UARTs.
LPC2144/46/48 UART1 equipped with standard modem interface signals.
This module also provides full support for hardware flow control (auto-CTS/RTS).
Register description
UART0 contains registers organized as shown in Table 4.4. The Divisor
Latch Access Bit (DLAB) is contained in U0LCR[7] and enables access to the
Divisor Latches.
one character and no UART0 Rx FIFO activity has occurred in 3.5 to 4.5
character times. Any UART0 Rx FIFO activity (read or write of UART0 RSR) will
clear the interrupt. This interrupt is intended to flush the UART0 RBR after a
message has been received that is not a multiple of the trigger level size. For
example, if a peripheral wished to send a 105 character message and the
trigger level was 10 characters, the CPU would receive 10 RDA interrupts
resulting in the transfer of 100 characters and 1 to 5 CTI interrupts (depending
on the service routine) resulting in the transfer of the remaining 5 characters.
interrupt is reset when a U0THR write occurs or a read of the U0IIR occurs and
the THRE is the highest interrupt (U0IIR[3:1] = 001).
Architecture
The architecture of the UART0 is shown below in the block diagram 4.3.
The VPB interface provides a communications link between the CPU or host
and the UART0. The UART0 receiver block, U0RX, monitors the serial input
line, RXD0, for valid input. The UART0 RX Shift Register (U0RSR) accepts valid
characters via RXD0. After a valid character is assembled in the U0RSR, it is
passed to the UART0 RX Buffer Register FIFO to await access by the CPU or
host via the generic host interface. The UART0 transmitter block, U0TX,
accepts data written by the CPU or host and buffers the data in the UART0 TX
Holding Register FIFO (U0THR). The UART0 TX Shift Register (U0TSR) reads
the data stored in the U0THR and assembles the data to transmit via the serial
output pin, TXD0. The UART0 Baud Rate Generator block, U0BRG, generates
the timing enables used by the UART0 TX block. The U0BRG clock input
source is the VPB clock (PCLK). The main clock is divided down per the divisor
specified in the U0DLL and U0DLM registers. This divided down clock is a 16x
oversample clock, NBAUDOUT. The interrupt interface contains registers
U0IER and U0IIR. The interrupt interface receives several one clock wide
enables from the U0TX and U0RX blocks. Status information from the U0TX
and U0RX is stored in the U0LSR. Control information for the U0TX and U0RX
is stored in the U0LCR.
The following table 5.1 gives the specifications of finger print module R303a
mode is semi duplex asynchronies serial communication. And the default baud
rate is 57600bps. User may set the baud rate in 9600 115200bps
Transferring frame format is 10 bit: the low-level starting bit, 8-bit data with
the LSB first, and an ending bit. There is no check bit.
Reset time
At power on, it takes about 500ms for initialization. During this period,
the Module cant accept commands for upper computer. Electrical parameter
(All electrical level takes GND as reference)
Power supply
The logic levels and their corresponding voltage levels are given in the
table 5.3 below
IV System Resources
To address demands of different customer, Module system provides
abundant resources at users use.
Notepad
The system sets aside a 512-bytes memory (16 pages* 32 bytes) for
users notepad, where data requiring power-off protection can be stored. The
host can access the page by instructions of PS_WriteNotepad and PS_Read
Notepad.
Note: when write on one page of the pad, the entire 32 bytes will be
written in wholly covering the original contents.
Buffer
There are an image buffer and two 512-byte-character-file buffer within
the RAM space of the module. Users can read & write any of the buffers by
instructions.
Note: Contents of the above buffers will be lost at power-off.
Image buffer
Image Buffer serves for image storage and the image format is 256*288
pixels. When transferring through UART, to quicken speed, only the upper 4
bits of the pixel is transferred (that is 16 grey degrees). And two adjacent pixels
of the same row will form a byte before the transferring. When uploaded to PC,
the 16-grey-degree image will be extended to 256-grey-degree format. Thats 8-
bit BMP format. When transferring through USB, the image is 8-bit pixel, thats
256 grey degrees.
Character file buffer
Character file buffer, CharBuffer1, CharBuffer2, can be used to store
both character file and template file.
Note:
Busy1 bit. 1: system is executing commands; 0: system is free;
Pass1 bit. 1: find the matching finger; 0: wrong finger;
PWD1 bit. 1: Verified devices handshaking password.
ImgBufStat1 bit. 1: image buffer contains valid image.
Module password
At power-on reset, system first checks whether the handshaking
password has been modified. If not, system deems upper computer has no
requirement of verifying password and will enter into normal operation mode.
Thats, when Module password remains the default, verifying process can be
jumped. The password length is 4 bytes, and its default factory value is 0FFH,
0FFH, 0FFH, 0FFH. Should the password have be modified, refer to instruction
SetPwd, then Module (or device) handshaking password must be verified before
JNTUA CE , pulivendula Page 58
Finger print based electronic voting machine
the system enter into normal operation mode. Or else, system will refuse to
execute and command. The new modified password is stored in Flash and
remains at power off.
Module address:
Each module has an identifying address. When communicating with
upper computer, each instruction/data is transferred in data package form,
which contains the address item. Module system only responds to data
package whose address item value is the same with its identifying address. The
address length is 4 bytes, and its default factory value is 0xFFFFFFFF. User
may modify the address via instruction SetAdder. The new modified address
remains at power off.
Random number generator Module integrates a hardware 32-bit random
number generator (RNG) (without seed). Via instruction GetRandomCode,
system will generate a random number and upload it.
Communication Protocol
The protocol defines the data exchanging format when ZFM-20 series
communicates with upper computer. The protocol and instruction sets apples
for both UART and USB communication mode. For PC, USB interface is
strongly recommended to improve the exchanging speed, especially in
fingerprint scanning device.
Data package format
When communicating, the transferring and receiving of
command/data/result are all wrapped in data package format.
The new modified password is stored in Flash and remains at power off.
Module address
Each module has an identifying address. When communicating with
upper computer, each instruction/data is transferred in data package form,
which contains the address item. Module system only responds to data
package whose address item value is the same with its identifying address. The
address length is 4 bytes, and its default factory value is 0xFFFFFFFF. User
may modify the address via instruction SetAdder. The new modified address
remains at power off. Random number generator Module integrates a hardware
32-bit random number generator (RNG) (without seed). Via instruction
GetRandomCode, system will generate a random number and upload it.
Module Instruction System
R303A series provide 23 instructions. Through combination of different
instructions, application program may realize muti finger authentication
functions. All commands/data are transferred in package format.
Chapter-6
Switches and Pushbuttons and LCD display
6.1Switches and Pushbuttons
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.
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 6.1 below:
Pin Logic
Function Name Description
Number State
Ground 1 Vss - 0V
Power supply 2 Vdd - +5V
Contrast 3 Vee - 0 Vdd
D0 D7 are interpreted as
0 commands
4 RS
1 D0 D7 are interpreted as
data
Write data (from controller
Control of 0 to LCD)
5 R/W
operating 1 Read data (from LCD to
controller)
0 Access to LCD disabled
1 Normal operating
6 E
From 1 Data/commands are
to 0 transferred to LCD
7 D0 0/1 Bit 0 LSB
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
Data / 10 D3 0/1 Bit 3
commands 11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
14 D7 0/1 Bit 7 MSB
Table 6.1 pin description of LCD
LCD screen:
JNTUA CE , pulivendula Page 64
Finger print based electronic voting machine
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 the connections are as shown in
figure 6.4. 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).
Execution
Command RS RW D7 D6 D5 D4 D3 D2 D1 D0
Time
Clear display 0 0 0 0 0 0 0 0 0 1 1.64mS
Cursor home 0 0 0 0 0 0 0 0 1 x 1.64mS
Entry mode set 0 0 0 0 0 0 0 1 I/D S 40uS
Display on/off control 0 0 0 0 0 0 1 D U B 40uS
Cursor/Display Shift 0 0 0 0 0 1 D/C R/L X x 40uS
Function set 0 0 0 0 1 DL N F X x 40uS
Set CGRAM address 0 0 0 1 CGRAM address 40uS
Set DDRAM address 0 0 1 DDRAM address 40uS
Read BUSY flag (BF) 0 1 BF DDRAM address -
Write to CGRAM or DDRAM 1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
Read from CGRAM or
1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM
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.
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.
LCD Initialization
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
Contrast Control:
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.
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.
LCD interface with the microcontroller (4-bit mode):
Chapter 7
Firmware Implementation of the project design
KEIL ARM Is Used For The Development Of Finger Print Based Electronic
Voting Machine
7.1.Vision3 Overview
The Vision3 IDE offers numerous features and advantages that help you
quickly and successfully develop embedded applications. They are easy to use
and are guaranteed to help you achieve your design goals.
The Vision3 IDE and Debugger is the central part of the Keil
development tool chain. Vision3 offers a Build Mode and a Debug Mode.In the
Vision3 Build Mode you maintain the project files and generate the
application.
In the Vision3 Debug Mode you verify your program either with a powerful
CPU and peripheral simulator or with the Keil ULINK USB-JTAG Adapter (or
other AGDI drivers) that connect the debugger to the target system. The ULINK
allows you also to download your application into Flash ROM of your target
system.
Feature Benefit
The Vision3 Simulator is the only Write and test application code before
debugger that completely simulates production hardware is available.
all on-chip peripherals. Investigate different hardware
configurations to optimize the hardware
design.
The ULINK USB-JTAG Adapter The same tool can be used for debugging
supports both Debugging and Flash and programming. No extra configuration
programming with configurable time required.
algorithm files.
Interface
The following sections list the Vision3 commands that can be reached by
menu commands, toolbar buttons, and keyboard shortcuts. The Vision3
commands are grouped mainly based on the appearance in the menu bar:
Outlining Menu
Advanced Menu
View Menu
Flash Menu
Peripherals Menu
Tools Menu
SVCS Menu
Window Menu
Help Menu
7.2.Creating Applications
This chapter describes the Build Mode of Vision3 and is grouped into the
following sections:
Project Target and File Groups: shows how to create application variants
and organized the files that belong to a project.
Tips and Tricks: provides information about the advanced features of the
Vision3 Project Manager.
This chapter uses the ARM as target architecture and only explains
generic features of the Vision3 IDE. Architecture specific information
(like bank switching for 8051) can be found in the Getting Started User's
Guide of the related toolchain.
Debugging
This chapter describes the Debug Mode of Vision3 and shows you how
to use the user interface to test a sample program. Also discussed are
simulation mode and the different options available for program debugging.
You can use Vision3 Debugger to test the applications you develop. The
Vision3 Debugger offers two operating modes that are selected in the Options
for Target Debug dialog.
Use Advanced GDI drivers, like the ULINK Debugger to interface to your
target hardware. For Vision3 various drivers are available that interface
to:
The Status Bar shows the current active debugging tool. In simulation
mode, timing statistics are provided.
Simulation
The chapter contains several Signal function temples that you may use
to simulate:
Digital Input
Push Button
Interrupt Signal
Impulse Patterns
Analog Input
Sine Wave
Noise Signal
Signal Combination
UART Communication
CAN Communication
IC Communication
SPI Communication
You may use external command-line driven utilities (usually provided by the
chip vendor) or the Keil ULINK USB-JTAG Adapter. The Flash Programming
Utilities are configured under
Flash Programming may be started from the Flash Menu or before starting the
Vision3 Debugger when you enable Project Options Utilities Update
Target before Debugging.
Configure Flash Menu: configures the Flash Menu for using an external
command-line based utility or the Keil ULINK USB-JTAG Adapter.
HEX File Flash Download: explains how to program existing HEX files.
#include <lpc214x.h>
#include "serial.h"
#include"lcd.h"
unsignedchar
enroll[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X01,0X00,0X05};
unsignedchar
generate_ch[13]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X04,0x02,0X01,0X00,0X0
8};
unsignedchar store[11]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X06,0X06,0X01};
unsignedchar
identify[12]={0xEF,0X01,0XFF,0XFF,0XFF,0XFF,0X01,0X00,0X03,0X11,0X00,0X15};
void clearfp(void);
unsignedchar part_A=0,part_B=0,part_C=0,part_D=0,check=0,count=0,enroll_check=0,en_byte;
/*-------------------------------------------------------------------------
main program
--------------------------------------------------------------------------*/
int main (void )
JNTUA CE , pulivendula Page 81
Finger print based electronic voting machine
{
lcd_init();
again:
lcd_cmd(0x01,0);
delay(1000);
message(0," welcome ");
//lcd_cmd(0x01,0);
lcd_cmd(0xc0,0);
message(0,"EVM with FP");
delay(1000);
i=0;
while(1)
{
/******* Enrolling your ID *********************/
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
dummy=UART1_getch();
dummy=UART1_getch();
if(!rec)
{
lcd_cmd(0x01,0);
message(0,"Enrolling ok");
}
else
{
lcd_cmd(0x01,0);
message(0,"Enrolling not ok");
goto again;
}
i=0;
while(i<13)
{
send_ch_UART0(generate_ch[i]);
i++;
}
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
dummy=UART1_getch();
dummy=UART1_getch();
if(!rec)
{
lcd_cmd(0x01,0);
message(0,"gen char ok");
}
else
{
lcd_cmd(0x01,0);
message(0,"genchar not ok");
goto again;
}
i=0;
while(i<11)
{
send_ch_UART0(store[i]);
i++;
}
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
rec=UART1_getch();
dummy=UART1_getch();
dummy=UART1_getch();
if(!rec)
{
lcd_cmd(0x01,0);
message(0,"store ok");
}
else
{
lcd_cmd(0x01,0);
message(0,"store not ok");
goto again;
}
//check=1;
//enroll_check =0;
//en_byte=12;
}
{
while((IOPIN0&sw2)==0);
lcd_cmd(0x01,0);
message(0,"Identfying...");
i=0;
while(i<12)
{
send_ch_UART0(identify[i]);
i++;
}
check=1;
enroll_check =1;
en_byte=16;
}
convert(part_D);
long_delay();
long_delay();
part_A=part_B=part_C=part_D=0;
goto again;
if(check==1)
{
count=0;
check=0;
while(count<en_byte)
{
fp[count]=UART0_getch();
count++;
}
long_delay();
n=0;
while(n<20)
{
if((fp[n]==0xEF)&&(fp[n+1]==0x01)&&(fp[n+9]==0x00))
{
lcd_cmd(0x01,0);
lcd_cmd(0x80,0);
message(1," Successfully ");
lcd_cmd(0xc0,0);
message(0xc0," completed");
b1=0; b2=0; i1=0; i2=0; id=0;
b1=fp[n+11]/10;
b2=fp[n+11]%10;
long_delay();
long_delay();
long_delay();
// lcd_cmd(0xc0,0);
// message(0xc0,"Id:");
// lcd_cmd(0xC3,0);
// lcd_cmd(b1+0x30,1);
// lcd_cmd(b2+0x30,1);
i1=b1-48;
i1=i1*10;
i2=b2-48;
i2=i2*1;
id=i1+i2;
long_delay();
if(enroll_check ==1)
{
lcd_cmd(0x01,0);
message(1," Plz poll ur vote ");
// clearfp();
enroll_check=0;
goto poll;
}
goto again;
else
{
lcd_cmd(0x01,0);
message(1," Failed");
long_delay();
goto again;
}
}
}
}
/*-----------------------------------------------------
polling your vote
----------------------------------------------------*/
poll:
while(1)
{
if((IOPIN0&sw1)==0) //sw1
{
part_A++;
lcd_cmd(0x01,0);
message(1,"Vote for part A");
long_delay();
goto again;
}
if((IOPIN0&sw2)==0) //sw2
{
part_B++;
lcd_cmd(0x01,0);
message(1,"Vote for part B");
long_delay();
goto again;
// goto again;
}
if((IOPIN0&sw3)==0) //sw3
{
part_C++;
lcd_cmd(0x01,0);
message(1,"Vote for part C");
long_delay();
goto again;
// goto again;
}
if((IOPIN0&sw4)==0) //sw4
{
part_D++;
lcd_cmd(0x01,0);
message(1,"Vote for part D");
long_delay();
goto again;
// goto again;
}
}
}
/*------------------------------------------------
Clear the string clearfp
------------------------------------------------*/
void clearfp(void)
{
unsigned char cl=0;
while(cl<20)
{
fp[cl]=' ';
cl++;
}
j=0;
}
/*---------------------------------------------------------------------------------------
;convertion program Binary to ASCii ;
--------------------------------------------------------------------------------------*/
{
unsigned char value,d1,d2,d3,k=0;
temp_value = temp_value;
value=temp_value/10;
d3=temp_value%10;
d1=value/10;
d2=value%10;
d1=d1+30;
// lcddata(d1);
delay(10);
d2=d2+30;
lcd_cmd(d2,1);
delay(4);
k++;
// msgdisplay(".");
d3=d3+0x30;
lcd_cmd(d3,1);
delay(10);
k=0;
}
/*---------------------------------------------------------------------------------
; long delay ;
----------------------------------------------------------------------------------*/
void long_delay (void )
{
unsigned int g;
for(g=0;g<500;g++)
delay(40000);
}
Chapter 8
Results and Discussions
8.1 Results
Assemble the circuit on the PCB as shown in Fig 5.1. After assembling
the circuit on the PCB, check it for proper connections before switching on the
power supply.
The EVM consists of a controller and switching unit , both the units are
working independently and in collaboration with each other as well.
The CU is accepting fingerprints in enrolling mode and is responding
accordingly.
In identifying and vote casting mode, the CU checks for finger print
detection routine
In total, the complete system (including all the hardware components and
software routines) is working as per the initial specifications and requirements
of our project. Because of the creative nature of the design, and due to lack of
time, some features could not be fine-tuned and are not working properly. So
certain aspects of the system can be modified as operational experience is
gained with it. As the users work with the system, they develop various new
ideas for the development and enhancement of the project
8.2 Conclusion
The implementation of Finger print based voting machine using
microcontroller is done successfully. The communication is properly done
without any interference between different modules in the design. Design is
done to meet all the specifications and requirements. Software tools like Keil
Uvision Simulator, Flash Magic to dump the source code into the
microcontroller, Orcad Lite for the schematic diagram have been used to
develop the software code before realizing the hardware.
The performance of the system is more efficient. Reading the Data and
verifying the information with the already stored data and perform the specified
task is the main job of the microcontroller. The mechanism is controlled by the
microcontroller.
CHAPTER 9
FUTURE SCOPE
Number of candidates could be increased.
It could be interfaced with printer to get the hard copy of the result almost
instantly from the machine itself.
It could also be interfaced with the personal computer and result could be
stored in the central server and its backup could be taken on the other
backend servers.
Again, once the result is on the server it could be relayed on the network to
various offices of the election conducting authority. Thus our project could
make the result available any corner of the world in a matter of seconds
CHAPTER 10
REFERENCES
1. http://www.aimglobal.org/technologies/rfid/what_is_rfid.asp
2. http://www.rfidjournal.com/faq
3. http://www.technovelgy.com/ct/Technology-Article.asp
4. http://www.perada.eu/documents/articles-perspectives/an-
introduction-to-rfid-technology.pdf
5. http://csrc.nist.gov/publications/nistpubs/800-98/SP800-98_RFID-
2007.pdf
6. www.ieee.org
7. http://www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.pdf
8. http://www.taltech.com/TALtech_web/resources/intro-sc.html
9. http://focus.ti.com/lit/ds/symlink/max232.pdf
10. http://www.kmitl.ac.th/~kswichit/89prog/index.html
11. http://www.microdigitaled.com/8051/Software/keil_tutorial.pdf