0% found this document useful (0 votes)
2 views8 pages

Exp 9

The document outlines the design and implementation of a simple electronic voting machine using Arduino UNO, push buttons, LEDs, and an LCD display. It details the apparatus required, the theory behind the electronic voting system, the circuit description, algorithm, and the program code. The project successfully registers votes and displays results, ensuring voting accuracy and preventing multiple votes per person.

Uploaded by

sankarayaswitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Exp 9

The document outlines the design and implementation of a simple electronic voting machine using Arduino UNO, push buttons, LEDs, and an LCD display. It details the apparatus required, the theory behind the electronic voting system, the circuit description, algorithm, and the program code. The project successfully registers votes and displays results, ensuring voting accuracy and preventing multiple votes per person.

Uploaded by

sankarayaswitha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

TinkeringLab

EXPERIMENT-9

EX-9: Design of voting Machine.

Aim: To design and implement a simple electronic voting machine using Arduino UNO, push buttons,
LEDs, and an LCD display to count and display votes
Objective:
 To understand the working of digital voting systems using Arduino.
 To interface push buttons and LEDs with Arduino for input and indication.
 To display voting results using a 16x2 LCD (I2C).
 To develop an automated counting system for multiple candidates.
 To ensure voting accuracy and avoid multiple votes per person.

Apparatus:

S.No Apparatus Range/Rating Quantity


1 ATmega328P Microcontroller 1
Arduino UNO
2 Push Buttons Momentary type 5
3 LEDs Red & Green 2
4 Resistors 220Ω 1
5 Breadboard Full-size 1
6 Jumper Wires Male to Male As required
7 16x2 LCD (I2C module) I2C Interface 1
8 USB Cable For Arduino programming 1

Theory:

An Electronic Voting Machine (EVM) is a microcontroller-based system that records and counts votes
electronically. In this Experiment, an Arduino UNO serves as the main controller. Each push button
represents a candidate, and pressing the button registers a vote for that candidate. Votes are stored and
counted in real-time within the Arduino. The LCD display (via I2C interface) shows the voting process and
final results. LED indicators are used — for example, a green LED can indicate a successful vote and a red
LED can signal the end of voting or an error.

The system ensures that:


 Each button press is counted as one vote.
 Votes are displayed after pressing a result button.
 Results can be reset for a new voting session.

1
TinkeringLab
Circuit Description / Working:

 Push Buttons: Each button represents a candidate (e.g., 4 candidates + 1 result button).
 Arduino UNO: Reads button presses and increments the corresponding vote counter variable.
 LCD (I2C): Displays welcome message, voting instructions, and final results.
 LEDs:
 Green LED glows when a valid vote is cast.
 Red LED may glow during result display or when voting ends.
 Power Supply: Arduino provides 5V regulated power to components through USB.
 When the “Result” button is pressed, the Arduino displays each candidate’s vote count on the LCD.

Connection diagram:

Algorithm:

1. Start the system.


2. Initialize the LCD, LEDs, and buttons.
3. Display “Welcome to Voting System”.
4. Wait for a button press (vote).
5. When a button is pressed:
o Increment the corresponding candidate’s counter.
o Turn ON the green LED briefly.
2
TinkeringLab
6. If the result button is pressed:
o Display all vote counts on the LCD.
o Turn ON the red LED.
7. Stop the system or reset to start a new session.

Program:
#include <Adafruit_LiquidCrystal.h>
Adafruit_LiquidCrystal lcd_1(0);
#define sw1 A0 // Button 1
#define sw2 A1 // Button 2
#define sw3 A2 // Button 3
#define sw4 A3 // Button 4
#define sw5 7 // Button 5 for result
int vote1=0;
int vote2=0;
int vote3=0;
int vote4=0;
void setup()
{
pinMode(sw1, INPUT);
pinMode(sw2,INPUT);
pinMode(sw3,INPUT);
pinMode(sw4,INPUT);
pinMode(sw5,INPUT);
pinMode(13,OUTPUT);// Red LED
pinMode(12,OUTPUT);// Green LED
lcd_1.begin(16, 2);
lcd_1.setCursor(0,0);
lcd_1.print("VOTING MACHINE ");
lcd_1.setCursor(0,1);
lcd_1.print("Circuit desigh ");
delay(3000);
digitalWrite(sw1, HIGH);
digitalWrite(sw2, HIGH);
digitalWrite(sw3, HIGH);
3
TinkeringLab
digitalWrite(sw4, HIGH);
digitalWrite(sw5, HIGH);
lcd_1.clear();
lcd_1.setCursor(0,0);
lcd_1.print("BJP");
lcd_1.setCursor(4,0);
lcd_1.print("INC");
lcd_1.setCursor(8,0);
lcd_1.print("AAP");
lcd_1.setCursor(12,0);
lcd_1.print("OTH");
}
void loop()
{
lcd_1.setCursor(0,0);
lcd_1.print("BJP");
lcd_1.setCursor(1,1);
lcd_1.print(vote1);
lcd_1.setCursor(4,0);
lcd_1.print("INC");
lcd_1.setCursor(5,1);
lcd_1.print(vote2);
lcd_1.setCursor(8,0);
lcd_1.print("AAP");
lcd_1.setCursor(9,1);
lcd_1.print(vote3);
lcd_1.setCursor(12,0);
lcd_1.print("OTH");
lcd_1.setCursor(13,1);
lcd_1.print(vote4);
if(digitalRead(sw1)==0)
{
vote1++;
digitalWrite(12,HIGH);
delay(500);
4
TinkeringLab
while(digitalRead(sw1)==0);
digitalWrite(12,LOW);
delay(1000);
}
if(digitalRead(sw2)==0)
{
vote2++;
digitalWrite(12,HIGH);
delay(500);
while(digitalRead(sw2)==0);
digitalWrite(12,LOW);
delay(1000);
}
if(digitalRead(sw3)==0)
{
vote3++;
digitalWrite(12,HIGH);
delay(500);
while(digitalRead(sw3)==0);
digitalWrite(12,LOW);
delay(1000);
}
if(digitalRead(sw4)==0)
{
vote4++;
digitalWrite(12,HIGH);
delay(500);
while(digitalRead(sw4)==0);
digitalWrite(12,LOW);
delay(1000 );
}
if(digitalRead(sw5)==0)
{
digitalWrite(13,HIGH);
int vote=vote1+vote2+vote3+vote4;
5
TinkeringLab
if(vote)
{
if((vote1 > vote2 && vote1 > vote3 && vote1 > vote4))
{
lcd_1.clear();
lcd_1.print("BJP Wins");
delay(5000);
lcd_1.clear();
}
else if((vote2 > vote1 && vote2 > vote3 && vote2 > vote4))
{
lcd_1.clear();
lcd_1.print("INC Wins");
delay(5000);
lcd_1.clear();
}
else if((vote3 > vote1 && vote3 > vote2 && vote3 > vote4))
{
lcd_1.clear();
lcd_1.print("AAP Wins");
delay(5000);
lcd_1.clear();
}
else if(vote4 > vote1 && vote4 > vote2 && vote4 > vote3)
{
lcd_1.setCursor(0,0);
lcd_1.clear();
lcd_1.print("OTH Wins");
delay(5000);
lcd_1.clear();
}
else if(vote4 > vote1 && vote4 > vote2 && vote4 > vote3)
{
lcd_1.setCursor(0,0);
lcd_1.clear();
6
TinkeringLab
lcd_1.print("OTH Wins");
delay(2000);
lcd_1.clear();
}
else
{
lcd_1.clear();
lcd_1.print(" Tie Up Or ");
lcd_1.setCursor(0,1);
lcd_1.print(" No Result ");
delay(5000);
lcd_1.clear();
}
}
else
{
lcd_1.clear();
lcd_1.setCursor(0,0);
lcd_1.print(" No Voting…. ");
delay(5000);
lcd_1.clear();
}
vote1=0;vote2=0;vote3=0;vote4=0,vote=0;
lcd_1.clear();
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}

RESULT: The electronic voting machine was successfully designed and implemented using Arduino UNO. The
system correctly registered votes through push buttons and displayed the final results on the LCD screen.

7
TinkeringLab
Viva Questions:

1. What is the purpose of using Arduino UNO in this project?


2. Why do we use pull-down or pull-up resistors with push buttons?
3. How does the LCD communicate with Arduino using I2C protocol?
4. What is the function of LEDs in this circuit?
5. How can you prevent multiple votes from the same person?
6. Can this system be upgraded for real elections? How?
7. What changes would be needed to add more candidates?
8. What are the advantages of electronic voting machines over manual voting?

You might also like