You are on page 1of 90

UNIVERSITY OF NIGERIA

FACULTY OF ENGINEERING
DEPARTMENT OF ELECTRONIC ENGINEERING

DESIGN AND IMPLEMENTATION OF ELECTRONIC VOTING MACHINE [EVM]

BY

AROH SUNDAY MELITUS: 2007/148268


ENYI VALENTINE SUNDAY: 2007/148078
NWOKOLO CHIBUZO VITALIS: 2007/148271

OMIKE RAMIGIUS CHIMA: 2007/147685

SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE


AWARD OF THE BACHELOR OF ENGINEERING (B.ENGR) DEGREE IN
ELECTRONIC ENGINEERING

PROJECT SUPERVISOR: ENGR. M.A. AHANEKU

AUGUST, 2012.
2

APPROVAL PAGE

This project has been supervised and certified as satisfying part, the requirements for the
award of Bachelor of Engineering degree (B.Eng.) in Electronic Engineering, Department of
Electronic Engineering, University of Nigeria, Nsukka.

SIGNATURE OF AUTHORS: ______________________________________________

AROH SUNDAY MELITUS DATE

(2007/148286)

______________________________________________

ENYI VALENTINE SUNDAY DATE

(2007/148078)

_____________________________________________

NWOKOLO CHIBUZO VITALIS DATE

(2007/148271)

______________________________________________

OMIKE RAMIGIUS CHIMA DATE

(2007/147685)

CERTIFIED BY: _______________________________________________

ENGR. M.A. AHANEKU DATE

(SUPERVISOR)

ACCEPTED BY: ________________________________________________

PROF. O.U. OPARAKU DATE

(HEAD OF DEPARTMENT)
i

DEDICATION

To our parents, siblings, friends and God Almighty


ii

ACKNOWLEDGEMENT

Our sincere gratitude goes to our parents and guardians for their formidable love and

support throughout the course of our academic stay, most especially in the aspect of

providing the funds put in this work.

Special thanks to our project supervisor, Engr. M.A. Ahaneku, for his guidance and

invaluable assistance towards the successful realization of this project. In addition, we duly

appreciate the fatherly role of our able and dynamic Head of Department, Prof. O.U.

Oparaku, in motivating students to attain academic excellence in the field of engineering.

All thanks to God Almighty, for His endless love and mercies that has helped thus far.
iii

ABSTRACT

Elections have come to be one of the controversial exercises in our nationhood. This is
evidenced from the plethora of litigations that subsequently arise after each general election.
This could be traced to the doubt about the figures that emanate from the electoral umpire
(INEC). The need therefore arises to have a system of voting devoid of the danger of
doctoring election figures. The approach is to minimize human interference in the whole
process of voting. An electronic voting machine is therefore proposed as the only feasible
option available. The system proposed would consist of a unique voter’s card made from
electrically erasable programmable memory (EEPROM). The EEPROM card would host a
unique voter identification number (VIN). During the voting process the voting machine part
of which is a microcontroller will read the VIN and forward it to computer software through
the RS232 serial interface of a computer. The software accesses this unique identification in
the EEPROM for verification of validity of the card. To prevent cases of multiple voting or
fraud, the voting machine after accessing the VIN subsequently deletes the number. The
microcontroller interface circuit verifies whether the voter has voted before. This is done by
deleting the unique pin resident in the voter card and replacing it with a particular identifying
number. The detection of a fraudulent voter is done by the microcontroller which checks the
unique pin in a voter card against the identifying number which is also stored in its register. A
match will result in the microcontroller sending trigger signal to the alarm detection system.
Otherwise the microcontroller allows the voter to depress a button representing the particular
political party he is voting for PC software then increments count of the particular political
party. The PC software also has the capability to display total results on request.
iv

LIST OF FIGURES

FIG. 2.1: BLOCK DIAGRAM OF 8051 MICROCONTROLLER 9

FIG. 2.2: PIN OUT OF 8051 MICROCONTROLLER 12

FIG. 2.3: A TYPICAL 4X4, I6-KEY KEYPAD 17

FIG. 2.4: PIN OUT OF AT89C51 20

FIG. 2.5: A TYPICAL LCD 23

FIG. 2.6: FLOWCHART OF AN ASSEMBLER 25

FIG. 3.1: BLOCK DIAGRAM OF ELECTRONIC VOTING MACHINE 29

FIG. 3.2: DIAGRAM OF THE POWER SUPPLY UNIT OF THE EVM 31

FIG. 3.3: PC SERIAL PORT INTERFACE MODULE 32

FIG.3.4: LINE DRIVER (CONVERTER) 33

FIG. 3.5: KEYPAD INTERFACE CIRCUIT 34

FIG. 3.6: BUZZER INTERFACE CIRCUIT 35

FIG. 3.7: EEPROM CARD INTERFACE MODULE 36

FIG. 3.8.1: FLOW CHART FOR THE VIN VERIFICATION UNIT 39 – 40

FIG. 3.8.2: FLOW CHART FOR THE VOTING PANEL 41

FIG. 3.8.3: FLOW CHART FOR THE EVM GUI 42

FIG. 4.1: EEPROM CARD INTERFACE IMPLEMENTATION 45

FIG. 4.2: LIQUID CRYSTAL DISPLAY UNIT 46

FIG. 4.3: LCD INTERFACE CIRCUIT 47

FIG. 4.4: BUZZER INTERFACE CIRCUIT 48

FIG. 4.5: POWER SUPPLY UNIT IMPLEMENTATION 49

FIG. 4.6: LINE DRIVER (CONVERTER) 50

FIG. 4.7: VOTERS REGISTRATION FORM 55

FIG. 4.8: CANDIDATES REGISTRATION FORM 55

FIG. 4.9: ADMIN LOGIN FORM 56


v

LIST OF TABLES

TABLE 2.1: SOME INTERRUPT ENABLE REGISTERS 11

TABLE 2.2: RESET VALUE OF REGISTERS 13

TABLE 2.3: ALTERNATE FUNCTIONS OF PORT 3 OF 8051 14

TABLE 2.4: SHOWING COMMAND OPERATIONS USING 8086 24

ASSEMBLY LANGUAGE

TABLE 3.1: SKETCH OF THE DATABASE TABLES 43

TABLE 4.1: TESTS PERFORMED ON THE VIN VERIFICATION 51

UNIT

TABLE 4.2: TESTS PERFORMED ON THE VOTING PANEL 52

TABLE 4.3: CANDIDATES DATABASE 52

TABLE 4.4: PARTIES DATABASE 53

TABLE 4.5: ELECTION POSTS DATABASE 53

TABLE 4.6: ELECTION MANAGERS DATABASE 53

TABLE 4.7: VOTERS DATABASE 54

TABLE 4.8: RECORDED VOTES DATABASE 54

TABLE 5.1: COST ANALYSIS TABLE 57 - 58


vi

TABLE OF CONTENTS

Title

Approval Page

Dedication … … … … … … … … … i

Acknowledgement … … … … … … … … ii

Abstract … … … … … … … … iii

List Of Figures … … … … … … … … iv

List Of Tables … … … … … … … … v

Table Of Contents … … … … … … … … vi - viii

CHAPTER ONE: INTRODUCTION

1.1: Background … … … … … … … … … 1

1.2: Statement of Problem …… … … … … … 1-3

1.3: Purpose of the Project … … … … … … … 3

1.4: Significance of The Project … … … … … … … 4-5

1.5: Scope of the Project … … … … … … … … 5-6

CHAPTER TWO: LITERATURE REVIEW


2.1: Brief Overview Of Voting Methods … … … 7
2.2: Description Of Basic Components Of The Electronic Voting Machine 7
2.3: Microcontrollers … … … … … … … … 7-8
2.3.1: Factors to Be Considered In Choosing A Microcontroller … … 8
2.4: The 8051 Microcontroller Architecture … … … … … 8 - 14
2.4.1: Microcontroller Program Storage … … … … … … 14 - 15
2.5: Buzzer And Beeper … … … … … … … 15
2.6: Smart Card ….. 15
2.7: Webcam … … … … … … … … … 15 - 16
2.8: Power Supplies … … … … … … … … 16
2.8.1: Forms of Electrical Power Supplies …… … … … 16 - 17
vii

2.9: Keypad … … … … … … … … … 17
2.10: In-System Programmer (ISP) … … … … … … 17 - 18
2.11: AT89S52 – 12MHZ Microcontroller … … … … … 18 – 19

2.11.1: Features Of AT89S52 – 12MHZ Microcontroller … … … 19

2.11.2: Description Of AT89S52 – 12 MHZ … … … … … 19 - 20

2.12: Peripherals Interface … … … … … … … 20 - 21


2.13: Display Unit … … … … … … … … 21
2.13.1: Liquid Crystal Display (LCD) … … … … … … 22 - 23

2.14: Software Development … … … … … … … 23

2.15: Assembly language … … … … … … … 23 - 25

2.15.1: The Flowchart Of A Typical Assembler … … … … … 25 - 26

2.15.2: Assembly Language Instruction Sets … … … … … 26 - 27

2.16: High-Level Language … … … … … … … 27

2.17: Choice Of Programming Language … … … … … 28

CHAPTER THREE: SYSTEM DESIGN

3.1: System Design Specifications … … … … … 30

3.1.1: Power Supply Unit Design … … … … … 30 - 31

3.1.2: PC Serial Port Interface Circuit … … … … … 31 - 33

3.1.3: Keypad Interface Circuit Design … … … … … 33 - 34

3.1.4: Timing Circuit … … … … … 34

3.1.5: Buzzer Interface Circuit Design … … … … … 35

3.1.6: EEPROM Card Interface Circuit Design … … … … 35 - 36

3.2: System Operation Description … … … … 36 - 37

3.2.1: Detailed Explanation Of The Interaction Between The Voters' Identification


viii

Number Verification Unit And The Voting Panel … … … 37 - 38

3.3: Flowchart For The Vin Verification Unit … … … … 39 - 40

3.4: Flowchart For The Voting Panel … … … … 41

3.5: Software Design And Development … … … … 42

3.5.1: Flow Chart Of The EVM Software … … … … 42 - 43

3.5.2: Database Design … … … … 43

CHAPTER FOUR: IMPLEMENTATION, TESTING AND RESULTS

4.1: Simulation And Implementation … … … … 44

4.1.1: Simulation … … … … 44

4.1.2: Implementation … … … … 44 - 50

4.2: Testing And Results … … … … 51 - 56

CHAPTER FIVE: COST ANALYSIS, CONCLUSION AND RECOMMENDATION

5.1: Cost Analysis … … … … 57 - 58

5.2: Conclusion … … … … 58

5.3: Recommendation … … … … 58 - 59

REFERENCES

APPENDIX A SCHEMATIC HARDWARE CIRCUIT DIAGRAM 61

APPENDIX B ASSEMBLY LANGUAGE SOURCE CODE 62 - 74

APPENDIX C GUI CODE 75 - 80


1

CHAPTER ONE

INTRODUCTION

1.1: BACKGROUND

Few years ago, a substantial part of the Nigerian population yearned for the democratic-style
of rule in the United States, as an obvious replacement to the highly controversial, military
system of rule in Nigeria. Not until May 29th, 1999, was this collective desire of the Nigerian
people duly met, and today, almost every facet of Nigerian politics have endorsed
“democracy” as the preferred system of governance. Democracy is a system of government
based on the principle of majority decision making [1]. Since the people’s choice in the
selection of leaders remains the major fulcrum of modern day democracy, technological
solutions are constantly been devised to provide an electoral process that is credible,
transparent, fair to all and ultimately, efficient.

Elections allow the populace to choose their representatives and express their preference for
how they will be governed. Naturally, the integrity of the election process is fundamental to
the integrity of democracy itself. The election system must be sufficiently robust to withstand
a variety of fraudulent behaviours and should be sufficiently transparent and comprehensible
that voters and candidates can accept the results of an election[2][3]. The electioneering
process in Nigeria since 1999, leaves much to be desired. It is marked with such issues as:
gross inefficiency, violation of proper voting standard and procedures, low credibility,
falsification of voting records and in the end, the people’s right to choose their leaders is
hereby hijacked. The EVM solution would no doubt help to correct these inadequacies,
reduce the high incidence of sharp practices in our electoral process and assure the electorate
that their votes do really count.

1.2: STATEMENT OF PROBLEM

As earlier mentioned, elections in Nigeria have been branded with negative insignias of sharp
electoral practices, pre- and post-election violence leading to the destruction of lives and
properties, distrust within the electorate over falsified election results which culminates into
their rejection of poll results. The inability of the Independent National Electoral Commission
(INEC) to conduct credible, free and fair elections has become the achilles heel of our
nascent democracy. In other words, INEC has lost its credibility.
2

It is a known fact everywhere, that elections to a particular political position should produce
only one winner. Thus, the aim of an election is defeated when more than one candidate lay
claim to victory in the polls. This unfortunate situation where candidates cannot trust election
results, has become a widespread problem. Most contestants view results released by INEC
as doctored with obvious manipulations. As a result of this common view, most candidates
engage in various forms of electoral and societal vices so as to tilt the pendulum of victory in
their favour. A summary of these vices are listed as:

- Snatching of ballot box from polling units as well as illegal stuffing of ballot boxes.

- The use of thugs and armed men to intimidate, and sometimes maim INEC officials in a bid
to falsify election records.

- Forgery of INEC voting materials etc.

These plethora of problems that besiege our electoral process are traceable to the following
causes:

 High Level Of Human Interference

Every process characterized by steady human involvement is fraught with the danger of
mistakes. Here, mistakes could be in the form of wrong collation of election figures during
vote counting, vote miscount (common in the conventional paper ballot system),
manipulation of election figures to favour the candidate who pays the highest bribe etc.

 Forgery Of Voting Materials

Since the traditional system of voting in Nigeria entails the use of ballot papers, there is high
likelihood that these voting materials can easily be reproduced by anyone in possession of the
right printing equipment. Many fraudulent politicians employ this possibility to forge ballot
papers in anticipation of the election day. The result is that, on election day, ballot box
snatching becomes rampant; and these ballot boxes are removed from polling units and
illegally moved to remote locations where they are stuffed with forged ballot papers.
Somehow, these stolen ballot boxes are smuggled back to INEC offices and in the end,
election results are gravely influenced.

Apart from forging ballot papers, politicians epecially those still in government and
contesting for political offices, could influence the contractors in charge of printing the ballot
3

papers. Either overproducing or underproducing the ballot papers would lead to the
disenfranchisement of the people’s right to vote.

 Poor Documentation Of Election Documents/ Records

In the ballot paper system of voting, documents are mostly maintained in their hard copy
formats and so, are prone to being destroyed by fire, pests and human agents. Also, with the
conventional system, the ease of document accessibility, analysis, processing and storage are
not highly provided for.

 Non-Reusable Ballot Papers

Ballot papers are not reusable and so, for every subsequent elections, the government always
spends a large chunk of the national budget on ballot paper production. This makes elections
too expensive to manage and conduct.

 Difficulty in Vote Assessment

It is almost impossible for voters to follow up the process of results collation during elections.
This is due to bureaucratic bottlenecks in the electoral process, whereby the whole of result
collation is ambiguous with little or no contribution from voters ( in terms of complaints or
feedback).

 Strenuous Voting Procedure

The traditional voting process usually involves the process of voter verification and
validation, issuance of voter card and production of other voting materials. These processes
are usually time consuming, coupled with the problem of late arrival of voting materials on
election day.

In the real voting process, a strenous burden is imposed on voters as they stand in long
queues for long hours. This could result in voter apathy.

1.3: PURPOSE OF THE PROJECT

The aim of the project is to minimize undue human interference in the entire voting process
as well as the collation of the election results. This is achieved by ensuring that the process of
voting is computerized in order to give credibility to the electoral system and process.
4

1.4: SIGNIFICANCE OF THE PROJECT

1) TRANSPARENCY

There is general apathy among the electorate during elections. This stems from their doubts
over the authenticity of election results. The use of the EVM together with its very
transparent methods would no doubt restore and boost the credibility of the electoral process.
By this, voter apathy will be greatly reduced.

2) VIOLENCE FREE ELECTIONS

With the introduction of EVM, politicking candidates become fully aware that have little or
no influence over the electioneering process. This is because the EVM solution leaves little or
no room for manipulation. It also ensures that a peaceful, conducive atmosphere for the
conduct of elections is in place. The electoral process is therefore devoid of violence, stealing
of ballot boxes, thuggery and other vices.

3) EASE OF DOCUMENTATION AND DATABASE SECURITY

The EVM solution provide results in electronic format with the possibility of making print
outs. This makes it easy to transfer results over the internet network to a central collation
database. Also, it is possible to measure the instantaneous voting pattern in a particular
locality.

Furthermore, given the ease of data documentation, various statistical analysis could be
carried out on obtained results. Data could also be easily retrieved in case of damage to the
original document copy. In the area of database security, effective measures are put in place
to protect the database from unauthorized access and manipulations by both the public and
fraudulent electoral officers.

4) REUSABLE VOTER CARD

Unlike the traditional voting system where ballot papers become useless after elections, the
electronic voter machine will make use of an EEPROM voter card. Thus, for subsequent
elections, the EEPROM cards are simply re-written to reflect the election at hand. This
greatly cuts down the cost of conducting elections.
5

5) INDEPENDENT VOTER VERIFICATION

Electronic voting systems can offer solutions that allow voters to verify that their votes are
recorded and tabulated[3]. These systems can alleviate problems of incorrectly recorded
voters.

6) ERADICATION OF FAKE BALLOT PAPER PRODUCTION

The EVM offers an electronic voter card as replacement to the conventional ballot paper,
thereby providing a voter card which is almost impossible to reproduce. The EEPROM cards
will bear unique identification numbers and this will help to cut down the forgery of voter
cards. The ID numbers will serve the purpose of distinguishing the original voter cards from
the fake ones.

7) REDUCED STRAIN ON VOTERS

The throughput of the EVM is far higher than the conventional system of voting, since it
automates such activities as voter registration, voting and vote tabulation. Because of this,
there would be reduced strain imposed on the voters.

8) PRIOR VOTER EDUCATION

One of the pre-requisites for the implementation of the EVM is prior voter education.
Therefore, the deployment of these machines will ensure that a new generation of
informed/enlightened voters emerge. Such voters will now be able to participate actively and
even, constructively critcize the electoral process when the need arises.

9) ACCURATE ELECTION RESULTS

The EVM is less prone to computation errors than the conventional voting systems. This is
because the machines are programmed specifically to follow a clearly stated sequence of
instructions or algorithm. Thus, provided there are no initial errors in the programming, the
results from tne EVM are guaranteed to be accurate.

1.5: SCOPE OF THE PROJECT

Within the limit of the specification realized in the project, the EVM could be deployed for
the following purposes:

1) Party Primaries:
6

The EVM can be used in party primaries as an efficient, selection tool in voting for the
party’s flagbearer as well as other party delegates who will represent the party in different
capacities.

2) Presidential, governorship or local government elections.

3) A company’s board executives election.


7

CHAPTER TWO
LITERATURE REVIEW

2.1: BRIEF OVERVIEW OF VOTING METHODS


The voting process itself has evolved dynamically in line with current advancements in
technology. Most countries are gearing up towards the improvement of their electoral
process. Before now, the following methods of voting were (or are still) employed, most of
which are primitive or mechanically oriented:
(1) The use of hands, voice as voting means.
(2) Depositing of beans and/or grain into a box as a voting procedure.
(3) Paper ballot system.
(4) The use of punch cards in voting.
(5) The use of tabulation machines (a process otherwise known as Mechanical voting).
(6) The Mark sense system which employs optical reading techniques in creating voter’s
card.
However, with the massive preference for digital systems (considering their accuracy and
reliability in getting results) over analogue or mechanical systems, several digital devices or
machines have been designed to solve the existing electoral deficiencies/limitations.
Examples of such devices or machines are:
(1)Online voting which employs the internet. The internet voting system falls under three
categories: kiosk, poll site and remote. Each category defines the location where the ballot is
cast and directly links up to the technical challenges inherent in that system.
(2) Electronic Voting Machine using a “smart card-type” ballot paper.
(3) Direct Recording Electronic (DRE) Voting Machine [4][5].

2.2: DESCRIPTION OF BASIC COMPONENTS OF THE ELECTRONIC VOTING


MACHINE (EVM)

2.3: MICROCONTROLLERS
A microcontroller is a single computer chip that executes a user program normally for the
purpose of controlling some device. Its distinguishing feature is the inclusion on a single
chip, of all the resources which permit the IC to serve as a controller in a system or an
instrument. It is a complete computer on a chip containing all of the elements of the basic
8

microprocessor along with other specialized functions. Its built-in facilities have obvious
advantages when building stand-alone front-ends and controllers.
A microcontroller is made up of CPU, RAM, ROM, I/O ports, timers, and serial
communication ports. It has wide applications in embedded systems that require some
amount of computing power but don’t require as much as that provided by a complex
processor. In an embedded system there is only one application software that is typically
burned into ROM. Microcontroller-based systems are generally smaller, more reliable and
cheaper. They are ideal for applications where cost and unit size are important considerations.
A typical example is the 8051\8052 family, which includes 8031, 8051,
8052,8751,8752,8951, 8952, etc. the major producers of microcontrollers are Atmel and Intel.
Certain factors are to be considered when choosing a microcontroller for an application.
They include:
-Speed, size of ROM/RAM, number of I/O ports, timers, power consumption and cost per
unit.
-Availability of software development tools like assemblers, debuggers, compilers, simulators
and technical support.
-Availability and reliable sources of microcontrollers. The 8051/8052 families are readily
available.

2.3.1: FACTORS TO BE CONSIDERED IN CHOOSING A MICROCONTROLLER


The factors to be considered in selecting a micro-controller for a particular application are:
-Speed, size of ROM/RAM, number of I/O port, timers, packaging, power consumption and
cost per unit.
-Availability of software development tools like assemblers, debuggers, compilers,
emulators, simulators, and technical support.
-Availability and reliable sources of microcontrollers. For example, 8951 family of
microcontrollers are readily available [6].

2.4: THE 8051 MICROCONTROLLER ARCHITECTURE


The 8051 is an 8-bit microcontroller originally developed by Intel in the late 1970s. It
included an instruction set of 255 operation codes, 32 input/output lines, three user-
controllable timers, an integrated and automatic serial port, and 256 bytes of on chip RAM.
The 8051 family was designed such that control of the microcontroller and all input/output
between the microcontroller and external devices is accomplished via Special Function
9

Registers (SFRs). Each SFR has an address between 128 and 255. Additional functions can
be added to new derivative microcontrollers by adding additional SFRs while remaining
compatible with the original 8051. This allows the developer to use the same software
development tools with any microcontroller that is 8052-compatible.

The 8051 microcontroller is a big family of microcontrollers consisting of other


microcontroller types. The 8051 family of microcontrollers have most of their features in
common with slight differences. In our project we used the 8051 micro controller which is
among the most recent in the family. The block diagram of the 8051 microcontroller could
be give below.

EXTERNAL
INTERRUPTS

INTERRUPT
COUNTER
CONTROL INPUTS

ADDRESS
DATA
.
FIG.2.1: BLOCK DIAGRAM OF 8051 MICROCONTROLLER

The 8051 microcontroller has the following features.


 8-Bit CPU optimized for control applications.
 Extensive Boolean processing capabilities (AND, OR, XOR, etc).
 On-chip flash program memory (4kB) and data RAM (128 Bytes)
 Bi-directional and individually addressable I/O lines.
 Multiple 16-bit timer/counters.
10

 Full duplex serial bus interface.


 Multiple source/priority interrupt structure.
 0n-chip clock oscillator, it has a maximum operating frequency of 24MHz and least
operating frequency of zero Hz and this determines the speed of operation.
 It has a watchdog timer.
 It supports two software selectable owner saving modes; idle mode and power down
mode.

The 8051 provides five (5) interrupt sources; two external interrupt, two timer interrupts and
a serial port interrupt. The external interrupts are denoted by INT0 and IUT1 and could each
be either level-activated or transition-activated, depending on the bits IT0 and IT1 in
register TCON. When the service routine is vectored to, hardware clears the flag that
generated an external interrupt only if the interrupt was transition-activated. If the interrupt
was level activated, then the external requesting source (rather than the on chip hardware)
controls the request flag.
The 8051 has two 16-bit timer/counter registers. As a timer, the register is incremented
every machine cycle. Thus, the register counts machine cycles. Since a machine cycle
consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. The timer
or counter function is selected by control bits C/T in the special function register TMOD.
When a timer interrupt is generated, the on-chip hardware clears the flag that generated it
when the service routine is vectored to.
The serial port interrupt is generated by the logical OR of R1 and T1. Neither of these flags
is cleared by the hardware when the service routine is vectored to.
Each of the interrupt sources can be individually enabled or disabled by setting or clearing
the interrupt enable (IE) bit in the special function register (SFR). This register also contains
a global disable bit, which can be cleared to disable all interrupts at once. Some of the
interrupt enable registers in AT 80C51 are: EA, ES, ETI, EXI, ETO, EXO. For instance if
EA=O, no interrupt will be acknowledged. Also if EA= I, each interrupt source is
individually enabled or disabled by setting or clearing its enable bit.
11

EA Global interrupt enable register


ES Serial port interrupt enable register
ETI Timer1 Interrupt enable register
EX1 External interrupt 1 enable register
EXO External interrupt 0 enable register
ETO Timer 0 interrupt enable register

TABLE 2.1: SOME INTERRUPT ENABLE REGISTERS

Each interrupt sources can also be individually programmed to one of two priority levels by
setting or clearing the interrupt priority (IP) bit in the special function register. A low-priority
interrupt could be interrupted by a high-priority interrupt but not by another low-priority
interrupt. A high priority interrupt cannot be interrupted by any other interrupt source. If two
interrupt requests of different priority levels are received simultaneously, the request of higher
priority level is serviced. If interrupt requests of the same priority level are received
simultaneously, an internal polling sequence determines which request is serviced. Thus, within
each priority level the polling sequence determines a second priority structure.
12

FIG.2.2: PIN OUT OF 8051 MICROCONTROLLER

The 8051 provides the following standard features: 4k bytes of flash, 128 bytes of RAM, 32 I/O
lines, two 16- bit timer/ counters, a five interrupt source, a full duplex serial port, on-chip
oscillator. In addition, the 8051 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The idle mode stops the
CPU while allowing the RAM, timer/ counters, serial port and interrupt system to continue
functioning. The power-down mode saves the RAM contents but freezes the oscillator disabling
all other chip functions.
The pin out of 8051 microcontroller is given above in figure 2.2:
 Pin 40 provides VCC. The VCC provides the supply voltage to the chip. The voltage
source is +5V.
13

 Pin 20 provides the ground (GND) pins 19, 18 are for crystal I (XTAL 1) and crystal
2 (XTAL 2). They provide external clock to the chip. External clock to the chip can
be provided using a quartz crystal oscillator or from a pulse generator. The two
options have different circuit configurations.
 Pin 9 provides a reset (RST). It is an input pin and is active high normally low. The
high pulse must be high at least two machine cycles. Upon applying a high pulse to
reset pins the microcontroller will reset and all values in the registers will be lost.
For example during a reset operation, the RAM would loose its contents; some of
the reset value of the register is given below.

Register Reset value


PC 0
ACC 0
B 0
PSW 0
SP 7
DPTR 0
TABLE 2.2: RESET VALUE OF THE REGISTERS
 Pin 31 functions as external access enable and also programming enable voltage;
(EA/VPP). In some microcontrollers without on chip ROM, for example 8031, the
external access enable (EA) must be connected to ground in order to enable the
device to fetch code from external program memory locations starting at 0000H to
FFFFH. For internal program executions, EA must be trapped to VCC.
The pin also receives a 12-volts programming enable voltage during the flash
programming.
 Pin 29 provides the program store enable pin (PSEN). It is the read strobe to the
external program memory. When the 80C51 is executing code from external
program memory, PSEN is activated twice each machine cycle, except during access
to external data memory.
 Pin 30 provides the address latch enable function. It is an output pin and is active
high. Since port 0 of 8051 provides both address and data, the (ALE) is used for
latching the low byte of the address during accesses to the external memory.
The pin is also the program pulse input (PROG) during flash programming.
14

The 8051 has four I/O ports:


i. Port 0, pins 32-39 (P0. 0 to P0.7)
ii. Port 1, pins 1-8 (P1.0 to P7).
iii. Port 2, pins 21-28 (P2.0 to P2.7).
iv. Port 3, pins 10-17 (P3.0 to P3.7)
Each of the ports has 8 pins or bits. These eight bits form a byte and each port could be used
as input or output (bi-directional). The output drivers of port 0 and port 2, and the input
buffers of port 0, are used in accesses to external memory. In this application, port 0 outputs
the low byte of the external memory address, timer multiplexed with the byte being written
or read. Port 2 outputs high byte of the external memory address when the address is 16 bits
wide. Port 1 and port 3 are specifically special function registers, which could accept input
or give out output as the case may be. Port 3 provides additional function or rather alternate
function; serial communication. Given is the table of alternate function or roles played by
port 3 of 8051.
Port Pin No Alternate functions
P3.0 10 RXD (serial input port)
P3.1 11 TXD (serial output port)
P3.2 12 TNTO (external interrupt 0)
P3.3 13 INTI (external interrupt 1)
P3.4 14 To (timer 0 external input)
P3.5 15 TI (timer 1 external input)
P3.6 16 WR (external data memory strobe)
P3.7 17 RD (external data memory strobe)
TABLE 2.3: ALTERNATE FUNCTIONS OF PORT 3 OF 8051

2.4.1: MICROCONTROLLER PROGRAM STORAGE


The program for a microcontroller is normally stored on a memory integrated circuit (IC),
called an EPROM, or on the microcontroller chips itself.
An EPROM (Electrically Programmable Read Only Memory) is a special type of integrated
circuit that does nothing more than store program code or other data but which is
maintained even when the power to the EPROM is turned off. Once the software is
developed for a microcontroller it is normally programmed (or burned) into an EPROM
chip, and that chip is subsequently physically inserted into the circuitry of the hardware.
The microcontroller accesses the program stored in the EPROM and executes it. Thus the
15

program is made available to the microcontroller without the need for a hard drive, floppy
drive, or any of the other circuitry necessary to access such devices.
In recent years, microcontrollers offer the capability of having programs loaded internally
into the microcontroller chip itself. Thus, rather than having a circuit that includes both a
microcontroller and an external EPROM chip, it is now entirely possible to have a single
microcontroller which stores the program code internally [6][7].

2.5: BUZZER AND BEEPER


These devices are output transducers converting electrical energy to sound. They contain an
internal oscillator to produce the sound, which is set at about 400Hz for buzzers and about
3KHz for beepers. Buzzers have a voltage rating but it is only approximate, for example 6V and
12V buzzers can be used with a 9V supply and with a typical current of about 25mA [9].

2.6: SMART CARD


There are two types of smart cards: contact and contactless. Both have an embedded
microprocessor and memory. The smart card differs from the card typically called a proximity
card, in that the microchip in the proximity card has only one function: to provide the reader
with the card’s identification number. The processor on the smart card has an operating system
and can handle multiple applications such as a cash card, a pre-paid membership card, and even
an access control card. The difference between the two types of smart cards is found in the
manner with which the microprocessor on the card communicates with the outside world. A
contact smart card has eight contacts, which must physically touch contacts on the reader to
convey information between them. A contactless smart card uses the same radio-based
technology as the proximity card with the exception of the frequency band used. Smart cards
allow the access control system to save user information on a credential carried by the user
rather than requiring more memory on each controller [8].
The smart card used in this project however is EEPROM based.

2.7: WEBCAM

Webcams (web cameras) are small cameras (usually, though not always, video cameras),
whose images can be accessed using the World Wide Web, instant messaging, or a PC video
conferencing application. The term webcam is also used to describe the low-resolution digital
16

video cameras designed for such purposes, but which can also be used to record in a non-real-
time fashion.

Web-accessible cameras involve a digital camera which uploads images to a web server,
either continuously or at regular intervals. This may be achieved by a camera attached to a
PC, or by dedicated hardware. Webcams are being used for security purposes. Software is
available allowing PC-connected cameras to watch for movement and sound, recording both
when they are detected; these recordings can be saved to the computer, e-mailed or uploaded
to the internet. In one well-publicized case, a computer e-mailed out images as the burglar
stole it, allowing the owner to give police a clear picture of the burglar's face even after the
computer had been stolen [7].

2.8: POWER SUPPLIES


A power supply unit (PSU) is a device or system that supplies electrical or other types of
energy to an output load or group of loads. The term is most commonly applied to electrical
energy supplies. Constraints that commonly affect power supplies are the amount of power
they can supply, how long they can supply it without needing some kind of refuelling or
recharging, how stable their output voltage or current is under varying load conditions, and
whether they provide continuous power or pulses.
The power supply unit (PSU) for a computer converts mains AC to low-voltage regulated DC
power for the internal components of the computer. Modern personal computers universally
use a switched-mode power supply. Some power supplies have a manual selector for input
voltage, while others automatically adapt to the supply voltage. Different power supply form
factors provide different power output connections, depending on system requirements

2.8.1: Forms of Electrical Power Supplies:


Electrical power supplies include the mains power distribution system together with any
other primary or secondary sources of energy such as:
- Batteries
- Chemical fuel cells and other forms of energy storage systems
- Solar power
- Generators or alternators
A simple AC power supply uses a transformer to convert the voltage from the wall outlet to a
lower voltage. A diode circuit then rectifies the AC voltage to pulsating DC. A capacitor
17

smoothens out most of the pulsating, rectified waveform to give a DC voltage with some
ripple. Finally, depending on the requirements of the load a linear regulator may be used to
reduce the voltage to the desired output voltage and remove the majority of the remaining
ripple. It may also provide other features such as current limiting [9].

2.9: KEYPAD
Keypads are an excellent way of entering data into the microcontroller. The keys are usually
numbered (numeric or alphanumeric) but they could be labelled as function keys for example
in a remote control handset in a TV to adjust the sound or colour etc. Keypads are usually
arranged in a switch matrix format to reduce the number of I/O connections. The switch
matrix is typically a 2-dimensional matrix of wires with switches at each vertex. The switch
is used to interconnect rows and columns in the matrix.
A 12 key keypad is arranged in a 3x4 format requiring 7 connections, while a 16 key keypad
is arranged in a 4x4 format requiring 8 connections [8].

FIG. 2.3: A TYPICAL 4X4, 16- KEY KEYPAD.

2.10.1: IN-SYSTEM PROGRAMMER (ISP)


A high level language such as C or low level language like assembly language can be used
on desktop computer(PC), or Laptop for application development on embedded system.
After the executable binary has been created by the cross development tools of compiler and
assembler, the generated binary needs to be uploaded to the target board i.e. the embedded
18

system (e.g. microcontroller).The binary, in most cases, would be converted to hexadecimal


format for simplicity, and then it will go to some kind of non-volatile memory (e.g. EPROM),
requiring specific programming procedures.

In the earlier, chips had to be removed from the target board and placed in a programming
device, today’s microcontroller and external memory chips can be re-programmed without
being removed from the circuit. This is termed in-circuit or in-system programming (ISP).
The ISP was in the loading of instructions (programming) on the non-volatile flash ROM of
the microcontroller (AT89S52).

The following items are needed in in-system;

1) A software tool running on the desktop computer, which is able to control the
programming interface via any standard port.

2) A special programming interface like SPI (Serial Programming Interface), JTAG (Joint
Action Group) etc. A firmware may be used to drive this interface, though this is gradually
becoming obsolete.

3) A Programming adapter which allows connecting the programming interface to any


standard port available at the PC, like USB, RS-232, parallel printer port etc.

All three requirements must be fulfilled somehow, but there is a large variety of real world
implementations. For instance, the programming adapter may be integrated on the target
board. In that case, for instance, a USB cable may be used to directly connect the PC to the
target board. Sometimes, the programming interface is accessible by special microcontroller
instructions or registers, which allows loading new firmware [8].

2.11: AT89S52 – 12MHz MICROCONTROLLER

The AT89S52 – 12MHz microcontroller which hails from Intel MCS-51 microcontroller
family usually referred to as 8051 family was used in this project work. It was manufactured
by Atmel Corporation using 8051 architecture and runs on a maximum of 12MHz oscillator
frequency.

The choice of AT889S52 – 12MHz for this project was based on the following features and
requirement:

1) Digital I/O pins requirement.


19

2) Memory needs of the project work.

3) Ease of usage. It is precisely due to the numerous input/output requirements and memory
availability that enhanced the choice of AT89S52 – 12MHz.

2.11.1: FEATURES OF AT89S52 – 12MHz MICROCONTROLLER

1) 8K bytes of in-system programmable (ISP) flash memory – endurance: 1000 write/erase


cycles.

2) 4.0V to 5.0V operating range.

3) Fully static operations: 1HZ to 33MHZ.

4) 256× 8 –Bit Internal RAM.

5) 32 programmable I/O lines.

6) Three 16-bit timers/counters.

7) Full duplex UART serial channel.

8) Low –power idle and power down modes.

9) Interrupt recovery from power-down mode.

10) Watch dog timer.

11) Dual data pointer.

12) Power off fag.

13) Fast programming time.

2.11.2: DESCRIPTION OF AT89S52 – 12 MHz

The AT89S52 – 12MHz is a low power, high-performance CMOS 8-bit microcontroller with
8K bytes of in-system programmable Flash memory. The device is manufactured using
Atmel’s high density non-volatile memory technology and is compatible with the industrial –
standard 8051 instruction set and pin out. The on-chip Flash allows the program to be
reprogrammed in-system or by a convectional non-volatile memory programmer. By
combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip,
20

the Atmel AT89S52 is a powerful microcontroller, which provides a highly flexible and cost-
effective solution to many embedded control applications. In addition, the AT89S52 is
designed with static logic for operation down to zero frequency and supports two software
selectable power saving modes.

The idle Mode stops the CPU while allowing the RAM, timer/counters, parallel port and
interrupt system to continue functioning. The Power-down mode saves the RAM contents but
freezes the oscillator, disabling all other chip functions until the next interrupt or hardware
reset [6][7][8].

FIG. 2.4: PIN OUT OF AT89C51

2.12: PERIPHERALS INTERFACE


Peripheral devices are usually external to the computer system’s internal bus. They are
devices with no direct connection to the system bus. Printers, mice, video cameras, scanners,
21

data/fax modems, plotters and lots of other peripheral devices exist. Unfortunately, their
existence is beyond the confines of the desktop or server machine. We need a way to reach
out to them. The process we undergo in order to reach out to them is called interfacing. In the
computer world, a port is a set of signal lines that the microprocessor, or CPU, uses to
exchange data with other components especially peripheral devices. Most computer ports are
digital, where each signal, or bit, is either a 0 or a 1. A parallel port transfers multiple bits at
once, while a serial port transfers a bit at a time. This is the basic difference between the
serial port and the parallel port though the serial port can transfer data in both directions
simultaneously. Interfacing external devices to the computer could be achieved either through
the serial port, the parallel port or even the USB port of the computer.

The Serial Port is relatively harder to interface than the Parallel Port. Generally, serial
transmission and reception of data involves and requires complex circuitry. Any device
connected to the serial port will have its data converted to a serial form before transmission
and then back to its parallel format after reception. This can be done using a Universal
Asynchronous Receiver/Transmitter (UART). The Parallel Port is the most commonly used
port for interfacing homemade projects. This port will allow the input of up to 9 bits or the
output of 12 bits at any one given time, thus requiring minimal external circuitry to
implement many simpler tasks. The port is composed of 4 control lines, 5 status lines and 8
data lines. It's found commonly on the back of your PC as a D-Type 25 Pin female connector
[6].

2.13: DISPLAY UNIT


The Visual Display Unit (VDU) displays an image on a screen according to the data supplied
to it by the graphics card. These components need to be compatible in order to work together.
Almost all modern display systems use the SVGA (Super Video Graphics Array) standard.
SVGA supports high colour depth, resolution, and refresh rate. Older display standards
include VGA and XGA, which are not capable of such high performance.
Most desktop computers use a Cathode Ray Tube (CRT) monitor to display an image (CRTs
are also used in television sets).
22

2.13.1: LIQUID CRYSTAL DISPLAY (LCD)

In low- power CMOS digital systems ( e.g. battery or solar-powered electronic devices), the
dissipation of an LED display can consume most of a system’s power requirements, and this
is undesirable in terms of saving power through the use of CMOS technology. Liquid crystal
displays (LCDs) are ideal for low-power applications; and unlike a LED display, they are
passive devices. Thus, instead of using electric current to generate light, it uses light that is
already externally present (e.g. sunlight, room lighting). For the LCD’s optical effect to
occur, the external light source need only supply a minute amount of power (within the
Mw/cm2 range). The typical LCD consists of two polarizing filters with a liquid crystal
solution between them. An electronic current aligns the crystals so that light can either pass
through or not pass through. The effect of light passing through in certain areas and not in
others is what creates the image. LCD comes in two forms—active matrix and passive
matrix. Active matrix is sometimes called thin film transistor (TFT). TFT allows each pixel to
be controlled, which creates very sharp colour images. Passive matrix is less expensive than
active matrix but does not provide the same level of image control. One disadvantage of the
LCD is their slow switching speeds (time it takes for a new digit/character to appear). Typical
switching speeds for LCDs range from around 40 to 100ms. At low temperature, the
switching speeds get even worse. Another problem with LCDs is the requirement that
external light be present. Though there are LCD displays that come with backlighting (e.g.
LED behind the display), the backlighting alone tends to defeat attempts at keeping power
consumption to a minimum [6].
23

FIG. 2.5: A TYPICAL LCD DISPLAY

2.14: SOFTWARE DEVELOPMENT

The software development process focuses on activities relating to the design, coding and
testing of the software aspect of this project. There are several software development process
models namely: the waterfall model, the prototyping method, the iterative development
process and the time boxing model. Each process model is suitable for the context where it
suits perfectly. Developing the EVM software entails a good combination of low-level and
high-level programming languages. While the former takes care of interactions within and
outside the microprocessor or microcontroller (highly machine-dependent), the latter
performs dual functions: hardware interface connections and database functions.

2.15: ASSEMBLY LANGUAGE

Assembly language is a low-level programming language used to control the operations of


microprocessor or microcontroller. Examples of assembly language programmes include: the
8086, 8051, PIC language series. The major difference between machine code and assembly
language is that, machine code purely makes use of binary representation while assembly
language uses symbolic representation. In fact, assembly language statements are symbolic of
individual machine codes, while ensuring that they are more user friendly and
understandable. They are mainly used in writing programs for real-time applications.

Each line in an assembly language program includes four fields:


24

1) Label field.

2) Instruction, mnemonic or op-code field.

3) Operand field.

4) Comment field.

As an example, a typical program for two 16-bit numbers written in 8086 assembly language
is:

LABEL MNEMONIC OPERAND COMMENT


START MOV BX,2 Move 2 into BX
MOV DX,3 Move 3 into DX
ADD BX,DX Add up contents of
BX to DX
JMP START Jump to the
beginning of
programme.
TABLE 2.4: SHOWING COMMAND OPERATIONS USING 8086 ASSEMBLY
LANGUAGE

Programming in assembly language is more convenient than programming in machine


language, since each mnemonic describes the operation to be performed. Thus, with assembly
language, the programmer does not need to find the numerical op-codes from a table of the
instruction set, and programming efficiency is significantly improved. The assembly
language program is translated to binary form via a program called an “assembler”. The
assembler program reads each assembly instruction of a program as ACII characters and
translates them into the respective binary op-code forms. One advantage of the assembler is
address computation. Most programs employ addresses within the program as data storage or
as targets for jumps or calls. When programming in machine language, these addresses must
be calculated by hand. The assembler solves this problem by allowing the programmer to
assign a symbol to an address. The programmer may then reference that address elsewhere by
using the symbol. The assembler computes the actual address for the programmer and fills it
automatically.
25

Most assemblers use two (2) passes to assemble a written program. This means that they read
the input program text twice. The first pass is used to compute the addresses of all labels in
the program. In order to obtain the address of a label, it is necessary to know the total length
of all the binary code preceding that label. So, the first pass computes the addresses of all
labels and stores them for the next pass, which generates the actual binary code. Various
types of assemblers do exist, and they include: one-pass assembler, two-pass assembler,
macro assembler, cross assembler, resident assembler and meta-assembler [11].

2.15.1: THE FLOWCHART OF A TYPICAL ASSEMBLER

EDITOR PROGRAM

myfile.asm

ASSEMBLER PROGRAM

myfile.lst myfile.obj

other obj f

LINKER PROGRAM

my file.abs

OH PROGRAM

my file.hex

FIG. 2.6: FLOWCHART OF AN ASSEMBLER


26

Using the flowchart above, we describe the sequence observed by the assembler in carrying
out its functions. The programmer puts his code down on an editor program (e.g Microsoft’s
notepad or GUI) and saves it; an action which generates the “.asm” file (assembler file).
Then, the assembler takes the “.asm” file and generates “.lst” file (list file ) and “.obj” file
(object file). The linker program combines several objects file to generate “.abs” file
(absolute object file); while the “.lst” file is used for debugging by the programmer. In the
end, the “.abs” file is converted to binary form (machine code) using hexadecimal format by
an OH program and thus generates “.hex” file. It is the “.hex” file that is burnt into the
microcontroller which implements the instructions through a firmware[11].

2.15.2: ASSEMBLY LANGUAGE INSTRUCTION SETS

An instruction set of a specific microprocessor comprise instructions that it can execute. The
capabilities of a microprocessor are determined, largely, by the type of instructions it can
perform. Each microprocessor has a unique instruction set designed by its manufacturer to do
a specific task. These instructions include:

1) Data Processing Instructions: These operations perform actual data manipulations. The
instructions typically include: arithmetic/logic operations, increment/decrement and
rotate/shift operations. Typical arithmetic instructions include: ADD, SUBTRACT,
COMPARE, MULTIPLY, DIVIDE.

2) Instructions for Controlling Microprocessor Operations: These instructions typically


include those that set the reset specific flags and halt or stop the microprocessor.

3) Data Movement Instructions: They move data from a register to memory and vice versa,
between registers, and between a register and an I/O device.

4) Instructions Using Memory Addresses: These contain a memory address, which is used to
read a data word from memory into a microprocessor register or for writing data from a
register into a memory location. Many instructions under data processing and movement fall
into this category.

5) Conditional and Unconditional JUMPS: These instructions typically include one of the
following:
27

i) Unconditional JUMP, which always transfers the memory address specified in the
instruction into the program counter.

ii) Conditional JUMP, which transfers the address portion of the instruction into the program
counter based on the conditions set by one of the status flags in the flag register [11].

2.16: HIGH-LEVEL LANGUAGE

The efficiency of a programmer using assembly language, increases significantly compared


to machine language. However, the programmer needs to be familiar with the
microprocessor’s architecture and its instruction set. Further, the programmer has to provide
an op-code for each operation that the microprocessor has to carry out in order to execute a
program. However, the programmer might find it tedious to write all the steps required for a
large program, and to become a reasonably good assembly language programmer, one needs
to have a lot of experience. High-level language programs composed of English-language-
type statements rectify all these deficiencies of machine and assembly language
programming. The programmer does not need to be familiar with the internal microprocessor
structure or its instruction set. Also, each statement in a high-level language corresponds to a
number of assembly or machine language instructions. Quite a large number of high-level
languages are used nowadays e.g. C, C++, C#, JAVA, BASIC, VISUAL BASIC etc. Typical
microprocessors like the 8086 series, the MOTOROLA 68000 and others, can be
programmed using these high-level languages. A high-level language is a problem-oriented
language. The programmer does not have to know the details of the microprocessor
architecture and its instruction set. Basically, the programmer follows the rules of the
particular language being used to solve the problem at hand. A second advantage is that a
program written in a particular high-level language can be executed by two different
microcomputers, provided they both understand that language. Just like the assembly
language program, a high-level language requires a special program for converting the high-
level statements into object codes. This program can either be an interpreter or a compiler.
They are usually very large programs compared to assembler. An interpreter is a program that
executes a set of machine language in response to each high-level in order to carry out the
function, but it does not generate an object program. On the other hand, a compiler converts
each statement into a set of machine language instructions and also produces an object
program that is stored in memory [11].
28

2.17: CHOICE OF PROGRAMMING LANGUAGE

The choice of programming language for this project is two-part: assembly and high-level
languages. On the assembly part, the AT89S52 microcontroller (8051 series) was used as a
core program for designing the electronic voting machine (EVM) hardware. The assembler
used in this design is the M-IDE assembler. On the high-level language aspect, we used C#
programming language for:

- Database design[10].

- Serial port interface between PC and the EVM hardware.


29

CHAPTER THREE

SYSTEM DESIGN

TIMING CIRCUIT
EEPROM
VOTER
CARD

LCD DISPLAY
µc 1 µc 2 UNIT

BUZZER

SERIAL
PORT
VIN VERIFICATION UNIT CABLE
VIN INPUT KEYPAD
PARTY/CANDIDATE
CHOICE INPUT
KEYPAD
VOTING PANEL

PC (LAPTOP)

FIG. 3.1: BLOCK DIAGRAM OF THE ELECTRONIC VOTING MACHINE

The Electronic Voting Machine (EVM) is basically divided into two modules: VIN
verification unit and the voting panel as shown above.
30

 DOUBLE POWER SUPPLY SOURCE: This has a voltage rating of 5V and 12V
each. The 5V is used to power the microcontroller while the 12V is used to power
the relay.
 DISPLAY UNIT: To ensure user-machine visual interaction, the electronic voting
machine is designed with a provision for a liquid crystal display unit.
 INPUT UNIT: Two keypad units are provided to allow users to either make entries of
password which allows them to vote subsequently based on a successful verification
or to enter the party of choice in order to cast their votes.
 TIMING UNIT: This unit is responsible for allotting a specific time period to every
voter, to exercise his or her franchise. When the maximum time limit (5 minutes), of
a voter is exhausted the voting session is terminated and reset to start the whole
process afresh.
 VOTER CARD: An EEPROM voter card is also a part of the electronic voting
machine. Each card possesses three unique numbers for appropriate identification of
card by the EVM. These unique numbers are burnt into the EEPROM card via a
registration module which comprises: a microcontroller programmed to store or
registers numbers in the EEPROM card and an LCD display unit to indicate
successful completion of the card registration process.
 MICROCONTROLLER AND PC INTERFACE UNIT: The PC resident high-level
program is responsible for both registration of voters, result computation and
database linking. The interface between the PC and the hardware uses the serial mode
of transmission. Therefore, a serial port cable interfaces the voting machine with the
serial port of a computer system.
 BUZZER/ALARM: The buzzer or alarm device sounds is used to alert the election
office(s) when an electorate wants to commit a fraud.

3.1: SYSTEM DESIGN SPECIFICATIONS

3.1.1: POWER SUPPLY UNIT DESIGN

SPECIFICATION:

Maximum Supply Current = 300mA.

Input voltage = 220V.


31

Output voltages are 5V (DC) and 12V (DC).

FIG.3.2: DIAGRAM OF THE POWER SUPPLY UNIT OF THE EVM

The power supply for the EVM is designed to supply both 12V and 5V simultaneously. Two
regulators were used to avoid the design of two separate power supply units (PSUs). When
the PSU is plug in an ac supply, the transformer will step down the main grid supply to a
level appropriate for rectification [9].

The fuse is incorporated as a safety measure in case of surging current flow into the system.
The bridge rectifier is used to rectify the ac to dc, since the EVM system needs dc to be
powered. Two regulators were used to provide 12V and 5V dc supply respectively. The
capacitors are for filtering since the output of the rectifier still contains ripples.

3.1.2: PC SERIAL PORT INTERFACE CIRCUIT

SPECIFICATION:

- Data Bus: 8

- Baud rate: 9600


32

-Flow control: none

- Stop/Start bit: one

- Serial mode: one

- Asynchronous mode of data transmission

- Half duplex transmission

DESIGN:

The 8051 microcontroller has a universal asynchronous receiver/transmitter (UART) that


operates with the TTL signal level. This in-built UART enables the 89S52 (otherwise known
as the 8051 µC) to transmit and receive data serially through pin 10 and 11 respectively. The
only problem is that PC serial ports operates with RS232 signal level (the TTL and RS 232
are not compatible).

Hence, we made a requirement to introduce a converter or Line Driver. The driver IC


performs the function of converting TTL level to RS 232 signal level and vice versa [8].
FIG.3.3 shows the interconnection between the line driver and the 8051µC and the PC serial
port; also, FIG.3.4 shows the internal structure of the line driver and its TTL and RS232
connections.

TTL SIDE RS232 SIDE


8051

P3.0 LINE DRIVER PC SERIAL

P3.1 PORT

FIG.3.3 PC SERIAL PORT INTERFACE MODULE


33

FIG 3.4 LINE DRIVER (CONVERTER)

3.1.3: KEYPAD INTERFACE CIRCUIT DESIGN

SPECIFICATION:

 4 × 4 keypad

The system makes use of two keypad interfaces. One of the keypads is used for voters
identification number (VIN) section of the EVM and the other keypad used for the party
choice section.
34

FIG. 3.5 KEYPAD INTERFACE CIRCUIT

The keypad shown in FIG.3.5 was interfaced to the microcontroller using a pull up resistor.
The pull up resistor limits the current sink by the 89S52 microcontroller. The microcontroller
usually reads the input port to which the keypads are connected. This is done to identify when
a key press occurs. If the pull resistors are not employed, excessive current would be sank by
the port of the microcontroller. The excessive current is contributed by both the external Vcc
and the internal loads of the port of 89S52 microcontroller. Thus, without the pull up
resistors, the ports will get damaged when a read is attempted by the microcontroller [8].

3.1.4: TIMING CIRCUIT

A timing circuit is designed with the following specifications:

 Five (5) minutes delay


 5V operating voltage
 NE555 astable mode of operation.
35

3.1.5: BUZZER INTERFACE CIRCUIT DESIGN

Vcc

RB
8051 P1.7
RE
BUZZER

FIG.3.6: BUZZER INTERFACE CIRCUIT

The alarm or buzzer is interfaced to the 8051 as shown in the circuit above. P1.7 is a port pin
of the 8051 and is set through software to trigger the buzzer ON when necessary.

An NPN transistor functioning as a switch directly switches on the buzzer. This is because
the output current of the 8051 pin cannot effectively drive the buzzer. RB limits the base
current to the value required to switch the transistor. The output voltage is taken across the
resistor RE and so, the load (buzzer) is connected across RE [8].

3.1.6: EEPROM CARD INTERFACE CIRCUIT DESIGN

SPECIFICATION:

 Card Slot Detection Capability.


 Minimum Read/Write Time Delay.
 Serial Transmission Mode.
36

VCC PIN CONTACT

8051µC

GROUND
2
P3.0 SERIAL CLOCK
P3.1 3
SERIAL DATA
P3.2 4
CARD DETECTION
EEPROM CARD

GROUND PIN CONTACT

FIG.3.7 EEPROM CARD INTERFACE MODULE

The EEPROM card interface is designed with 5 contact points: VCC , ground, serial clock,
serial data and card detection pins.

The VCC and ground contacts (or terminals) enable the EEPROM to connect to a power
source. The serial clock (SCL) contact connects to the microcontroller pin which clocks the
EEPROM during data write/read. Data is read from or written to the EEPROM card through
the serial data contact (SDC).

The last contact of the card is the card detection point. Once a card is slotted into the
machine, the 8051 µC reads the contact to detect a card slot event. Therefore, the
microcontroller polls the particular contact [8].

3.2: SYSTEM OPERATION DESCRIPTION

During the process of voters’ registration, the personal information or bio data of each voter
is stored in a database program resident in the PC device. The EEPROM voter card
registration module writes to the EEPROM memory, three groups of numbers:

(1) Valid Card Identification Number: The essence of this unique number is to enable the
voting machine to identify voters with valid voters’ cards. The voting machine allows for a
37

maximum of three attempts to vote, after which the card is rendered invalid. The case of
“invalid cards” occurs when voters fail to key in the correct Voter Identification Number
(VIN) after three successive trials. The EVM acts in this fashion so as to ensure that the
rightful owner of the voter card votes accordingly and does not use the card of another voter.
Thus, the valid card identification number is the first number checked by the EVM to
determine if the voter card has been used for three unsuccessful vote trials.

(2) Double Voting Identifier (DVI): This second number enables the EVM to identify
voters that have voted before in a particular election process.

On the successful completion of a voting process, the EVM via a microcontroller writes a
new number known as the “double vote identifier” into the EEPROM memory of the voter’s
card. This new number (now stored in the card) is detected when a voter attempts to vote
more than once (double/multiple voting). An immediate detection of the DVI triggers on the
buzzer or alarm device to sound whereby informing the electoral officer or officers of a
security breach or illegal entry to the system.

(3) Voter Identification Number (VIN): The VIN is generated by the PC database program
during voter’s registration. The number is programmed into the voter’s card using the
EEPROM voter card registration module. The VIN of voter A is totally different from that of
voter B, hence the VIN is used to verify the authenticity of the voters as they cast their votes
on the election day.

3.2.1: DETAILED EXPLANATION OF THE INTERACTION BETWEEN THE


VOTERS' INDENTIFICATION NUMBER VERIFICATION UNIT AND THE
VOTING PANEL

As shown in the block model of the EVM system in the Appendix A, there are two 8051
microcontrollers. Both co-ordinate and monitor the entire voting process performed by the
EVM. The first microcontroller (µC 1) continuously polls the EEPROM card slot to detect or
sense when an EEPROM card is plugged into the EVM. On detecting an EEPROM card, the
first microcontroller starts the timing circuit: which apportions time to each voter. Then, the
whole process of checking all three numbers in the voter card as earlier described starts off,
and in the case of any misnomer detected, the buzzer or alarm device is triggered on.

In addition to validity checks on the voter card as well as multiple votes check, the first
microcontroller makes requests for and receives the VIN inputs from voters for verification.
38

During verification, it compares the VIN input against the one read from the voter card. Any
mismatch after three trial limits indicates a stolen or misplaced card. After exhausting the
trial attempts allotted, the first microcontroller triggers on the buzzer to sound as alert. This
microcontroller also displays the values entered (via the LCD display unit) during
verification.

On successful verification of VIN input, the first microcontroller enables the voting panel to
perform its function. The voting panel is responsible for sending the choice of candidates by
voters to the PC program. The panel is synchronized with the VIN verification unit. The
voting panel receives choice of voters and waits for the verification unit to issue it with a
command to send the choice made to PC. During this brief wait period, the verification unit
on receiving the input signal indicates the voter has made a choice, checks to see that the
voter card is still plugged on to the machine. It then rewrites the double voting identifier
(DVI) into the card’s memory, to enable it detect future attempts to vote more than once. By
completing the above writing, the process, the voting panel is informed of the completion via
a command indicating that it is right time to send the voter’s choice to the PC program. In the
case where the card is removed before the verification unit completes its double voting re-
writing procedure, the voting panel issues a command signalling the voting panel to discard
the choice.
39

3.3: FLOWCHART FOR THE VIN VERIFICATION UNIT

START

INSERT THE EEPROM


CARD INTO THE CARD
LCD DISPLAYS “INVALID
SLOT
CARD” AND TELLS THE
USER TO “REMOVE CARD”

µC 1 CHECKS NO
FOR CARD
VALIDITY

YES

µC 1 CHECKS µC 1 READS THE DVI


CARD FOR NO AND STORES IN ITS
DOUBLE MEMORY
VOTING

YES

BUZZER COMES ON.


LCD DISPLAYS
“REMOVE CARD”

1
40

REQUEST AND RECEIVE VIN ENTRY FROM VOTER


FOR COMPARISON

COMPARE VIN ENTRY FROM VOTER WITH VIN


READ FROM VOTER CARD

CHECK IF THE LCD


NO
TWO VINs DISPLAYS
MATCH “INVALID”

YES

µC 2 IS ENABLED

FIG. 3.8.1: FLOW CHART FOR THE VIN VERIFICATION UNIT


41

3.4: FLOWCHART FOR THE VOTING PANEL:

REQUEST AND RECEIVE


VOTER’S PARTY CHOICE

LCD DISPLAYS THE


PARTY CHOSEN AND
REQUEST FOR VOTES

RESULT IS SENT TO PC VIA


SERIAL PORT

DISPLAY PARTY VOTED


FOR AND ASK USER TO
REMOVE THE CARD

STOP

3.8.2: FLOW CHART FOR THE VOTING PANEL


42

3.5: SOFTWARE DESIGN AND DEVELOPMENT

3.5.1: FLOW CHART OF THE EVM GRAPHIC USER INTERFACE (GUI)

START

ADMIN LOGIN
PAGE

ENTER
USERNAME
PASSWORD? NO

YES

VOTER
PANEL

STOP

FIG. 3.8.3: FLOW CHART FOR THE EVM GUI


43

The flow chart above describes the EVM interface containing a central database. The EVM
software was realised using the following software packages:

1) C#.
2) My SQL.
3) Visual Studio 2010.

All three packages were thoroughly combined in designing the EVM database and user
interface[10].

3.5.2: DATABASE DESIGN

The database forms the pivot of the EVM software. The following are built-in tables in the
database.

TABLE NAME TABLE DESCRIPTION


ADMIN PANEL This table contains the following fields: new
manager, new party choice and new voter
choice.
MANAGER PANEL This table contains the following fields: new
candidate choice, new voter choice, party ID,
username and password.
REGISTER CANDIDATE This table contains the following fields: party
selection, candidate’s first name, middle
name and surname, political position and the
candidate’s picture.
REGISTER MANAGER This table contains the fields: parties and
party ID.
REGISTER PARTY This table contains the following fields:
party’s name, party’s logo and slogan.
REGISTER VOTER This table contains the following fields: first
name, middle name, surname, state of origin,
local government area, date of birth,
username, password and image capture.
RESULTS This table contains election results as well as
descriptive charts corresponding to the
results obtained.
VOTE NEW This table contains the field: Vote New.
LOGIN This table contains the following fields:
username and password.
TABLE 3.1: SKETCH OF THE DATABASE TABLES
44

CHAPTER FOUR

IMPLEMENTATION, TESTING AND RESULTS

4.1: SIMULATION AND IMPLEMENTATION

4.1.1: SIMULATION

The simulation tool used for analysing the EVM circuitry design before actual
implementation was a computer aided design tool known as Proteus 7 (as well as on a
breadboard). The assembly language software used in designing the EVM hardware was
MIDE, which is highly compatible with Proteus 7. The EVM source code used in the
simulation is shown in Appendix B.

4.1.2: IMPLEMENTATION

A prototype of the EVM was designed and fabricated on a Vero board. After implementing
the design, several tests were performed to ensure its efficient operation.

Modules by module implementation of the EVM are outlined as follows:

1) EEPROM CARD INTERFACE CIRCUIT:

The EEPROM memory adopted as the voter card is the AT24C08 from ATMEL. This
memory is an 8Kbits memory. The preference for this memory is based on its relatively fast
access speed whereby the latency involved in accessing the memory is relatively small. Such
a memory was the ideal chosen for the implementation of our project work considering the
fact that we needed to reduce the amount of time spent by each voter. The AT24C08 is also a
serial access based memory. This means that it uses only two pins for storage and retrieval of
data from the EEPROM. These pins are called serial data pins-pin 7 and serial clock, pin 6.
Unlike various memory types which could be 8-bit based parallel transmission. This memory
type IC enables us to greatly reduce the number of slots when card is inserted during the
voting process.

The figure shown below illustrates how the EEPROM circuit is interfaced with the
microcontroller (89S52) via pin 3.0, 3.1 & 3.2. Pin 3.2 of the microcontroller is used to detect
the presence of the card whenever it is inserted. This is designed with five projections. These
projections enable the EEPROM memory to make contact with Vcc and ground in order to
power the EEPROM. From the remaining three projections, two are used for accessing the
45

EEPROM storage thus reading from and writing to the EEPROM voter’s card. These
projections are the serial data and serial clock: SDA and SCL respectively [8]. The fifth
projection is connected to the ground and is meant to contact pin 3.2 of the microcontroller as
shown in FIG.4.0.

The microcontroller continually toggles pin 3.2 to detect the presence of a card insertion.
Once a card is inserted into the slot and the fifth projection makes contact with pin 3.2 of the
microcontroller (as shown below), then card insertion has occurred.

FIG.4.1 EEPROM VOTER CARD INTERFACE IMPLEMENTATION

2) LIQUID CRYSTAL DISPLAY UNIT

The display type employed in the project is the Liquid Crystal Display (LCD) .The exact
LCD used is the RTI602C 16x2 characters. The LCD was adopted instead of seven segment
display because of the multiplicity of characters to be displayed. Port 0 of the microcontroller
was used for sending data to the data pins of the LCD i.e. DB0 – DB7.

Because port 0 of the microcontroller has no internal pull up resistor unlike port 2 and 3,
10kΩ resistors were used to pull up the port before the LCD was connected. The pins of
microcontroller has open drain transistors such that if no pull resistor were attached to port
0,the drain will float when the transistor is switched ON. The 10kΩ resistor used as pull up
resistor in the design is specified by the manufacturer’s datasheet [8].
46

The LCD can only display ASCII characters that it receives at the input data pins. So, a
minimum of 7bits is enough to represent each ASCII character. In a nutshell, we eventually
used only 7 pins of the data input of the LCD. The eighth data input pin was configured as a
busy flag. This data input pin DB7 was connected to port pin 3.7 of the microcontroller to
enable it to check when the LCD is busy. This is done before sending data to the LCD so as
to avoid losing the data sent to the LCD.

The control pin of the LCD: EH, RS and RW were connected to the port pins 2.0, 2.1 and 2.2
respectively. This was done to ensure that the microcontroller issue control command to the
LCD.

FIG.4.2 LIQUID CRYSTAL DISPLAY UNIT


47

FIG.4.3 LCD INTERFACE CIRCUIT

3) BUZZER MICROCONTROLLER INTERFACE

The circuit for interfacing the microcontroller to the buzzer is shown below. The essence of
the buzzer is to draw attention when fraud or double voting is attempted. The transistor used
in the above design is C828 general purpose transistor [9]. Since most general transistors
have a minimum dc gain of 20, this gain was used for determining the bias resistors as shown
in FIG.4.2.

The resistor attached to the emitter is 10Ω and it requires saturation current, which can be
expressed as IC = IE = (VCC–VBE ) / RE

VBE =0.7V for a transistor operating in saturation region.

Ic = (8- 0.7) / 104 = 7.3/104 =0.73mA

But IC/IB = β

Since we assumed a minimum dc gain of 20, then:

Ic/IB = 20
48

= 0.73mA/IB = 20

IB = 0.73mA/20 =36.5µA

The output of a pin the microcontroller is guaranteed to be 4.0V and a maximum of 5V.

Therefore, the transistor base resistor value can be calculated as RB =VB /IB

= 4/36.5µA = 109.5KΩ

Thus, 109kΩ will ensure that the transistor is saturated when operated as a switch as shown
in the circuit below. 1kΩ was used instead of the calculated value of 109kΩ because 1kΩ will
ensure that the transistor operates at saturated region of the minimum dc gain (which was
assumed to be 20).

FIG.4.4 BUZZER INTERFACE CIRCUIT


49

4) POWER SUPPLY UNIT IMPLEMENTATION

Specifications:

 Fuse Rating is 0.5A.

 Transformer Rating = 220V/12V/300mA/50Hz.

 Capacitors, C1 = 2200µf/25V; C2, C3, C4 = 100pf

 Regulator 1 = 7812

 Regulator 2 = 7805

The power supply makes use of two regulators 7812 and 7805 respectively, in which the
7812 supplies approximately 12V, while 7805 gives an output voltage of approximately 5V.
A 0.5A fuse was used to prevent the draining of excess current from the power supply, which
could damage the system. The capacitors: C1, C2, C3 serve as filters to eliminate ripples from
the rectified outputs [9].

FIG.4.5 POWER SUPPLY UNIT


50

5) PC SERIAL INTERFACE CIRCUIT SPECIFICATION

The serial port of PC operates with the old RS232 voltage levels. This means those modern
integrated circuits that operate with TTL are not compatible with the serial port.

The 8051 microcontroller is a TTL IC. Therefore, to interface a PC serial port with a
microcontroller requires a line driver (voltage driver) to convert the RS232 signals to TTL
voltage levels that will be acceptable to the 8051 TXD and RXD pins i.e. the data transmit
and data receive pins respectively. Several converters can also be used for the purpose of
conversion. However, in our design we specifically chose the MAX 232 manufactured by
Maxim Corp. The MAX232 converts from RS232 voltage levels to TTL voltage levels and
vice versa. One advantage of MAX232 chip is that it uses a +5V power source which is
equivalent to the source voltage of the 8051. Therefore a single 5V power supply can serve
the requirements of the 8051 and MAX232. This eliminates the need for the dual power
supplies as used by older systems [8].

FIG.4.6 LINE DRIVER (CONVERTER)


51

4.2: TESTING AND RESULTS

The project was tested for functionality after implementation. The following tests were
conducted to ensure maximum workability of the electronic voting machine (EVM):

1) POWER PLAN TEST:

The EVM was test run to check for its normal power rating. The mains voltage supplied to
the machine is 220V to 240V with an internal running voltage of 12V.

The following tables describe test procedures carried out on the EVM set up and their
corresponding outcomes in an effort to confirm its full operating capacity:

A) TESTS PERFORMED ON THE VIN VERIFICATION UNIT: These tests were


performed with the EEPROM voter card inserted into the EVM.

TEST PROCEDURES OUTCOMES


1) When the voter keys in a secret VIN that is The LCD displays ‘’WRONG VIN’’.
less than 6-digits.
2) When the voter keys in a secret VIN that is The LCD displays ‘’WRONG VIN’’.
greater than 6-digits and presses the ENTER
key.
3) When the voter keys in a 6-digit number The LCD displays ‘’WRONG VIN’’. The
that is not equal to the VIN burnt on the screen is cleared, thus giving the voter 2
EEPROM card on first trial. more chances of keying in the correct VIN.
4) After 3 trials, if the voter still keys in the The card is rendered invalid and cannot be
incorrect VIN. used further. The LCD displays ‘’REMOVE
THE CARD’’.
5) When the voter keys in the correct VIN. The LCD displays ‘’ENTER PARTY’’, thus
enabling the voter to cast his/her vote.
6) When the voter does not key in his/her The verification procedure will start afresh
secret VIN after 5mins. again.
7) When the VIN verification unit checks for If the card is valid, no error message is
validity of the inserted EEPROM voter card. displayed on the LCD screen; and if the card
is invalid the LCD displays ‘’INVALID’’.
TABLE 4.1: TESTS PERFORMED ON THE VIN VERIFICATION UNIT
52

B) TESTS PERFORMED ON THE VOTING PANEL: The voting panel becomes enabled
when the verification exercise on the VIN verification unit is successful.

TEST PROCEDURES OUTCOMES


1) When the voter keys in the wrong party The LCD screen is cleared, and the voter is
choice before pressing the ENTER key, and allowed again to key in his right party choice.
the CLEAR key is pressed.
2) When the voter removes the card The vote is discarded and the voting panel is
immediately after pressing the ‘’ENTER’’ automatically shut down.
key.
3) If the voter attempts to vote more than The buzzer is triggered on to show illegal
once. entry.
4) If the voter presses more than one party The LCD displays no choice.
choice simultaneously.
TABLE 4.2: TESTS PERFORMED ON THE VOTING PANEL

C) DATABASE/GUI TESTING: Due to the absence of specialized tools for database


testing, we employed visual inspection as a means of measuring the performance of the
database built for the EVM. Based on the observations made, the database proved reliable
with less error during testing. The codes for the database/ graphic user interface (GUI) design
is shown in appendix C. Sample diagrams of the database designed are shown below:

i) Candidate Database:

TABLE 4.3: CANDIDATES DATABASE


53

ii) Parties Database:

TABLE 4.4: PARTIES DATABASE

iii) Election Posts Database:

TABLE 4.5: ELECTION POSTS DATABASE

iv) Election Managers Database:

TABLE 4.6: ELECTION MANAGERS DATABASE


54

v) Voters Database:

TABLE 4.7: VOTERS DATABASE

vi) Recorded Votes Database:

TABLE 4.8: RECORDED VOTES DATABASE

D) GRAPHIC USER INTERFACE (GUI) TESTING:

The GUI worked well when tested for functionality. The following are samples of the GUIs
designed under the software aspect of this project:

i) Voter Registration Form:


55

FIG. 4.7: VOTERS REGISTRATION FORM

ii) Candidate Registration Form:

FIG. 4.8: CANDIDATES REGISTRATION FORM


56

iii) Admin Login Page:

FIG. 4.9: ADMIN LOGIN FORM

E) LINES OF CODE (LOC) CHECK:

The lines of codes for the assembly language build up of the EVM hardware, serial port
configuration and database design were individually analysed and thoroughly checked for
errors (via visual inspection). After each check, the right corrections were made to boost
maximum performance of the lines of code so that they carry out their functions adequately.
57

CHAPTER FIVE

COST ANALYSIS, CONCLUSION AND RECOMMENDATION

5.1: COST ANALYSIS

The list below shows the cost analysis for the design:

S/N. ITEMS/COMPONENTS PIECE AMOUNT


(NAIRA)

1) LCD 2 2,000

2) 30pF Capacitor 5 100

3) 100µFx16V Capacitor 1 70

4) 10KΩ Resistors 24 120

5) 1KΩ Resistor 3 15

6) 10KΩ Variable 1 20
Resistor

7) C828 Transistor 3 30

8) Diode IN4007 2 20

9) Transformer 1 400

10) 16 pin IC Socket ` 1 20

11) 40 pin IC Socket 2 100

12) Buzzer 2 200

13) 12MHz Crystal 2 120

14) Battery Cap 1 30

15) 7805 Regulator 1 50

16) Serial Port Cable 1 1,000

17) Vero board 1 100

18) Microcontroller 2 600


(AT89S52)

19) Keypad 2 800

20) Flexible Connection 2 yards 60


Wires
58

21) Power Buttons 2 80

22) DC Relay (6V) 2 160

23) Digital Camera 1 3,500

24) Packaging 1 5,000

TOTAL N 14,595.00

TABLE 5.1: COST ANALYSIS TABLE

From the above analysis, the EVM design is highly cost effective and could be sponsored by
government on a large scale basis for the conduct of the general elections.

5.2: CONCLUSION

This project is aimed at boosting the efficiency, credibility and reliability of elections
conducted in our democratic setting. The benefits derived from employing this method of
voting are enormous and, would go a long way in reflecting the people’s true choice in the
selection of their leaders as well as fast track development strides especially in Nigeria’s
political terrain.

5.3: RECOMMENDATION

Based on the challenges we encountered in the course of our work, we recommend that more
research be carried out in order to improve the EVM design. There are some lapses, which we
would like similar designs to tackle, such as interfacing of the EVM with printer to get the
hard copy of the result almost instantly from the database.

Also, our design is not waterproofed. We therefore recommend that for future work on the
EVM, materials used in the packaging should be relatively unaffected by environmental
conditions such as temperature variations, the ingress of water, pests or rodents attack etc.

Furthermore, we recommend that a more practical, networking approach be considered in the


design of the EVM database so as to enable individual EVMs in each polling booth send
results or data directly to the main INEC offices for backup and to avoid fraud. As well, the
59

EVM database could be built to have the functionality of being able to match voters’ pictures
in the database.

This project is only a prototype which needs more features and enhancement to make the
system more robust, and these features could include:

1) A Printer that can give print outs of votes recorded as means of physical verification.

2) Independent standard Verification/ testing tool can be developed and be made


available to all political parties/ candidates. It can use code signatures to ensure
software is identical on all EVMs.

3) Use of Open-source software and transparent hardware system.

Finally, we recommend the use of biometric for fingerprint identification of the electorate
especially in the case of identical twins where pictures could be misleading. Finger prints are
unique for every individual and so is highly recommended for further research work in the
design of the EVM.
60

REFERENCES

[1] “Democracy”. Washington DC: Microsoft Encarta, 2008-2009.

[2] Arthur M. Keller, David Mertz et al. Privacy Issues In An Electronic Voting Machine.
UC Berkley (USA), 2005.

[3] Dill, D.L. Electronic Voting: An Overview of The Problem. Retrieved November

1, 2006 from http://www.verifiedvotingfoundation.org/article.php?id=5731. (2005).

[4] Jones, D. W. A Brief Illustrated History of Voting. Retrieved September, 23, 2005

from http://www.cs.uiowa.edu/~jones/voting/pictures/#ballota. (2003).

[5] Hernson, P.S. et al. Characteristics of Contemporary Voting Machines. Retrieved

February 12, 2007 from www.capc.umd.edu/rpts/md_evote_ContempVotingMach.pdf.(2004).

[6] Chris.B, Fred.C and Hassan.P. 8051 Microcontroller: An Application-Based Introduction.

Linacre House, Jordan Hill, Oxford OX2 8DP, 200 Wheeler Road, Burlington, MA
01803, 2004.

[7] Kenneth J.Ayala,The 8051 Microcontroller: Architecture, Programming and Application.

Western Publishing Company,1991. Beginning Visual Cⱡⱡ 2010.Wiley Publishing, Inc, 2010.

[8] Muhammad, A.M and Janice, G.M, The 8051 Microcontroller and Embedded Systems:
Using Assembly and C .Prentice Hall. 2004.

[9] Paul Scherz, Practical Electronics for Inventors. McGraw-Hill, New York, 2000.

[10] Ullman, L. Php and Mysql for Dynamic Web Design (first Edition).London: Peach Pit
Press. 2003.
[11] M. Rafiquzzaman. Fundamentals of Digital Logic And Microcomputer Design. John
Wiley And Sons, Inc.: New Jersey. 2005.
61

APPENDIX A

SCHEMATIC HARDWARE CIRCUIT DIAGRAM OF THE EVM


62

APPENDIX B

ASSEMBLY LANGUAGE SOURCE CODE

;;;;;;;;;;;
ELECTRONIC VOTING MACHINE

MOV A,#38H

ACALL COMMAND

MOV A,#0EH

ACALL COMMAND

MOV A,#01H

ACALL COMMAND

MOV A,#06H

ACALL COMMAND

MOV A,#02H

ACALL COMMAND

SETB P3.3

SETB P3.5

SETB P3.2

ACALL KEYBOARD

ACALL HASVOTED ; clear p3.3 to inform the second microcontroller that voter has made
choice

WAIT_FOR_NEXT__COMMAND :JB P3.5,WAIT_FOR_NEXT__COMMAND ;wait for


the vin unit to issue go ahead order before sending party choice to pc

MOV A,R3

ACALL SEND_VOTE ;send party id to pc


63

ACALL HASSENTVOTE

HERE2:SJMP HERE2

SEND_VOTE:

ACALL DELAY

MOV TMOD,#20H

MOV TH1,#-3

MOV SCON,#50H

SETB TR1

MOV SBUF,A

HERE: JNB TI ,HERE

CLR TI

HERE1:SJMP HERE1

RET

HASSENTVOTE:

CLR P3.2

RET

HASVOTED:CLR P3.3

RET

CLEAR: MOV A,#01H

ACALL COMMAND

MOV A,#02H

ACALL COMMAND

RET
64

DISPLAY: ACALL READY

MOV P0,A

SETB P1.0

CLR P1.1

SETB P1.2

CLR P1.2

RET

READY: SETB P0.7

CLR P1.0

SETB P1.1

BACK: CLR P1.2

SETB P1.2

JB P0.7,BACK

RET

KEYBOARD:

SETB P2.0

SETB P2.1

SETB P2.2

SETB P2.3

K1:CLR P2.4

CLR P2.5

CLR P2.6

CLR P2.7
65

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,K1

K2:ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,OVER

SJMP K2

OVER: ACALL DELAY

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,OVER1

SJMP K2

OVER1:CLR P2.4
66

SETB P2.5

SETB P2.6

SETB P2.7

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,ROW0

SETB P2.4

CLR P2.5

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,ROW1

SETB P2.5

CLR P2.6

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,ROW2

SETB P2.6

CLR P2.7

ACALL ACCUMULATO

ANL A,#00001111B

CJNE A,#00001111B,ROW3

LJMP K2

ROW0:MOV DPTR,#KCODE0
67

SJMP FIND

ROW1:MOV DPTR,#KCODE1

SJMP FIND

ROW2:MOV DPTR,#KCODE2

SJMP FIND

ROW3:MOV DPTR,#KCODE3

SJMP FIND

FIND: RRC A

JNC MATCH

INC DPTR

SJMP FIND

MATCH:ACALL CLEAR

CLR A

MOVC A,@A+DPTR

CJNE A,#13,NOT_ENTER;CHECK IF ENTER KEY HAS BEEN PRESSED

LJMP RETURN

NOT_ENTER: CJNE A,#14,CONTINUE;check if user has pressed clear key

ACALL CLEAR

LJMP K1

CONTINUE:CJNE A,#0,LOADANPP

MOV DPTR,#PDP

CLR A

ACALL PARTY_DISPLAY
68

LJMP K1

LOADANPP:CJNE A,#1,LOADAPGA

MOV DPTR,#ANPP

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADAPGA:CJNE A,#2,LOAD_ACN

MOV DPTR,#APGA

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOAD_ACN:CJNE A,#3,LOAD_AD

MOV DPTR,#ACN

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOAD_AD:CJNE A,#4,LOAD_UPGA

MOV DPTR,#AD

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOAD_UPGA:CJNE A,#5,LOADCPC

MOV DPTR,#UPGA
69

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADCPC:CJNE A,#6,LOADLP

MOV DPTR,#CPC

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADLP:CJNE A,#7,LOADLPP

MOV DPTR,#LP

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADLPP:CJNE A,#8,LOADDPP

MOV DPTR,#LPP

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADDPP:CJNE A,#9,LOADRSS

MOV DPTR,#DPP

CLR A

ACALL PARTY_DISPLAY

LJMP K1
70

LOADRSS:CJNE A,#10,LOADCPA

MOV DPTR,#RSS

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADCPA:CJNE A,#11,LOADCCC

MOV DPTR,#CPA

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADCCC:CJNE A,#12,LOADDNP

MOV DPTR,#CCC

CLR A

ACALL PARTY_DISPLAY

LJMP K1

LOADDNP:CJNE A,#15,GETBACK_TOK1

MOV DPTR,#DNP

CLR A

ACALL PARTY_DISPLAY

GETBACK_TOK1:LJMP K1

RETURN:RET

PARTY_DISPLAY:MOVC A,@A+DPTR

JZ EXIT
71

ACALL SAVE_PARTY

ACALL DISPLAY

INC DPTR

CLR A

SJMP PARTY_DISPLAY

CLR A

EXIT:RET

ACCUMULATO:

JNB P2.0,AC4

SETB ACC.0

SJMP E

AC4:CLR ACC.0

E:JNB P2.1,AC5

SETB ACC.1

SJMP F

AC5:CLR ACC.1

F: JNB P2.2,AC6

SETB ACC.2

SJMP G

AC6:CLR ACC.2

G:JNB P2.3,AC7

SETB ACC.3

SJMP H
72

AC7:CLR ACC.3

H: RET

COMMAND: ACALL READY

MOV P0,A

CLR P1.0

CLR P1.1

SETB P1.2

CLR P1.2

RET

DELAY:NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP

NOP
73

NOP

RET

SAVE_PARTY:JZ RETURN_TOCALLER

MOV R3,A

RETURN_TOCALLER:RET

ORG 300H

KCODE0: DB 3,2,1,0

KCODE1: DB 7,6,5,4

KCODE2: DB 11,10,9,8

KCODE3: DB 15,14,13,12

ORG 500H

PDP: DB "PDP",2,0

ANPP: DB "ANPP",3,0

APGA: DB "APGA",4,0

AD: DB "ACN",5,0

ACN: DB "AD",0

UPGA: DB "UPGA",0

CPC: DB "CPC",0

LP: DB "LP",0

LPP: DB "LPP",0

DPP: DB "DPP",0

RSS: DB "RSS",0

CPA: DB "CPA",0
74

CCC: DB "CCC",0

DNP: DB "DNP",0

PPA: DB "PPA",0

UNDP: DB "UNDP",0

END
75

APPENDIX C

GUI CODE

<?xml version="1.0" encoding="utf-8"?>


<Project ToolsVersion="4.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DA757B9C-AA1B-4725-A53A-3714635ED56F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ElectionManager</RootNamespace>
<AssemblyName>ElectionManager</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MySql.Data, Version=6.5.4.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files\MySQL\MySQL Connector Net
6.5.4\Assemblies\v4.0\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="MySql.Data.Entity, Version=6.5.4.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\Program Files\MySQL\MySQL Connector Net
6.5.4\Assemblies\v4.0\MySql.Data.Entity.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
76

<Reference Include="Microsoft.CSharp" />


<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WebCam_Capture">
<HintPath>..\..\..\..\..\..\..\Robosys\Barcode\Video_Voice_Conferencing\Peer-to-
peer Conference System\bin\Debug\WebCam_Capture.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="About.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="About.Designer.cs">
<DependentUpon>About.cs</DependentUpon>
</Compile>
<Compile Include="RegisterMgr.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RegisterMgr.Designer.cs">
<DependentUpon>RegisterMgr.cs</DependentUpon>
</Compile>
<Compile Include="Login.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Login.Designer.cs">
<DependentUpon>Login.cs</DependentUpon>
</Compile>
<Compile Include="AdminPanel.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AdminPanel.Designer.cs">
<DependentUpon>AdminPanel.cs</DependentUpon>
</Compile>
<Compile Include="Globals.cs" />
<Compile Include="MgrPanel.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MgrPanel.Designer.cs">
<DependentUpon>MgrPanel.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RegisterVoter.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RegisterVoter.Designer.cs">
<DependentUpon>RegisterVoter.cs</DependentUpon>
</Compile>
<Compile Include="RegisterCandidate.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RegisterCandidate.Designer.cs">
<DependentUpon>RegisterCandidate.cs</DependentUpon>
</Compile>
<Compile Include="RegisterParty.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RegisterParty.Designer.cs">
<DependentUpon>RegisterParty.cs</DependentUpon>
77

</Compile>
<Compile Include="Results.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Results.Designer.cs">
<DependentUpon>Results.cs</DependentUpon>
</Compile>
<Compile Include="SpecialButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Splash.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Splash.designer.cs">
<DependentUpon>Splash.cs</DependentUpon>
</Compile>
<Compile Include="ViewItems.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ViewItems.Designer.cs">
<DependentUpon>ViewItems.cs</DependentUpon>
</Compile>
<Compile Include="VistaApi.cs" />
<Compile Include="Vote.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Vote.Designer.cs">
<DependentUpon>Vote.cs</DependentUpon>
</Compile>
<Compile Include="VoteNew.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="VoteNew.Designer.cs">
<DependentUpon>VoteNew.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="About.resx">
<DependentUpon>About.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RegisterMgr.resx">
<DependentUpon>RegisterMgr.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Login.resx">
<DependentUpon>Login.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="AdminPanel.resx">
<DependentUpon>AdminPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MgrPanel.resx">
<DependentUpon>MgrPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="RegisterVoter.resx">
<DependentUpon>RegisterVoter.cs</DependentUpon>
78

</EmbeddedResource>
<EmbeddedResource Include="RegisterCandidate.resx">
<DependentUpon>RegisterCandidate.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RegisterParty.resx">
<DependentUpon>RegisterParty.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Results.resx">
<DependentUpon>Results.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Splash.resx">
<DependentUpon>Splash.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ViewItems.resx">
<DependentUpon>ViewItems.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Vote.resx">
<DependentUpon>Vote.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="VoteNew.resx">
<DependentUpon>VoteNew.cs</DependentUpon>
</EmbeddedResource>
<None Include="Helpers.cd" />
<None Include="RegistrationClasses.cd" />
<None Include="MainClasses.cd" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Skeleton.cd" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Tips.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\camera.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\camera2.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\send.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\upload.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Login Manager.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Monsieur_Security_v2_2.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\BRIGHTS PRINTER.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\office22.png" />
79

</ItemGroup>
<ItemGroup>
<None Include="Resources\print item.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\add_user.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\agent.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\close folder.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\iCandy_Junior 057.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\iCandy_Junior 024.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\iCandy_Junior 015.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\iCandy_Junior 001.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\iCandy_Junior 067.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\iCandy_Junior 023.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\viewmag.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Drop Box.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\elicn.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\BACK2.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\collinspix.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ccmg.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and
uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
80

You might also like