SMS BASED VOTING MACHINE Project Report

December 19, 2018 | Author: Rahul Garg | Category: Short Message Service, Computer Hardware, Electronics, Technology, Digital Technology
Share Embed Donate


Short Description

Download SMS BASED VOTING MACHINE Project Report ...

Description

SMS BASED VOTING MACHINE

CHAPTER 1 INTRODUCTION

1.1

Introduction Introduction to SMS Based Voting Machine

India is world‟s largest democracy. Fundamental right to vote or simply voting in elections

forms the basis of Indian democracy. In India all earlier elections a voter used to cast his vote by using ballot paper. This is a long time-consuming process and very much prone to errors. This situation 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. Cell phone based voting machine is capable of saving considerable printing stationery and transport of large volumes of electoral material. It is easy to transport, store, and maintain. It completely rules out the chance of invalid votes. It reduces of polling time, resulting in fewer problems in electoral preparations, law and order, candidate‟s expenditure, etc. and easy and accurate

counting without any mischief at the counting centre. The aim of our project is to design & develop a mobile based voting machine. This project focuses onto implement GSM (Global System for Mobile Communication) based Voting System. This system is implemented using an embedded microcontroller. The embedded microcontroller used here is AT89S52microcontroller. Actually, the aim of the project is to implement an Automatic Voting system. GSM Based voting machine is fully controlled system. There is no chance of any mistake. Primarily, the system functions with the help of different technologies like the traditional cellular network such as Global System for Mobile Communications (GSM) and other radio frequency medium. Today GSM fitted Banks, cars; ambulances, fleets and police vehicles are common sights. The functional units of our projects are GSM MODEM, LCD display, PC data base and AT89S52.

1.2

Basic Aim of Project

The aim of our project is to design & develop a mobile based voting machine. In this project user can dial the specific number from any land line or mobile phone to cast his vote. Once the user is connected to the voting machine he can enter his password & choice of vote. If  1

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

he has entered a valid choice & password his vote will be caste with two short duration  beeps. For invalid password/choice pas sword/choice long beep will be generated. User is allotted allott ed 15 seconds to enter his password & choice. A reset button is provided for resetting the system. A total key is provided to display the result. We have also used non-volatile memory for storing all data. EEPROM will preserve all information in case of power failure.

1.3

Current Market Solution Available:

At present Electronic Voting Machines ("EVM") are being used in Indian General and State Elections to implement electronic voting in part from 1999 elections and in total since 2004 elections. The EVMs reduce the time in both casting a vote and declaring the results compared to the old paper ballot system. However, EVMs have been under a cloud of  suspicion over their alleged tamping arability and security problems during elections (especially after the 2009 general elections). elections). An EVM consists of two units: •

Control Unit



Balloting Unit

The Control Unit is with the Polling Officer and the Balloting Unit is placed inside the voting compartment

Fig 1.1: Typical Electronic Voting Machine

But EVM is very complicated and there is lot of wasting of time and money so SMS voting machine can be a safer mode of casting vote with respect to Electronic Voting Machines (EVM).

1.4

Current Technology Used in Project

The current technology used in the project is SMS (Short Message Service) service based on GSM (Global System for Mobile).GSM (Global System for Mobile communications) is an open, digital cellular technology used for transmitting mobile voice and data services. 2

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

he has entered a valid choice & password his vote will be caste with two short duration  beeps. For invalid password/choice pas sword/choice long beep will be generated. User is allotted allott ed 15 seconds to enter his password & choice. A reset button is provided for resetting the system. A total key is provided to display the result. We have also used non-volatile memory for storing all data. EEPROM will preserve all information in case of power failure.

1.3

Current Market Solution Available:

At present Electronic Voting Machines ("EVM") are being used in Indian General and State Elections to implement electronic voting in part from 1999 elections and in total since 2004 elections. The EVMs reduce the time in both casting a vote and declaring the results compared to the old paper ballot system. However, EVMs have been under a cloud of  suspicion over their alleged tamping arability and security problems during elections (especially after the 2009 general elections). elections). An EVM consists of two units: •

Control Unit



Balloting Unit

The Control Unit is with the Polling Officer and the Balloting Unit is placed inside the voting compartment

Fig 1.1: Typical Electronic Voting Machine

But EVM is very complicated and there is lot of wasting of time and money so SMS voting machine can be a safer mode of casting vote with respect to Electronic Voting Machines (EVM).

1.4

Current Technology Used in Project

The current technology used in the project is SMS (Short Message Service) service based on GSM (Global System for Mobile).GSM (Global System for Mobile communications) is an open, digital cellular technology used for transmitting mobile voice and data services. 2

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

GSM supports voice calls and data transfer speeds of up to 9.6 kbps, together with the transmission of SMS (Short Message Service). GSM operates in the 900MHz and 1.8GHz bands in Europe and the 1.9GHz and 850MHz  bands in the US. The use of harmonized harmoniz ed spectrum spectru m across most of the globe, combined combin ed with GSM‟s international roaming capability, allows travellers to access the same mobile

services at home and abroad. GSM enables individuals to be reached via the same mobile number in up to 219 countries. Terrestrial GSM networks now cover more than 90% of the world‟s population. GSM

satellite roaming has also extended service access to areas where terrestrial coverage is not available.

3

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 2 CIRCUIT AND BLOCK DIAGRAM OF PROJECT 2.1 Block Diagram of Project POWER

AT89S52

PC

SUPPLY

MICROCONTROLLER

DATABASE

GSM MODEM

(VB)

EEPROM

MOBILE

LCD

Fig 2.1: Block Diagram of Project

2.1.1 Block Diagram Description A mobile is interfaced to computer where database is to be verified and AT89S52 microcontroller is also interfaced to computer (PC) to display and store database. The user  has his password stored in from of his ID number in the database of PC. The User has to send his voting information via SMS to the mobile interfaced to the microcontroller. The µc will consider a vote if the password of a person matches to his database of software in PC. The mobile interfaced to the PC will send an acknowledgment message when the vote is granted, if something goes wrong then µc will send a negative acknowledgment message via SMS to the user. If the password of the person is entered in the same order, there will be a positive vote given to the candidate to which the voter is voting. This is done in order to reduce the risk of  forcible voting. The PC data will be transfer to controller and further display at LCD.

2.1.2 GSM Modem A GSM modem is a wireless modem that works with a GSM wireless network. A GSM modem can be an external device or a PC Card PCMCIA Card. In this project GSM modem is connected to a computer through a serial cable or a USB cable. Behaving as a PC Card .It 4

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

should be inserted into one of the PC Card slots of a laptop computer. Like a GSM mobile  phone, a GSM modem requires a SIM card from a wireless carrier in order to operate computers use AT commands to control modems. These extended AT commands are defined in the GSM standards. With the extended AT commands Reading, writing, deleting and Sending SMS messages are monitored.

2.1.3 Mobile Here mobile is the user mobile who‟s SIM card number has been priory registered in voting machine. Through mobile user will have to cast his\her vote in specific format using Short Message Service (SMS).

2.1.4 PC Database Computer (PC) is used as common interface between microcontroller and GSM module. Software tool visual basic 6.0 is used to control, store and secondary display of votes. In software part two forms are made one for administration access and another for voting status display where all options are available for storage display and control.

2.1.5 AT89S52 Microcontroller In this project we interfaced AT89S52 microcontroller with computer and LCD. The AT89S52 is 40 pin IC packaged in DIP package.it is derivative of 8051 family, from Atmel Inc. AT89S52 Microcontroller is the heart of the circuit as it controls all the functions of  display, interfacing external EEPROM, LCD and computer 

2.1.6 Power Supply 7805 VOLTAGE REGULATOR The 78xx (also sometimes known as LM78xx) series of devices is a family of self-contained fixed linear voltage regulator integrated circuits. The 78xx family is a very popular choice for many electronic circuits which require a regulated power supply, due to their ease of use and relative cheapness. When specifying individual ICs within this family, the xx is replaced with a two-digit number, which indicates the output voltage the particular device is designed to provide (for example, the 7805 has a 5 volt output, while the 7812 produces 12 volts). The 78xx line is positive voltage regulators, meaning that they are designed to produce a voltage that is positive relative to a common ground. There is a related line of 79xx devices which are complementary negative voltage regulators. 78xx and 79xx ICs can be used in combination to  provide both positive and negative supply voltages in 5

the

same

circuit,

if 

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

necessary.78xx ICs have three terminals and are most commonly found in the TO220 form factor, although smaller surface- mount and larger TO3 packages ar e also available from some manufacturers. These devices typically support an input voltage which can be anywhere from a couple of volts over the intended output voltage, up to a maximum of 35 or 40 volts, and can typically provide up to around 1 or 1.5 amps of  current .

Fig 2.2: 7805 Voltage Regulator IC

2.1.7 LCD In this project 16*2 LCD is used. This LCD is interface with AT89S52 at port 2.It used to display voting result with candidates A, B, C, D.

Fig 2.3: 16*2 LCD

2.1.8 Bridge Rectifier A diode bridge is an arrangement of four diodes in a bridge configuration that provides the same polarity of output for either polarity of input. When used in its most common application, for conversion of an alternating current (AC) input into direct current a (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a rectifier with a 3-wire input from a transformer with a center-tapped secondary winding.

6

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

2.2 Circuit Diagram

Fig: 2.4: Circuit Diagram

7

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

2.2.1 Circuit Description Here port 1 is connected to the LCD to display data from the microcontroller to the LCD. The virtual terminal is used to send and receive data via serial port and is used instead of a GSM module. The HEX file of the program is loaded into the controller and the clock frequency and baud rates of all the devices are adjusted so that they work in synchronization. Some pins of port 3 are used to give the write and latching commands to the lcd.18th &19th pin is connected to the crystal oscillator. Twentieth pin is connected to a led which is the indicator of power supply MAX 232 is used in this circuit for serial communication. Crystal oscillator is used for generating the clock frequency for microcontroller. Crystal oscillator frequency for microcontroller is 11.0592MhzCapacitors in crystal oscillator is used to avoid damping. First supply is given. The rectifier circuit converts ac power into DC. Here bridge rectifier  is used for increasing the efficiency. DC voltage generated is passed through a 7805 voltage regulator, output of which is 5volts. Programme for voting procedure is embedded on the microcontroller Name of the candidates appears in the lcd screen as A ,B,C,D. Then we cast the vote through the cell  phone in a prescribed format.

8

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 3 COMPONENTS AND ITS DESCRIPTION 3.1 Component List Basic components used in this project are: Table 3.1 Component list

Sr.no 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 12.

13. 14. 15. 16. 17. 18. 19.

Component Microcontroller  LCD display LED Resistor  Crystal oscillator Capacitor  MAX 232 GSM module SIM card Copper clad Voltage regulator IC Berge strip Connecting wires ZIF Resistance array Computer setup DB-9 Connector  Switch

Specification (AT89S52) 16*2 text

1K,10K  (11.0592Mhz) (33pf,10mf(63V),) SIM300 Any 7805

Quantity 1 1 2 8 1 2 2 1 1 2 1

Male Female(16 pin)

2 As per need

40 pin

1

10k  9 slot On/off 

1 1 2 1

9

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

3.2 Component Descriptions 3.2.1 Introduction To 8052 Microcontroller:

Fig 3.1 8052 Pin diagram

Description The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel‟s high -density non-volatile memory technology and is

compatible with the industry-standard 80C51 and 80C52 instruction set and pin out. The onchip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer which provides a highlyflexible and cost-effective solution to many embedded control applications.

10

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Features of 8052: • Compatible with MCS-51™ Products • 8K Bytes of In-System Reprogrammable Flash Memory • Endurance: 1,000 Write/Erase Cycles • Fully Static Operation: 0 Hz to 24 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 • Programmable Serial Channel • Low-power Idle and Power-down Modes

PIN DESCRIPTION: VCC

Supply voltage. GND

Ground. Port 0

Port 0 is an 8-bit open drain bi-directional 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 bi-directional 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 11

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

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 bi-directional 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 highorder address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3

Port 3 is an 8-bit bi-directional 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 also serves the functions of various special features of the AT89S51, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification. Table 3.2: Port 3 description

Port Pins

Alternate Function

P 3.0

RXD(serial input port)

P 3.1

TXD(serial output port)

P 3.2

INT0 (external interrupt 0)

P 3.3

INT1(external interrupt 1)

P 3.4

T0(Timer 0 external input)

P 3.5

T1(Timer 1external input)

P 3.6

WR (external data memory write strobe)

P 3.7

RD (external data memory read strobe)

12

Dept. of E&C, PCE

SMS BASED VOTING MACHINE RST

Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG

Address Latch Enable 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 ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN

Program Store Enable 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 when 12-volt programming is selected. XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2

Output from the inverting oscillator amplifier. 13

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Fig 3.2: Crystal Oscillator

Interrupts The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. In the AT89C51, bit position IE.6 and IE.5 are unimplemented. User  software should not write 1s to these bit positions, since they may be used in future AT89  products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register  T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows. Table 3.3: Interrupts

(MSB) EA

(LSB) -

ET2

ES

ET1

EX1

ET0

EX0

Enable Bit = 1 enables the interrupt. Enable Bit = 0 disables the interrupt.

14

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

3.2.2 MAX 232 IC

Fig 3.3: MAX 232 IC

The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals. The drivers  provide RS- 232 voltage level outputs (approx. ± 7.5 V) from a single +5V supply via onchip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0V to + 5 V range, as power  supply design does not need to be made more complicated just for driving the RS-232 in this case. The receivers reduce RS-232inputs (which may be as high as ± 25 V), to standard 5 V TTL levels. These receivers have atypical threshold of 1.3 V, and a typical hysteresis of 0.5 V. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors ± 0.1 F in place of  the 1.0 F capacitors used with the original device. The newer MAX3232 is also backwards compatible, but operates at a broader voltage range, from 3 to 5.5V. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors – 0.1 μF in place of the 1.0 μF capacitors used with the original device. The newer MAX3232 is also backwards compatible, but operates at a broader voltage range, from 3 to 5.5 V. Pin to pin compatible: ICL232, ST232, ADM232, HIN232 (much cheaper alternatives).

15

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

3.2.3 GS M MODULE

Fig 3.4: GSM Module

A GS M modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial- up modem. The main difference between them is that a dial- up modem sends and receives data through a fixed telephone line while a wireless modem Sends and receives data through radio waves. A GSM modem can be an external device or a PC Card PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It should be inserted into one of the PC Card /PCMCIA Card slots of a laptop computer. Like a GSM mo bi le  phone, a GSM mod em requires a SIM card from a wireless carrier in order to operate. As mentioned below of this SMS tutorial l computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial- up modem. In addition to the standard AT commands; GSM modems support an extended set of AT commands. These extended AT co mmands are defined in the GSM standards. With the extended AT commands, you can do things like: 1. Reading, writing and deleting SMS messages. 2. Sending S MS messages. 3. Monitoring the signal strength. 4. Monitoring the charging status and charge level of the battery. 5. Reading, writing and searching phone book entries. 16

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

The number of SMS messages that can be processed b y a GSM modem per minute is very low -- only about six to ten SMS messages per minute. 3.2.3.1 AT Commands

AT commands are instructions used to control a modem. AT is the abbreviation of  Attention.

Every command l i n e st ar ts wit h “ AT ” or  “ at".

That‟s why m o d e m

commands are called AT commands. Many of the commands that are used to control wired dial- up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GP RS modems and mobile phones. Besides this common AT command s et, GS M/GPRS modems and mobile phones support an AT command set that is specific to the GSM technology, which includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).  Note that the starting "AT" is the pre fix that informs the modem about the start of a command line. It is not part of the AT command name. For example, D is the actual AT command name in

ATD and +CMGS

is the actua l AT command name in

AT+CMGS. However, some books and web sites use them interchangeably as the name of an AT command. Here are so me of the tasks that can be do ne using AT commands with a GS M/GPRS modem or mobile phone: 1. Get basic information about the mobile p hone or GS M/GPRS modem. For  example, name of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR). 2. Get

basic information about the

subscriber.

For example

MSISDN

(AT+CNUM) and IMSI number (International Mobile Subscriber Identity) (AT+CIMI). 3. Get the current status of the mobile phone or GSM/GP RS modem. For  example,

mobile phone

activity status

(AT+CPAS),

mobile network 

registration status (AT+CREG), radio signal strength (AT+CSQ), battery charge level 17

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

and battery charging status (AT+C BC). 4. Establish a data connection or voice connectio n to a remote modem (ATD, ATA, etc.). 5. Send and receive fax (ATD, ATA, AT+F*). 6. Send

(AT+CMGS,

AT+CMSS),

read

(AT+CMGR,

AT+CMGL),

write

(AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS messages (AT+CNMI). 7. Read (AT+CP BR), wr it e (AT+CPBW) or search (AT+CPBF) phonebook entries. 8. Perform security-related tasks, such as opening or closing facility locks (AT+CLCK), checking whether a facility is locked (AT+CLCK) and changing  passwords (AT+CPWD). (Facility lock examples : SIM lock [a password must be given to the SIM card ever y time the mobile p hone is switched on] and P H-SIM lock  [a certain SIM card is a ssociated with the mobile phone. To use other S IM cards with the mobile phone, a password must be entered.]) 9. Control the presentation of result codes / error messa ges of AT commands. For  example, you can control whether to enable certain error messa ges (AT+CMEE) and wh et he r error mess age s should be displayed in numeric format or verbose format (AT+CMEE=1 or AT+CMEE=2). 10. Get or change the configurations of the mobile phone or GSM/GPRS modem. For example, change

the GSM net work (AT+COPS), bearer serv ice t ype

(AT+CBS T), radio link protocol parameters (AT+CRLP), SMS ce nter address (AT+CSCA) and storage of SMS messa ges (AT+CPMS). 11. Save and restore configurations o f the mobile phone or GSM/GPRS modem. For example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging such as the SMS center address.

 Note that mobile phone manufacturers usually do not implement all AT commands, command parameters and parameter values in their mobile phones. Also, the behaviour of  the implemented AT commands may be different from that defined in the standard. In general, GSM/GPRS modems designed for wireless applications have better  support of AT commands than ordinary mobile phones. In addition, some AT commands require the support of mobile network operators. For  example, SMS over GP RS can be enabled on some GP RS mobile phones and GPRS 18

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

modems with the +CGSMS command (command name in text: Select Service for MO SMS Messages). But if the mobile network operator does not support the transmission of  SMS over GP RS, you cannot use this features .There are two t ypes of AT commands: basic commands and extended commands. Basic commands are AT commands that do not start with "+". For example, D (Dial), A (Answer), H (Hook control) and O (Return to online data state) are basic commands. Extended commands are AT commands that start with "+". All GSM AT commands are extended commands. For example, +CMGS (Send SMS message), +CMSS (Send SMS message from storage), +CMGL (List SMS messages) and +CMGR (Read SMS messages) are extended commands. 3.2.3.2 General Syntax of Extended AT Commands

The general syntax of extended AT commands is straightforward. The syntax rules are  provided below. The syntax of basic AT commands is slightly different. We will not cover the syntax of basic AT commands in this SMS tutorial since all SMS messaging commands are extended AT commands. Syntax rule 1 . All command lines must start with "AT" and end with a carriage return

character. (We will use to represent a carriage return character in this SMS tutorial.) In a terminal program like HyperTerminal of Microsoft Windows, you can press the Enter key on the keyboard to output a carriage return character. Example: To list all unread inbound SMS messages stored in the message storage area, type "AT", then the extended AT command "+CMGL", and finally a carriage return character, like this: AT+CMGL Syntax rule 2. A command line can contain more than one AT command. Only the first

AT command should be prefixed with "AT". AT commands in the same command- line string should be separated with semicolons. Example: To list all unread inbound SMS messages stored in the message storage area and obtain the manufacturer name of the mobile device, type "AT", then the extended AT command

"+CMGL",

followed

by

a

semicolon

and

the

next

extended

AT

command "+CGMI": AT+CMGL; +CGMI 19

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

An error will occ ur if both AT commands are prefixed with "AT", like this: AT+CM GL; AT+C GMI Syntax rule 3 . A string is e nclosed between double quotes.

Example: To read all SMS messages from message storage in SMS text mode (at this time you do not need to know what SMS text mode is. More information will be provided later  in this SMS tutorial), you need to assign the string "ALL" to the extended AT command +CMGL, like this: AT+CMGL="ALL" Syntax ru le 4. Information responses and result codes (including both final result

codes and unsolicited result codes) always start and end with a carriage return character and a linefeed character. Example: After sending the command line "AT+CGMI“to the mobile device, the mobile device should return a response similar to this: The first line is the information response of the AT command +CGMI and the second line is the final result code. and represent a carriage return character and a line feed character respectively. The final results c o d e

"OK ” marks the end of the

response. It indicates no more data will be sent from the mobile device to the computer / PC. When a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. Hence,

the

command

line

"AT+CGMI "

that

you

entered

and

the

corresponding respo nse will be displayed like this in a terminal program such as HyperTerminal o f Microsoft Windows: AT+C GMI  Nokia OK  3.2.3.3 Information Response and Final Result Code

Don't forget the meanings of information response and final result code stated above, since you will see these two terms frequently as you go thro ugh this SMS tutorial. 20 Dept. of E&C, PCE

SMS BASED VOTING MACHINE Result codes of AT commands: Result codes are messa ges s ent from the GSM/GP RS

modem or mobile phone to provide you information about the execution of an AT command and the occurrence of an event. Two types of result codes are use ful to yo u when dealing with AT commands for SMS messaging: 

Final result codes



Unsolicited result codes

Final Result Codes of AT Commands : A final result code marks the end of an AT

command respo nse. It is an indication that the GSM/GP RS modem or mobile phone has finished the execution of a command line. Two frequently used final result codes are OK  and ERRO R. Only one final result code will be returned for each command line. Thus, you will not see bo th OK and ERROR in the response of a command line.

The OK Final Result Code: The OK final result code indicates that a command

line has been

executed success fully by the GSM/GP RS modem or mobile phone. It

always starts and ends with a carriage return character and a linefeed character. Here is an example for illustration. Let's say you send the command line "AT+CMGL; +CGMI“to

your

GSM/GPRS

modem.

The

AT c o m m a n d "+CMGL" is

used to list SMS messages stored in the message storage area and the AT command “+CGMI" is used to get the manufacturer name of the GS M/GPRS modem. If 

everything works properly without any errors, the command line, together with the response returned, should be something similar to this: AT+CMGL; +CGMI +CMGL: 1,"REC UNREAD","+85291234567 ",” 06/11/11, 00:30:29+32"Welcome

to

our

SMS

tutorial. Nokia

OK 

As mentioned earlier, when a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line.

When it sees a line feed character, it moves the cursor to the sa me

 position on the next line. Hence, the command line you entered, together with the response returned, will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows :

AT+CMGL; +CGMI 21

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

+CMGL: 1,"REC UNREAD","+7568501753",” 06/11/11, 00:30:29+32 " Welcome to our  SMS tutoria l”.  Nokia OK  3.2.3.4 SMS Tutorial

In general, there are two ways to send SMS messages from a computer / PC to a mobile phone: 1.

Connect a mobile phone or GSM/GPRS modem to a computer / PC. Then use the

computer / PC and AT commands to instruct the mobile phone or GSM/GPRS modem to send SMS messages. 2. Connect the computer / PC to the SMS center (SMSC) or SMS gateway of a wireless carrier or SMS service provider. Then send SMS messages using a protocol / interface supported by the S MSC or SMS gateway. 3.2.3.5 The 1st Way: Sending S MS Messages from a Computer Using a Mobile P hone or GSM/GP RS Modem

The SMS specification has defined a way for a computer to send SMS messages through a mobile phone or GS M/GPRS modem. A GSM/GP RS modem is a wireless modem that works with GS M/GPRS wireless networks. A wireless modem is s imilar to a dial-up modem. The main difference is that a wireless modem transmits data through a wireless network whereas a dial-up modem transmits data through a copper telephone line. Most mobile phones can be used as a wireless modem. However, some mobile phones have certain limitations comparing to GSM/GPRS modems. To send SMS messages, first place a valid SIM card from a wireless carrier into a mobile  phone or GSM/GP RS modem, which is then connected to a computer. There are several ways to connect a mob ile phone or GSM/GP RS modem to a computer. For example, t hey can be connected through a serial cable, a USB cable, a Bluetooth link or an infrared link. The actual way to use depends o n the capability of the mobile phone or GSM/GPRS mo de m. For example, if a mo bi le phone does no t support Bluetooth, it cannot connect to the computer through a Bluetooth link. After connecting a mobile p hone or GSM/GP RS modem to a compu ter, you can 22

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

control the mobile phone or GSM/GP RS modem by sending instructions to it. The instructions used for controlling the mobile phone or GS M/GPRS modem are called AT commands. (AT commands are also used to control dial- up modems for wired telephone system.) Dial- up modems, mobile phones and GSM/GP RS modems support a common set of standard AT commands. In addition to this common set of standard AT commands, mobile phones and GSM/GP RS modems s upport an extended set of AT commands. One use of the extended AT commands is to control the sending and receiving of SMS messa ges. The following table lists the AT commands that are related to the writing and sending of  SMS messages: Table 3.4: AT Command TX AT command

Meaning

+CMGS

Send message

+CMSS

Send message from storage

+CMGW

Write message to memory

+CMGD

Delete message

+CMGC

Send command

+CMMS

More messa ges to send

One way to send AT commands to a mobile phone or GSM/GP RS modem is to use a terminal program. A terminal program's function is like this: It sends the character you typed to the mobile phone or GSM/GP RS modem. It then displays the respo nse it receives from the mobile phone or GSM/GPRS modem on the screen. The terminal program on Microsoft W indows is called HyperTerminal. Below shows a simple example that demonstrates

how

to

use

AT co mmands

and

the

HyperTerminal program of 

Microsoft Windows to send an SMS text message. The lines in bold type are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GP RS modem or mobile phone. 23

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

AT OK  AT+CMGF=1

OK  AT+CMGW="+7568501753" > A simple demo of SMS text messaging.

+CMGW: OK  AT+CMSS=1

+CMSS: OK  To send SMS messages from an application, you have to write the source code for  connecting to and sending AT co mmands to the mobile phone or GS M/GPRS modem, just like what a terminal program does. You can write the source code in C, C++, Java, Visual Basic, Delphi or other programming languages you like. However, writing your own code has a few disadvantages: 1.

You have to learn how to compose the bits and bytes of an SMS message. For  example, to specify the character encoding (e.g. 7-bit encoding and 16-bit Unicode encoding) of an SMS message, you need to know which bits in the message header  should be modified and what value should be assigned.

2.

Sending SMS messages with a mobile p hone or GSM/GP RS modem has a drawback -- the SMS transmission speed is lo w. As your SMS messaging application becomes more popular, it has to handle a larger amount of SMS traffic and finally the mobile phone or GSM/GPRS modem will not be able to take the load. To obtain a high SMS transmiss ion speed, a direct connection to an SMSC or S MS gateway of a wireless carrier or S MS service pro vider is needed. However, AT commands are not used fo r communicating with an SMS center or SMS gateway. This means you have to make a big change to your SMS messa ging app lication in order to move from a wireless- modem- based solution to a SMSC-based solution.

In most cases, instead of writing your own code for interacting with the mobile phone or  GSM/GPRS modem via AT commands, a better solution is to use a high- level SMS messa ging

API

(Application

pro gramming

interface)

/

S DK

(Software

development kit) / library. The AP I / SDK / library encapsulates the low- level details. So, an SMS application developer does not need to know AT commands and the composition of S MS messa ges in the b it-level. Some SMS messa ging APIs / S DKs / libraries support SMSC protocols in addition to AT commands. To mo ve fr om a 24

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

wireless- modem-based SMS solution to a SMSC-based SMS solution, usually you just need to modify a configuration file / property file or make a few changes to your SMS messaging application's source code. Another way to hide the low-level AT command layer is to place an SMS gateway  between the SMS messaging application and the mobile phone or GS M/GPRS modem. (This has been described in the section "What is an SMS Gate way? ” earlier.) Simple protocols such as HTTP / HTTPS can then be used for sending S MS messages in the application. If an SMSC protocol (e.g. SMPP, CIMD, etc.) is used for  communicating with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API / S DK / library can b e very helpful to yo u since it encapsulates the SMSC protocol's details. Usually a list of supported / unsupported mobile phones or wireless modems is  provided on the web site of an SMS messaging API / SDK / library or an SMS gateway software package. Remember to check the list if you are going to use an SMS messaging API / SDK / library or an S MS gateway software package. 3.2.3.6 How to receive SMS messages using Computer/PC

In general, there are three ways to receive SMS messages using your com puter / PC: 1. Connect a mobile phone or GSM/GPRS modem to a computer / PC. Then use the computer / PC and AT commands to get the received SMS messages from the mobile  phone or GSM/GPRS modem. 2.

Get access to the SMS center (SMSC) or SMS gateway of a wireless carrier. Any SMS messages received will be forwarded to your computer / PC using a protocol / interface supported b y the S MSC or SMS gateway.

3. Get access to the SMS gat ew ay of an SMS se rv ic e provider. Any SMS messages received will be forwarded to your computer / PC using a protocol / interface supported  by the SMS gateway. 3.2.3.7 The 1st Way: Using a Computer to Receive SMS Messages through a Mobile Phone or GSM/GP RS Modem

Receiving SMS messages through a mobile phone or GSM/GP RS modem has a major  advantage over the other two ways -- wireless carriers usually do not charge any fees for  receiving incoming SMS messages with their SIM cards. The disadvantage of receiving SMS messages this way is that a mobile p hone or GSM/GP RS modem cannot handle 25

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

a large amount of SMS traffic. One wa y to overco me this is to load balance the S MS traffic with a pool of mobile phones or GSM/GP RS modems. Each mobile p hone or GS M/GPRS modem will have its own SIM card and mobile phone number. In terms of programming, sending and receiving SMS messages through a mobile  phone or GSM/GP RS modem are similar. What you need to do is to send instructions (in the form of AT commands) to the mobile phone or GSM/GP RS modem. The following table lists the AT commands that are related to the receiving and reading of SMS messa ges: Table 3.5: AT Command RX AT command

Meaning

+CNMI

New message indications

+CMGL

List messages

+CMGR

Read messages

+CNMA

New message acknowledgement

Below shows a simple example that demonstrates how to use AT commands and the HyperTerminal program of Microsoft Windows to read SMS text messages received by a GSM / GP RS modem or mobile phone. The lines in bold t ype are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GP RS modem or mobile phone. AT OK  AT+CMGF=1

OK  AT+CMGL="ALL"

+CMGL: 1,"REC

READ","+7568501753",” 06/11/11, 00:30:29+32" Hello, welcome to

our SMS tutorial. +CMGL: 2,"REC

READ","+7568501753",” 06/11/11, 00:32:20+32" A simple

demo of SMS

text messaging.

OK  26

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

3.2.4 LCD

Fig 3.5: LCD 16*2

An HD44780 Character LCD is a de facto industry standard liquid crystal display (LCD) display device designed for interfacing with embedded systems. These screens come in a variety of configurations including 8x1, which is one row of eight characters, 16x2, and 20x4. The most commonly manufactured configuration is 40x4 characters, which requires two individually addressable HD44780 controllers with expansion chips as the HD44780 can only address up to 80 characters. These LCD screens are limited to text o nly a nd are often used in copiers, fax machines, laser   printers, industrial test equipment, networking equip ment such as routers and storage devices. Character LCDs use a standard 14- pin interface and those with backlights have 16 pins. The pin outs are as follows: 1.

Ground

2.

VCC (+3.3 to +5V)

3.

Contrast adjustment (VO)

4.

Register Select (RS). RS=0: Co mmand, RS=1: Data

5.

Read/Write (R/W). R/W=0: Write, R/W=1: Read

6.

Clock (Enable). Falling edge triggered

7.

Bit 0 (Not used in 4-bit operation)

8.

Bit 1 (Not used in 4-bit operation)

9.

Bit 2 (Not used in 4-b it operation)

10.

Bit 3 (Not used in 4-bit operation)

11.

Bit 4

12.

Bit 5 27

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

13.

Bit 6

14.

Bit 7

15.

Backlight Anode (+)

16.

Backlight Cathode (-)

Character LCDs ca n operate in 4-bit or 8-bit mode. In 4 bit mode, pins 7 through 10 are unused and the entire byte is sent to the screen using pins 11 through 14 by sending 4-bits (nibble) at a time.

3.3 ATMEL 24C02 Flash Memory Features • Low-voltage and Standard-voltage Operation.  – 2.7 (VCC = 2.7V to 5.5V)  – 1.8 (VCC = 1.8V to 5.5V) • Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K),

1024 x 8 (8K) or 2048 x 8 (16K). • Two-wire Serial Interface. • Schmitt Trigger, Filtered Inputs for Noise Suppression. • Bidirectional Data Transfer Protocol. • 100 kHz (1.8V) and 400 kHz (2.7V, 5V) Compatibility. • Write Protect Pin for Hardware Data Protection. • 8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes. • Partial Page Writes Allowed. • Self-timed Write Cycle (5 ms max). • High-reliability  – Endurance: 1 Million Write Cycles  – Data Retention: 100 Years • Automotive Devices Available. • 8-lead JEDEC PDIP, 8-lead JEDEC SOIC, 8-lead Ultra-Thin Mini-MAP (MLP 2x3),

5- Lead SOT23, 8-lead TSSOP and 8-ball dBGA2 Packages. • Die Sales: Wafer Form, Waffle Pack and Bumped Wafers.

28

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Description The AT24C01A/02/04/08A/16A provides 1024/2048/4096/8192/16384 bits of serial electrically erasable and programmable read-only memory (EEPROM) organized as 128/256/512/1024/2048 words of 8 bits each. The device is optimized for use in many industrial and commercial applications where low-power and low-voltage operation are essential. The AT24C01A/02/04/08A/16A is available in space-saving 8-lead PDIP, 8-lead JEDEC

SOIC,

8-lead

Ultra-Thin

Mini-MAP

(MLP

2x3),

5-lead

SOT23

(AT24C01A/AT24C02/AT24C04), 8-lead TSSOP, and 8-ball dBGA2 packages and is accessed via a Two-wire serial interface. In addition, the entire family is available in 2.7V (2.7V to 5.5V) and 1.8V (1.8V to 5.5V) versions.

PIN Diagram

Table 3.6: Pin configuration of ATMEL 24C02

29

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 4 DATABASE

In this project the database of voting is maintained though software tool Visual basics 6.0 In this software tool there is full duplex interfacing between microcontroller, PC and GSM module.

4.1 Introductions to Visual Basics Visual Basic is a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. Visual Basic is designed to be relatively easy to learn and use. Visual Basic

was

derived

from BASIC and

enables

the rapid

application

development

(RAD) of graphical user interface (GUI) applications, access to databases using Data Access

Objects, Remote Data Objects, or  ActiveX Data Objects, and creation

of ActiveX controls and objects. VBA is effectively the same language as Visual Basic but VBA-code is tied to Microsoft Office and can only run within that environment. The scripting language VBScript is a subset of Visual Basic. A programmer can create an application using the components provided by the Visual Basic  program itself. Programs written in Visual Basic can also use the Windows API, but doing so requires external function declarations. Though the program has received criticism for its  perceived faults, version 3 of Visual Basic was a runaway commercial success, and many companies offered third party controls greatly extending its functionality. The final release was version 6 in 1998. Microsoft's extended support ended in March 2008 and the designated successor was Visual Basic .NET (now known simply as Visual Basic).

4.1.1 Language Features of Visual Basic 6.0 Like the BASIC programming language, Visual Basic was designed to be easily learned and used by beginner programmers. The language not only allows programmers to create simple GUI applications, but to also develop complex applications. Programming in VB is a combination of visually arranging components or controls on a form, specifying attributes 30

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Fig 4.1: Icons for main controls in Visual Basic 6.0

and actions of those components, and writing additional lines of code for more functionality. Since default attributes and actions are defined for the components, a simple  program can be created without the programmer having to write many lines of code. Performance problems were experienced by earlier versions, but with faster computers and native code compilation this has become less of an issue. Although VB programs can be compiled into native code executables from version 5 onwards, they still require the presence of runtime libraries of approximately 1 MB in size. Runtime libraries are included by default in Windows 2000and later, however for earlier  versions of Windows, i.e. 95/98/NT, runtime libraries must be distributed together with the executable.

Fig 4.2: An empty form in Visual Basic 6.0

Forms are created using drag-and-drop techniques. A tool is used to place controls (e.g., text  boxes,

buttons,

etc.) on the form (window). 31

Controls

have attributes and event Dept. of E&C, PCE

SMS BASED VOTING MACHINE

handlers associated with them. Default values are provided when the control is created, but may be changed by the programmer. Many attribute values can be modified during run time  based on user actions or changes in the environment, providing a d ynamic application. For  example, code can be inserted into the form resize event handler to reposition a control so that it remains centered on the form, expands to fill up the form, etc. By inserting code into the event handler for a key press in a text box, the program can automatically translate the case of the text being entered, or even prevent certain characters from being inserted. Visual Basic can create executable (EXE files), ActiveX controls, or DLL files, but is primarily used to develop Windows applications and to interface database systems. Dialog boxes with less functionality can be used to provide pop-up capabilities. Controls provide the basic functionality of the application, while programmers can insert additional logic within the appropriate event handlers. For example, a drop-down combination box will automatically display its list and allow the user to select any element. An event handler is called when an item is selected, which can then execute additional code created by the programmer to  perform some action based on which element was selected, such as populating a related list. Alternatively, a Visual Basic component can have no user interface, and instead provide ActiveX objects to other programs via Component Object Model (COM). This allows for server-side processing or an add-in module. The runtime recovers unused memory using reference counting which depends on variables passing out of scope or being set to "Nothing", resulting in the very common problem of memory leaks. There is a large library of utility objects, and the language provides basic object oriented support. Unlike many other programming languages, Visual Basic is generally not case sensitive, although it will transform keywords into a standard case configuration and force the case of variable names to conform to the case of the entry within the symbol table. String comparisons are case sensitive by default. The Visual Basic compiler is shared with other Visual Studio languages (C, C++), but restrictions in the IDE do not allow the creation of some targets (Windows model DLLs) and threading models.

32

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

4.2 Characteristics of Visual Basic 6.0 Visual Basic has the following traits which differ from C-derived languages: 

Statements tend to be terminated with keywords such as "End If", instead of using "{}"s to group statements.



Multiple variable assignments are not possible. A = B = C does not imply that the values of A, B and C are equal. The Boolean result of "Is B = C?" is stored in A. The result stored in A would therefore be either false or true.



Boolean constant True has numeric value −1. This is because the Boolean data type is stored as a 16- bit signed integer. In this construct −1 evaluates to 16 binary 1s (the Boolean value True), and 0 as 16 0s (the Boolean value False). This is apparent when  performing a Not operation on a 16 bit signed integer value 0 which will return the integer value −1, in other words True = Not False. This inherent functionality becomes

especially useful when performing logical operations on the individual bits of an integer  such as And, Or, Xor and Not. This definition of True is also consistent with BASIC since the early 1970s Microsoft BASIC implementation and is also related to the characteristics of CPU instructions at the time. 

Logical and bitwise operators are unified. This is unlike some C-derived languages (such as Perl), which have separate logical and bitwise operators. This again is a traditional feature of BASIC.



Variable array base. Arrays are declared by specifying the upper and lower bounds in a way similar to Pascal and FORTRAN. It is also possible to use the Option Base statement to set the default lower bound. Use of the Option Base statement can lead to confusion when reading Visual Basic code and is best avoided by always explicitly specifying the lower bound of the array. This lower bound is not limited to 0 or 1,  because it can also be set by declaration. In this way, both the lower and upper bounds are programmable. In more subscript-limited languages, the lower bound of the array is not variable. This uncommon trait does exist in Visual Basic .NET but not in VBScript. OPTION BASE was introduced by ANSI, with the standard for ANSI Minimal BASIC in the late 1970s.

33

Dept. of E&C, PCE

SMS BASED VOTING MACHINE



Relatively

strong

integration

with

the Windows

operating

system and

the Component Object Model. The native types for strings and arrays are the dedicated COM types, BSTR and SAFEARRAY. 

Banker's rounding as the default behaviour when converting real numbers to integers with the Round function.[7] ? Round (2.5, 0) gives 2,? Round(3.5, 0) gives 4.



Integers are automatically promoted to real‟s in expressions involving the normal division operator (/) so that division of one integer by another produces the intuitively correct result. There is a specific integer divide operator (\) which does truncate.



By default, if a variable has not been declared or if no type declaration character is specified, the variable is of type Variant. However this can be changed with Deftype statements such as DefInt,

DefBool , DefVar,

DefObj,

DefStr. There are

12 Deftype statements in total offered by Visual Basic 6.0. The default type may be overridden for a specific declaration by using a special suffix character on the variable name (# for Double, for Single, & for Long, % for Integer, $ for String, and @ for Currency) or using the key phrase as (type). VB can also be set in a mode that only explicitly declared variables can be used with the command Option Explicit. 

With VB 6, you can create any program depending on your objective. For example, if you are a college or university lecturer, you can create educational programs to teach business, economics, engineering, computer science, accountancy, financial management, information system and more to make teaching more effective and interesting. If you are in business, you can also create business programs such as inventory management system, point-of-sale system, payroll system, financial  program as well as accounting program to help manage your business and increase  productivity. For those of you who like games and working as games programmer, you can create those programs as well. Indeed, there is no limit to what program you can create! There are many such programs in this tutorial, so you must spend more time on the tutorial in order to learn how to create those programs.

4.3 Project Database Features In this project two forms are created form 1 for administration login and form 2 for main database window. 34

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

4.3.1 Form 1

Fig: 4.3: form1

Form 1 include two text windows one for user name and another for password. Two buttons are provided for ok to submit username and password and exit button for exit. If the  password entered by admin is correct then only form 2 will be displayed.

4.3.2 Form 2 Form 2 is the main window of voting machine in software part for display, control and storage of database.

4.3.2.1 Form 2 description a) GSM MODEM COMMUNICATION: This label consist two buttons Start and Stop ,

the Start button is for starting modem .as we click start button at commands are implemented at modem and whenever there is network available ok command is display at GSM MOEM DATA text window. The stop button is to stop the modem. b) MICROCONTROLLER COMMUNICATION: This label consist two buttons Start

and Stop , the Start button is for starting microcontroller .as we click start button voting status is send to microcontroller and displayed on lcd. The stop button is to stop the controller.

35

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Fig 4.4: Form 2 before Voting c) Voter's Detail: In this text window voting detail of user (voter) is displayed.in the details

voter NAME, PHONE NO. and CHOICE is displayed. d) Erase Button : It will erase the data store in EEPROM. e) Overall Voting: It will display the overall voting status from EEPROM. f) Send Data: It will send data to EEPROM and microcontroller. g) Logout: It will save current voting status and exit from window.

36

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Fig 4.5: Form 2 after Voting

37

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 5 LAYOUT & PCB DESIGNING 5.1 Printed Circuit Board (PCB) A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic

components using conductive pathways,

tracks

or

signal

traces etched from copper sheets laminated onto a non-conductive substrate. When the  board has only copper tracks and features, and no circuit elements such as capacitors, resistors or active devices have been manufactured into the actual substrate of the board, it is more correctly referred to as printed wiring board (PWB) or etched wiring board. Use of  the term PWB or printed wiring board although more accurate and distinct from what would  be known as a true printed circuit board, has generally fallen by the wayside for many  people as the distinction between circuit and wiring has become blurred. Today printed wiring (circuit) boards are used in virtually all but the simplest commercially produced electronic devices, and allow fully automated assembly processes that were not possible or   practical in earlier era tag type circuit assembly processes.

5.2 Advantages of PCB Advantages of PCBs are: a) The circuit board fabrication cost (PCB cost) is lower with mass quantity production  b) Electronic circuit characteristics will be maintained without introducing parasite capacitance with a proper circuit board design. c) Component wiring and assembly can be mechanized in a circuit board manufacturing facility. d) PCB‟s offer uniformity of electrical characteristics from assembly to assembly. e) The location of electronic parts is fixed and so it simplifies components identification and maintenance of equipment. f) Inspection time is reduced because printed circuitry eliminates the probability of error.

38

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

5.3 PCB Layout

Fig 5.1: Top layer

39

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Fig 5.2: Bottom layer

40

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 6 SOFTWARE & HARDWARE TOOL 6.1 Software Tools: 6.1.1 Keil Uvision 4.0 Keil Software is used provide you with software development tools for 8051 based microcontrollers. With the Keil tools, you can generate embedded applications for  virtually every 8051 derivative. The supported microcontrollers are listed in the μ - vision

6.1.2 Proteus Professional V7.6 Proteus is software for  microprocessor simulation, schem ati c captu re, an d printed circuit board (PCB) design. It is developed by Lab center Electronics. The X Game Station Micro Edition was designed using Lab center ‟s Proteus schematic entry and PCB layout tools.

6.1.3 Programming language The programming language used in this project is “C language”.

6.2 Hardware Tools: DB 9 Connector: The DB9 (originally DE-9) connector is an analog 9-pin plug of the DSub miniature connector family (D-Sub or Sub-D).The DB9 connector is mainly used for  serial connections, allowing for the asynchronous transmission of data as provided for by standard RS-232 (RS-232C).

Fig 6.1:DB9 Connector

 Note that there are DB9-DB25 adapters for easily converting a DB9 plug into a DB25, and vice versa.

41

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 7 FLOW CHART AND ALGORITHMS 7.1 Flow Chart of Project

Fig 7.1: Flow Chart of Project

42

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

7.2 Algorithms of Microcontroller Programming STEP1: INITIALIZING SYSTEM VARIABLE: PORT 1 STEP 2: INITIALIZING LCD STEP 3: DATA WRITING OF THE LCD STEP 4: CHECKING MSB BIT IS '0' OR'1' USED FOR SENDING THE BIT STEP 5: RESET IN_DATA STEP 6: PROVING DELAY FOR RECEVING SIGNALS STEP 7: RCEIVING DATA FROM PC STEP 8: SAVIN DATA IN EEPROM STEP 9: READING DATA FROM PC STEP 10: TRASMISSION DATA FROM MEMORY TO PC DATABASE

7.3 Algorithms of Visual Basic Programming STEP1: INITIALIZING SYSTEM VARIABLE STEP 2: INITIALIZING GSM MODEM STEP 3: INITIALIZING MICROCONTROLLER  STEP 4: CHECKING USERNAME AND PASSWORD IN SMS FORMAT STEP 5: UPDATING CANDIDATE CHOICE STEP 6: EXTRACTING MOBILE NUMBER NAME AND CHOICE FROM SMS STEP 7: SENDING DATA TO MICROCONTROLLER  STEP 8: SAVING DATA IN MEMORY.

43

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 8 ADVANTAGES & APPLICATIONS 8.1 Applications a) The EVM system is a longtime-consuming process and very much prone to errors.  b) This situation continued till election scene was completely changed by electronic voting machine.. Cell phone based voting machine is capable of saving considerable  printing stationery and transport of large volumes of electoral material. c) SMS based voting system can be used in remote areas where manual voting system is difficult to implement. d) This system can be used in colleges, society and various other places for elections. e) Fast track voting which could be used in small scale elections, like resident welfare association, “panchayat” level election and other society level elections.

f) It could also be used to conduct opinion polls during annual shareholders meeting. g) 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. h) It is used in various TV serials as for public opinion.

8.2 Advantages a) Democracy : All and only the authorized voters can vote, and each eligible voter can vote no more than once. Voters can also choose not to vote.  b) Privacy : All votes remain secret while voting takes place and each individual vote cannot be linked by any individual or authority to the voter who casts it. c) Accuracy: The voting result accurately reflects voters· Choices. In this case, no vote can be altered, duplicated or eliminated without being detected. d) Fairness: No partial result is available before the final result comes out.

44

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 9 FUTURE SCOPE & LIMITATIONS 9.1 Future Scope The system can be further modified to enhance its utility. The enhancements are: a)  Number of candidates could be increased.  b) It can be interfaced with printer to get the hard copy of the result almost instantly from the machine itself. c) It can also be interfaced with the personal computer and result can be stored in the central server. d) 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 can make results available at any corner of the world in a matter of seconds.

9.2 Limitations a)  Number of candidates is less.  b) Major limitation is network problem. c) Less storage of data. d) Voting numbers are limited to three digits.

45

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

CHAPTER 10 CONCLUSION

We proposed a GSM mobile voting scheme, where the GSM authentication Infrastructure is used to provide voter authentication and improve voter mobility. Authentication is always a difficult requirement to fulfil for remote voting schemes, most of which apply a public-key  based signature scheme for voter authentication. In our scheme, by using the existing GSM authentication infrastructure, the public-key overhead is largely reduced. Our scheme also enhances the security and provides more mobility and convenience to voters. Where the voters‟ privacy is protected by applying a blind signature scheme. In this report, we

 presented the basic structure and protocol of our GSM based mobile voting system.

46

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

REFERENCES / BIBLIOGRAPHY 

 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.howstuffworks.com



www.alldatasheets.com



www.efyprojects.com



www.google.com

47

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

APPENDICES / ANNEXURE

A.1 Electronic Component Cost

SR.NO COMPONENT NAME

REFRENCE

QUANTITY

RATE PER  UNIT

AMOUNT

 NUMBER 

1.

MICROCONTROLLER AT89S52

1

55.00

55.00

2.

GSM MODULE

SIM 300

1

3000.0

3000.0

3.

MAX232

16PIN

2

20.00

40.00

4.

REGULATOR IC

LM7805

1

7.00

7.00

5.

LED

RED

1

2.00

4.00

GREEN

1

2

35.00

70.00

10µF,16V

2

1.50

3

22pF

2

1.50

3

6.

COPPERCLADE PCB

7.

CAPACITOR 

8.

CRYSTAL OSSCILLATOR 

11.0592MHZ

1

7.00

7.00

9.

IC BASE

40 PIN

1

4.00

4.00

10.

SOLDERING WIRE

15METER

1

10.00

150.00

11.

DB9 CONNECTOR

9 PIN

2

231.0

464.0

48

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

12.

RESISTERS

10KΩ

1

1.00

1KΩ

1

1.00

220Ω

1

1.00

310KΩ

1

1.00

4.00

13.

EEPROM

24C02

1

21.00

21.00

14.

TRANSISTOR

2N3904

1

8.00

8.00

15.

BATTERY

+9V

1

38.00

38.00

16.

TRANSFORMER

+12V

1

45.00

45.00

TOTAL:

3923/-

A.2 Mechanical Structure Cost SR.NO

AMOUNT

1.

CARDBOARD SHEET

55.00

2.

FEVICOL

20.00

3.

SIM AIRTEL

60.0

4.

THERMOCOL SHEET

25.0

5.

CELLO TAPE & COLOUR TAPE

40.00

Total

200/-

Total cost of project (Electronic + Mechanical components) =4123/-

49

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

A.3 Microcontroller Coding #include

// header file of microcontroller 

char msg[10],notice[96]; sfr lcddata=0x90; //p1 port sbit rs=P3^7; sbit rw=P3^6;

//initializing flash memory 24c02

sbit en=P3^5; sbit SDA=P2^1; sbit SCL=P2^0;

void delay(unsigned int a) { unsigned int i,j; for(i=0;i c4 Then Label8.Caption = " 3"

//maximum votes calculation

ElseIf c4 > c1 And c4 > c2 And c4 > c3 Then Label8.Caption = " 4" Else Label8.Caption = " -" End If  Text2.Text = c1 Text3.Text = c2 Text4.Text = c3 Text5.Text = c4 MSComm2.Output = "AT+CMGS=" & Chr(34) & Number1 & Chr(34) & vbCrLf  Sleep (200) MSComm2.Output = "YOUR VOTING IS SUCCESSFUL. THANK YOU." & Chr(26 ) If (Check1 = vbChecked) Then '''''''''''''''' If c1 < 10 Then m1 = "0"

//variable for candidate voting

Else m1 = "" End If  If c2 < 10 Then m2 = "0" 66

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

Else m2 = ""

//variable for candidate voting

End If  If c3 < 10 Then m3 = "0" Else m3 = "" End If

//variable for candidate voting

If c4 < 10 Then m4 = "0" Else m4 = "" End If

//data send to flash memory

MSComm1.Output = "E*w" & m1 & c1 & m2 & c2 & m3 & c3 & m4 & c4 & "#" 'MsgBox "Data Sent to Microcontroller" 'MsgBox "Data Sent to Microcontroller" End If  Else

//sms send for voying done

MSComm2.Output = "AT+CMGS=" & Chr(34) & Number1 & Chr(34) & vbCrLf  Sleep (200) MSComm2.Output = "YOUR VOTING IS ALREADY DONE. VOTING ONCE IS ONLY PERMITTED." & Chr(26) End If   proceed: Text6.Text = "" 67

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

End If  MSComm2.Output = "AT+CMGD=1" & vbCrLf  Timer2.Enabled = False End Sub

//password verification

Public Sub findname() If Number1 = "7568501753" And PASSWORD = "0000" Then  Name1 = "Mr. RAHUL" ElseIf Number1 = "8963040102" And PASSWORD = "1111" Then  Name1 = "Mr. VIJAY" ElseIf Number1 = "8963040102" And PASSWORD = "2222" Then  Name1 = "Mr. VIJAY" ElseIf Number1 = "8963040102" And PASSWORD = "3333" Then  Name1 = "Mr. VIJAY" ElseIf Number1 = "8963040102" And PASSWORD = "4444" Then  Name1 = "Mr. VIJAY" Else MSComm2.Output = "AT+CMGS=" & Chr(34) & Number1 & Chr(34) & vbCrLf  Sleep (200) MSComm2.Output = "YOUR VOTING IS UNSUCCESSFUL. Mobile  Number/Password Verification Error." & Chr(26)  NONAME = True End If  End Sub

68

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

A.5 HEX File Coding :1001B70057616974696E6720342044415441004E89 :1001C7004557204441544142415345005341564904 :1001D7004E472044415441424153450053415645FF :1001E7004400412020422020432020442020005268 :1001F700454144494E47204441544120260054522A :10020700414E534D495454494E472E2E2E2E0053DE :04021700454E5400FC :0602C400D2A07F017E00C4 :1002CA00E4FDFCC3ED9FEC9E5015E4FBFA0BBB006A :0F02DA00010ABA04F8BBFBF50DBD00010C80E46E :0102E90022F2 :070276001203837F017E00EB :10027D00E4FDFCC3ED9FEC9E5015E4FBFA0BBB00B7 :0F028D00010AEB64014A70F50DBD00010C80E41D :01029C00223F :070353007F0112035A7F80B5 :10035A008F90D2B5C2B7C2B67F027E001202CAC25D :02036A00B522BA :05036C001203717F2067 :100371008F90D2B5D2B7C2B67F027E001202CAC236 :02038100B522A3 :06030F008B788A79897ADF :10031500E4F57BAB78AA79A97A857B82758300128F :0C0325000249FF6007120371057B80E7AE :0103310022A9 69

Dept. of E&C, PCE

SMS BASED VOTING MACHINE

:10038300D2A11202C6D2A01202CAC2A11202CAC2CA :04039300A00202CAF8 :10039700C2A01202C6C2A11202CAD2A01202CAD2B7 :0403A700A10202CAE3 :02029D008F7A56 :10029F00E4F9E57A30E703D38001C392A1E57A252B :1002AF00E0F57A1202C4C2A01202CA09B908E31219 :0402BF0002C4C2A013 :0102C3002218 :1002EA008F788D791203831202C67FA012029D12A3 :1002FA0002C6AF7812029D1202C6AF7912029D128F :05030A0002C60203978A :10033200E4F579F9E57925E0F579D2A0A2A1E433D3 :100342004279120279C2A012027D09B908E6AF7998 :010352002288 :02021B008F78DA :10021D001202767FA012029D120279AF7812029D12 :10022D001202791202767FA112029D120279120337 :0B023D0032A907120279120397AF01EB :010248002293 :100003007577307F3812035A7F0C12035A75985054 :10001300758920758DFD1203537BFF7A0179B71221 :10002300030FE4FFD28EC2983098FD74682FF8A6B0 :10003300990F74672FF8E6FE64456026EE644270FC :100043000302014DEE644E6004C29880DB12035339 :100053007BFF7A0179C612030F7D30E4FF1202EAB7 :1000630080B4D28EC2983098FDAF99E572B401077F 70

Dept. of E&C, PCE

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF