YOU ARE DOWNLOADING DOCUMENT

Please tick the box to continue:

Transcript
Page 1: Cellphone based voting machine project report

CHAPTER 1

INTRODUCTION

1.1 VOTINGVoting is a method for a group such as a meeting or an electorate to make a

decision or to express an opinion often following discussions or debates.

1.1.1 Voting TechniquesIn India all earlier elections be it state elections or centre elections a voter used to

cast his/her vote to his/her favorite candidate by putting the stamp against his/her name

and then folding the ballot paper as per a prescribed method before putting it in the Ballot

box. This is a long, time-consuming process and very much prone to errors.

This method wanted voters to be skilled voters to know how to put a stamp, and

methodical folding of ballot paper. Millions of paper would be printed and heavy ballot

boxes would be loaded and unloaded to and from ballot office to polling station. All this

continued till election scene was completely changed by electronic voting machine. No

more ballot paper, ballot boxes, stamping, etc. all this condensed into a simple box called

ballot unit of the electronic voting machine.

1.1.2 Electronic Voting MachineThe complete EVM consists mainly of two units - (a) Control Unit and (b)

Balloting Unit with cable for connecting it with Control unit. A Balloting Unit caters up-

to 16 candidates. Four Balloting Units linked together catering in all to 64 candidates can

be used with one control unit. The control unit is kept with the Presiding Officer and the

Balloting Unit is used by the voter for polling.

The Balloting Unit of EVM is a small Box-like device, on top of which each

candidate and his/her election symbol is listed like a big ballot paper. Against each

candidate's name, a red LED and a blue button is provided. The voter polls his vote by

pressing the blue button against the name of his desired candidate.

1

Page 2: Cellphone based voting machine project report

1.1.3 Tele voting MachineTele-voting is a method of decision making and opinion polling conducted by

telephone. TVM has the major unit i.e. control unit. And the heart of the machine is a

microcontroller which controls all the ICs and components connected to it. It can cater

large number of candidates and even further its capacity can be increased by interfacing it

with 8255.

In this a voter calls up the number with which the machine is connected and the

system automatically activates and the voice message already stored on voice processor

chip gets played and on following the voice script voter casts his vote by pressing the

respective key of his phone. And the vote cast gets stored in flash memory instantly. All

vote cast can be checked later with the help of couple of switches and LCD display. Reset

keys are also provided to reset the machine for next time.

1.2 ADVANTAGES OF TVMThe TVMs have following advantages:

Elimination of polling queues.

Can be interfaced with PC to generate back-ups

The saving of considerable printing stationery and transport of large volumes of

electoral material,

Easy transportation, storage, and maintenance,

No invalid votes,

Reduction in polling time.

Easy and accurate counting without any mischief at the counting centre

Eco-friendly.

1.3 COMPARE A ND CONTRAST: PAPER VOTING, EVM and TVM We have so far discussed three different voting systems. These systems are

being used or considered obsolete because of certain positive and negative points. These

are summarized as follows:

Device type

Ballot paper : Papers and boxes

2

Page 3: Cellphone based voting machine project report

EVM : Embedded system with Assembly code

TVM : Embedded system with Assembly code

Visual Output

Ballot paper : Stamp on paper

EVM : Single LED against each candidate's name

TVM : LCD screen and one LED

Security Issues

Ballot paper : No security provided by the system, neither during polling nor

during voting.

EVM : During polling, a facility is provided to seal the machine in case of

booth capturing. No further voting can be done afterwards.

TVM : machine is disconnected from the telephone line. No more calls can

be received afterward.

Power Supply

Ballot paper : No power supply required.

EVM : 6V alkaline batteries or electricity.

TVM : Electricity and supply from exchange.

Capacity

Ballot paper : As much a ballot box can hold.

EVM : 3840 Votes.

TVM : Depends on the size of flash memory attached.

3

Page 4: Cellphone based voting machine project report

1.4 EXISTING SYSTEMBut this electronic voting machine has its disadvantages too. These areas of

deficiency are not much of a concern to a layman, but for an intelligent voter this must be

eliminated for a secure election. The few technical disadvantages are given as:

Microprocessor based design, which requires a no. of supporting components like

memory, peripheral interface, etc.

Long polling queues at the centre.

Existing system costs around 12000 INR(300$)

1.5 PROPOSED SYSTEMAll these faults motivated us to make this enhanced version of EVM. The faults

which are eliminated are summarized as follows:

Microcontroller replaced microprocessor, which made the EVM closer to real

time operation making it faster, more reliable and unique.

More user friendly and interactive LCD display

Proposed Module costs around Rs 2000.

Elimination of polling queues had been the major factor.

4

Page 5: Cellphone based voting machine project report

TRANSFORMER

VOLTAGE REGULATO

R

RECTIFIER FILTER

CHAPTER 2

POWER SUPPLY

2.1 INTRODUCTION

These days almost all the electronic equipments include a circuit that converts AC

supply into DC supply. The part of equipment that converts AC into DC is known as AC

to DC converter. In general, at the input of the power supply is a transformer. It is

followed by a rectifier, a smoothing filter and then by a voltage regulator circuit.

2.2 COMPONENTS OF POWER SUPPLY

Power supply consists of four components:-

(i) Step-Down Transformer

(ii) Rectifier

(iii) Filter

(iv) Voltage Regulator

Block diagram of such a supply is shown below:-

Fig. 2.1 Block diagram

5

Page 6: Cellphone based voting machine project report

2.2.1 Step Down Transformer

A transformer in which the output (secondary) voltage is less than the input

(primary) voltage is called step down transformer. Alternating current is passed through

the primary coil which creates the changing magnetic field in iron core. The changing

magnetic field then induces alternating current of the same frequency in the secondary

coil (the output). A step down transformer has more turns of wire on the primary coil

than in secondary coil which makes a smaller induced voltage in the secondary coil.

The transformer equation relates the number of turns of wire to the difference in

voltage between the primary and secondary coils.

Vp/Vs = Np/Ns ...(2.1)

Vp is the voltage in the primary coil.

Vs is the voltage in the secondary coil.

Np is the number of turns of wire on the primary coil.

Ns is the number of turns of wire on the secondary coil.

2.2.2 Rectifier

Rectifier is defined as an electronic device used for converting A.C voltage into

unidirectional voltage. A rectifier utilizes unidirectional conduction device like P-N

junction diode.

There are three types of rectifier:-

a. Half wave rectifier.

b. Full wave center tap rectifier.

c. Full wave bridge rectifier.

6

Page 7: Cellphone based voting machine project report

7805

2.2.3 Filter

The output from any of the rectifier circuits is not purely D.C but also has some

A.C components, called ripples, along it. Therefore such supply is not useful for driving

sophisticated electronic devices/circuits. Hence, it becomes essential to reduce the ripples

from the pulsating D.C supply available from rectifier circuits to the minimum. This is

achieved by using a filter or smoothing circuit which removes the A.C components and

allows only the D.C component to reach the load. A filter circuit should be placed

between the rectifier and the load.

2.2.4 Voltage RegulatorVoltage Regulator (regulator), usually having three legs, converts varying input

voltage and produces a constant regulated output voltage.

7805 voltage regulator has three pins:-

a. Input:- For 7805 the rectified and filtered voltage coming at this pin must be

between 8 to 18V in order to get stable 5V DC output at the output pin.

INPUT O OUTPUT

GND

Fig. 2.2 Pin configuration

b. Ground:- This pin is connected to the ground of the circuit to which this 5V DC

supply is provided.

c. Output:- If the input voltage at input pin is between 8-18V then at the output pin a

stable 5V DC voltage will be available.

7805 can give +5V output at about 150 mA current, but it can be increased to 1A when

good cooling is added to 7805 regulator chi

7

Page 8: Cellphone based voting machine project report

2.3 5V DC POWER SUPPLY USING FULL WAVE CENTER TAP

RECTIFIER

The transformer supplies the source voltage for two diode rectifiers, D1 and D2.

This transformer has a center-tapped, low-voltage secondary winding that is divided

into two equal parts (W1 and W2). W1 provides the source voltage for D1, and W2

provides the source voltage for D2. The connections to the diodes are arranged so that

the diodes conduct on alternate half cycles. When the center tap is grounded, the

voltages at the opposite ends of the secondary windings are 180 degrees out of phase

with each other. Thus, when the voltage at point A is positive with respect to ground,

the voltage at point B is negative with respect to ground. Let's examine the operation of

the circuit during one complete cycle.

During the first half cycle (indicated by the solid arrows), the anode of D1 is

positive with respect to ground and the anode of D2 is negative. As shown, current

flows from ground (center tap) to point A, through diode D1 to point B and to point D.

When D1 conducts, it acts like a closed switch so that the positive half cycle is felt

across the load (RL).

During the second half cycle (indicated by the dotted lines), the polarity of the

applied voltage has reversed. Now the anode of D2 is positive with respect to ground

and the anode of D1 is negative. Now only D2 can conduct. Current now flows, as

shown, from point C to point B through diode D2 then to point F and back to point D.

Now during both the cycles the capacitor C1 quickly charges to the peak voltage

but when the input voltage becomes less than peak voltage the capacitor discharges

through load resistance and loses charge. But because of large load resistance the

discharging time is large and hence capacitor does not have sufficient time to discharge

appreciably. Due to this the capacitor maintains a sufficiently large voltage across the

load.

8

Page 9: Cellphone based voting machine project report

Fig. 2.3 Centre-tap full-wave rectifier

The voltage across the capacitor is applied to 7805 voltage regulator which

provides a constant 5V D.C. voltage at its output.

Fig. 2.4 Output waveforms of centre-tap full-wave rectifier

9

Page 10: Cellphone based voting machine project report

Fig. 2.5 Output waveform of voltage regulator.

10

Page 11: Cellphone based voting machine project report

CHAPTER 3

DTMF RECEIVER

3.1 INTRODUCTIONDTMF stands for Dual Tone Multi Frequency. In TVM we are required to convey

the information of phone key pressed by the voter to the microcontroller for further

processing. DTMF receiver converts the analog signal to digital signal that could be fed

to the microcontroller through demultiplexer. In this project we have used MT8870DE

series of DTMF receiver.

3.2 GENERAL DESCRIPTIONThe MT8870DE series are Dual Tone Multi Frequency (DTMF) receivers

integrated with digital decoder and band-split filter functions. The MT8870DE type

supply power-down mode and inhibit mode operations. It uses the digital counting

techniques to detect and decode all the 16 DTMF tone pairs into a 4-bit code output.

Highly accurate switched capacitor filters are employed to divide tone (DTMF) signals

into low and high group signals. A built-in dial tone rejection circuit is provided to

eliminate the need for pre-filtering.

3.2.1 Features Operating voltage: 2.5V~5.5V

Minimal external components

No external filter is required

Low standby current (on power down mode)

Excellent performance

Tristate data output for µC interface

3.58MHz crystal or ceramic resonator

1633Hz can be inhibited by the INH pin

11

Page 12: Cellphone based voting machine project report

MT8870DE: 18-pin SOP package

3.2.2 Pin Configuration

Fig. 3.1 Pin configuration

12

Page 13: Cellphone based voting machine project report

Pin Name I/O Internal Connection Description

Vp I OPERATIONAL

AMPLIFIER

Operational amplifier non-inverting

input

Vn I Operational amplifier inverting input

Gs O Operational amplifier output terminal

VRef O VREF Reference voltage output, normally

VDD/2

X1 I

OSCILLATOR

The system oscillator consists of an

inverter, a bias resistor and the

necessary load capacitor on chip. A

standard 3.579545MHz crystal

connected to X1 and X2 terminals

implements the oscillator function.

X2 O

PWDN I CMOS IN

Pull-low

Active high. This enables the device to go into power down mode and inhibits the oscillator.

Pin Name I/O Internal Connection Description

INH I CMOS IN

Pull-low

Logic high. This inhibits the detection

of tones representing characters A, B,

C and D. This pin input is internally

pulled down.

Vss --- --------- Negative power supply

13

Page 14: Cellphone based voting machine project report

OE I CMOS IN

Pull-high

D0~D3 output enable, high active

D0-D3 O CMOS OUT

Tristate

Receiving data output terminals

OE=_H_: Output enable

OE=_L_: High impedance

DV O CMOS OUT Data valid output When the chip

receives a valid tone (DTMF) signal,

the DV goes high; otherwise it remains

low.

EST O CMOS OUT Early steering output (see Functional

Description)

RT/GT I/O CMOS IN/OUT Tone acquisition time and release time

can be set through connection with

external resistor

Pin Name I/O Internal Connection Description

Vdd --- ----------- Positive power supply, 2.5V~5.5V for

normal operation

DVB O CMOS OUT One-shot type data valid output, normal

high, when the chip receives a valid

time (DTMF) signal, the DVB goes

low for 10ms.

Table 3.1 Pin Description

14

Page 15: Cellphone based voting machine project report

3.3 FUNCTIONAL DESCRIPTION

The MT8870DE series tone decoders consist of three band pass filters and two

digital decode circuits to convert a tone (DTMF) signal into digital code output. The pre-

filter is a band rejection filter which reduces the dialing tone from 350Hz to 400Hz. The

low group filter filters low group frequency signal output whereas the high group filter

filters high group frequency signal output. When each signal amplitude at the output

exceeds the specified level, it is transferred to full swing logic signal. When input signals

are recognized to be effective, DV becomes high, and the correct tone code (DTMF) digit

is transferred.

When one of the telephone set's buttons is pressed two tones are produced: One

signifying the row and the other the column. The frequencies are chosen thus that they

don't contain harmonic frequencies of each other. Normal human speech doesn't contain

mixed frequencies that are stable for a significant duration.

1 2 3 A 697

4 5 6 B 770

7 8 9 C 852

0 * # D 941

1209 1336 1477 1633 Hz

Table 3.2 Dual Tone Multi Frequencies

15

Page 16: Cellphone based voting machine project report

When the voltage of RT/GT changes from 0 to VTRT (2.35V for 5V supply), the

input signal is effective and the correct code will be created by the code detector. After

D0~D3 are completely latched, DV output becomes high. When the voltage of RT/GT

falls down from VDD to VTRT (i.e.., when there is no input tone), DV output becomes

low, and D0~D3 keeps data until a next valid tone input is produced.

16

Page 17: Cellphone based voting machine project report

CHAPTER 4

MICROCONTROLLER AT89S52

4.1 INTRODUCTIONThe AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller

with 8K bytes of in-system programmable Flash memory. The device is manufactured

using Atmel’s high-density nonvolatile memory technology and is compatible with the

industry- standard 80C51 instruction set and pin out. The on-chip Flash allows the

program memory to be reprogrammed in-system or by a conventional nonvolatile

memory programmer. By combining a versatile 8-bit CPU with in-system programmable

Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which

provides a highly-flexible and cost-effective solution to many embedded control

applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256

bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit

timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-

chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic

for operation down to zero frequency and supports two software selectable power saving

modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial

port, and Interrupt system to continue functioning. The Power-down mode saves the

RAM contents but freezes the oscillator, disabling all other chip functions until the next

interrupt or hardware reset.

17

Page 18: Cellphone based voting machine project report

4.2 FEATURES

– Compatible with MCS-51® Products

– 8K Bytes of In-System Programmable (ISP) Flash Memory

– Endurance: 1000 Write/Erase Cycles

– 4.0V to 5.5V Operating Range

– Fully Static Operation: 0 Hz to 33 MHz

– Three-level Program Memory Lock

– 256 x 8-bit Internal RAM

– 32 Programmable I/O Lines

– Three 16-bit Timer/Counters

– Eight Interrupt Sources

– Full Duplex UART Serial Channel

– Low-power Idle and Power-down Modes

– Interrupt Recovery from Power-down Mode

– Watchdog Timer

– Dual Data Pointer

– Power-off Flag

– Fast Programming Time

– Flexible ISP Programming (Byte and Page Mode)

18

Page 19: Cellphone based voting machine project report

4.3 BLOCK DIAGRAM

Figure 4.1

19

Page 20: Cellphone based voting machine project report

4.4 PIN DESCRIPTION

Figure 4.2

VCC Supply voltage.

GND Ground.

20

Page 21: Cellphone based voting machine project report

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each

pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins

can be used as high impedance inputs. Port 0 can also be configured to be

the multiplexed low-order address/data bus during accesses to external

program and data memory. In this mode, P0 has internal pull-ups. Port 0

also receives the code bytes during Flash programming and outputs the

code bytes during program verification. External pull-ups are required

during program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1

output buffers can sink/source four TTL inputs. When 1s are written to

Port 1 pins, they are pulled high by the internal pull-ups and can be used

as inputs. As inputs, Port 1 pins that are externally being pulled low will

source current (IIL) because of the internal pull-ups. In addition, P1.0 and

P1.1 can be configured to be the timer/counter 2 external count input

(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively,

as shown in the following table. Port 1 also receives the low-order address

bytes during Flash programming and verification.

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2

output buffers can sink/source four TTL inputs. When 1s are written to

Port 2 pins, they are pulled high by the internal pull-ups and can be used

as inputs. As inputs, Port 2 pins that are externally being pulled low will

source current (IIL) because of the internal pull-ups. Port 2 emits the high-

order address byte during fetches from external program memory and

21

Page 22: Cellphone based voting machine project report

during accesses to external data memory that use 16-bit addresses. In this

application, Port 2 uses strong internal pull-ups when emitting 1s.

Table 4.1 Alternate Functions of Port1

Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3

output buffers can sink/source four TTL inputs. When 1s are written to

Port 3 pins, they are pulled high by the internal pull-ups and can be used

as inputs. As inputs, Port 3 pins that are externally being pulled low will

source current (IIL) because of the pull-ups. Port 3 receives some control

signals for Flash programming and verification. Port 3 also serves the

functions of various special features of the AT89S52, as shown in the

following table.

22

Page 23: Cellphone based voting machine project report

Table 4.2 Alternate Functions of Port3

RST Reset input. A high on this pin for two machine cycles while the oscillator

is running resets the device. This pin drives high for 98 oscillator periods

after the Watchdog times out. The DISRTO bit in SFR AUXR (address

8EH) can be used to disable this feature. In the default state of bit

DISRTO, the RESET HIGH out feature is enabled.

ALE/PROGAddress Latch Enable (ALE) is an output pulse for latching the low byte

of the address during accesses to external memory. This pin is also the

program pulse input (PROG) during Flash programming. In normal

operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency

and may be used for external timing or clocking purposes. Note, however,

that one ALE pulse is skipped during each access to external data

memory. If desired, ALE operation can be disabled by setting bit 0 of SFR

location 8EH. With the bit set, ALE is active only during a MOVX or

MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the

23

Page 24: Cellphone based voting machine project report

ALE-disable bit has no effect if the microcontroller is in external

execution mode.

PSEN Program Store Enable (PSEN) is the read strobe to external program

memory. When the AT89S52 is executing code from external program

memory, PSEN is activated twice each machine cycle, except that two

PSEN activations are skipped during each access to external data memory.

EA/VPP External Access Enable. EA must be strapped to GND in order to enable

the device to fetch code from external program memory locations starting

at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed,

EA will be internally latched on reset. EA should be strapped to VCC for

Internal program executions. This pin also receives the 12-volt

programming enable voltage (VPP) during Flash programming.

XTAL1 Input to the inverting oscillator amplifier and input to the internal clock

operating circuit.

XTAL2 Output from the inverting oscillator amplifier.

24

Page 25: Cellphone based voting machine project report

4.5 MEMORY ORGANISATIONMCS-51 devices have a separate address space for Program and Data Memory. Up to

64K bytes each of external Program and Data Memory can be addressed.

4.5.1 Program MemoryIf the EA pin is connected to GND, all program fetches are directed to external

memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses

0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H

through FFFFH are to external memory.

4.5.2 Data MemoryThe AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes

occupy a parallel address space to the Special Function Registers. This means that the

upper 128 bytes have the same addresses as the SFR space but are physically separate

from SFR space. When an instruction accesses an internal location above address 7FH,

the address mode used in the instruction specifies whether the CPU accesses the upper

128 bytes of RAM or the SFR space. Instructions which use direct addressing access the

SFR space. For example, the following direct addressing instruction accesses the SFR at

location 0A0H (which is P2).

EXAMPLE: MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For

example, the following indirect addressing instruction, where R0 contains 0A0H,

accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).

EXAMPLE: MOV @R0, #data

Note that stack operations are examples of indirect addressing, so the upper 128 bytes of

data RAM are available as stack space.

25

Page 26: Cellphone based voting machine project report

4.6 FUNCTIONAL DESCRIPTIONThe function of the pins of microcontroller AT89S52 used in the TELEVOTING

MACHINE can be described as follows:

– Pin no 1,2,3,4 of PORT 1 are connected to get the vote data input from 74154

(BCD to DECIMAL decoder) for four different candidates.

– Pin no 5,6,7,8 are connected to four push-button switches to check the vote data

casted for individual candidate.

– Pin no 9 is connected to the reset button to reset the microcontroller automatically

when we switch on the power. It is a Power on reset.

– Pin no 10 of PORT 3 is connected to a push-button switch to check the total vote

caste for all the candidates.

– Pin no 11 and 12 of PORT 3 are connected to two push-button switches (R-1 and

R-2) to reset or clear all the vote data. To reset the data firstly we will press the R-

1 button then press the R-2 button and again press the R-1 button. Then all the

vote data has to be cleared from the AT24c02 flash memory.

– Crystal is connected to the pin no 18(XTAL 1) and pin no 19(XTAL 2) providing

11.0592 MHz frequency.

– Pin no 20 is connected to the ground (GND).

– Pin no 21 and 22 of PORT 2 are connected to pin no 5(SDA- serial data) and pin

no 6 (SCL- serial clock input) of AT24c02 flash memory.

– Pin no 26, 27, 28 of PORT 2 are connected to the pin no 4, 5, 6 of LCD display.

Pin no 26 is connected to RS (register select), pin no 27 is connected to R/W

(read/write select) and pin no 28 is connected to En(chip enable signal) of LCD.

– Pin no 31( EA/Vpp) should be strapped to VCC for internal program executions,

this pin also receives the 12-volt programming enable voltage (VPP) during flash

programming.

– Pin no 32 – 39 of PORT 0 are connected to the DB0-DB7 (8-bit) data lines of

LCD display.

26

Page 27: Cellphone based voting machine project report

– Pin no 40 is connected to the positive supply (Vcc)

CHAPTER 5

LIQUID CRYSTAL DISPLAY

5.1 INTRODUCTION

Figure 8.FFFF

FIG. 5.1Liquid Crystal Display also called as LCD is very helpful in providing user

interface as well as for debugging purpose. The most common type of LCD controller is

HITACHI 44780 which provides a simple interface between the controller & an LCD.

These LCD's are very simple to interface with the controller as well as are cost effective.

The most commonly used ALPHANUMERIC displays are 1x16 (Single Line &

16 characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty

characters per line).

The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The

number on data lines depends on the mode of operation. If operated in 8-bit mode then 8

data lines + 3 control lines i.e. total 11 lines are required. And if operated in 4-bit mode

then 4 data lines + 3 control lines i.e. 7 lines are required. How do we decide which mode

to use? It’s simple if you have sufficient data lines you can go for 8 bit mode & if there is

27

Page 28: Cellphone based voting machine project report

a time constrain i.e. display should be faster then we have to use 8-bit mode because

basically 4-bit mode takes twice as more time as compared to 8-bit mode.

5.2 PIN DESCRIPTION

Figure 5.2

Pin Symbol Function

1 Vss Ground

2 Vdd Supply Voltage

Pin Symbol Function

3 Vo Contrast Setting

4 RS Register Select

5 R/W Read/Write Select

6 En Chip Enable Signal

7-14 DB0-DB7 Data Lines

28

Page 29: Cellphone based voting machine project report

15 A/Vee Gnd for the backlight

16 K Vcc for backlight

Table 5.1 Pin Description of LCD

1.RS(Register Select) When RS is low (0), the data is to be treated as a command. When RS is high (1), the

data being sent is considered as text data which should be displayed on the screen.

2. R/W(Read/Write)When R/W is low (0), the information on the data bus is being written to the LCD. When

RW is high (1), the program is effectively reading from the LCD. Most of the times there

is no need to read from the LCD so this line can directly be connected to GND thus

saving one controller line.

3. E(enable)The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW

signal is required to latch the data. The LCD interprets and executes our command at the

instant the EN line is brought low. If you never bring EN low, your instruction will never

be executed.

4. D0-D7The 8 bit data pins D0-D7 are used to send information to the LCD or read the contents

of the LCD’s internal registers. .To display any character on LCD micro controller has to

send its ASCII value to the data bus of LCD. For e.g. to display 'AB' microcontroller has

to send two hex bytes 41h and 42h respectively LCD display used here is having 16x2

size. It means 2 lines each with 16 characters.

29

Page 30: Cellphone based voting machine project report

In 4-bit mode the data is sent in nibbles, first we send the higher nibble and then the

lower nibble. To enable the 4-bit mode of LCD, we need to follow special sequence of

initialization that tells the LCD controller that user has selected 4-bit mode of operation.

We call this special sequence as resetting the LCD. Following is the reset sequence of

LCD. Wait for about 20mS Send the first init value (0x30) Wait for about 10mS Send second init value (0x30) Wait for about 1mS Send third init value (0x30) Wait for 1mS Select bus width (0x30 - for 8-bit and 0x20 for 4-bit) Wait for 1Ms

5.3 LCD CONNECTIONS IN 4-BIT MODE

Figure 5.3

30

Page 31: Cellphone based voting machine project report

Sending data/command in 4-bit Mode

The common steps are: Mask lower 4-bits Send to the LCD port Send enable signal Mask higher 4-bits Send to LCD port Send enable signal

5.4 FUNCTIONAL DESCRIPTION

5.4.1 Writing and reading the data from the LCDWriting data to the LCD is done in several steps:

1) Set R/W bit to low

2) Set RS bit to logic 0 or 1 (instruction or character)

3) Set data to data lines (if it is writing)

4) Set E line to high

5) Set E line to low

Read data from data lines (if it is reading):

1) Set R/W bit to high

2) Set RS bit to logic 0 or 1 (instruction or character)

3) Set data to data lines (if it is writing)

4) Set E line to high

5) Set E line to low

31

Page 32: Cellphone based voting machine project report

EXAMPLE:

Fig. 5.4

5.5 LCD COMMAND CODES

1. CLEAR DISPLAY SCREEN

2. RETURN HOME

4 DECREMENT CURSOR ( SHIFT CURSOR TO LEFT)

5 SHIFT DISPLAY RIGHT.

6. INCREMENT CURSOR ( SHIFT CURSOR TO RIGHT)

7. SHIFT DISPLAY LEFT

8. DISPLAY OFF, CURSOR OFF

A DISPLAY OFF CURSOR ON

C DISPLAY ON CURSOR OFF

E DISPLAY ON CURSOR BLINKING

F. DISPLAY ON CURSOR BLINKING.

10. SHIFT CURSOR POSITION TO LEFT

32

Page 33: Cellphone based voting machine project report

14. SHIFT CURSOR POSITION TO RIGHT

18. SHIFT THE ENTIRE DISPLAY TO THE LEFT

1C SHIFT THE ENTIRE DISPLAY TO THE RIGHT

80 FORCE CURSOR TO BEGINNING OF IST LINE

C0 FORCE CURSOR TO BEGINNING OF 2ND LINE

38 2 LINES AND 5 X 7 MATRIX

5.5.1 Checking the busy status of LCD

The code to check the status of LCD whether it is busy or not is as follows:

WAIT_LCD:

SETB EN ;Start LCD command

CLR RS ;It's a command

SETB RW ;It's a read command

MOV DATA, #0FFh ;Set all pins to FF initially

MOV A,DATA ;Read the return value

JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy

CLR EN ;Finish the command

CLR RW ;Turn off RW for future commands

RET

Thus, our standard practice will be to send an instruction to the LCD and then call

our WAIT_LCD routine to wait until the instruction is completely executed by the LCD.

This will assure that our program gives the LCD the time it needs to execute instructions

and also makes our program compatible with any LCD, regardless of how fast or slow it

is.

33

Page 34: Cellphone based voting machine project report

5.5.2 Initializing the LCDThe code to initialize the LCD is as follows:

INIT_LCD:

SETB EN

CLR RS

MOV DATA, #38h

CLR EN

LCALL WAIT_LCD

SETB EN

CLR RS

MOV DATA, #0Eh

CLR EN

LCALL WAIT_LCD

SETB EN

CLR RS

MOV DATA, #06h

CLR EN

LCALL WAIT_LCD

RET

Having executed this code the LCD will be fully initialized and ready for us to

send display data to it.

5.5.3 Clearing the displayThe code to clear the LCD display is as follows:

CLEAR_LCD:

SETB EN

CLR RS

MOV DATA,#01h

CLR EN

LCALL WAIT_LCD

RET

34

Page 35: Cellphone based voting machine project report

we may clear the LCD at any time by simply executing an LCALL

CLEAR_LCD.

5.5.4 Writing text to the LCDThe code to write any text to the LCD is as follows:

WRITE_TEXT:

SETB EN

SETB RS

MOV DATA,A

CLR EN

LCALL WAIT_LCD

RET

The WRITE_TEXT routine that we just wrote will send the character in the

accumulator to the LCD which will, in turn, display it. Thus to display text on the LCD

all we need to do is load the accumulator with the byte to display and make a call to this

routine.

35

Page 36: Cellphone based voting machine project report

CHAPTER 6

PROJECT DESCRIPTION

6.1 CIRCUIT DIAGRAM

Figure 6.1

36

Page 37: Cellphone based voting machine project report

6.2 Functional Description

The function of the pins of microcontroller AT89S52 used in the electronic voting

machine can be described as follows:

– Pin no 1,2,3,4 of PORT 1 are connected to get the vote data input for four

different candidates.

– Pin no 5,6,7,8 are connected to four push-button switches to check the vote data

casted for individual candidate.

– Pin no 9 is connected to the reset button to reset the microcontroller automatically

when we switch on the power. It is a Power on reset.

– Pin no 10 of PORT 3 is connected to a push-button switch to check the total vote

caste for all the candidates.

– Pin no 11 and 12 of PORT 3 are connected to two push-button switches to reset or

clear all the vote data. To reset the data firstly we will press the R-1 button then

press the R-2 button and again press the R-1 button. Then all the vote data has to

be cleared from the AT24c02 flash memory.

– Crystal is connected to the pin no 18(XTAL 1) and pin no 19(XTAL 2) providing

11.0592 MHz frequency.

– Pin no 20 is connected to the ground (GND).

– Pin no 21 and 22 of PORT 2 are connected to pin no 5(SDA- serial data) and pin

no 6 (SCL- serial clock input) of AT24c02 flash memory.

– Pin no 26, 27, 28 of PORT 2 are connected to the pin no 4, 5, 6 of LCD display.

Pin no 26 is connected to RS (register select), pin no 27 is connected to R/W

(read/write select) and pin no 28 is connected to En(chip enable signal) of LCD.

– Pin no 31( EA/Vpp) should be strapped to VCC for internal program executions,

this pin also receives the 12-volt programming enable voltage (VPP) during flash

programming.

37

Page 38: Cellphone based voting machine project report

– Pin no 32 – 39 of PORT 0 are connected to the DB0-DB7 (8-bit) data lines of

LCD display.

– Pin no 40 is connected to the positive supply (Vcc).

6.3 WORKING OF THE SYSTEMThe working of this project is controlled by a microcontroller ATMEL AT89S52

and EEPROM is used for memory storage. The project works in the following ways:

1. Switch on power supply.

2. Message ‘VOTING MACHINE’ , ‘INDIA VOTING’ will appear on LCD.

3. Controller switch is pressed after which the message ‘Cast the Vote’ appears.

4. After casting the vote, one hears the buzzer after which no other votes will be casted

until the controller button is again pressed.

5. To check the number of vote press the button on the PCB and number of votes of each

candidate & total number of vote will appear on LCD.

6. Two memory clear pins are provided for clearing the EEPROM.

6.4 LIST OF COMPONENTS

S.NO. LIST OF COMPONENTS QUANTITY

1 220V, 50HZ, 9V-0-9V CENTRE TAP

TRANSFORMER

1

2 7805 VOLTAGE REGULATOR 2

3 LIQUID CRYSTAL DISPLAY 1

4 8Ω LOUD SPEAKER 1

5 CONDENSER MICROPHONE 1

6 89S52 MICROCONTROLLER 1

7 MT8870 DTMF RECEIVER 1

38

Page 39: Cellphone based voting machine project report

8 CD74HC154E Demultiplexer 1

9 24C02 EEPROM 1

10 LED 7

11 IN4148 DIODE 1

12 IN 4007 DIODE 3

13 1000µF,16V ELECTROLYTIC CAPACITOR 2

14 470Ω RESISTOR 3

15 LED 7

16 PUSH BUTTON SWITCH 11

17 10KΩ RESISTOR 5

18 4.7KΩ RESISTOR 4

19 10µF,100V ELECTROLYTIC CAPACITOR 1

20 22KΩ RESISTOR 2

21 100KΩ RESISTOR 9

22 3.58 MHZ CRYSTAL OSCILLATOR 1

23 0.1µF CERAMIC CAPACITOR 4

24 330KΩ RESISTOR 1

25 1KΩ RESISTOR 8

26 27µF CERAMIC CAPACITOR 2

27 10µF,50V ELECTROLYTIC CAPACITOR 1

28 0.01µF CERAMIC CAPACITOR 1

29 100Ω RESISTOR 1

30 270Ω RESISTOR 1

31 33KΩ RESISTOR 1

32 22µF CERAMIC CAPACITOR 1

33 BC 548 NPN TRANSISTOR 5

34 11.0592MHZ CRYSTAL OSCILLATOR 1

39

Page 40: Cellphone based voting machine project report

Table 6.1 List of ComponentS

CHAPTER 7

CONCLUSIONS

7.1 Area of Applications

Fast track voting which could be used in small scale elections, like resident

welfare association, “panchayat” level election and other society level elections.

It could also be used to conduct opinion polls during annual share holders

meeting.

It could also be used to conduct general assembly elections where number of

candidates are less than or equal to eight in the current situation.

It is used in various TV serials as for public opinion.

7.2 Future Scope

Number of candidates could be increased by using other microcontroller.

It could be interfaced with printer to get the hard copy of the result almost

instantly from the machine itself.

It could also be interfaced with the personal computer and result could be stored

in the central server and its backup could be taken on the other backend servers.

40

Page 41: Cellphone based voting machine project report

Again, once the result is on the server it could be relayed on the network to

various offices of the election conducting authority. Thus our project could make

the result available any corner of the world in a matter of seconds.

CHAPTER 8

CODING

#include<reg52.h>#define lcdport P0sbit rs=P2^2; sbit rdwr=P2^1;sbit lcde=P2^0;sbit cand1=P1^0;sbit cand2=P1^1;sbit cand3=P1^2;sbit cand4=P1^3;sbit cand5=P1^4;sbit cand6=P1^5;sbit cand7=P1^6;sbit cand8=P1^7;sbit party1=P2^3;sbit party2=P2^4;sbit party3=P2^5;sbit party4=P2^6;sbit party5=P2^7;sbit party6=P3^0;sbit party7=P3^1;sbit party8=P3^2;unsigned int cand1count,cand2count,cand3count,cand4count,cand5count,cand6count,cand7count,cand8count;

/****************FUNCTION FOR SWAPPING LSBYTE AND MSBYTE OF THE DATA***************/

unsigned char xch(unsigned char data1)

41

Page 42: Cellphone based voting machine project report

unsigned char temp,temp1;temp=data1;data1=data1>>4;temp1=data1;data1=temp;data1=data1<<4;data1=data1|temp1;return(data1);

/************ delay for 20 micro second **********************************************/

void delay()unsigned char i,j;for(i=0;i<80;i++)for(j=0;j<120;j++)

/***************** FUNCTION FOR SENDING LCD COMMANDS***********************************/ void send_command(unsigned char data1) unsigned char newdata; rs=0; delay(); lcde=1; delay(); lcdport=data1;

lcde=0; delay(); lcde=1; newdata=xch(data1); lcdport=newdata; delay(); lcde=0; delay(); rs=1;

42

Page 43: Cellphone based voting machine project report

/************************** FUNCTION FOR WRITING DATA ON THE LCD***********************/

void send_data(unsigned char data1) unsigned char newdata; rs=1; delay(); lcde=1; delay(); lcdport=data1;

lcde=0; delay(); lcde=1; newdata=xch(data1); lcdport=newdata; delay(); lcde=0; delay(); rs=0;

/*********** COMMAND FOR BRINGING LCD CURSOR ON SECOND LINE ***************************/

void next_line()send_command(0xc0);delay();

/**************COMMAND FOR CLEARING LCD AND BRINGING LCD CURSOR ON FIRST LINE********/

void clr_lcd() send_command(0x01);delay();send_command(0x02);delay();

43

Page 44: Cellphone based voting machine project report

/* FUNCTION FOR DISPLAYING DATA ON THE LCD *************************************/

void dispslogan(unsigned char *p) unsigned char data1; while(*p)

data1=*p; send_data(data1);p++;

/********************** INITIALIZATION OF LCD ***********************************/ void lcdinit() clr_lcd(); /*FUNCTION SET */ send_command(0x28); delay(); send_command(0x28); delay(); send_command(0x28); delay(); send_command(0x06); //ENTRY MODE delay();

send_command(0x0e); //DISPLAY ON/OFF delay();

clr_lcd();

void count_display(unsigned int data1)unsigned int a[4];int i=0;while(data1!=0)a[i++]=data1%10;data1=data1/10;i--;

44

Page 45: Cellphone based voting machine project report

for(;i>=0;i--)send_data(a[i] + 48);void cand1chk()if(cand1==0 && vote_switchflag==1)next_line();dispslogan("CONG_OK ");vote_switchflag=0;cand1count++;void cand2chk()if(cand2==0 && vote_switchflag==1)next_line();dispslogan("BJP_OK ");vote_switchflag=0;cand2count++;

vote_switchflag=0;cand7count++;void cand8chk()if(cand8==0 && vote_switchflag==1)next_line();dispslogan("CP1_OK ");vote_switchflag=0;cand8count++;void voteswitchchk()if(vote_switch==0)vote_switchflag=1;void party1chk()if(party1==0)next_line();dispslogan("CONG= ");send_command(0xc5);

45

Page 46: Cellphone based voting machine project report

count_display(cand1count);

void party2chk()if(party2==0)next_line();dispslogan("BJP= ");send_command(0xc5);count_display(cand2count);void party3chk()if(party3==0)next_line();dispslogan("RSS= ");send_command(0xc5);count_display(cand3count);void party4chk()if(party4==0)next_line();dispslogan("BSP= ");send_command(0xc5);count_display(cand4count);void party5chk()if(party5==0)next_line();dispslogan("SP= ");send_command(0xc5);count_display(cand5count);void party6chk()if(party6==0)next_line();dispslogan("RJD= ");send_command(0xc5);

46

Page 47: Cellphone based voting machine project report

count_display(cand6count);void party7chk()if(party7==0)next_line();dispslogan("JDU= ");send_command(0xc5);count_display(cand7count);void party8chk()if(party8==0)next_line();dispslogan("CP1= ");send_command(0xc5);count_display(cand8count);

47

Page 48: Cellphone based voting machine project report

RESULTS AND DISCUSSION

The complete system (including all the hardware components and software routines) is

working as per the initial specifications and requirements of our project. Because of the

creative nature of the design, and due to lack of time some features could not be fine-

tuned and are not working properly. So certain aspects of the system can be modified as

operational experience is gained with it.

Initially the landline section in the circuit got hanged after 3 rings & the circuit to

automatic switch on the landline section does not work properly as the

electromagnetic relay connected earlier consumes more current when circuit is

powered on therefore, a remedy to this problem is that we have used reed relay

which has low switch & voltage ratings, capable of faster switching speeds and

mainly used for temporarily storing information in telephone exchanges.

Also, the voice processor section having APR9600 chip got hanged due to reverse

current flow in that section. To avoid this we have connected an op-amp 714 to

compensate for the same.

As the users work with the system, they develop various new ideas for the development

and enhancement of the circuit.

48

Page 49: Cellphone based voting machine project report

REFRENCES

Muhammad Ali Mazidi , Janice Gillispie Mazidi, Rolin D. Mckinlay. Second

edition, “THE 8051 MICROCONTROLLER AND EMBEDDED SYSTEM”

K. J. Ayala. Third edition, “The 8051 MICROCONTROLLER” Tutorial on

microcontroller:

www.8051projects.net/microcontroller_tutorials/Tutorial on LCD:

www.8051projects.net/lcd-interfacing/

WEBSITES www.atmel.com

www.seimens.com

www.howstuffworks.com

www.alldatasheets.com

www.efyprojects.com

www.google.com

www.eci.gov.in/Audio_VideoClips/presentation/EVM.ppt

www.rajasthan.net/election/guide/evm.htm

www.indian-elections.com/electoralsystem/electricvotingmachine.html

49


Related Documents