2 Auto Voting
2 Auto Voting
2 Auto Voting
FACULTY OF TECHNOLOGY
DEPARTMENT OF ELECTRICAL AND
COMPUTER ENGINEERING
INDUSTRIAL CONTROL STREAM
FINAL YEAR PROJECT
DECLARATION
We are honestly declare that, this is our own work and no copying or plagiarism is there with our
work and that all sources of materials used in this project have been strongly acknowledged.
I
This is to certify that the above declaration made by our effort is correct to the best of
our knowledge.
In doing so, we assure that we agree with all written above with our signature as follows.
This is to certify that I have read this project and that in my opinion it is fully adequate, in scope
and quality, as a final project for the degree of Bachelor of Science.
------------------------------------- -----------------------------
Name of Advisor Signature
ACKNOWLEDGMENT
We would like to express our deepest appreciation to all those who provided us the possibility to
complete this project. A special gratitude we give to our advisor Achamie A. for their expert
guidance, constructive comment, suggestion and encouragement, without this work could have
not been completed.
We also would like to thanks other lecturers and co-advisor Aberham, who helped us with
different ideals and motivation which inspire us for the successful completion of this project.
Following that, we would like to thank our department of electrical and computer Engineering.
I
TABLE OF CONTENTS
Contents
DECLARATION ............................................................................................................................. I
ACKNOWLEDGMENT.................................................................................................................. I
LIST OF FIGURES ...................................................................................................................... IV
LIST OF TABLES ......................................................................................................................... V
ACRONYMS AND ABBREVIATIONS ...................................................................................... V
ABSTRACT.................................................................................................................................. VI
CHAPTER ONE ............................................................................................................................. 1
1 Introduction .............................................................................................................................. 1
1.1 Background of the study .................................................................................................... 1
1.2 Statement of the problem................................................................................................... 4
1.3 Objective of the study ................................................................................................... 5
II
1.4 Significance of the study ................................................................................................... 5
1.5 Methodology...................................................................................................................... 5
1.6 Scope and Limitation of the project .................................................................................. 7
1.7 Path that we have followed ................................................................................................ 8
1.8 Application of electronic voting ........................................................................................ 8
CHAPTER TWO ............................................................................................................................ 9
2 Literature review ...................................................................................................................... 9
2.1 Overview of electronic voting system ............................................................................... 9
2.2 Introduction to several basic Electrical Components ...................................................... 10
2.3 Block Diagram of Power Supply for the System ............................................................ 17
CHAPTER THREE ...................................................................................................................... 21
3 The system design and development...................................................................................... 21
3.1Basic block diagram of the system ................................................................................... 21
3.2 Software development for electronic voting system ....................................................... 23
3.3 System components, integrations, and specifications ..................................................... 26
3.4 Development of Overall Control Circuit of the System .................................................. 34
3.5 System Operations ........................................................................................................... 35
CHAPTER FOUR ......................................................................................................................... 37
4 Result and discussion ............................................................................................................. 37
4.1 Simulation Result ............................................................................................................ 37
4.2 material requirement and cost.......................................................................................... 42
CHAPTER FIVE .......................................................................................................................... 43
5 Conclusion and recommendation ........................................................................................... 43
5.2 Recommendation ............................................................................................................. 44
REFERENCES .......................................................................................................................... VIII
APPENDECIX 1 ........................................................................................................................... IX
III
LIST OF FIGURES
Figure 1.1 The frame work of the project ....................................................................................... 6
Figure 1.2 Control system fram work ............................................................................................. 7
Figure 1.3 Flow chart of the project development ......................................................................... 8
Figure 2.1 The 8051 microcontroller ............................................................................................ 11
Figure 2.2 Pin assigment of AT89c51 .......................................................................................... 13
Figure 2.3 Symbol of liqud crystal display ................................................................................... 14
Figure 2.4 Resistor ...................................................................................................................... 15
Figure 2.5 capacitor ..................................................................................................................... 16
Figure 2.6 Buzzer .......................................................................................................................... 16
Figure 2.7 push button switch ....................................................................................................... 17
Figure 2.8 Block diagram of power supply ................................................................................. 17
Figure 2.9 Step down transformer ................................................................................................ 18
Figure 2.10 Result out put wave form .......................................................................................... 19
Figure 3.1 Block diagram of voting system .................................................................................. 21
Figure 3.2 Flow chart of the system.............................................................................................. 23
Figure3.3 Circuit diagram of candidate switch ............................................................................. 27
Figure 3.4 Circuit diagram of start and result switch.................................................................... 28
Figure 3.5 Circuit diagram of crystal oscillator ........................................................................... 29
Figure 3.6 Circuit diagram of AT89c51 microcontroller ............................................................. 30
IV
Figure 3.7 Circuit diagram of Liquied crystal display .................................................................. 30
Figure 3.8 Circuit diagram of Buzzer and relay ........................................................................... 31
Figure 3.9 Circuit diagram of capacitor filter .............................................................................. 32
Figure 3.10 Circuit diagram of voltage regulator ........................................................................ 33
Figure 3.11 Circuit diagram of power supply ............................................................................... 34
Figure 3.12 Over all circuit development of the system ............................................................. 35
Figure 4.1 Simulation result.......................................................................................................... 38
Figure 4.2 Simulation result with wellcome to and pleas vote ..................................................... 38
Figure 4.3 Simulation result with candidate symbol .................................................................... 39
Figure 4.4 Simulation result with voting done ............................................................................. 39
Figure 4.5 Simulation result with total vote.................................................................................. 40
Figure 4.6 Simulation result with congratulation message ........................................................... 40
Figure 4.7 Simulation result with clash message display ............................................................. 41
LIST OF TABLES
Table 1.1 material requerment and estimation cost ..................................................................... 42
V
RAM…………………………………………………..Random access memory
I/O………………………………………………..…...Input output
V……………………………………………………..Volts/voltage
GSM..……………………………...…………………Global System for Mobile Communications
LCD………………………………………………......Liquid Crystal Display
VSM………………………………………………….Virtual System Modeling
Rs……………………………………………………..register select
Kohm………………………………………………….killo ohm
VSM…………………………………………………..virtual system model
IDE…………………………………………………….integrated development environment
ABSTRACT
This paper presents the design and simulation of a simple electronic voting system with a liquid
crystal display (LCD).The design is based on the microcontroller 8051( AT89C51). The design
of this prototype is for four candidates. The design contains switches for each candidate. There
are two extra switches interfaced with microcontroller that can give function in combination with
candidate switches. The first one new entry indicator switch is provided for enabling the
candidate switches in voting mode. This switch is highly require for voting and each voter can
only vote once and protects the identity of the voter to make the process unbiased and fair. The
other one is total vote switch used to know the total vote and indicates who the winner is. In
addition, buzzer with relay is interfaced to indicate that the voter does voting. Here, after voting
is done, the final count can be seen on LCD. The total vote switch and new entry indicator switch
is under the control of voting authority.
Keywords: electronic voting system, AT9C51, switches, LCD, KeiluVision, and proteus.
VI
CHAPTER ONE
1 Introduction
1.1 Background of the study
Democracy has accepted as the most preferred form of political system all over the world.
Ethiopia is one of a country that uses democratic system, which follows a federal form of
government. It means that governance power is not residing with one authority, but distributed
at various levels. In Ethiopia, power distributed as at the federal level, Ethiopia elects a
legislature. The Federal and the regional councils may elect them themselves or through popular
elections. Elections were first held in Ethiopia under the provisions of the current constitution in
June 1994 to elect the membership of local governments; general elections have since been held
in 1995,2000,2005 and 2010 (Wikipedia Encyclopedia, 2013). Ethiopian constitution provide
every adult above the age of 18 years irrespective of his/her religion, region, caste, creed, color,
economic status, education and sex the essential right to vote and elect her/his candidate to
represent her/him.
Voting is a crucial device to reveal the opinion of a group on an issue that is under consideration.
Based on the promise of greater efficiency, better scalability, faster speed, lower cost, and more
convenience, voting is currently shifting from manual paper-based processing to automate
electronic-based processing. The term “electronic voting” characteristically depicts to the use of
some electronic means in voting and ensuresthe security, reliability, guarantee and transference
(Paul and Kumar Ray, 2013).
Now-a-days Electronic voting machine [2] has now replaced the traditional mechanism of voting.
Perhaps the most important, influential, publicized and widespread use of voting is its use in
national elections. Compared to its traditional paper-based counterpart, electronic voting is
considered to have many greater potential benefits. These benefits include better accuracy by
eliminating the negative factor of human error like security, automatic counting, increased speed
for tally computation, lower operational cost through automated means, and the convenience of
voting from any location Whether or not electronic voting is a necessary replacement for the
traditional paper-based method, it is irrefutable that the conduct of voting has been shifting to the
use of electronic medium. It has become an effective voting tool. Flawless voting is ensuredby
1
Electronic voting machine. This is the reason it became more widespread. People are made sure
that their vote is secured. One more feature is that it avoids any kind of malpractice or invalid
votes. Talking about economic benefits, this system is more economical as consequent
expenditure incurred on manpower is saved. In addition, it is use friendly; it means voter feels
convenient, because he/she has to press only one key of the respective candidates to vote.
[3]
Electronic voting machine is economic because less labor is required and may save
transportation cost due to its compact size. It is also more convenient and time conscious as less
time required for voting and counting. Besides that, it is also more secure because of avoiding an
invalid voting such as a people make a vote more than twice. Other than that, paper-based
voting can actually miss ballots due to human mistakes in placing the paper based ballot in
the machine. But, this will be not happen at electronic voting machine and, of course, helps
maintain total voting secrecy without the use of ballot papers. The EVM is 100 per cent tamper
proof. Electronic voting machine has now days become an effective tool for voting. It ensures
flawless voting and thus has become more widespread. It ensures people about their vote being
secured. It avoids any kind of malpractice and invalid votes. In addition, such kind of system
becomes more economical as consequent expenditure incurred on labor is saved. It is also
convenient on the part of voter, as he has to just press one key whichever belongs to his
candidates.
Voting process has lasted five years in Ethiopia that is not instrumental. These elections have
always been characterized by negative reactions from different quarters, both locally and
internationally. This is because ,In Ethiopia all earlier elections be it state elections or center
elections a voter used to cast his/her vote to his/her favorite candidate by putting the stamp
against his/her name and then folding the ballot paper as per a prescribed method before
putting it in the Ballot box. It is a long time consuming process and very much prone to errors
like voting more than once, manipulation of vote. This situation continued till election scene was
completely changed by electronic voting machine.
Thus, such kind of project comes up with a remedy to solve the above problem with high
efficiency and low costing system. In order to overcome the problems, Microcontroller Based
Electronic Voting machine is used. This machine is used to reduce the time, unfair, counting
problem on total amount of vote, and so son by using microcontroller and other interfacing
2
devices rather than Ballot Box. Electronic voting machine is more economic because less
manpower is required and may save transportation cost due to its compact size. It is also more
convenient and time conscious as less time required for voting and counting. Besides that, it is
also more secure due to avoid invalid voting such as people make a vote twice. Other than that,
paper-based voting can actually miss ballots due to human mistakes in placing the paper-based
ballot in the machine. But, this will be not happen at electronic voting machine.
The aforementioned arguments presented in this study play a very important role in the pursuit to
undergo proper voting system in Ethiopia. Because of this, the proponents are motivated to
design and simulate microcontroller-based voting system. Furthermore, the arguments discussed
in the baseline research excited more enthusiasm to conduct this study most especially on issues
that ensure a more reliable and efficient way of voting, eradicate rigging (illegal Voting), voting
more than twice, and eliminate error while counting the votes[6]. Hence, the conduct of this
present study provides alternative solution to problems posed by conventional voting system.
3
1.2 Statement of the problem
The design and development of this Micro-controller-Based Electronic voting system will
enhance a good voting system across Ethiopia. Electronic voting system replaced the traditional
mechanism of voting system. The study therefore answers the following problem.
Paper based voting system does not save stationary material such as, printing paper, pen,
pencil and other.
Error occurs while counting.
Occur illegal voting
Consume time while counting
Mostly require educating man
Less security
Require more man power
Lessflexible and economical (cost pay for staff)
4
1.3Objective of the study
1.3.1 General objective
General objective of the study is to design electronic voting system model
throughmicrocontroller-based circuit and simulation.
The design and simulation of electronic voting system model will offer a good voting system to
the people who elect their wanted candidates using microcontroller-based technology .The
application of microcontroller technology to voting paves the way for an efficient and more
convenient voting across Ethiopia thereby providing significant economic impact. Moreover, the
technology adopted also provides potent technology transfer to paper-based voting system into
possible development of an electronic voting machine.
1.5Methodology
The materials used in this project are websites; through different books, journals, and thesis and
ongoing projects in electronic voting system. From this we are going to select appropriate rating
of resistors, relays, and switch based on their application in electronic voting system and
analyzed values.
The other material we have been used for our simulations are keiluvision(emulator) and proteus
software(simulator).
First we have focused on finding problems by observing our surrounding. Since election is
continues and we are facing to this problem, we have decided to design and develop a system
which solve the paper ballot system. The Proteus simulation was then developed with C code to
5
show how the overall system works. Therefore,
Therefore, in order to develop this overall system we have
used a scientific approach methodology.
The methodology that we have used in our project design is electronic voting machine
machine.
The theoretical framework used in the study follows the input – process – output relationship as
shown in Figure 1.1 Switches are connected to the appropriate input module of the
microcontroller and output devices are connected to the designated output module of the
microcontroller. Input & output devices are processed through the microcontroller to the desired
control outcome of the output devices.
The study is anchored on the system framework as shown in Figure 1.2 where
input/output devices are connected to the 8051 microprocessor (microcontroller)
programmin in C-language [1] is accomplished through an interfacing
modules; system programming
circuit.
6
Figure 1.2: Control system framework
The premise of the study covers the design and development of an electronic voting system that
operates by using electronic switching through electronic simulation. It is conducted by using
microcontroller (8051) simulation, the Proteus software for hardware connection and Keil
uVision5 for C Programming language, which is preferred due to materials and its availability.
[9]
Switches, buzzer with relay and LCD are the preferred devices, which are dependent on
appropriate triggering input switches. A user can get his/her vote register through a set of
switches (one for each candidate). After voting is done, the final count can be seen on LCD. This
LCD based electronic voting machine is designed for four candidates. The result of each
individual candidate is designed for 3-digits at maximum of 999.
The project inhibits the conduct of the following in the entire scope of the study (limitation)
7
1.7 Path that we have followed
Few stages will be involved in order to work out the objectives in this project. The
project was beginning by discussion the project with our advisor. After finding
right objectives, problem and other related issues, the finding is done doing some
literature review. After that the project development is begin. The project is
divided in to two parts which are hardware and software development.
8
CHAPTER TWO
2 Literature review
The related literatures and similar studies mentioned in this study substantiate the arguments that
support the theories and assumptions. The information gathered in this chapter provides
compelling motivation to pursue the study due to the benchmark information that reflects
meritorious works and scholarly studies conducted that are relevant to electronic voting system.
The use of electronic voting technology in elections was introduced in 1964 when punch cards
and computer tally machines were first used in the United States (US) presidential primaries in
two counties in the state of Georgia. Since then, other technologies like direct recording
electronic (DRE) voting machines have been introduced in some countries to help improve the
efficiency and transparency of voting/counting procedures [6]. However, there are countries that
had previously adopted these technologies and are now reverting to conventional paper ballots
for various reasons. Electronic voting machines (EVMs), are either electro-mechanical or
electronic equipment that can be used to define ballots, cast and/or count votes, report or display
election results, and/or maintain and produce audit trail information.( IFES, 2011).
( Chaum 2003) addressed the concepts of untraceable electronic mail and digital pseudonyms,
which can apply for electronic voting for anonymity. In the recent years, voting equipment which
were widely adopted may be divided into five types (Mercuri 2002): Paper-based voting,
Optical voting machine, Lever voting machine, Punch card and direct recording electronic
voting machine. Although most electronic voting devices are usually sourced out and
customized (McClure and Lohry 2001), various open source E-voting systems are also available
Design and implementation requirements were presented while (Kumar and Begum 2011)
presented a fingerprint based system. Although these designs are quite efficient, the intensity
involved and complexity of the overall system is an issue, which our design answers.
The foregoing related literatures cited provided benchmark information that substantiates the
technical content of the present study. The literatures cited also complements the theories
9
required to strengthen the study. The relevant studies provided valuable input that supports the
conduct of the study.
2.2.1 Microcontroller
A micro-controller [7]can be compared to a small stand-alone computer; it is a very powerful
device, which is capable of executing a series of pre-programmed tasks and interacting with
other hardware devices.
Criteria for selection of microcontroller in any embedded system are as following
Efficiently and cost effectively
Speed of operation
Packing, being packed in a tiny integrated circuit (IC) whose size and weight is
usually negligible
Power consumption
Amount of RAM and ROM on chip
No. of I/O pins and timers on chip, used to interact with other devices, like
reading the state of a sensor or controlling device.
Fast I/O operations and fast access to on-chip RAM in data space
Efficient and flexible interrupt system
Cost
Availability of software development tools such as compiler, assembler and
debugger.
Nowadays, microcontrollers are so cheap and easily available that it is common to use them
instead of simple logic circuits like counters for the sole purpose of gaining some design
flexibility and saving some space. Some machines and robots will even rely on a multitude of
microcontrollers, each one dedicated to a certain task. Most recent microcontrollers are ‘In
System Programmable’, meaning that you can modify the program being executed, without
removing the microcontroller from its place.
10
Intel designed the 8051 Microcontroller as shown in Figure 2.1 in 1980’s. Its foundation was on
Harvard Architecture for bringing into play in Embedded Systems. At first it was created by
means of NMOS technology but as NMOS technology needs more power to function therefore
Intel re-intended
intended Microcontroller 8051 employing CMOS technology and a new edition came
into existence with a letter ‘C’ in the title name, for illustration: 80C51. These most modern
Microcontrollers need fewer amount of power to function in comparison to their
their forerunners.
There are two buses in 8051 Microcontroller one for program and other for data. As a result, it
has two storage rooms for both program and data of 64K by 8 size. The microcontroller comprise
of 8-bit accumulator &8-bit
bit processing unit. It also consists of 8 bit B register as majorly
functioning blocks and 8051 microcontroller[4] programming is done with embedded C
languageusing Kiel software.
This c programming is reliable, efficient, and portable; easily interface with hardware,
flexible and effective. Keil provides several different RTOS systems for the various
microcontroller architectures: Kiel uvision software used for
for writes both assemble and c
language.it support many micro-controllers.
micro . Keil compiler is software used where the
machine language code is written and compiled. After compilation, the machine source
code is converted into hex code whichis to be dumped into
into the microcontroller for further
processing. Keil compiler also supports C language code
For internal functioning & processing Microcontroller 8051 comes with integrated built
built-in RAM.
This is prime memory and is employed for storing temporary data. It is unpredictable memory
i.e. its data can get be lost when the power supply to the Microcontroller switched OFF.
The one part of 8051 is AT89C51.The
AT89C51.The characteristics of this microcontroller are as follow:
follow:-
11
The special features of the AT89c51microcontroller[J12],it is just important to note that the
89c51 incorporates hardware circuits that can be used to prevent the processor from
executing various repetitive tasks
Generating precise timing sequences
4K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
128 x 8-bit Internal RAM
32 Programmable I/O Lines
Two 16-bit Timer/Counters
It has 4ports.
Lower power consumption
High performance, powerful
High flexible
Program memory size 32 KB
Follow RIS architecture
Has high integratedmemory (512) but other less memory (64).
Can operate at different frequency
There are four ports designated as P1, P2, P3 and P0.All these ports are 8-bit bi-directional ports,
i.e., can be used as both input and output ports.
12
Figure 2.2: The pin assignment of AT89C51 as describe in the Proteus software
Pin-40: Named as Vcc is the main power source. Usually it is +5V DC, instead use RESET if we
use external memory.
Pins 32-39: Known as Port 0 (P0.0 to P0.7) – In addition to serving as I/O port, lower order
address and data bus signals are multiplexed with this port (to serve the purpose of external
memory interfacing). This is a bi directional I/O port (the only one in 8051) and external pull up
resistors are required to function this port as I/O.
Pin-31:- EA/ External Access input are used to enable or disallow external memory interfacing.
If there is no external memory requirement, this pin is pulled high by connecting it to Vcc.
Pin-30:- ALE aka Address Latch Enable is used to DE multiplex the address-data signal of port
0 (for external memory interfacing).ALE pulses are available for each machine cycle.
Pin- 29:- PSEN or Program Store Enable is used to read signal from external program memory.
Pins- 21-28:- Known as Port 2 (P 2.0 to P 2.7) – in addition to serving as I/O port, higher order
address bus signals are multiplexed with this quasi bi directional port.
Pin 20:- Named as Vcc – it represents ground (0 V) connection, instead use EN.
Pins 18 and 19:- used for interfacing an external crystal to provide system clock.
Pins 10 – 17:- Known as Port 3. This port also serves some other functions like interrupts, timer
input, control signals for external memory interfacing RD and WR, serial communication signals
RxD and TxD etc. This is a quasi bi directional port with internal pull up.
13
Pin 9:- As explained before RESET pin is used to set the 8051 microcontroller to its initial
values, while the microcontroller is working or at the initial start of application. The RESET pin
must be set high for 2-machinecycles,
machinecycles,If it is high signal, it erass all value of register.
Pins 1 – 8:- Known as Port 1. Unlike other ports, this port does not serve any other functions.
Port 1 is an internally pulled up, quasi bi directional I/O port. (Seng and Chua, 2015/2016).
2.2.2 LCD
14
Generally for execute LCD with microcontroller there are 4steps
2.2.3 Resistor
Resistor [J2] in Figure 2.4 is a passive two terminal components which widely use in the circuit.
Its function is to limit the current of the circuit. It also used as a safety mechanism if a circuit
exceeds safe margins. The flow of charge through any material encounters an opposing force
similar in many respects to mechanical friction this opposing force is called resistance of the
material .in some electric circuit resistance is deliberately introduced
introduced in form of resistor.
Resistors are in ohms and are represented in Greek letter omega,
omega, looks as an upturned horseshoe.
Most electronic circuit requires resistors to make them work properly and it is obliviously
important to find out something about the different types of resistors available. Resistance is
measured in ohms; the symbol for
or ohm is an omega ohm. 1 ohm is quite small for electronics so
resistances are often given in kOhm and MOhm.
2.2.4 Capacitor
A capacitor [J5] in Figure 2.5 is a device that stores energy in the electrical field created between
a pair of conductors on which electrical changes of equal magnitude, but opposite sign, have
been placed. A capacitor is occasionally referred to using the older term condenser.
Capacitors are two-terminal
terminal electrical elements. Capacitors are essentially two conductors,
usually conduction plates - but any two conductors - separated by an insulator - dielectric -with
connection wires connected to the two conducting plates. Capacitors occur
occur naturally. On printed
circuit boards two wires running parallel to each other on opposite sides of the board form a
capacitor.
15
Capacitors are components that are used to store an electrical charge and are used in timer
circuits. A capacitor may be used with a resistor to produce a timer. Sometimes capacitors are
used to smooth a current in a circuit as they can prevent false triggering of other components.
When power is supplied to a circuit that includes a capacitor, the capacitor Charges up. When
power is turned off the capacitor discharges
discharge its electrical charge slowly.
2.2.5 Buzzer
A Buzzer [14] in Figure2.6 or Beeper is a signaling device, usually electronic, typically used in
automobiles, household appliances such as microwave ovens, or game shows. It shows how
voter elect once rightly delay of time t second in the internal program of microcontroller.
It most
st commonly consists of a number of switches or sensors connected to a control unit that
determines if and which button was pushed or a preset time has lapsed, and usually illuminates a
light on the appropriate button or control panel, and sounds a warning in the form of a
continuous or intermittent buzzing or beeping sound.
16
Figure2.7: pushbutton Switch
a) Power Supply
The input to the controlling circuit is applied from the regulated power supply. The ac input i.e.,
230v from the mains supply is step down by the transformer to 12v and is fed to a rectifier. The
output obtained from the rectifier is a pulsating dc voltage.
voltage. So in order to get a pure dc voltage,
the output voltage from the rectifier is fed to a filter to remove any ac components present even
after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc
voltage.
17
What is a step down transformer: is one whose secondary voltage is less than its primary voltage.
It is designed to reduce the voltage from the primary winding to the secondary winding. This
kind of transformer “steps down” the voltage applied
a to it.As a step-down
down unit, the transformer
converts high-voltage, low-current
current power into low-voltage,
low high-current
current power.
Secondary winding of the transformer and transfer energy from the primary circuit to the load
connected in the secondary circuit.
circu
Usually, DC voltages are required to operate various electronic equipment and these voltages are
5v, 9v or 12v. But these voltages cannot be obtained directly. Thus the ac input available at the
mains supply i.e., 230 is to be brought down to the required
required voltage level. This is done by a
transformer. Thus, a step down transformer is employed to decrease the voltage to a required
level as shown in the Figure 2.9 below.
c) Rectifier
A diode bridge is an arrangement of four (or more) diodes in a bridge circuit configuration that
provides the same polarity of output for either polarity of input.
When used in its most common application, for conversion of an alternating current (AC) input
[5].
into a directcurrent (DC) output, it is known as a bridge rectifier A bridge rectifier provides
full-waverectification from a two-wire
two wire AC input, resulting in lower cost and weight.
The output from the transformer is fed to the rectifier. It converts AC into pulsating DC. The
rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier in Figure
is used because of its merits like good stability
2.10is stability and full wave rectification. Therefore, in the
discussion below the conventional model
mo is retained. Because of the increasing availability of
voltage-regulator
regulator chips, passive filters are less commonly used. The chips can compensate for
18
changes in input voltage and load current, which the passive filter does not, and eliminate ripple
to a high degree.
d) The Smoothing Capacitor
We saw in the previous section that the single-phase half-wave rectifier produces an output wave
every half cycle and that it was not practical to use this type of circuit to produce a steady DC
supply. The full-wave bridge rectifier however, gives us a greater mean DC value (0.637 Vmax)
with less superimposed ripple while the output waveform is twice that of the frequency of the
input supply frequency (more repeated than the first). We can therefore increase its average DC
output level even higher by connecting a suitable smoothing capacitor across the output of the
bridge circuit as shown below.
The smoothing capacitor converts the full-wave rippled output of the rectifier into a smooth DC
output voltage. Generally for DC power supply circuits the smoothing capacitor is an Aluminum
Electrolytic type that has a capacitance value of 1000uF or more with repeated DC voltage
pulses from the rectifier charging up the capacitor to peak voltage.
The maximum ripple voltage present for a Full Wave Rectifier circuit is not only determined by
the value of the smoothing capacitor but by the frequency and load current, and is calculated as:
19
2.2.8 OSCILLATOR
One of the most important features of any oscillator is its frequency stability, or in other words
its ability to provide a constant frequency output under varying load conditions
Micro-controllers have two oscillator pins.In this type of microprocessor application the Quartz
Crystal Oscillator [J2] produces a train of continuous square wave pulses whose fundamental
frequency is controlled by the crystal itself. This fundamental frequency regulates the flow of
instructions that controls the processor device, For example, the master clock and system timing.
Frequency stability of the output signal can be improved by the proper selection of the
components used for the resonant feedback circuit. A simple circuit will generate pulses of
electricity at a very specific frequency. Those pulses will also assure the synchronization of the
events between various components inside the microcontroller. For example, if the CPU is
waiting for some result of mathematical operation from the ALU (Arithmetic and Logic Unit), it
will be known – according to very specific protocol – when and where the resulting data will be
delivered to the CPU. The clock has another very important role, which is to enable the
microcontroller to count timing.
A major reason for the wide use of crystal oscillators is their high Q-factor [14]. A typical Q value
for a quartz oscillator ranges from 104 to 106, compared to perhaps 102 for an LC oscillator. The
maximum Q for a high stability quartz oscillator can be estimated as Q = 1.6 × 107/f, where f is
the resonance frequency in megahertz. Crystals suffer from minor short-term frequency
fluctuations as well. It reduces the impact of noise by increasing the ratio. Processes speed of
microcontroller depends on crystal oscillator frequency. The time of increment, also depend on
the frequency of oscillator.
20
CHAPTER THREE
Power supply
Crystal
oscillator LCD
Party_1
switch Alarm
circuit
AT89C51
Party_2
switch Microcontr
Entry &
oller Start switch
Party_3
switch
Result &
Stop switch
Party_4
Switch
21
3.1.1 Block diagram description of the system
22
3.2 Software development for electronic voting system
3.2.1 Flow chart system
23
3.2.1.1 Overall working Algorithm
1. Initialize microcontroller, LCD, start switch
2. Read the input signal from candidate switch
3. Start analog to digital conversion since, the output of the start switch values is analog it
has to be digitalized
4. Display the values on LCD
5. Press ‘p1’,’p2’,’p3’,and ’p4’
Condition 1:press ‘p1’
Result: “voting done thank you”
Buzzer generates sound
Condition 2:press ‘p2’
Result: “voting done thank you”
Buzzer generates sound
Condition 3:press ‘p1’
Result: “voting done thank you”
Buzzer generates sound
Condition 4:press ‘p1’
Result: “voting done thank you”
Buzzer generates sound
6. Press result switch
Condition 1: ‘p1’>’p2’>’p’3>’p4’
Result:’P1’ wine
Condition 2: ‘p2’>’p1’>’p’3>’p4’
Results:’P2’ wine
Condition 3: ‘p3’>’p1’>’p’2>’p4’
Results:’P3’ wine
Condition 4: ‘p4’>’p1’>’p’2>’p3’
Results:’P4’ wine
Condition 5: ‘p1=’p2’=’p’3=’p4’
Results:’clash between’ ‘p1’,’p2’,’p3’,’p4’
24
3.2.2Software development tools used
Proteus, ISIS Professional version 8
Keil µvision version 5
3.2.2.1 Proteus design suit version 8.0
For real design and simulation proteus is used.
Proteus is a Virtual System Modeling (VSM) that combines circuit simulation, animated
components and microprocessor models to co-simulate the complete microcontroller based
designs. This is the perfect tool for engineers to test their microcontroller designs before
constructing a physical prototype in real time.
Features:-
A new application framework lets you view modules of Proteus as tabs in a single
window or, via drag and drop, as separate windows for a side-by-side view
A new common parts database enables sharing of information between schematic and
PCB so that changes to data is instantly reflected across the software.
A new live net list means changes to connectivity in the schematic can be instantly
reflected in the PCB, the Bill of Materials and the Design Explorer.
The new integrated VSM Studio IDE binds our firmware project to your schematic
design and Active Popups bring the schematic into your VSM Studio debug session.
25
The software is written in ‘C’ language and compiled using keil µvision ‘C’ compiler. The
source program is converted into hex code by the compiler. Keil µvision and C fit together well:
prized for its efficiency, is the natural choice for developing embedded systems.
26
The components of the electronic voting system consist of
Input Unit
Power supply Unit
Control unit
Output Unit
1 Candidate’s switch
The switches are used to cast vote. Four switches have been used in modeled system to cast
votes; be sides every switch the name of the candidate in Figure 3.3 are written so that the voter
can choose their candidate and by pressing the switch can cast the
the vote to their respective
candidates. These switches are made active high
The resistors R1, R2, R3 and R4 with 10K magnitude are connected for safety purpose of the
corresponding switch. These ports of microcontroller have no internal pull up resistor, so vcc
potential when the switch is not pressed. When the switch is press these pin will be ground.
27
get approval
val from the polling officer. It is provided for enabling the party switch in voting mode
and thus making the system more secured and less prone to mistakes.
Stop switch is used to know the result of polling vote after voting. The final results are displa
displayed
by pressing the result switch after voting process is finished. While press the stop switch ends the
voting and displays the poll results on LCD screen.
The two switches are must not be controlled by the candidate it should be controlled by polling
officer.
ficer. The presidinting officer of polling station is empowered to close the control unit of for
further recorded. These two switches are made active low.
3 Crystal oscillators
It can be deduced that the precision of the timing of a microcontroller depends on the frequency
of its clock. It is an oscillator circuit in Figure 3.5 that deploys the property of mechanical
resonance of a vibrating crystal of the piezoelectric crystals for creating an accurate electrical
signal with a very precise frequency. Crystal oscillators are oscillators where the primary
frequency determining element is a quartz crystal. Because of the inherent characteristics of the
quartz crystal the crystal oscillator
illator may be held to extreme accuracy of frequency stability. The
frequency of the crystal by keeping a track of time provides clock signal to the microcontroller.
Quartz crystal of frequency 12MHz is used in the proposed system. Toprovides a stable clock
signal for digital integrated circuits, and to stabilize frequencies.
The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits
designed around them became known as "crystal oscillators.
XTAL1is input of microcontroller
roller for inverting oscillation amplifier and clock operates.
XATL2 is output inverting oscillation.
Generally, Crystal oscillator used for to create signal at certain frequency and for keeping track.
28
Figure 3.5: Circuit diagram of crystal oscillator
The total load capacitor is specified in the crystal’s data sheet .To knowoscillationfrequency
oscillationfrequencycan
be increased if the frequency high , load capacitor high.
CL =2(20-15)µf=10µf
29
MICROVONTROLLER
19 39
XTAL1 P0.0/AD0
38
P0.1/AD1
37
P0.2/AD2
18 36
XTAL2 P0.3/AD3
35
P0.4/AD4
34
P0.5/AD5
33
P0.6/AD6
9 RST P0.7/AD7 32
21
P2.0/A8
22
P2.1/A9
23
P2.2/A10
29 PSEN P2.3/A11 24
30 25
AL E P2.4/A12
31 26
EA P2.5/A13
27
P2.6/A14
28
P2.7/A15
1 10
P1.0/T2 P3.0/RXD
2 11
P1.1/T2EX P3.1 /TXD
3 12
P1.2 P3.2/ INT0
4 13
P1.3 P3.3/INT1
5 P1.4 P3.4/T0 14
6 15
P1.5 P3.5 /T1
7 16
P1.6 P3.6/ WR
8 17
P1.7 P3.7/RD
AT89C55
The AT89C51 has internal pull-ups of approximately four 10Kohms on ports one, and three.
Because port zero does not have internal pull-ups, external pull-ups of ten Kohms have been
added to permit proper operation of program verification mode.
30
2 Alarm circuit
The alarm circuit in Figure3.8 consists of the buzzer speaker with relay driven by 5 V. The
buzzer speaker is an electromagnetic devil which produces a beep soundwhen signal is sent to
the candidate’s switches. A buzzer is provided for audio effect of switch bounce. Whenever a
switch is bounced, the system acknowledges the bounce by a short beep sound.
when press pressed candidate switch micro controller sends signal one the transistor amplifythis
signal to diode ,which conduct current in the forward direction then vcc(10-20v ) energize the
relay. When relay energize buzzer will be beep sound at12v
Calculations involved
Therefore, Vp = √2 × Vrms (1)
31
24V- (0.7 × 2) = 24- 1.4 = 22.6 V DC. It is 22.6V that goes to the filtering circuit. The frequency
of the full wave signal is double the input frequency.
1 Filtering Circuit
A filter figure 3.10s used to reduce the amount of AC ripple, thus providing a relatively pure
form of DC. The main function of the filter is to minimize the ripple content in the rectifier
output. A capacitor connected in parallel with the output of the rectifier circuit is used as a filter.
Therefore a regulator is applied at the output stage. It is non-electrolyte capacitor.
C
1 mF
Calculation
The main voltage of 220V is stepped down by a 220V/24V transformer. Smoothing capacitors
are needed to reduce the ripples to an acceptable level. The resulting ripple voltage (dv) can be
calculated as follows
The standard 7805 series can produce output current in excess of 1A when used with adequate
heat sink. Therefore, it can supply a maximum of 1A. This current will be drawn from the
supply. Thus, Iload = 1A (maximum).
32
C = Idt/dv (4)
But generally dv which is the ripple voltage is chosen to be 30% of Vp , where Vpis the peak
voltage. For bridge rectifier, Vp(out) = Vp(in) – 1.4V, since 0.7V dropped across a diode whenever
it conducts. Only two diodes will conduct at a time. Therefore, Vp(out) = 24√2 – 1.4 = 32.54V
dv = (30/100) * 32.54 = 9.76V Therefore, C = (1 * 0.01)/9.76 = 1.034 × 10-3 F Thus, C = 1034μF
So the commercial value of 1mF.
VOLTAGE REGULATOR
7805
1 3
VI VO
D
N
G
Calculation
Then the expected ripple voltage using this value of 1000μF capacitor is
VP – 0.5dv = 32.54- (0.5 × 10.00) = 27.54V the output from the 7805 is 5V at maximum current
output of 1A.
The overall design of power supply unit is shown in Figure 3.11
33
Figure 3.11:: The circuit of power supply unit
The Project Electronic Voting System in Figure 3.12 uses AT89C51 microcontroller as its brain.
The microcontroller circuit contains, LCD, buzzer with relay, switches. The microcontroller port
one is connected to the data pins of LCD. Likewise port three of the microcontroller is connected
to the data pins of LCD. Pins P3.0 through P3.2 are used to connect to the control pins of LCD
.Pins P2.0 through P2.7 are connected to the INTR, WR and RD pins of LCD. Pin 3.3 of the port
3 is use to generate control signal
al to sound the buzzer. This pin is connected to the input pin of
the relay at the same port of buzzer. The relay is driving the switch to turn the buzzer on/off.
34
Figure 3.12: Overall Circuit Developments of the system
35
presses the New Entry switch. Then the voter has to press the switch to cast another vote and
finally the Result switch is pressed to get the sum results. When the Result button is pressed the
names of the candidates are displayed along with their vote counts. After some delay, the result
is displayed which could be either declaration of the winner candidate or the candidates with a
clash of their number of votes.
36
CHAPTER FOUR
37
Figure 4.1: simulation result
After that, the LCD screen will display “welcome to vote" immediately after a Delay “please
vote” to indicate the voter could start to cast their vote. The result is shown in Figure 4.2 below.
Figure 4.2: simulation results with please welcome message and please vote
38
2 The switch New Entry switch is closed, allows the electronic voting system to take the vote.
The vote is taken only when this push button is pressed. The following message in Figure 4.3
below is displayed.
3 A push button is assigned to each party. When the push button of the desired party is pressed,
then the vote is cast and the buzzer gives a beep. When the vote is casted for at least one
candidate, “voting done” after some delay “thank you” message are displayed in Figure 4.4.
Again the push button is pressed so that, it is ready to take the next vote .The same process is
repeated until all the voterscast their votes.
Figure 4.4: simulation results with voting done and please welcome message
4 To know the result of the party, the push button of the respective party must be pressed so that
the number of votes cast for the party is displayed on the LCD screen. After the voting process is
ended, the Result switch is being pressed by a conservator. Then all the candidates follow by the
number of votes will be displayon LCD screen as shown in Figure 4.5 and after some delay it
would declare the winner automatically.
39
Figure 4.5: Simulation result with total vote
Based on the figure 4.5 above party who have gotten higher vote. The LCD Screen will make
congratulation and declare that party wins inFigure 4.6.
In case of the number of higher votes for candidates clash, the LCD screen will display clash
between parties and ask for proceed to another voting in Figure 4.7.
40
Figure 4.7: Simulation result with clash message display
41
4.2 material requirement and cost
4.2.1 Hardware
42
CHAPTER FIVE
43
5.2 Recommendation
The electronic voting system still can be improved for a future development. Some modification
and renovation on the system have to be made in order acquire powerful system of automatic
voting and counting. Therefore, lists of recommendationsare given as below:-
.Biometric Verification of voters, so that automatically it can be insured that one person
is voting once.
We can also increase the number of candidates by interfacing 8255 IC or Other
microcontroller. We can increase the number of switches for candidate
Itcould also be interfaced with the personal computer and result could be stored in the
central server and its backup could be taken on the other backend servers.
This project will be more powerful if GSM -voting system is used.
44
REFERENCES
[1] Muhammad Ali Mazidi, Janice Mazidi, RolinMcKinlay “8051
Microcontroller and Embedded Systems” 2nd Edition
[2] http://en.wikipedia.org/wiki/Electronic_voting system
[3] Neo Chan Seng and Siti Fatimah BtShamsudin Chua “Electronic Voting
Machine”, University Sains Malaysia
[4] Muoghalu, C. N. (2008), “WLAN connectivity of Network Printersin
UNIBEN, M.Eng thesis: University of Benin, Benin City.
[5] Parker, S.P. (1994), “Rectifier”, Concise Encyclopedia of Science and Technology, 3rd Ed.,
McGraw hillInc, pp 1589
[6] Uzu, I. (2009), “Design and construction of an Electronic Vote Counting and monitoring
System”, B. Eng thesis: Anambra
[7] H all, D. O (2004),“Microprocessor and interfacing, programming and Hardware”,
McGraw-Hill, pp. 278 - 279.Horowitz,P. and Winfred H (1989), “The Art of Electronics”, 2nd
Ed., Cambridge University press, pp. 44 - 4 7,ISBN0521370957.
[8] Neo Chan Seng and Siti Fatimah BtShamsudin Chua “Electronic Voting Machine”,
University Sains Malaysia
[9] D. Balzarotti, G. Banks, M. Cova, V.Felmetsger, R. A. Kemmerer, W.Robertson, F. Valeur,
and G. Vigna, “An Experience in Testing the Security of Real-World Electronic Voting
Systems,IEEE Transactions on Software Engineering, vol. 36, no. 4, 2010.
[10] www.electronicshub.org/interfacing-16x2-lcd-8051
[11] Introduction to Atmel89c51 (http://www.circuitstoday.com/introduction-to-ATMEL).
Retrieved may, 2016
[12] Advantages of Atmel (http://www.crazyengineers.com/threads/advantages-of Atmel -over-
atmel89c51/). Retrieved may 18, 2016
Journals
[1]Electronic Design
[2] Electronics for you
[3] Electronics Text.
[4] www.engineersgarage.com,2016
[5] Learner 8051(for beginners)
VIII
APPENDECIX 1
Source Code
/****************************************************
Programmers: Group
Designation: Control Students
Compiled on: KeiluVision C51 compiler
Program for: Electronic voting system Using microcontroller (final Project)
****************************************************/
#include<reg51.h>
#define msec 55
#define lcd_data_str_pin P2
sbitrs = P3^0; //Register select (RS) pin
sbitrw = P3^1; //Read write(RW) pin
sbit en = P3^2; //Enable(EN) pin
sbitini_pin = P1^0; // Start voting pin
sbitstop_pin = P1^5; // Stop voting pin
sbit BUZZER=P3^3;
sbit candidate_1=P1^1; //Candidate1=p1
sbit candidate_2=P1^2; //Candidate2=p2
sbit candidate_3=P1^3; //Candidate3=p3
sbit candidate_4=P1^4; //Candidate4=p4
int max = 0;
int carry = 0;
intarr[4];
intvote_amt[3];
unsignedint vote_1,vote_2,vote_3,vote_4;
void delay(intdelay_time) // Time delay function
{intj,k;
for(j=0;j<=delay_time;j++)
for(k=0;k<=1000;k++);}
voidlcd_cmd(unsigned char cmd_addr) //Function to send command to LCD
{lcd_data_str_pin = cmd_addr;
en = 1;
rs = 0;
rw = 0;
delay(1);
en = 0;
return;}
voidlcd_data_str(char str[20]) //Function to send string
{
int p;
for(p=0;str[p]!='\0';p++){// loop will go on till the NULL character in the string
lcd_data_str_pin = str[p];// sending data on LCD byte by byte
rw = 0;
rs = 1;
en = 1;
IX
delay(1);
en = 0;}
return;}
voidwait_a_second(){
unsignedint x;
for(x=0;x<33000;x++);}
voidlcd_data_int(unsigned int vote) //Function to send 0-9 character values
{
chardig_ctrl_var;
int j;
for (j=0;j<=2;j++){
vote_amt[j]=vote%10;
vote=vote/10;}
dig_ctrl_var = vote_amt[j];
lcd_data_str_pin = dig_ctrl_var;
rw = 0;
rs = 1;
en = 1;
delay(1);
en = 0;}
return;}
1.1 voidlcd_ini()//function activate start switch
{
lcd_cmd(0x38);// Use two lines and 5x7 matrix
delay(msec);
lcd_cmd(0x0E);// Display on and also cursor on
delay(msec);
lcd_cmd(0x01);// clear screen
delay(msec);
lcd_cmd(0x80);// Force cursor to beginning of second line
delay(msec);
lcd_data_str("Welcome to vote!");
delay(150);
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x80);
delay(50);
lcd_data_str("Press");
delay(msec);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("party sw");
delay(msec);
lcd_cmd(0xC0);
delay(msec);
lcd_data_str("then");
X
delay(100);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("please vote");
delay(100);
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x80);// display from line 1 position 0
delay(msec);
lcd_data_str("P1");
delay(msec);
lcd_cmd(0x84);
delay(msec);
lcd_data_str("P2");
delay(msec);
lcd_cmd(0x88);//bring cursor to position 3 of line 1
delay(msec);
lcd_data_str("P3");
delay(msec);
lcd_cmd(0x8C);
delay(msec);
lcd_data_str("P4");
delay(msec);
vote_count();
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x85);
delay(msec);
lcd_data_str("Voting done");
delay(100);
lcd_cmd(0x85);
delay(msec);
lcd_data_str("Thank you!!");
delay(100);}
2,1 void results() // Function to show results
{
int i;
carry = 0;
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x80);
delay(msec);
lcd_data_str("The");
delay(msec);
lcd_cmd(0x14);
delay(msec);
XI
lcd_data_str("results");
delay(msec);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("are");
delay(msec);
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x80););// Activate first line position 0
delay(msec);
lcd_data_str("P1");
delay(msec);
lcd_cmd(0x84);
delay(msec);
lcd_data_str("P2");
delay(msec);
lcd_cmd(0x88);
delay(msec);
lcd_data_str("P3");
delay(msec);
lcd_cmd(0x8C);
delay(msec);
lcd_data_str("P4");
delay(msec);
lcd_cmd(0xC0););// Activate second line position 0
delay(100);
3.lcd_data_int(vote_1);
delay(msec);
lcd_cmd(0xC4);
delay(msec);
4 lcd_data_int(vote_2);
delay(msec);
lcd_cmd(0xC8);
delay(msec);
lcd_data_int(vote_3);
delay(msec);
lcd_cmd(0xCC);
delay(msec);
lcd_data_int(vote_4);
delay(300);
arr[0] = vote_1;
arr[1] = vote_2;
arr[2] = vote_3;
arr[3] = vote_4;
for(i=0; i<4; i++){
if(arr[i]>=max)
XII
max = arr[i];}
if ( (vote_1 == max) && ( vote_2 != max) && (vote_3 != max)&& (vote_4 !=
max) ){
carry = 1;
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x82);
delay(msec);
lcd_data_str("congratulation!");
delay(50);
lcd_cmd(0xC4);
delay(msec);
lcd_data_str("P1");
delay(msec);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("wins");
delay(msec);}
if ( (vote_2 == max) && ( vote_1 != max) && (vote_3 != max)&& (vote_4 !=
max) ){
carry = 1;
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x82);
delay(msec);
lcd_data_str("Congratulation!");
delay(50);
lcd_cmd(0xC4);
delay(msec);
lcd_data_str("P2");
delay(msec);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("wins");
delay(msec);}
if ( (vote_3 == max) && ( vote_1 != max) && (vote_2 != max)&& (vote_4 !=
max) ){
carry = 1;
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x82);
delay(msec);
lcd_data_str("Congratulation!");
delay(50);
lcd_cmd(0xC4);
delay(msec);
XIII
lcd_data_str("P3");
delay(msec);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("wins");
delay(msec);}
if ( (vote_4 == max) && ( vote_1 != max) && (vote_3 != max)&& (vote_2 !=
max) ){
carry = 1;
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x82);
delay(msec);
lcd_data_str("Congratulation!");
delay(50);
lcd_cmd(0xC4);
delay(msec);
lcd_data_str("P4");
delay(msec);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("wins");
delay(msec);}
if (carry==0){
lcd_cmd(0x01);
delay(msec);
lcd_cmd(0x82);
delay(msec);
lcd_data_str("clash");
delay(100);
lcd_cmd(0x14);
delay(msec);
lcd_data_str("between!");
delay(100);
if(vote_1==max)
{ lcd_cmd(0xc0);
lcd_data_str("P1");
delay(100);}
if(vote_2 == max) {
lcd_cmd(0xC4);
lcd_data_str("P2");
delay(100);
delay(70); }
if(vote_3 == max) {
lcd_cmd(0xC8);
lcd_data_str("P3");
XIV
delay(100);}
if(vote_4 == max) {
lcd_cmd(0xCC);
lcd_data_str("P4");
delay(100); }}}
voidvote_count() // Function to count votes
{
while (candidate_1==0 && candidate_2==0 && candidate_3==0 &&
candidate_4==0);
if(candidate_1==1)
{while (candidate_1 == 1);
3.1{vote_1 = vote_1 + 1;
BUZZER=1;
delay(100);
BUZZER=0;}}
if(candidate_2==1){
while (candidate_2 == 1);{
4.1 vote_2 = vote_2 + 1;
BUZZER=1;
delay (100);
BUZZER=0; }}
if(candidate_3==1){
while(candidate_3 == 1);{
vote_3 = vote_3 + 1;
BUZZER=1;
delay(100);
BUZZER=0; }}
if(candidate_4==1){
while(candidate_4 == 1); {
vote_4 = vote_4 + 1;
BUZZER=1;
delay(100);
BUZZER=0; }}}
void main(){
{
ini_pin = stop_pin =0;
vote_1 = vote_2 = vote_3 = vote_4 = BUZZER=0;
candidate_1 = candidate_2 = candidate_3 = candidate_4 = 0;
lcd_cmd(0x38);
delay(msec);
lcd_cmd(0x0E);// Display on and also cursor on
delay(msec);
lcd_cmd(0x01);// clear screen
delay(msec);
lcd_cmd(0x80);// display first line postion 0
delay(msec);
XV
lcd_data_str( "Press" );
delay(msec);
lcd_cmd(0x16);// display first line postion 1
delay(msec);
lcd_data_str("start ");
delay(msec);
delay(msec);
lcd_cmd(0xC0);
delay(msec);
lcd_data_str("switch to");
delay(msec);
lcd_cmd(0x14);// Activate second line position 2
delay(msec);
lcd_data_str("begin");
delay(100);
while(1){
while(ini_pin!= 0) {
if (stop_pin== 0)
break;}
if (stop_pin!= 0){
break;}
1.lcd_ini();}
while(1){
2. results();
}}}
XVI