Vous êtes sur la page 1sur 22

11/20/2013

ELECTRONIC
VOTING MACHINE
USING ATMEGA-16 MICROCONTROLLER
Nupur
[COMPANY NAME]
ELECTRONIC DESIGN LABORATORY
PROJECT REPORT


SUBMITTED BY:
VISHAL MISHRA 111EC0179
JAGRUTI PATEL 111EC0182
NUPUR SAHU 111EC0188

1 | P a g e

Contents
EXPERIMENT NO: 4 ..................................................................................................................... 2

OBJECTIVE ....................................................................................................................................... 2

Literature survey .......................................................................................................................... 3

Theory ................................................................................................................................................ 4

COMPONENTS USED ................................................................................................................... 6

SYSTEM DESIGN ............................................................................................................................ 7

PROGRAM ...................................................................................................................................... 10

SIMULATION RESULTS ........................................................................................................... 18

IMPLEMENTATION ................................................................................................................... 20

RESULT AND DISCUSSION ..................................................................................................... 20

References ..................................................................................................................................... 21




2 | P a g e

EXPERIMENT NO: 4

TITLE: ELECTRONIC VOTING MACHINE USING ATMEGA
DATE: 20.11.2013

OBJECTIVE:
To design an ELECTRONIC VOTING MACHINE which can be used in elections. The
machine is controlled by an ATMEGA microcontroller and can be used both for
voting and counting votes.

INTRODUCTION:
Electronic Voting Machine (EVM) retains all the characteristics of voting by ballot
papers, while making polling a lot more expedient. Being fast and absolutely
reliable, the EVM saves considerable time, money and manpower. And, of course,
helps maintain total voting secrecy without the use of ballot papers. The EVM is
100 per cent tamper proof. And, at the end of the polling, just press a button and
there you have the results.

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.
Also such kind of system becomes more economical as consequent expenditure
incurred on manpower 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 machines are the total combination of mechanical, electromechanical, or
electronic equipment (including software, firmware, and documentation required
to program control, and support equipment), that is used to define ballots; to cast
and count votes; to report or display election results; and to maintain and

3 | P a g e

produce any audit trail information. The first voting machines were mechanical
but it is increasingly more common to use electronic voting machines.

A voting system includes the practices and associated documentation used to
identify system components and versions of such components; to test the system
during its development and maintenance; to maintain records of system errors or
defects; to determine specific changes made after initial certification; and to
make available any materials to the voter (such as notices, instructions, forms, or
paper ballots).

Traditionally, a voting machine has been defined by the mechanism the system
uses to cast votes and further categorized by the location where the system
tabulates the votes.
Voting machines have different levels of usability, security, efficiency and
accuracy. Certain systems may be more or less accessible to all voters, or not
accessible to those voters with certain types of disabilities. They can also have an
effect on the public's ability to oversee elections.

Literature survey:
According to Election Data Services, the percentage of electronic voting machines
per country doubled between 1998 and 2002 to 16 percent-, yet a full
replacement of the traditional voting procedure is very unlikely. In its essence, an
electronic voting machine is a computer assisted self-interviewing device (CASI)
giving the voter the opportunity to review and change his/her vote before
submitting it. The different types of voting machines allow for different kinds of
interaction, such as using a touch screen technology, using a dial wheel, touching
a paper panel, or pressing a button on an LCD screen. Each machine provides
feedback for blank ballots and under-voting and prevents selecting more choices
than the maximum allowed. Some machines even have advanced functions such
as increasing the font for visually impaired voters and/or allowing for listening of
the voting options rather than reading. The common features electronic voting
machines share with CASI and ACASI devices allow for theoretical and empirical
predictions of the advantages and disadvantages this technology can provide. The
paper presents an overview of the different types of voting machines and based

4 | P a g e

on established theories and results from CASI and ACASI studies, examines and
compares characteristics of the machines currently used and computer-human
interaction mechanisms, their potential effects, and unexplored applications.
Furthermore, possibilities such as prediction of candidates name order effect,
already existing in the literature, and computer literacy effect on voting are
discussed.

Theory:
1. HARDWARE TOOLS:

The control Unit: In Total control of the polling Conduction of polling, display of
total votes polled, sealing at the end of the poll, and finally, declaration of results
these are the various accomplishments of just one gadget: the control unit. In
total control of the polling, this electronic unit gives you all necessary information
at a press of a few buttons. For instance, if you need to know the total number of
votes, you just have to press the Total switch. Candidates-wise results can be had
only at the end of polling.
The Ballot Unit: An electronic ballot box. A simple voting device, it displays the
list of candidates. A facility to incorporate party names and symbols is in-built. All
the voter has to do is press the desired switch located next to the name of each
candidate. The main advantage is the speed, apart from the simplicity of
operation, which requires no training at all. A single ballot unit takes in the names
of 16 candidates. And thus, by connecting four ballot units the EVM can
accommodate a total of 64 candidates in a single election.



2. SOFTWARE TOOLS:
AVR STUDIO SOFTWARE:


5 | P a g e

Atmel AVR Studio is an Integrated Development Environment (IDE) for developing
and debugging embedded Atmel AVR applications. It enables full control
execution of programs on the AT90S In-Circuit Emulator or on the built-in AVR
Instruction Set Simulator. It provides a project management tool, source file
editor, simulator, assembler and front-end compiler for C/C++ programming,
emulator and on-chip debugger. The AVR Studio gives a seamless and easy-to-use
environment to write, build and debug C/C++ and assembly code.

AVR Studio supports source level execution of Assembly programs assembled
with the Atmel Corporation's AVR Assembler and C programs compiled with
compilers such as IAR Embedded Workbench, Code Vision AVR C compiler,
GCC(GNU), etc. In AVR studio 5 there is an integrated C compiler, and need not be
installed separately.

The Assembler translates assembly source code into object code. The generated
object code can be used as input to a simulator such as the ATMEL AVR Simulator
or an emulator such as the ATMEL AVR In-Circuit Emulator. The Assembler also
generates a PROMable hex code which can be programmed directly into the
program memory of an AVR microcontroller. The Assembler generates fixed code
allocations, consequently no linking is necessary.
AVR Studio 4(or higher version) has a modular architecture which allows even
more interaction with 3rd party software vendors. GUI plug-ins and other
modules can be written and hooked to the system.

PROTEUS SOFTWARE:

Proteus 7.0 is a Virtual System Modelling (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. This
program allows users to interact with the design using on-screen indicators
and/or LED and LCD displays and, if attached to the PC, switches and buttons. One
of the main components of Proteus 7.0 is the Circuit Simulation -- a product that
uses a SPICE3f5 analogue simulator kernel combined with an event-driven digital
simulator that allow users to utilize any SPICE model by any manufacturer.
Proteus VSM comes with extensive debugging features, including breakpoints,
single stepping and variable display for a neat design prior to hardware

6 | P a g e

prototyping. In summary, Proteus 7.0 is the program to use when you want to
simulate the interaction between software running on a microcontroller and any
analog or digital electronic device connected to it.


COMPONENTS USED:
1) Micro controller:

Micro controller senses the signal given from switches and decides the mode of
operation in voting mode it increments the data for corresponding key i.e.
respective candidate as well as it sends signal to display block to indicate one key
is pressed. In counting mode micro controllers fetches data from memory location
and send it to display devices.

2) LCD:

Liquid Crystal Display which is commonly known as LCD is an Alphanumeric
Display it means that it can display Alphabets, Numbers as well as special symbols
thus LCD is a user friendly Display device which can be used for displaying various
messages unlike seven segment display which can display only numbers and some
of the alphabets. The only disadvantage of LCD over seven segment is that seven
segment is robust display and be visualized from a longer distance as compared to
LCD. Here I have used 16 x 2 Alphanumeric Display which means on this display I
can display two lines with maximum of 16 characters in one line.

3) LED:

A light-emitting diode (LED) is a semiconductor light source. LEDs are used as
indicator lamps in many devices and are increasingly used for other lighting. Light-
emitting diodes are used in applications as diverse as replacements for aviation
lighting, automotive lighting (particularly brake lamps, turn signals and indicators)
as well as in traffic signals.

4) Control switches:


7 | P a g e

There are three control switches:
I. Clear Votes. II. Controller switch. III. Total Votes


SYSTEM DESIGN:
1) Power on: When supply is turned on RED LED glows.

2) Mode selection:
i) Voting mode: toggle switch on VCC
ii) Counting mode: toggle switch on GND.

Voting Mode:
When toggle switch is in voting mode Voting mode is displayed followed by
Please vote. After a vote being given, Please wait for authority switch is
displayed and again enable for voting after Control switch being pressed by the
voting Authority.

Counting Mode:
When toggle switch is in counting mode Counting mode in displayed on the
screen, and total number of votes to respective candidate can be displayed on the
screen by pressing the respective key assigned to them.

3) Clear mode:
Press clear switch when all entries are required to be erased. Clear switch should
be pressed before voting procedure.

4) Buzzer indication:
Pressing of key in voting mode is indicated by a buzzer sound.

5) Controller switch:
This switch is provided for enabling the keypad in voting mode. This switch is
under the control of voting authority.



8 | P a g e


BLOCK DIAGRAM OF ELECTRONIC VOTING MACHINE:


9 | P a g e



10 | P a g e

PROGRAM:
#include<avr/io.h>
#define F_CPU 1000000
#include<util/delay.h>
#include<avr/lcd.h>
#include<avr/eeprom.h>
#define bzr PD2


int main()
{
DDRA=0xFF;
DDRB=0x00;
PORTB=0xFF;
DDRC=0xFF;
DDRD=0x04;
PORTD=0x60;
unsigned char input=0x00;
unsigned char
p1=0,p2=0,p3=0,p4=0,p5=0,p6=0,p7=0,p8=0,voting_input_status=0,voter_id,sho
w_status=1;
lcd_init();
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
/* if(!(PIND&(1<<PD5))&&(!(PIND&(1<<PD6))))
{
eeprom_write_byte(0x00,0x00);
eeprom_write_byte(0x01,0x00);
eeprom_write_byte(0x02,0x00);
eeprom_write_byte(0x03,0x00);
eeprom_write_byte(0x04,0x00);
eeprom_write_byte(0x05,0x00);
eeprom_write_byte(0x06,0x00);
eeprom_write_byte(0x07,0x00);
}
else

11 | P a g e

;
_delay_ms(100);*/
p1=eeprom_read_byte(0x00);
p2=eeprom_read_byte(0x01);
p3=eeprom_read_byte(0x02);
p4=eeprom_read_byte(0x03);
p5=eeprom_read_byte(0x04);
p6=eeprom_read_byte(0x05);
p7=eeprom_read_byte(0x06);
p8=eeprom_read_byte(0x07);
while(1)
{


input=PINB;

if(input==0xFE)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=1;
}

else if(input==0xFD)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);

12 | P a g e

lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=2;
}
else if(input==0xFB)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=3;
}
else if(input==0xF7)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=4;
}
else if(input==0xEF)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);

13 | P a g e

lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=5;
}
else if(input==0xDF)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=6;
}
else if(input==0xBF)
{
PORTD|=(1<<bzr);
_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=7;
}
else if(input==0x7F)
{
PORTD|=(1<<bzr);

14 | P a g e

_delay_ms(100);
PORTD&=~(1<<bzr);
lcd_command_write(0x01);
lcd_command_write(0x81);
lcd_string_write("VOTING MACHINE");
lcd_command_write(0xc0);
lcd_string_write("Party Voted");
voting_input_status=1;
voter_id=8;
}
else
;
_delay_ms(300);

if(voting_input_status==1)
{
if( !(PIND & (1<<PD5)))
{
if(voter_id==1)
{
p1++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x00,p1);
}
else if(voter_id==2)
{
p2++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x01,p2);
}
else if(voter_id==3)
{
p3++;

15 | P a g e

voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x02,p3);
}
else if(voter_id==4)
{
p4++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x03,p4);
}
else if(voter_id==5)
{
p5++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x04,p5);
}
else if(voter_id==6)
{
p6++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x05,p6);
}
else if(voter_id==7)
{
p7++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x06,p7);
}

16 | P a g e

else if(voter_id==8)
{
p8++;
voting_input_status=0;
lcd_command_write(0x01);
lcd_string_write("Authenticated");
eeprom_write_byte(0x07,p8);
}
else
;
}
else ;
}

show_status=PIND & (1<<PD6);
if(show_status==0x00)
{
lcd_command_write(0x01);
lcd_string_write("Party 1:");
lcd_number_write(p1,10);
lcd_command_write(0xc0);
lcd_string_write("Party 2:");
lcd_number_write(p2,10);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
lcd_command_write(0x01);
lcd_string_write("Party 3:");
lcd_number_write(p3,10);
lcd_command_write(0xc0);
lcd_string_write("Party 4:");
lcd_number_write(p4,10);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);

17 | P a g e

lcd_command_write(0x01);
lcd_string_write("Party 5:");
lcd_number_write(p5,10);
lcd_command_write(0xc0);
lcd_string_write("Party 6:");
lcd_number_write(p6,10);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
lcd_command_write(0x01);
lcd_string_write("Party 7:");
lcd_number_write(p7,10);
lcd_command_write(0xc0);
lcd_string_write("Party 8:");
lcd_number_write(p8,10);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
_delay_ms(500);
show_status=0x01;
}
else
;
}

}







18 | P a g e

SIMULATION RESULTS




19 | P a g e




20 | P a g e



IMPLEMENTATION:
The electronic voting machine was first tested in the voting mode. The EVM first
needed an authority Switch to enable voting. After pressing the authority switch,
the Green LED glows and a vote is registered. On registering a vote the EVM again
asks for an authority switch to enable the next vote and the process continues.
Then it was switched to Counting Mode where the EVM display displays the total
number of votes that each party gets.
RESULT AND DISCUSSION:
We have described the specification and architecture of an ELECTRONIC VOTING
MACHINE .Various fault-tolerance and security issues are delegated to the
platform itself, therefore relieving the application designer from accommodating
these features in the application design itself. This approach allows for the easy
development and deployment of applications.
For quite some time, voting equipment vendors have maintained that their
systems are secure, and that the closed-source nature makes them even more
secure. Our glimpse into the code of such a system reveals that there is little
difference in the way code is developed for voting machines relative to other
commercial endeavors. In fact, we believe that an open process would result in
more careful development, as more scientists, software engineers, political
activists, and others who value their democracy would be paying attention to the
quality of the software that is used for their elections. (Of course, open source
would not solve all of the problems with electronic elections. It is still important
to verify somehow that the binary program images running in the machine
correspond to the source code and that the compilers used on the source code
are non-malicious. However, open source is a good start.) Such open design
processes have proven successful in projects ranging from very focused efforts,
such as specifying the Advanced Encryption Standard (AES) [23], through very

21 | P a g e

large and complex systems such as maintaining the Linux operating System.
Australia is currently using an open source voting system10Alternatively, security
models such as the voter-verified audit trail allow for electronic voting systems
that produce a paper trail that can be seen and verified by a voter. In such a
system, the correctness burden on the voting terminals code is significantly less
as voters can see and verify a physical object that describes their vote. Even if, for
whatever reason, the machines cannot name the winner of an election, then the
paper ballots can be recounted, either mechanically or manually, to gain
progressively more accurate election results. Voter-verifiable audit trails are
required in some U.S. states, and major DRE vendors have made public
statements that they would support such features if their customers required it.
The EVM project an ambitious attempt to create an open-source voting system
with a voter-verifiable audit trail
A laudable goal, the model where individual vendors write proprietary code to
run our elections appears to be unreliable, and if we do not change the process of
designing our voting systems, we will have no confidence that our election results
will reflect the will of the electorate. We owe it to ourselves and to our future to
have robust, well-designed election systems to preserve the bedrock of our
democracy.
References

[1] Wikipedia, "Electronic Voting Machine," Wiki, [Online]. Available:
www.wikipedia.org.
[2] "http://www.electronicsforyou.com," [Online].
[3] Electroschematics, "http://www.electroschematics.com," [Online].