Sunday, March 10, 2013

Electronic Voting Machine

This is a Prototype of Electric Voting Machine. I made it just for Fun. But it is very useful. It can take vote,Can save vote, no problem if Electricity gone Even it can upload Voting Result To Election commission office server during every vote. I used Arduino to make it. Code below
EVM




#include <EEPROM.h>
#include <LiquidCrystal.h>
// Syed Razwanul Haque(Nabil)
// Shahjalal University of Scinece and Tech

(Bangladesh)
// www.ArduinoPic.blogspot.com
int reset=8;
int vote1=6;
int vote2=7;
int i=0;
int a=0;
int b=0;
int t=0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
            {  lcd.begin(16, 2);
               pinMode(reset, INPUT);
               pinMode(vote1, INPUT);
               pinMode(vote2, INPUT);
               pinMode(13, OUTPUT);
               lcd.setCursor(3, 0);
               lcd.print("ELECTRONIC");
               lcd.setCursor(1,1);
               lcd.print("VOTING MACHINE");
               delay(8000);
               lcd.setCursor(3, 0);
               lcd.print("          ");
               lcd.setCursor(1,1);
               lcd.print("              ");
            }
        
void loop(){
  int y=analogRead(A4);
  if(y>500)
      {
        EEPROM.write(0,0);
        EEPROM.write(1,0);
        EEPROM.write(2,0);
        digitalWrite(13,HIGH);
        lcd.setCursor(0, 0);
        lcd.print("Memory Cleared");
        lcd.setCursor(0,1);
        lcd.print("Ready For Voting");
             
        delay(8000);
        digitalWrite(13, LOW);
        lcd.setCursor(0, 0);
        lcd.print("              ");
        lcd.setCursor(0,1);
        lcd.print("                ");
       
      } 
            a= EEPROM.read(0);
            b=  EEPROM.read(1);
            t= EEPROM.read(2);
              lcd.setCursor(0, 0);
              lcd.print("Total Vote=");
              lcd.setCursor(11,0);
              lcd.print(t);
             
              lcd.setCursor(0, 1);
              lcd.print("Nabil=");
              lcd.setCursor(6,1);
              lcd.print(a);
             
              lcd.setCursor(8, 1);
              lcd.print("Isrq=");
              lcd.setCursor(14,1);
              lcd.print(b);
             
              int vote_1state=analogRead(A0);

//digitalRead(vote1);
              int vote_2state=analogRead(A5);     

            //digitalRead(vote2);
              int reset_state= digitalRead(reset);
             
      if(reset_state== HIGH)
        { i--;
        if(i==-1)
       {
         i=0;
         digitalWrite(13,HIGH);
       }
        }
         if(vote_1state>2 && i==0 &&

vote_2state<1)
             {
              a++;
              lcd.setCursor(0, 1);
              lcd.print("Nabil=");
              lcd.setCursor(6,1);
              lcd.print(a);
              delay(300);
              EEPROM.write(0,a);
              t++;
              delay(300);
              EEPROM.write(2,t);
              lcd.setCursor(0, 0);
              lcd.print("Total Vote=");
              lcd.setCursor(11,0);
              lcd.print(t);
              delay(15000);
             
             
             }
             if(vote_2state >2 && i==0 &&

vote_1state<1)
              {
              b++;
               lcd.setCursor(8, 1);
              lcd.print("Isrq=");
              lcd.setCursor(14,1);
              lcd.print(b);
              delay(300);
             EEPROM.write(1,b);
              t++;
              delay(300);
              EEPROM.write(2,t);
              lcd.setCursor(0, 0);
              lcd.print("Total Vote=");
              lcd.setCursor(11,0);
              lcd.print(t);
              delay(15000);
             }
           
          if(vote_1state >2 || vote_2state>2) 
               for(i=0;i<2;i++)
               if(i!=0)
               digitalWrite(13, LOW);
              
      delay(300); 
}  

15 comments:

  1. Hey! So I am making an electronic voting machine too, but I guess there is something wrong in my circuit, do you think you could share your circuit diagram with me? Its for a project and it would really be helpful! I am using an arduino itself......thanks a lot!

    ReplyDelete
    Replies
    1. i am nabil
      thnx for comment.plz see the code carefully so that you can undrstnd ckt.i hv no schamatic for it. Dont forget to put 10k resistor with ground for press button

      Delete
  2. Hi, great work Nabil
    I had an alilttle input tho, having the Result displayed next the character kind of defeats the purpose of an EVM, setting a pin/button to display the total result in the end makes it more practical.But good work :).
    A quick question, do you must reset the arduino button, in between a new vote each time?
    anyways keep up the good work Nabil and best of luck with the reset of your projects.

    ReplyDelete
  3. hey can you please post the header files included...i want to study them!!

    ReplyDelete
  4. Can you plz help with code for PIC? I am also making a EVM as my project but using pic.

    ReplyDelete
  5. can u plz help me out with the schematic diagram of it. i have been looking for to work with aurduino and i found urs project..plz help me out with its circuit diagram....u can me at--ruchitjain898@gmail.com..
    thanku...w8ng for your fast reply

    ReplyDelete
  6. will u plz show complete circuit diagram?

    ReplyDelete
  7. plz plz plz complete circuit diagram

    ReplyDelete
  8. program not working
    error in int reset=8; line showing expected constructer/destructer or type conversion before int.

    ReplyDelete
  9. please help me to make EVM with code for PIC.

    ReplyDelete
  10. circuit diagram please//

    ReplyDelete
  11. These are truly amongst the wonderful informative blogs.Thanks for sharing such informative blog article with us.

    Ballot Box Suppliers | Voting Booths

    ReplyDelete