Friday, June 26, 2015

Digital Voting Machine Project Using PIC Microcontroller





Digital Voting Machine Using Microcontroller

Digital Voting Machine  is one kind of microcontroller based device which can perform in election. Once I had made Digital Voting Machine when I was in 6th semester. Today I am going to share an upgrade version of  it. In the upgrade version I used  EEPROM of  PIC 18f2550  so that data could be saved during electricity failure. Now take a look on the picture :
Digital Voting Machine Circui
Digital Voting Machine Circuit

Description :

This Voting Machine conains 6 buttons for operation and two LEDs  for notification.

Candidate Category Button :

Button_RA0 : Candidate_1 .

Button_RA1 : Candidate_2 .

Button_RA2 : Candidate_3 .

Control Button :

Button_RA4 : Control Button.

Status Viewer Button :

Button_RC2 :  Status View  Button.

Result Button :

Button_RA3 : Final Result Button.


***Control Button :

This is the main controller of all other buttons. Without having permission of  this button, any button can't perform. Without permission, reading instruction will not be taken. This will be placed in the presiding officer's room. Once he press the button and only one of these buttons can be permitted to perform only for one time. If any key or button is pressed, it works for one time and the system becomes disable automatically for voting until the presiding officer press control button again. So, one person will be able to vote for one time & voter will not be able to do that without permission of PO. Watch this video to understand completely.
Video of  Digital Voting Machine in Proteus :



Digital Voting Machine Using Microcontroller
digital voting machine

***Status Viewer Button :

For security reason we are hiding the voting status from the voter and Only the PO(presiding officer) can check this. At first PO have to press "Control Button " and  LED 1 turns on when he can see the voting status by pressing "View Status" button. Current status will be shown only for a little time before getting back to the previous stage with turning on LED2.
Digital Voting Machine Using Microcontroller


*** Result Button :

When OP decide to publish who is winner , he just need to press "control button" and after that need to press Final Result Button . After Showing result , it will be reset and all data will be erased .
Digital Voting Machine Using Microcontroller


***Candidate Category Button :


When control button gives permission , only one of  "candidate button category" buttons can perform,  only for one time . After performing,  this will disable the system . Generally these buttons are incremented by one during each action .

***LED 1 & LED 2 :

Digital Voting Machine Using Microcontroller



When LED1 remains on , others buttons can perform . When LED2 remains on, all buttons are disabled.

Source Code :

   

 sbit LCD_RS at RB7_bit;  
 sbit LCD_EN at RB6_bit;  
 sbit LCD_D4 at RB5_bit;  
 sbit LCD_D5 at RB4_bit;  
 sbit LCD_D6 at RB3_bit;  
 sbit LCD_D7 at RB2_bit;  
 sbit LCD_RS_Direction at TRISB7_bit;  
 sbit LCD_EN_Direction at TRISB6_bit;  
 sbit LCD_D4_Direction at TRISB5_bit;  
 sbit LCD_D5_Direction at TRISB4_bit;  
 sbit LCD_D6_Direction at TRISB3_bit;  
 sbit LCD_D7_Direction at TRISB2_bit;  
 // End LCD module connections  
  short dat_can1=0,dat_can2=0,dat_can3=0,con=4;  
  char txt[]="        ";  
  char txt1[]="htp://pic18fmicrocontroller.blogspot.com";  
  char txt2[]="    Digital Voting Machine";  
  int i=0,j=0,chk=10;  
  char c1i='0',c1j='0',c1k='0';  
  char c2i,c2j,c2k;  
  char c3i,c3j,c3k;  
  int can_1adrs =15; // Keeping memory address for Candidate 1  
  int can_2adrs =19;   // Keeping memory address for Candidate 2  
  int can_3adrs = 29;   // Keeping memory address for Candidate 3  
  int chkk = 33,aq=0,b=0,aa=0,bb=0,cc=0;  
  char thirdchar(short dk){         ////find third Char of Short Data  
   aq=dk/100;  
   aa=aq*100;  
   aa=dk-aa;  
   if(aq==0)  
   { aa=dk;  
    return '0'; }  
   if(aq==1) return '1';  
   if(aq==2) return '2';  
   if(aq==3) return '3';  
   if(aq==4) return '4';  
   if(aq==5) return '5';  
   if(aq==6) return '6';  
   if(aq==7) return '7';  
   if(aq==8) return '8';  
   if(aq==9) return '9';  
  }  
    char secondchar(short dk){  ////find Second Char of Short Data  
   b=aa/10;  
   bb=b*10;  
   bb=aa-bb;  
   if(b==0)  
   { bb=dk;  
    return '0'; }  
   if(b==1) return '1';  
   if(b==2) return '2';  
   if(b==3) return '3';  
   if(b==4) return '4';  
   if(b==5) return '5';  
   if(b==6) return '6';  
   if(b==7) return '7';  
   if(b==8) return '8';  
   if(b==9) return '9';  
  }  
  char firstchar(short dk){ ////find first Char of Short Data  
   if(bb==0) return '0';  
   if(bb==1) return '1';  
   if(bb==2) return '2';  
   if(bb==3) return '3';  
   if(bb==4) return '4';  
   if(bb==5) return '5';  
   if(bb==6) return '6';  
   if(bb==7) return '7';  
   if(bb==8) return '8';  
   if(bb==9) return '9';  
  }  
 void main() {  
  ADCON1=0x0F;  
  CMCON=7;  
  TRISA.F0=1;  
  TRISA.F1=1;  
  TRISA.F2=1;  
  TRISA.F3=1;  
  TRISA.F4=1;  
  TRISC.F0=0;  
  TRISC.F1=0;  
  TRISC.F2=1;  
  Lcd_Init();  
   Lcd_Cmd(_LCD_CLEAR);        // Clear display  
  Lcd_Cmd(_LCD_CURSOR_OFF);  
  /////////////////////// Lcd Scroling Display Start  
   for(i=0;i<19;i++){  
   Lcd_Out(1,1,txt1);  
   Lcd_Out(2,1,txt2);  
   Lcd_Cmd(_LCD_SHIFT_LEFT);  
   delay_ms(200);  
     }  
    Lcd_Cmd(_LCD_CLEAR);  
  /////////////////////// Lcd Scroling Display End  
     for(j=0;j<16;j++){  
     Lcd_Cmd(_LCD_CLEAR);  
     txt[j]='.';  
   Lcd_Out(1,1," Starting...");  
   Lcd_Out(2,1,txt);  
      delay_ms(300);  
     }  
 dat_can1 = EEPROM_Read(can_1adrs); // reading previous data if avail able for Candidate 1  
 c1i=thirdchar(dat_can1); ///third  
 c1j=secondchar(dat_can1); //second  
 c1k=firstchar(dat_can1);   //first  
 //// these functions should be called with this structure  
 /// I used this , because MikroC's short to str conversion didn't work .  
 dat_can2=EEPROM_Read(can_2adrs); // reading previous data if avail able for Candidate 2  
 c2i=thirdchar(dat_can2);  
 c2j=secondchar(dat_can1);  
 c2k=firstchar(dat_can1);  
 dat_can3=EEPROM_Read(can_3adrs);   // reading previous data if avail able for Candidate 2  
 c3i=thirdchar(dat_can3);  
 c3j=secondchar(dat_can1);  
 c3k=firstchar(dat_can1);  
 Lcd_Cmd(_LCD_CLEAR);  
 if(dat_can3<=0){    // check if it runs for the first time , then set data null or 0  
  EEPROM_Write(can_3adrs,0);  
  dat_can3=EEPROM_Read(can_3adrs);  
 }  
 if(dat_can2<=0){      // check if it runs for the first time , then set data null or 0  
  EEPROM_Write(can_2adrs,0);  
  dat_can2=EEPROM_Read(can_2adrs);  
 }  
 if(dat_can1<=0){       // check if it runs for the first time , then set data null or 0  
  EEPROM_Write(can_1adrs,0);  
  dat_can1=EEPROM_Read(can_1adrs);  
 }  
 while(1){  
 c1i=thirdchar(dat_can1);   // It is taking the last update data for Candidate 1  
 c1j=secondchar(dat_can1);  
 c1k=firstchar(dat_can1);  
 c2i=thirdchar(dat_can2);    // It is taking the last update data for Candidate 2  
 c2j=secondchar(dat_can2);  
 c2k=firstchar(dat_can2);  
 c3i=thirdchar(dat_can3);        // It is taking the last update data for Candidate 3  
 c3j=secondchar(dat_can3);  
 c3k=firstchar(dat_can3);  
   Lcd_Out(1,1,"C_1 C_2 C_3");  
     Lcd_Chr(2,1,'*');  
     Lcd_Chr(2,2,'*');  
     Lcd_Chr(2,3,'*');  
     Lcd_Chr(2,6,'*');  
     Lcd_Chr(2,7,'*');  
     Lcd_Chr(2,8,'*');  
     Lcd_Chr(2,11,'*');  
     Lcd_Chr(2,12,'*');  
     Lcd_Chr(2,13,'*');  
  if(PORTA.F4==0){  // if control button is pressed , it enables voting.  
  con=3;  
 }  
 if(con!=3){    // if control button is not pressed ,naturally it disables voting.  
 Lcd_Out(2,15,"DV");  
 PORTC.F0=0;  
 PORTC.F1=1;     //LED2 is on  
 }  
 while(con==3){    // if control button is pressed , it enables voting.  
  Lcd_Out(2,15,"EV");  
 PORTC.F0=1;     //LED1 is on  
 PORTC.F1=0;  
 if(PORTC.F2==0){   // when view status button is pressed  
     Lcd_Chr(2,1,c1i);  
     Lcd_Chr(2,2,c1j);  
     Lcd_Chr(2,3,c1k);  
     Lcd_Chr(2,6,c2i);  
     Lcd_Chr(2,7,c2j);  
     Lcd_Chr(2,8,c2k);  
     Lcd_Chr(2,11,c3i);  
     Lcd_Chr(2,12,c3j);  
     Lcd_Chr(2,13,c3k);  
   delay_ms(4000);  
   con=5;    // con=5 makes disable voting  
  }  
    if(PORTA.F0==0){  
     dat_can1=dat_can1+1;   // Candidate 1 variable is incrementing .  
    EEPROM_Write(can_1adrs,dat_can1); // writing the incremented value on EEPROM for Candidate 1  
     con=5;    // con=5 makes disable voting  
    }  
    if(PORTA.F1==0){  
     dat_can2=dat_can2+1;      // Candidate 2 variable is incrementing .  
    EEPROM_Write(can_2adrs,dat_can2);   // writing the incremented value on EEPROM for Candidate 2  
     con=5;                  // con=5 makes disable voting  
    }  
    if(PORTA.F2==0){  
     dat_can3=dat_can3+1;          // Candidate 3 variable is incrementing .  
    EEPROM_Write(can_3adrs,dat_can3);     // writing the incremented value on EEPROM for Candidate 3  
     con=5;                   // con=5 makes disable voting  
    }  
   if(PORTA.F3==0){      // If Result Button is pressed .  
    Lcd_Cmd(_LCD_CLEAR);  
    for(j=1;j<17;j++){  
   Lcd_Out(1,1," Calculating...");  
   Lcd_Out(2,j,".");  
   delay_ms(200);  
     }  
    if(dat_can2>dat_can1&&dat_can2>dat_can3){  
     Lcd_Cmd(_LCD_CLEAR);  
   Lcd_Out(1,1,"Winner is C_2");  
   Lcd_Out(2,1,"Congratulation!!");  
     delay_ms(5000);  
   Lcd_Out(1,1,"Winner is C_2");  
   Lcd_Out(2,1,"He got =");  
     delay_ms(5000);  
     Lcd_Cmd(_LCD_CLEAR);  
          dat_can2=0;  
  //Erasing All Datas  
    dat_can1=0;  
    dat_can3=0;  
    EEPROM_Write(can_1adrs,0);  
    EEPROM_Write(can_2adrs,0);  
    EEPROM_Write(can_3adrs,0);  
    }  
   else if(dat_can1>dat_can2&&dat_can1>dat_can3){  
     Lcd_Cmd(_LCD_CLEAR);  
   Lcd_Out(1,1,"Winner is C_1");  
   Lcd_Out(2,1,"Congratulation!!");  
     delay_ms(5000);  
     Lcd_Cmd(_LCD_CLEAR);  
          dat_can2=0;  
    dat_can1=0;  
    dat_can3=0;  
    EEPROM_Write(can_1adrs,0);  
    EEPROM_Write(can_2adrs,0);  
    EEPROM_Write(can_3adrs,0);  
    }  
    else if(dat_can3>dat_can1&&dat_can3>dat_can2){  
     Lcd_Cmd(_LCD_CLEAR);  
   Lcd_Out(1,1,"Winner is C_3");  
   Lcd_Out(2,1,"Congratulation!!");  
     delay_ms(5000);  
     Lcd_Cmd(_LCD_CLEAR);  
      dat_can2=0;  
    dat_can1=0;  
    dat_can3=0;  
    EEPROM_Write(can_1adrs,0);  
    EEPROM_Write(can_2adrs,0);  
    EEPROM_Write(can_3adrs,0);  
    }  
    else{  
     Lcd_Cmd(_LCD_CLEAR);  
   Lcd_Out(1,1,"Something is");  
   Lcd_Out(2,1,"Worng!!!");  
     delay_ms(1000);  
     Lcd_Cmd(_LCD_CLEAR);  
    }  
     con=5;  
    }  
  }  
  }  
  } 

Circuit Diagram :

Digital Voting Machine Using Microcontroller
Digital Voting Machine Using Microcontroller

Video of  Digital Voting Machine in Practical :




                           Download This Project                                    


Thank You!





38 comments:

  1. did you use mikroC for the code?

    ReplyDelete
    Replies
    1. and sorry for late response.I couldn't have replied since commenting wasn't working for long time.

      Delete
  2. Replies
    1. You just need to do some modification in your code. That's it.

      Delete
  3. Most of the time I don’t make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! ltd.

    ReplyDelete
    Replies
    1. I am impressed totally! I will try to apply this technique and these words to convince someone. :)

      Delete
  4. helps me in many ways.Thanks for posting this again. marine valve

    ReplyDelete
  5. Make sure that any company you use for your PCBs is willing to conduct an accurate PCB test, so that you can be sure of quality control. https://fastpcbunion.com/aluminum-pcb/ It belongs to the category of professional software and does come with a price; however, it is affordable and one of the most used software amongst medium-sized businesses in the present times.

    ReplyDelete
  6. It should be noted that whilst ordering papers for sale at paper writing service, you can get unkind attitude. In case you feel that the bureau is trying to cheat you, don't buy term paper from it. machine

    ReplyDelete
  7. I was more than happy to uncover this great site. I need to thank you for your time due to this fantastic read!!
    I definitely enjoyed every bit of it and I have you bookmarked to see new information on your blog.
    humidifier dehumidifier combo

    ReplyDelete
  8. I was more than happy to uncover this great site. I need to thank you for your time due to this fantastic read!!
    I definitely enjoyed every bit of it and I have you bookmarked to see new information on your blog.
    WordPress Chat Plugin

    ReplyDelete
  9. Arrowsmith Construction and Project Management Limited is a professional construction management team. We have been executing projects of various sizes in the heavy civil and industrial sectors for the past decade throughout British Columbia and Western Canada. Arrowsmith construction

    ReplyDelete
  10. Use Darling Door Ducky - front load washer door prop - to prevent mold and mildew build-up and lessen odors front load washer door prop

    ReplyDelete
  11. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... printing

    ReplyDelete
  12. The good thing about these online escrow platform, is that everyone should upload their scanned ID, this guarantees security during the transactions.BTC near me

    ReplyDelete
  13. there is some error if i using mplab ide.how can i fix it

    ReplyDelete
  14. How beautifully all the feelings have been conveyed through writing.
    nunique pandas

    ReplyDelete
  15. I'm extremely inspired along with your writing skills as neatly as with the format in your blog. Is that a paid subject or did you customize it yourself? Anyway stay up the excellent quality writing, it's rare to look at a great blog like this one today.. Round LED Mirror

    ReplyDelete
  16. This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… write for us

    ReplyDelete
  17. Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! https://9xflix.World

    ReplyDelete
  18. There is so much in this article that I would never have thought of on my own. Your content gives readers things to think about in an interesting way. Thank you for your clear information. https://watchserieshd.website

    ReplyDelete
  19. This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog.. https://uwatchfree.cloud

    ReplyDelete
  20. What a sensational blog! This blog is too much amazing in all aspects. Especially, it looks awesome and the content available on it is utmost qualitative. https://pelisplus.world

    ReplyDelete
  21. You have beaten yourself this time, and I appreciate you and hopping for some more informative posts in future. Thank you for sharing great information to us. https://xmovies8.fun

    ReplyDelete
  22. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. https://vegamovies.today

    ReplyDelete
  23. Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also https://kuttymovies.website

    ReplyDelete
  24. I went to this website, and I believe that you have a plenty of excellent information, I have saved your site to my bookmarks. https://vegamovies.network

    ReplyDelete
  25. Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. https://movieswood.today

    ReplyDelete
  26. I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. https://pedropolis.site

    ReplyDelete
  27. I read your blog frequently, and I just thought I’d say keep up the fantastic work! It is one of the most outstanding blogs in my opinion. https://123mkv.website

    ReplyDelete
  28. It is extremely nice to see the greatest details presented in an easy and understanding manner. Goldshell KD6

    ReplyDelete
  29. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. tyres

    ReplyDelete
  30. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page! Trustee Seller Goldshell Kd6

    ReplyDelete
  31. wow, great, I was wondering how to cure acne naturally. and found your site by google, learned a lot, now i’m a bit clear. I’ve bookmark your site and also add rss. keep us updated. MicroBT Whatsminer M50S

    ReplyDelete
  32. Excellent and very exciting site. Love to watch. Keep Rocking. cnc machining

    ReplyDelete

Ain't getting any visitors!
Please Share and Bookmark posts.

Tags

: (1) 18F2550 (1) 36KHz (3) and (1) arduino (1) Based (1) battery (1) Bipolar (1) Blinking (1) blinks (1) Bluetooth (1) bluetooth device interfacing (1) bluetooth module (1) button (1) circuit (1) clock (1) control (1) crystal oscillator (3) Db9 (1) DC Motor (2) digital (2) Digital Voting Machine (1) digital voting machine using pic (1) display (2) DS1307 (1) electronic (1) embedded c programming tutorial (11) embedded c tutorial (11) experiment kit (4) external interrupt (4) flash (1) flashing (1) Gas Leakage detector (1) HC-06 (1) home (1) how (1) How to (10) i2c tutorial (1) in (1) indicator (1) infrared Connection (3) interface (8) interfacing (3) Interrupt (3) Introduction (1) IR Connection (3) IR Receiver (4) IR Transmitter (4) key pad (1) keyboard (1) keypad (1) lavel (1) Lcd 16x2 (2) lcd 2x16 (2) led (1) lm35 (2) LPG (1) machine (1) make (1) Make bootloader (1) making (1) matrix (1) max232 (1) membrane keyboard (2) meter (2) Micocontroller (1) microchip (4) microchip pic (2) microchips (3) microcontroller (9) microcontroller based (3) microcontroller programming (3) Microcontroller Project (4) Microcontroller Projects (1) microcontroller_project (2) microcontrollers (4) Microprocessor (2) mikroC (5) mikroc code to start and stopstart and stop dc motor (1) mikroc pro for pic (2) Motion detector (1) MQ-9 Gas Sensor (1) musical (1) NEC Protocol (4) pcb (5) PIC (3) pic controller (11) pic microcontroller (11) pic microcontroller tutorial (11) pic programming (1) pic programming in c (12) pic proteus (1) Pic Tutorial (12) pic18 (2) pic18f2550 (11) picmicrocontroller (4) picRFモジュール (1) PIR Motion Sensor (1) printed circuit board (1) proteus (6) pulse width modulation (1) push (1) push button (1) PWM (1) real (1) rf transmitter (3) Rs 232 (1) Rs232 (1) scroll (1) scrolling (1) Serial communication (1) Serial Connection (1) Serial Port (1) serial port rs232 (1) Servo Motembedded c programming tutorial (1) simulation (2) Soil Moisture Meter (1) speed control (1) step by step (7) step bystep (1) Stepper Motor (2) text (2) Thief Detector (1) time (1) timer (4) timer0 (4) tone (1) TSOP38236 Receiver (4) tutorial (2) Unipolar (1) USART Connection (1) USB (1) usb 1.0 (1) USB bootloadere (1) USB HID (1) using (9) voltmeter (1) voting (1) water level indicator (3) with (2) work (1)

Traffic Feed


Live Traffic Feed
Visitor Tracking

Leave Your Message Here

Name

Email *

Message *

Like on Facebook