20
Introduction This LCD based electronic voting machine is designed for two candidates. The input part consists of a set of 4 switches. The switches and 16x2 LCD are interfaced to microcontroller for various operations and displays. The provision of casting votes for the candidates has been provided through 2 of these switches (one for each candidate). These switches are made active high and connected to input pins of the controller. The remaining 2 switches are New Entry and Result. The New Entry switch initializes the voting system when pressed, while the Result switch ends the voting and displays the result (total number of votes for respective candidate) and winner on LCD screen. This system is set to 1 vote for each voter. In other word, the voter cannot make the second vote even he or she press the switch as long as the New Entry switch is press. Besides that, each of the switches has connected to a 1k ohm resistor and a LED. The resistor act as a pull down resistor which make the input normal LOW while the LED is to indicate the switch is being press. The main objective of this project is to design and create a general electronic voting machine to replace the traditional paper-based voting schemes so that we can take an advantage in term of economic and convenient. Electronic voting machine is more economic because less manpower is required and may saves transportation cost due to its compact size. It is also more convenient and time conscious as less

evm11

Embed Size (px)

DESCRIPTION

evm

Citation preview

IntroductionThisLCDbased electronic voting machine is designed for two candidates. The input part consists of a set of 4 switches. The switches and 16x2 LCD are interfaced to microcontrollerfor various operations and displays. The provision of casting votes for the candidates has been provided through 2 of these switches (one for each candidate). These switches are made active high and connected to input pins of the controller. The remaining 2 switches are New Entry and Result. The New Entry switch initializes the voting system when pressed, while the Result switch ends the voting and displays the result (total number of votes for respective candidate) and winner on LCD screen. This system is set to 1 vote for each voter. In other word, the voter cannot make the second vote even he or she press the switch as long as the New Entry switch is press. Besides that, each of the switches has connected to a 1k ohm resistor and a LED. The resistor act as a pull down resistor which make the input normal LOW while the LED is to indicate the switch is being press.The main objective of this project is to design and create a general electronic voting machine to replace the traditional paper-based voting schemes so that we can take an advantage in term of economic and convenient. Electronic voting machine is more economic because less manpower is required and may saves transportation cost due to its compact size. It is also more convenient and time conscious as less time required for voting and counting. Besides that, it is also more secure due to avoid invalid voting such as a people make a vote twice. Other than that, paper-basedvoting can actually miss ballots due to human mistakes in placing thepaper-based ballot in the machine. But, this will be not happen at electronic voting machine.The following is the advantages of electronic voting machine:1. It is economical2. Less manpower required3. Time conscious4. Avoids invalid voting5. Convenient

Objectives To program the Microprocessor 8051 to create an electronic voting machine. To interface the Microprocessor 8051 with 2x16 LCD screen. To program the Microprocessor for automatic counting and secured systemLiterature ReviewAccording to the electronic voting machine that designed by others, we found that it is similar to our design. First of all, their security system has control by 2 buttons. The first switch is New Entry switch to display the Welcome from thanks after a vote has been casted. While the second switch is Ready switch to indicate the voter ready to cast a vote. Then the voter can only cast a vote after the New Entry is pressed and follow by Ready button. Our security system is only control by one switch which is New Entry switch. After a vote has been casted, our voting machine will be display Welcome automatically from thanks after some delay. Then the voter can only cast a vote after the New Entry switch has pressed. Otherwise, any vote will not be counted. Besides that, their voting system is designed for 4 candidates and the counter for number of votes for each candidate can reach 3-digits number while we had designed for 2 candidates and the counter for number of votes for each candidate can only reach 2-digits number. But, we can add the number of candidate and also the counter by modified the program as well. Due to the time constraints we designed this as a prototype.Moreover, we had found that some weakness and flaw in their system. We found that their electronic voting machine will display the number of votes for respective candidates after a vote has been casted. This phenomena may cause an unfair election happen due to the voter could tell the next voter about the result. This may affect the decision of other voters. Besides that, the guideline of the message that shown on LCD display not really clear. The LCD screen will display nothing when the period for voter ready to cast their vote. This may confused the users of this voting machine.Thus, we are enhance the system by hide the number of votes for each candidates as long as the Result button is pressed. Once the result are out, the voting process is end and the LCD screen will declare the winner. Next, we also enhance the guideline of the system by adding the message Please vote during the period for voter ready to cast a vote. So that the voter would not be confused.

MethodologyHow does it works?First, the LCD screen will always display Welcome to vote! as long as the voting is started by pressing the New Entry switch after which the user is prompted to vote. Then, the LCD screen will display Please vote to indicate the voter could start to cast a vote. The count of votes is stored in two different variables. As soon as the user votes for a candidate by pressing one of the switches, the value of the corresponding variable is increased by one. After this, a Thank you message is displayed on LCD to acknowledge the registration of users vote and the LCD screen will be automatically display back Welcome to vote! after some delay. The message will be stays on the screen until the next voter come and a conservator presses the New Entry switch. Then the voters have to press the switch to cast another vote and finally the Result switch is pressed to get the poll results. When the Result button is pressed the names of the candidates are displayed along with their vote counts. After some delay, the result is displayed which could be either declaration of the winner candidate or the candidates with a clash of their number of votes.

Component ListComponent/EquipmentQuantity

8051 Development System1

Light Emitted Diode (LED)4

Reset Button Switch4

1k ohm Resistor4

2x16 LCD Screen1

Hardware DescriptionMicrocontroller board 8051The 8051 Microcontroller was designed in 1980s by Intel. Its foundation was on Harvard Architecture and was developed principally for bringing into play in Embedded Systems. At first it was created by means of NMOS technology but as NMOS technology needs more power to function therefore Intel re-intended Microcontroller 8051 employing CMOS technology and a new edition came into existence with a letter C in the title name, for illustration: 80C51. These most modern Microcontrollers need fewer amount of power to function in comparison to their forerunners.There are two buses in 8051 Microcontroller one for program and other for data. As a result, it has two storage rooms for both program and data of 64K by 8 size. The microcontroller comprise of 8 bit accumulator & 8 bit processing unit. It also consists of 8 bit B register as majorly functioning blocks and 8051 microcontroller programming is done withembedded C languageusing Keil software. It also has a number of other 8 bit and 16 bit registers.For internal functioning & processing Microcontroller 8051 comes with integrated built-in RAM. This is prime memory and is employed for storing temporary data. It is unpredictable memory i.e. its data can get be lost when the power supply to the Microcontroller switched OFF.

8051 Pin Diagram & Description

For describing pin diagram and pin configuration of 8051, we are taking into consideration a 40 pin DIP (Dual inline package). Now lets go through pin configuration in detail.Pin-40 :Named as Vcc is the main power source. Usually its +5V DC.You may note some pins are designated with two signals (shown in brackets).Pins 32-39:Known as Port 0 (P0.0 to P0.7) In addition to serving as I/O port, lower order address and data bus signals are multiplexed with this port (to serve the purpose of external memory interfacing). This is a bi directional I/O port (the only one in 8051) and external pull up resistors are required to function this port as I/O.Pin-31:-ALE aka Address Latch Enable is used to demultiplex the address-data signal of port 0 (for external memory interfacing.) 2 ALE pulses are available for each machine cycle.Pin-30:-EA/ External Access input is used to enable or disallow external memory interfacing. If there is no external memory requirement, this pin is pulled high by connecting it to Vcc.Pin- 29:-PSEN or Program Store Enable is used to read signal from external program memory.Pins- 21-28:-Known as Port 2 (P 2.0 to P 2.7) in addition to serving as I/O port, higher order address bus signals are multiplexed with this quasi bi directional port.Pin 20:-Named as Vss it represents ground (0 V) connection.Pins 18 and 19:-Used for interfacing an external crystal to provide system clock.Pins 10 17:-Known as Port 3. This port also serves some other functions like interrupts, timer input, control signals for external memory interfacing RD and WR , serial communication signals RxD and TxD etc. This is a quasi bi directional port with internal pull up.Pin 9:-As explained before RESET pin is used to set the 8051 microcontroller to its initial values, while the microcontroller is working or at the initial start of application. The RESET pin must be set high for 2 machine cycles.Pins 1 8:-Known as Port 1. Unlike other ports, this port does not serve any other functions. Port 1 is an internally pulled up, quasi bi directional I/O port.Microcontroller board 8255The Intel 8255A is a general purpose programmable I/O device which is designed for use with all Intel and most other microprocessors. It provides 24 I/O pins which may be individually programmed in 2 groups of 12 and used in 3 major modes of operation. In MODE 0, each groups of 12 I/O pins may be programmed in sets of 4 and 8 to be inputs or outputs. In MODE 1, each group may be programmed to have 8 lines of input or output. 3 of the remaining 4 pins are used for handshaking and interrupt control signals. MODE 2 is a strobed bi-directional bus configuration. The 8255 is a 40 pin integrated circuit (IC), designed to perform a variety of interface functions in a computer environment. The 8255 wasnt originally designed to be connected to the Z80. It was manufactured by Intel for the 8080 microprocessor.

D0 - D7These are the data input/output lines for the device. All information read from and written to the 8255 occurs via these 8 data lines.CS(Chip Select Input). If this line is a logical 0, the microprocessor can read and write to the 8255.RD(Read Input) Whenever this input line is a logical 0 and theRDinput is a logical 0, the 8255 data outputs are enabled onto the system data bus.WR(Write Input) Whenever this input line is a logical 0 and theCSinput is a logical 0, data is written to the 8255 from the system data busA0 - A1(Address Inputs) The logical combination of these two input lines determines which internal register of the 8255 data is written to or read from.RESETThe 8255 is placed into its reset state if this input line is a logical 1. All peripheral ports are set to the input mode.PA0 - PA7,PB0 - PB7,PC0 - PC7These signal lines are used as 8-bit I/O ports. They can be connected to peripheral devices. The 8255 has three 8 bit I/O ports and each one can be connected to the physical lines of an external device. These lines are labelled PA0-PA7, PB0-PB7, and PC0-PC7. The groups of the signals are divided into three different I/O ports labelled port A (PA), port B (PB), and port C (PC).

LCD2x16

The Serial LCDs are very functional, liquid crystal displays that can be easily interfaced to and controlled by a microcontroller using an I/O pin. The LCD displays provide basic text wrapping so that your text looks correct on the display. Full control over all of their advanced LCD features allows you to move the cursor anywhere on the display with a single instruction and turn the display on and off in any configuration. They support the same visible characters as the Terminal (ASCII Dec 32-127). In addition, you may define up to eight of your own custom characters to display anywhere on the LCD. This device can be connected to a PC serial port using a MAX232 line driver. The circuit isn't supported by us.ResistorResistor is a passive two terminal components which widely use in the circuit. Its function is to limit the current of the circuit. In this miniproject, we used 4 1k resistors as a pull down resistor for the 4 reset buttons.It also used as a safety mechanism if a circuit exceeds safe margins.

LED

Light-Emitting Diode (LED) is a basic component we widely use in the circuit. It usually connect in series with resistor to emit light. We used the LED to indicate the reset buttons have pressed.

Reset Button

Inelectronicsandtechnology, areset buttonis abuttonthat canresetadevice. Onvideo game consoles. Reset buttons are found oncircuit breakersto reset the circuit. This button can cause data corruption so this button often doesn't exist on many machines. Usually, in computers and other electronic devices, it is present as a small button, possibly recessed into the case or only accessible by a pin or similar thin object, to prevent it being pressed accidentally.

SCHEMATIC DIAGRAM

BLOCK DIAGRAM FOR ELETRONIC VOTING MACHINEA block diagram is drawn to ease the understanding to connection of circuit design. This block diagram explains roughly about the connection of the microcontroller 8051, PPI 8255, 2x16 LCD screen and LEDs. Based on this block diagram, we write the program code according to our circuit design.

4 switches/reset buttons80512805155

4 LEDs

2x16 LCD screen

NOIs the Result switch being press?ARTIs the New Entry switch being press?ARTNOStartARTLCD display:WELCOME TO VOTE!LCD display: PLEASE VOTEAFTER A DELAYXXYYYESLCD display:DRAW!! PROCEED TO THE NEXT VOTING...LCD display:CONGRATULATION!! C2 WINS!!!LCD display:CONGRATULATION!! C1 WINS!!!LCD display:C1 C2XX YYAFTER A DELAYLCD display:THANK YOUYESYESThe number of votes for C2 +1The number of votes for C1 +1NONOIs the switch that represent C1 being press?ARTIs the switch thatrepresentC2 being press?ARTYESFlow Chart

Problem Statement and Analysis Problem 1:When we display those message on LCD screen, we found that the cursor on LCD screen keep on moving and it is too annoying for the user.Solution:We change the command to LCD from 0E(display on, cursor on) to 0C(display on, cursor off).Problem 2:We are going to display the number of votes of candidate that have stored in register on LCD screen. Then, we realise that the LCD display the other character instead of the number.Solution:We found that LCD can only read ASCII code and the number that stored in the register is HEX code. By refer to the table of comparison between ASCII code and HEX code, we found that we could convert the HEX code to ASCII code by adding 30H for the numbering part. In other word, 30H will display 0 on LCD, 31H will display 1 on LCD.Problem 3:After we solved the problem 2, we are facing the other problem that we can only display the single digit (0-9) to LCD screen due to only 0-9 available on ASCII code. Double digits such as 17, 23 will display the other characters on LCD.Solution:First we move the number that stored in the register to Accumulator and move 10H to register B. After that, we use the function DIV AB and move the content of A and B to another 2 registers follow by add 30H for both registers and finally display on LCD screen. Example:23H A, 10H BDIV AB A=2, B=3A R5+30H, B R6+30H

Result And DiscussionFirst of all, the electronic voting machine will be starting by display WELCOME TO VOTE! as shown in figure below as long as the New Entry switch is being pressed. The switch 1 represented New Entry switch and switch 4 represented Result switch. While the switch 2 and 3 represented candidate 2 and 3.

Switch 2Switch 3Switch 4Switch 1After that, the LCD screen will display PLEASE VOTE immediately to indicate the voter could start to cast their vote. The result is shown in figure below.

After the voting process is ended, the Result switch is being pressed by a conservator. Then all the candidates follow by the number of votes will be display on LCD screen and after some delay it would declare the winner automatically.

Declare The Winner

ResultBased on the figures above candidate1 (C1) get 18 votes while candidate2 (C2) only 11 votes. So C1 has wins the poll and the LCD screen will make a congratulation and declare that C1 wins! Conversely the LCD screen will display C2 wins if the number of votes for C2 is more than C1. In case of the number of votes for both candidates clash, the LCD screen will ask for proceed to another voting.In this project, we still require to make some improvement to make it more effective for future scope. First, we can make an option initially to choose how much the candidate will be involved. Next, in security system, we could add a finger print scanning to mark down the people who has voted to ensure that a same people cannot vote for the second times. We can also provide several different languages to voters for whom English is not the first language. Finally, there are also advantages when it comes to disabled people, such as blind individuals. Electronic voting machine can provide headphones to read off instructions to blind voters. Additional tools can be incorporated into these voting machines to help with other disabilities and to aid the elderly as well. Due to time constraints we have not been able to implement these features in our project. But it is possible to make it in the future.