In this post I will show how to construct a circuit for an Electronic Voting Machine using Arduino and SD card module where the election data is stored in the SD card.
By
UPDATE:
This circuit has been upgraded to an improved version in which the results can be viewed over an attached LCD display, you can get the details at the bottom section of the post
Using 16x2 LCD Dislay
A 16 x 2 display shows the status of the voting machine and when you cast your vote, the name of the candidate will be displayed along with the activation of LED and buzzer.
Note: The proposed project is made for educational purpose only and not intended for real election usage.
Electronic voting machines are implemented for speeding up the election process and reduce the usage paper and these reasons indirectly reduce the expenses related to elections.
Electronic voting machines provide superior security prior to traditional paper ballot method.
Transporting those bulk ballot boxes is risky than to transport compact machines, where vehicle capture frauds cannot alter the data in the EVM (Electronic voting Machine) even though one able to capture the vehicle.
Some countries are showing interest on Indian made EVMs due to superior security. Countries like US still stick to traditional paper ballot method for their elections due to higher risk of hacking and altering the election data.
So, what made the Indian made EVMs more secure? Well, US made voting machines loaded with windows operating system and networked with servers to make the vote count easy. This opens a lot of loopholes for hackers to alter the election data.
Indian made EVMs are standalone devices and not connected to internet or servers. For counting the votes the machines are carried to counting booth, where the results will be declared and no middle man.
The proposed project is designed with similar functionality of Indian EVMs but, there are lot of modifications done.
Now let’s move to constructional details of the project.
Circuit Layout:
The proposed EVM circuit can only accommodate 6 candidates. A control button is provided similar to control unit in real EVMs. After a person caste his/her vote, the ballot buttons are disabled.
The ballot buttons are enabled again only after pressing the control button. The control button will be placed near the person in charge who controls the election booth.
After a person cast a vote he/she is acknowledged with activation of LED and buzzer. The person can also confirm the vote to whom he/she casted in the display, it will show the candidate name or the party name for couple of seconds. This feature is not still present in real EVMs.
Schematic Diagram:
Arduino displaying connectivity:
The circuit is divided into two parts to avoid confusions while duplicating the project. The above circuit describes the wiring between LCD display and arduino. Adjust the variable resistor for optimum contrast.
Here is the rest of the circuit consisting of 9V battery, switch, seven push buttons, LED, buzzer and more importantly SD card module.
The SD card will store the data instantly after a vote is casted. Once the election is over; the SD card is inserted to a computer to declare the vote count and result.
The Proposed design can record up to 4,294,967,295 (which is more than 4 billion) votes per candidate and 25,769,803,770 (more than 25 billion which is more than thrice the current world’s population) votes per machine and still more than 99.9% SD card is still empty.
This is far more efficient than real EVMs which can record 3840 votes per machine.
Program:
//--------Program Developed by R.Girish------//
#include <SPI.h>
#include <SD.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
//----------------------------------------------------//
String Party1 = "MODI";
String Party2 = "TRUMP";
String Party3 = "PUTIN"; // Place the Candidate Names Here.
String Party4 = "Abdul Kalam";
String Party5 = "Girish";
String Party6 = "Swagatam";
//-----------------------------------------------------//
const int btn_1 = A0;
const int btn_2 = A1;
const int btn_3 = A2;
const int btn_4 = A3;
const int btn_5 = A4;
const int btn_6 = A5;
const int ctrl_btn = 8;
const int cs = 10;
const int LED = 9;
boolean ballot = false;
File Party1File;
File Party2File;
File Party3File;
File Party4File;
File Party5File;
File Party6File;
unsigned long int Party1_Count = 0;
unsigned long int Party2_Count = 0;
unsigned long int Party3_Count = 0;
unsigned long int Party4_Count = 0;
unsigned long int Party5_Count = 0;
unsigned long int Party6_Count = 0;
void setup()
{
pinMode(btn_1,INPUT);
pinMode(btn_2,INPUT);
pinMode(btn_3,INPUT);
pinMode(btn_4,INPUT);
pinMode(btn_5,INPUT);
pinMode(btn_6,INPUT);
pinMode(ctrl_btn,INPUT);
pinMode(cs,OUTPUT);
pinMode(LED,OUTPUT);
digitalWrite(btn_1,HIGH);
digitalWrite(btn_2,HIGH);
digitalWrite(btn_3,HIGH);
digitalWrite(btn_4,HIGH);
digitalWrite(btn_5,HIGH);
digitalWrite(btn_6,HIGH);
digitalWrite(ctrl_btn,HIGH);
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Electronic");
lcd.setCursor(0,1);
lcd.print(" Voting Machine");
delay(2000);
if (!SD.begin(cs))
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SD Card failed");
lcd.setCursor(0,1);
lcd.print("or not present");
while(true)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Machine Status:");
lcd.setCursor(0,1);
lcd.print("Initialized !!!");
digitalWrite(LED,HIGH);
delay(2000);
digitalWrite(LED,LOW);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Machine is ready");
lcd.setCursor(0,1);
lcd.print("----------------");
while(!ballot)
{
if(digitalRead(ctrl_btn) == LOW)
{
ballot = true;
for(int y = 0; y < 3; y++)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Cast Your Vote");
lcd.setCursor(0,1);
lcd.print("----------------");
}
}
}
void loop()
{
while(ballot)
{
if(digitalRead(btn_1) == LOW)
{
Party_1();
}
if(digitalRead(btn_2) == LOW)
{
Party_2();
}
if(digitalRead(btn_3) == LOW)
{
Party_3();
}
if(digitalRead(btn_4) == LOW)
{
Party_4();
}
if(digitalRead(btn_5) == LOW)
{
Party_5();
}
if(digitalRead(btn_6) == LOW)
{
Party_6();
}
}
}
void Party_1()
{
ballot = false;
SD.remove("Party1.txt");
Party1File = SD.open("Party1.txt", FILE_WRITE);
if(Party1File)
{
Party1_Count = Party1_Count + 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("You voted for:");
lcd.setCursor(0,1);
lcd.print(Party1);
Party1File.println("------------------------------------");
Party1File.print("Result for: ");
Party1File.println(Party1);
Party1File.print("------------------------------------");
Party1File.println(" ");
Party1File.print("Number of Votes = ");
Party1File.print(Party1_Count);
Party1File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_2()
{
ballot = false;
SD.remove("Party2.txt");
Party2File = SD.open("Party2.txt", FILE_WRITE);
if(Party2File)
{
Party2_Count = Party2_Count + 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("You voted for:");
lcd.setCursor(0,1);
lcd.print(Party2);
Party2File.println("------------------------------------");
Party2File.print("Result for: ");
Party2File.println(Party2);
Party2File.print("------------------------------------");
Party2File.println(" ");
Party2File.print("Number of Votes = ");
Party2File.print(Party2_Count);
Party2File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_3()
{
ballot = false;
SD.remove("Party3.txt");
Party3File = SD.open("Party3.txt", FILE_WRITE);
if(Party3File)
{
Party3_Count = Party3_Count + 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("You voted for:");
lcd.setCursor(0,1);
lcd.print(Party3);
Party3File.println("------------------------------------");
Party3File.print("Result for: ");
Party3File.println(Party3);
Party3File.print("------------------------------------");
Party3File.println(" ");
Party3File.print("Number of Votes = ");
Party3File.print(Party3_Count);
Party3File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_4()
{
ballot = false;
SD.remove("Party4.txt");
Party4File = SD.open("Party4.txt", FILE_WRITE);
if(Party4File)
{
Party4_Count = Party4_Count + 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("You voted for:");
lcd.setCursor(0,1);
lcd.print(Party4);
Party4File.println("------------------------------------");
Party4File.print("Result for: ");
Party4File.println(Party4);
Party4File.print("------------------------------------");
Party4File.println(" ");
Party4File.print("Number of Votes = ");
Party4File.print(Party4_Count);
Party4File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_5()
{
ballot = false;
SD.remove("Party5.txt");
Party5File = SD.open("Party5.txt", FILE_WRITE);
if(Party5File)
{
Party5_Count = Party5_Count + 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("You voted for:");
lcd.setCursor(0,1);
lcd.print(Party5);
Party5File.println("------------------------------------");
Party5File.print("Result for: ");
Party5File.println(Party5);
Party5File.print("------------------------------------");
Party5File.println(" ");
Party5File.print("Number of Votes = ");
Party5File.print(Party5_Count);
Party5File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_6()
{
ballot = false;
SD.remove("Party6.txt");
Party6File = SD.open("Party6.txt", FILE_WRITE);
if(Party6File)
{
Party6_Count = Party6_Count + 1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("You voted for:");
lcd.setCursor(0,1);
lcd.print(Party6);
Party6File.println("------------------------------------");
Party6File.print("Result for: ");
Party6File.println(Party6);
Party6File.print("------------------------------------");
Party6File.println(" ");
Party6File.print("Number of Votes = ");
Party6File.print(Party6_Count);
Party6File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Error()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Unable to log");
lcd.setCursor(0,1);
lcd.print("data to SD card");
for(int x = 0; x < 100 ; x++)
{
digitalWrite(LED, HIGH);
delay(250);
digitalWrite(LED, LOW);
delay(250);
}
}
void Tone()
{
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Thanks for");
lcd.setCursor(0,1);
lcd.print(" Voting!!!");
delay(1500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Not Ready");
lcd.setCursor(0,1);
lcd.print("----------------");
}
void ctrl()
{
while(!ballot)
{
if(digitalRead(ctrl_btn) == LOW)
{
ballot = true;
for(int y = 0; y < 3; y++)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Cast Your Vote");
lcd.setCursor(0,1);
lcd.print("----------------");
}
}
}
//--------Program Developed by R.Girish------//
………That’s a massive program.
How to operate this EVM Circuit:
• Turn ON the machine, it will acknowledge with a beep indicating everything is fine. If the machine is not fine, it beeps rapidly and displays the error message on the LCD.
• Press the control button, now it is ready to record one vote.
• Once the vote is recorded it will activate LED and beep for a second and display the name of the candidate to whom you voted for couple of seconds.
• To record next vote the control button has to be pressed again. Every time the control button is pressed, the buzzer gives 3 short beeps.
• This has to be continued until the last voter cast their vote. No need to press the control button after the last voter caste the vote.
• After the last vote is casted, the machine should be turned off immediately using the off switch and SD card should be removed. So that no data will be altered.
• Plug the SD card to a computer and you can see 6 text files as shown below:
Opening a file will show the name of the candidate and number of vote, as illustrated below:
Author’s prototype:
Illustration of SD card Module:
Note 1: Any interruption in power supply will reset the vote count to zero.
Note 2: Please change candidate name in the program.
String Party1 = "MODI";
String Party2 = "TRUMP";
String Party3 = "PUTIN"; // Place the Candidate Names Here.
String Party4 = "Abdul Kalam";
String Party5 = "Girish";
String Party6 = "Swagatam";
Note 3: If no vote is cast to a particular party/candidate the text file will not appear in the SD card.
Upgrading the Above Design
This particular upgraded version of electronic voting machine project was requested by Sumesh chourasia, who is an avid reader of this website.
This project is an improvement over Electronic Voting Machine explained above. The main drawback of the above EVM (Electronic Voting Machine) was the result could not be viewed on the 16 x 2 LCD display, but it can only be viewed on the computer.
In this project we are going shoot down mentioned draw back and with the newly proposed design we can view the result of the 6 candidates on LCD display instantly.
Difficulties which we encountered:
All the input / output pins (of Arduino) of previous EVM project were utilized by the 16 x 2 display, SD card module, ballot buttons, control button and buzzer. No more room left for connecting any new button.
After some research we found that any I / O pins can be changed to output to input and vice versa at any point.
After careful observation we chose the LED / buzzer pin as save button. Now this pin programmed as both input (save button) and output (buzzer).
Note that the save / buzzer pin is assigned at any one of the state at an instant i.e. output or input.
The circuit:
LCD to Arduino connection:
Just connect as per the earlier schematics and use 10K potentiometer for adjusting viewing contrast; rest of the circuit is self-explanatory.
S1 to S6 are ballot buttons through which voters input their choice. The save and control button must be kept away from ballot unit (under control of the poll booth in-charge).
New Program:
//--------Program Developed by R.Girish------//
#include <SPI.h>
#include <SD.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
//----------------------------------------------------//
String Party1 = "MODI";
String Party2 = "TRUMP";
String Party3 = "PUTIN"; // Place the Candidate Names Here.
String Party4 = "Abdul Kalam";
String Party5 = "Girish";
String Party6 = "Swagatam";
//-----------------------------------------------------//
const int btn_1 = A0;
const int btn_2 = A1;
const int btn_3 = A2;
const int btn_4 = A3;
const int btn_5 = A4;
const int btn_6 = A5;
const int ctrl_btn = 8;
const int cs = 10;
int LED = 9;
int saveTest = 0;
int A = 0;
int B = 0;
int C = 0;
int D = 0;
int E = 0;
int F = 0;
boolean ballot = false;
File Party1File;
File Party2File;
File Party3File;
File Party4File;
File Party5File;
File Party6File;
File save;
unsigned long int Party1_Count = 0;
unsigned long int Party2_Count = 0;
unsigned long int Party3_Count = 0;
unsigned long int Party4_Count = 0;
unsigned long int Party5_Count = 0;
unsigned long int Party6_Count = 0;
void setup()
{
pinMode(btn_1, INPUT);
pinMode(btn_2, INPUT);
pinMode(btn_3, INPUT);
pinMode(btn_4, INPUT);
pinMode(btn_5, INPUT);
pinMode(btn_6, INPUT);
pinMode(ctrl_btn, INPUT);
pinMode(cs, OUTPUT);
pinMode(LED, OUTPUT);
digitalWrite(btn_1, HIGH);
digitalWrite(btn_2, HIGH);
digitalWrite(btn_3, HIGH);
digitalWrite(btn_4, HIGH);
digitalWrite(btn_5, HIGH);
digitalWrite(btn_6, HIGH);
digitalWrite(ctrl_btn, HIGH);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F(" Electronic"));
lcd.setCursor(0, 1);
lcd.print(F(" Voting Machine"));
delay(2000);
if (!SD.begin(cs))
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("SD Card failed"));
lcd.setCursor(0, 1);
lcd.print("or not present");
while (true)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
}
if (SD.exists("save.txt"))
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Opening Results"));
lcd.setCursor(0, 1);
lcd.print(F("----------------"));
delay(1500);
DisplayResult();
}
else
{
Party1File = SD.open("Party1.txt", FILE_WRITE);
if (Party1File)
{
Party1File.println("--------Null-------");
Party1File.close();
}
else
{
Error();
}
Party2File = SD.open("Party2.txt", FILE_WRITE);
if (Party2File)
{
Party2File.println("--------Null-------");
Party2File.close();
}
else
{
Error();
}
Party3File = SD.open("Party3.txt", FILE_WRITE);
if (Party3File)
{
Party3File.println("--------Null-------");
Party3File.close();
}
else
{
Error();
}
Party4File = SD.open("Party4.txt", FILE_WRITE);
if (Party4File)
{
Party4File.println("--------Null-------");
Party4File.close();
}
else
{
Error();
}
Party5File = SD.open("Party5.txt", FILE_WRITE);
if (Party5File)
{
Party5File.println("--------Null-------");
Party5File.close();
}
else
{
Error();
}
Party6File = SD.open("Party6.txt", FILE_WRITE);
if (Party6File)
{
Party6File.println("--------Null-------");
Party6File.close();
}
else
{
Error();
}
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Machine Status:"));
lcd.setCursor(0, 1);
lcd.print(F("Initialized !!!"));
digitalWrite(LED, HIGH);
delay(2000);
digitalWrite(LED, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Machine is ready"));
lcd.setCursor(0, 1);
lcd.print(F("----------------"));
while (!ballot)
{
if (digitalRead(ctrl_btn) == LOW)
{
ballot = true;
for (int y = 0; y < 3; y++)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Cast Your Vote"));
lcd.setCursor(0, 1);
lcd.print(F("----------------"));
}
}
}
void loop()
{
pinMode(LED, INPUT);
if (digitalRead(LED) == HIGH)
{
save = SD.open("save.txt", FILE_WRITE);
if (save)
{
save.println("Results File");
save.close();
}
else
{
Error();
}
}
if (SD.exists("save.txt"))
{
while (true)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Results Saved"));
lcd.setCursor(0, 1);
lcd.print(F("Successfully."));
delay(1500);
lcd.setCursor(0, 0);
lcd.print(F("Disconnect the"));
lcd.setCursor(0, 1);
lcd.print(F("Power Supply"));
delay(1500);
}
}
if (digitalRead(btn_1) == LOW)
{
Party_1();
}
if (digitalRead(btn_2) == LOW)
{
Party_2();
}
if (digitalRead(btn_3) == LOW)
{
Party_3();
}
if (digitalRead(btn_4) == LOW)
{
Party_4();
}
if (digitalRead(btn_5) == LOW)
{
Party_5();
}
if (digitalRead(btn_6) == LOW)
{
Party_6();
}
}
void Party_1()
{
ballot = false;
SD.remove("Party1.txt");
Party1File = SD.open("Party1.txt", FILE_WRITE);
if (Party1File)
{
Party1_Count = Party1_Count + 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You voted for:"));
lcd.setCursor(0, 1);
lcd.print(Party1);
Party1File.print(Party1_Count);
Party1File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_2()
{
ballot = false;
SD.remove("Party2.txt");
Party2File = SD.open("Party2.txt", FILE_WRITE);
if (Party2File)
{
Party2_Count = Party2_Count + 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You voted for:"));
lcd.setCursor(0, 1);
lcd.print(Party2);
Party2File.print(Party2_Count);
Party2File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_3()
{
ballot = false;
SD.remove("Party3.txt");
Party3File = SD.open("Party3.txt", FILE_WRITE);
if (Party3File)
{
Party3_Count = Party3_Count + 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You voted for:"));
lcd.setCursor(0, 1);
lcd.print(Party3);
Party3File.print(Party3_Count);
Party3File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_4()
{
ballot = false;
SD.remove("Party4.txt");
Party4File = SD.open("Party4.txt", FILE_WRITE);
if (Party4File)
{
Party4_Count = Party4_Count + 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You voted for:"));
lcd.setCursor(0, 1);
lcd.print(Party4);
Party4File.print(Party4_Count);
Party4File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_5()
{
ballot = false;
SD.remove("Party5.txt");
Party5File = SD.open("Party5.txt", FILE_WRITE);
if (Party5File)
{
Party5_Count = Party5_Count + 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You voted for:"));
lcd.setCursor(0, 1);
lcd.print(Party5);
Party5File.print(Party5_Count);
Party5File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Party_6()
{
ballot = false;
SD.remove("Party6.txt");
Party6File = SD.open("Party6.txt", FILE_WRITE);
if (Party6File)
{
Party6_Count = Party6_Count + 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("You voted for:"));
lcd.setCursor(0, 1);
lcd.print(Party6);
Party6File.print(Party6_Count);
Party6File.close();
Tone();
ctrl();
}
else
{
Error();
}
}
void Error()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Unable to log"));
lcd.setCursor(0, 1);
lcd.print(F("data to SD card"));
for (int x = 0; x < 100 ; x++)
{
digitalWrite(LED, HIGH);
delay(250);
digitalWrite(LED, LOW);
delay(250);
}
}
void Tone()
{
pinMode(LED, OUTPUT);
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F(" Thanks for"));
lcd.setCursor(0, 1);
lcd.print(F(" Voting!!!"));
delay(1500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F(" Not Ready"));
lcd.setCursor(0, 1);
lcd.print("----------------");
}
void ctrl()
{
while (!ballot)
{
pinMode(LED, INPUT);
if (digitalRead(LED) == HIGH)
{
save = SD.open("save.txt", FILE_WRITE);
if (save)
{
save.println("Results File");
save.close();
}
else
{
Error();
}
}
if (SD.exists("save.txt"))
{
while (true)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Results Saved"));
lcd.setCursor(0, 1);
lcd.print(F("Successfully."));
delay(1500);
lcd.setCursor(0, 0);
lcd.print(F("Disconnect the"));
lcd.setCursor(0, 1);
lcd.print(F("Power Supply"));
delay(1500);
}
}
if (digitalRead(ctrl_btn) == LOW)
{
ballot = true;
for (int y = 0; y < 3; y++)
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Cast Your Vote"));
lcd.setCursor(0, 1);
lcd.print(F("----------------"));
}
}
}
void DisplayResult()
{
while (true)
{
Party1File = SD.open("party1.txt");
if(Party1File)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Party1);
while (Party1File.available())
{
lcd.setCursor(A, 1);
lcd.write(Party1File.read());
A = A + 1;
}
}
A = 0;
delay(2000);
Party1File.close();
Party2File = SD.open("party2.txt");
if(Party2File)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Party2);
while (Party2File.available())
{
lcd.setCursor(B, 1);
lcd.write(Party2File.read());
B = B + 1;
}
}
B = 0;
delay(2000);
Party2File.close();
Party3File = SD.open("party3.txt");
if(Party3File)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Party3);
while (Party3File.available())
{
lcd.setCursor(C, 1);
lcd.write(Party3File.read());
C = C + 1;
}
}
C = 0;
delay(2000);
Party3File.close();
Party4File = SD.open("party4.txt");
if(Party4File)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Party4);
while (Party4File.available())
{
lcd.setCursor(D, 1);
lcd.write(Party4File.read());
D = D + 1;
}
}
D = 0;
delay(2000);
Party4File.close();
Party5File = SD.open("party5.txt");
if(Party5File)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Party5);
while (Party5File.available())
{
lcd.setCursor(E, 1);
lcd.write(Party5File.read());
E = E + 1;
}
}
E = 0;
delay(2000);
Party5File.close();
Party6File = SD.open("party6.txt");
if(Party6File)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Party6);
while (Party6File.available())
{
lcd.setCursor(F, 1);
lcd.write(Party6File.read());
F = F + 1;
}
}
F = 0;
delay(2000);
Party6File.close();
}
}
//--------Program Developed by R.Girish------//
How to operate this Electronic voting machine:
- With completed hardware setup upload the code with your desire candidate names.
- Turn on the machine, if everything is fine it will give a long beep.
- Now press the control button and now it can record a single vote.
- After every vote the control button must be pressed once.
- Once the last vote is casted, press save button this will save the results and prompt you to disconnect the power supply (so that you can view the results in private).
- Re-connect the supply it will automatically starts showing the results. If a candidate didn’t get any vote it displays “null”.
- To conduct another election, you have to format the SD card / delete all the files generated by this EVM.
Please note that this EVM need uninterrupted power, any interruption will roll the vote count to zero.
Please write the candidate names in the code (16 letters maximum):
//----------------------------------------------------//
String Party1 = "MODI";
String Party2 = "TRUMP";
String Party3 = "PUTIN"; // Place the Candidate Names Here.
String Party4 = "Abdul Kalam";
String Party5 = "Girish";
String Party6 = "Swagatam";
//-----------------------------------------------------//
That concludes the project, if you have any questions regarding this project; feel free to express in the comment section, you may receive a quick reply.
Gabriel says
Hi R GR, Gabriel again, regarding the LCD, a welding was enough for the LCD to work, I wonder if I can enter a numeric keypad and a button to correct the vote, if so, what would be the difficulty and what are the limitations?
Gabriel says
Good day, GR! I would like to know if this new code is made to show the result on the LCD, if it is not, could you send me a code that prints the result? I used the new code the machine works perfectly, but it shows nothing on the display. If there is an error in the comment, it’s because I’m Brazilian and I’m using google translate
GR says
Hi Gabriel,
Good Day.
Yes the result is made to show on the LCD display (2nd one).
This is a tested project, no problem with the code. Please Check your wire connection to LCD and increase the display contrast.
Regards
OFFOR KELVIN PIUS says
Hi, SWAG, can the electronic machine be made to accommodate up to 50 candidate , automatic and can transmit the information to central location via gprs? Can you develop this if yes. Thanks
Swagatam says
Hi Offor, Thanks for contacting us, I’ll forward this question to Mr. GR, he will answer you soon….
GR says
HI OFFOR KELVIN PIUS,
We cannot accommodate 50 candidates to my knowledge, but we can accommodate 30 candidates with Arduino MEGA and can be send over an SMS.
Let us know your opinion Mr, OFFOR is this okay for you.
Regards
Sumesh chourasia says
Hello sir I want result button through which we can see the result on display screen that is my project required but I was fail to find code for this ples help me
Swagatam says
Hi Sumesh., I’ll forward this question to Mr. GR, he will answer you soon!
GR says
Hi Sumesh chourasia,
So you want me to update this project for displaying the results on LCD display, rather on computer? Right..
Regards
GR says
I will update it as per your request soon.