GSM Based Voting Machine System
GSM Based Voting Machine System
INTRODUCTION
1.1.OVERVIEW
This Project focuses onto implement GSM ( Global System for Mobile
Communication) based Banking Security System. This system is implemented
using an embedded microcontroller. The embedded microcontroller used here is
89C51.
Primarily, the system functions with the help of different technologies like the
Global Positioning System (GPS), 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.
LCD Display
Micro Controller 89c51
1.2.GSM MODULE
The GSM module consist of Wireless CPU, SIM card holder and power
LED. It helps to transmit and receive the SMS with UART.
1.3.STEPPER MOTOR
The type of Stepper motor we used here is Brushless shaft. This helps in
smooth rotation. These motors are used to control the Doors.
1.4.LCD DISPLAY
SYSTEM DESCRIPTION
2.1. BLOCK DIAGRAM
2.1.1. DESCRIPTION
The embedded microcontroller used here is 89C51 microcontroller.
Since, this microcontroller has in-built peripherals it is called as embedded
controller. The 89C51 microcontroller is a derivative of 8051 microcontroller
whose architecture and instructions are same as 8051 microcontroller with some
added facilities.
The GSM module is connected with the microcontroller through serial
port. Using ‘AT’ commands the SMS is transferred to the GSM module. The
GSM module converts the digital information into airborne signals. Through
GSM network the SMS is transferred to the required person’s hand phone. This
system offers better solution for the Bank security system and also it will help
you to track the intruder.
GSM differs from first generation wireless systems in that it uses digital
technology and time division multiple access transmission methods. Voice is
digitally encoded via a unique encoder, which emulates the characteristics of
human speech. This method of transmission permits a very efficient data
rate/information content ratio.
probability within the cell. On the other hand, the smaller the cell is sized, the
more equipment will be needed in the system as each cell requires the
necessary
transceiver and switching equipment, known as the base station subsystem
(BSS), through which the mobile users access the network over radio links. The
degree to which the allocated frequency spectrum is reused over the cellular
service area, however, determines the spectrum efficiency in cellular systems.
That means the smaller the cell size, and the smaller the number of cells in the
reuse geometry, the higher will be the spectrum usage efficiency. Since digital
modulation systems can operate with a smaller signal to noise (i.e., signal to
interference) ratio for the same service quality, they, in one respect, would
allow smaller reuse distance and thus provide higher spectrum efficiency. This
is one advantage the digital cellular provides over the older analogue cellular
radio communication systems. It is worth mentioning that the digital systems
have commonly used sectored cells with 120-degree or smaller directional
antennas to further lower the effective reuse distance. This allows a smaller
number of cells in the reuse pattern and makes a larger fraction of the total
frequency spectrum available within each cell. Currently, research is being done
on implementing other enhancements such as the use of dynamic channel
assignment strategies for raising the spectrum efficiency in certain cases, such
as high uneven traffic distribution over cells.
The Base Station Subsystem controls the radio link with the Mobile Station.
The Network Subsystem, the main part of which is the Mobile services
Switching Center (MSC), performs the switching of calls between the mobile
users, and between mobile and fixed network users.
The MSC also handles the mobility management operations. Not shown is the
Operations and Maintenance Center, which oversees the proper operation and
setup of the network. The Mobile Station and the Base Station Subsystem
communicate across the Um interface, also known as the air interface or radio
link. The Base Station Subsystem communicates with the Mobile services
Switching Center across the A interface.
Mobile Equipment (ME) such as hand portable and vehicle mounted unit.
Subscriber Identity Module (SIM), which contains the entire customer related
information (identification, secret key for authentication, etc.). The SIM is a
small smart card, which contains both programming and information. The A3
and A8 algorithms are implemented in the Subscriber Identity Module (SIM).
Subscriber information, such as the IMSI (International Mobile Subscriber
The BSC controls multiple BTSs and manages radio channel setup, and
handovers. The BSC is the connection between the Mobile Station and
Mobile
Switching Center. The Base Station Controller (BSC) provides, classicaly,
the
intelligence behind the BTSs. Typically a BSC has 10s or even 100s of
BTSs
under its control. The BSC handles allocation of radio channels, receives
measurements from the mobile phones, controls handovers from BTS to
BTS. A
key function of the BSC is to act as a concentrator where many different
low
capacity connections to BTSs become reduced to a smaller number of
connections towards the Mobile Switching Center (MSC) (with a high level
of
utilisation). Overall, this means that networks are often structured to have
many
BSCs distributed into regions near their BTSs which are then connected to
large
centralised MSC sites.
The BSC is undoubtedly the most robust element in the BSS as it is not
only a BTS controller but, for some vendors, a full switching center, as well as
an SS7 node with connections to the MSC and SGSN. It also provides all the
required data to the Operation Support Subsystem (OSS) as well as to the
performance measuring centers. A BSC is often based on a distributed
computing architecture, with redundancy applied to critical functional units to
ensure availability in the event of fault conditions. Redundancy often extends
beyond the BSC equipment itself and is commonly used in the power supplies
and in the transmission equipment providing the A-ter interface to PCU.
The databases for all the sites, including information such as carrier frequencies,
frequency hopping lists, power reduction levels, receiving levels for cell border
calculation, are stored in the BSC.
of these terms though could refer to the same MSC, but doing different things at
different times.
A Gateway MSC is the MSC that determines which visited MSC the
subscriber who is being called is currently located. It also interfaces with the
Public Switched Telephone Network. All mobile to mobile calls and PSTN to
mobile calls are routed through a GMSC. The term is only valid in the context
of one call since any MSC may provide both the gateway function and the
Visited MSC function, however, some manufacturers design dedicated high
capacity MSCs which do not have any BSCs connected to them. These MSCs
will then be the Gateway MSC for many of the calls they handle.
The Visited MSC is the MSC where a customer is currently located. The VLR
associated with this MSC will have the subscriber's data in it. The Anchor MSC is
the MSC from which a handover has been initiated. The Target MSC is the MSC
toward which a Handover should take place. An MSC Server is a part of the
redesigned MSC concept starting from 3GPP Release 5.
basic unit for the definition of logical channels. One physical channel is one
burst period per TDMA frame.
Organization of bursts, TDMA frames, and multiframes for speech and data
GSM is a digital system, so speech which is inherently analog, has to be
digitized. The method employed by ISDN, and by current telephone systems for
multiplexing voice lines over high speed trunks and optical fiber lines, is Pulse
Coded Modulation (PCM). The output stream from PCM is 64 kbps, too high a
rate to be feasible over a radio link. The 64 kbps signal, although simple to
implement, contains much redundancy. The GSM group studied several speech
coding algorithms on the basis of subjective speech quality and complexity
(which is related to cost, processing delay, and power consumption once
implemented) before arriving at the choice of a Regular Pulse Excited -- Linear
Predictive Coder (RPE--LPC) with a Long Term Predictor loop. Basically,
information from previous samples, which does not change very quickly, is
used to predict the current sample. The coefficients of the linear combination of
the previous samples, plus an encoded form of the residual, the difference
between the predicted and actual sample, represent the signal. Speech is
divided
into 20 millisecond samples, each of which is encoded as 260 bits, giving a total
bit rate of 13 kbps. This is the so-called Full-Rate speech coding. Recently, an
Enhanced Full-Rate (EFR) speech-coding algorithm has been implemented by
some North American GSM1900 operators. This is said to provide improved
speech quality using the existing 13 kbps bit rate.
2.2.5. WORKING
2.2.6. FEATURES
Performance
Fast with high real throughput
Integrity
Secure controlled data transfer
Network Access
Quick and consistent
Contention Control
Avoid conflicts and collisions
Installation
Simple quick installation
Frequency Choice
Choice of RF bands to suit different terrains
Network Diagnostics
For ease of maintenance and cost saving
2.3.2 FUNDAMENTALS OF OPERATION
The top electromagnet (1) is charged, attracting the topmost four teeth of a
sprocket.
.3.3. APPLICATIONS
Computer controlled stepper motors are one of the most versatile forms
of positioning systems, particularly when digitally controlled as part of a
servosystem. Stepper motors are used in floppy disk drives ,flatbed,
scanners,printers, plotters and many more devices note that the hard
drives no
longer use stepper motors to position the read\write heads instead
utilizing a
voice coil and servo feedback in head positioning.
A liquid crystal display is a thin, flat display device made up of any number of
color or monochrome pixels arrayed in front of a light source or reflector. It is
prized by engineers because it uses very small amounts of electric power and is
therefore suitable for use in battery powered electronic devices.
The surfaces of the electrodes that are in contact with the liquid
crystal material are treated so as to align the liquid crystal molecules
in a particular direction this treatment typically consists of a thin
polymer layer that is unidirectionally rubbed using a cloth.
State
1
State 2
State 3
State 4
State 5
State
6
Examining the following figure, note that of the 40 pins a total of 32 pins are set
aside for the four ports P0, P1, P2 and P3, where each port takes 8 pins. The rest
of the pins are designated as Vcc, GND, XTAL1, XTAL2, RST, EA,
ALE, and PSEN. Of these 8 pins, all 8051 derivatives use six of them. In other
words, they must be connected in order for the system to work.
Fig. 1.5. Pin Diagram of 89C51 Microcontroller
1–8: P1.0 to P1.7 (Port 1): Each of these pins can be used as either input
or output according to your needs. Port 1 is an 8-bit bi-directional I/O port with
internal pull-ups on all pins. Port 1 pins that have 1s written to them are pulled
high by the internal pull-ups and can be used as inputs. As inputs, port 1 pins
that are externally pulled low will source current because of the internal pull-ups.
Each pin of Port1 has an alternate function
•
Pin 1: T2 (P1.0)
Clock input of counter 0
Pin 2: T2EX (P1.1) - Timer/Counter 2 Reload / Capture / Direction
Control
•
Pin 3: ECI (P1.2) - External Clock Input to the PCA
•
Pin 4: CEX0 (P1.3) - External I/O for PCA module 0
•
Pin 5: CEX1 (P1.4) - External I/O for PCA module 1
•
Pin 6: CEX2 (P1.5) - External I/O for PCA module 2
•
Pin 7: CEX3 (P1.6) - External I/O for PCA module 3
•
Pin 8: CEX4 (P1.7) - External I/O for PCA module 4
9: RST (Reset Signal): High logical state on this input halts the MCU
and clears all the registers. Bringing this pin back to logical state zero starts the
program a new as if the power had just been turned on. In another words,
positive voltage impulse on this pin resets the MCU. Depending on the device's
purpose and environs, this pin is usually connected to the push-button, reset-
upon-start circuit or a brown out reset circuit.
10-17: P3.0 to P3.7 (Port 3): As with Port 1, each of these pins can be
used as universal input or output. However, each pin of Port 3 has an
alternative function:
•
Pin 10:RxD(P3,0)
Serial input for asynchronous
communication
•
Pin 11:TxD(P3.1)
Serial output for asynchronous
communication
•
Pin 12:INT0( P 3.2) - Input for interrupt 0
•
Pin 13:INT1( P 3.3) - Input for interrupt 1
•
Pin 14:T0(P 3.4)
Clock input of counter 0
•
Pin 15:T1(P 3.5)
Clock input of counter
Pin 16:WR(P3.6)
Signal for writing to external RAM
memory
•
Pin 17:RD(P3.7)
Signal for reading from external RAM
memory
18-19: XTAL2 and XTAL1 (Crystal input and output): Input and
output of internal oscillator. Quartz crystal controlling the frequency
commonly connects to these pins.
20: VSS:Gr ound
21- 28: P2.0 to P2.7 (Port 2): If external memory is not present, pins of
29: PSEN (Program Store Enable): MCU activates this bit (brings to
low state) upon each reading of byte instruction from program memory. If
external ROM is used for storing the program, PSEN is directly connected to its
control pins.
30: ALE (Address Latch Enable): Before each reading of the external
memory, MCU sends the lower byte of the address register (addresses A0 – A7)
to port P0 and activates the output ALE. External Chip (eg: 74HC373),
memorizes the state of port P0 upon receiving a signal from ALE pin, and uses it
as part of the address for memory chip. During the second part of the MCU
cycle, signal on ALE is off, and port P0 is used as Data Bus. In this way, by
adding only one integrated circuit, data from
SIMULATION CODES
//*****************BANK LOCKER SYSTEM USING
GSM*********************
//**********************Password is
11253**************************
#include<reg51.h>
#include<stdio.h>
#include<string.h>
//*****************PREPROCESSOR
DIRECTIVES**************************
sbit security_sw=P3^2;
sbit locker=P3^3;
sbit sw1=P1^3;
sbit sw2=P1^4;
sbit red_led=P1^5;
sbit green_led=P1^6;
//**************VARIABLE
DECLARATION*********************************
unsigned char init[]= "AT";
unsigned char text[]="AT+CMGF=1";
unsigned char read[]="AT+CMGR=1";
unsigned char no[]= "AT+CMGS=\"9486163383\"";
unsigned char sms[]= "THEFT OCCURED";
unsigned char del_all[]="AT+CMGD=1,4";
unsigned char del[]="AT+CMGD=1";
unsigned char clockwise1[4]={0x09,0x05,0x06,0x0A};
unsigned char clockwise2[4]={0x90,0x50,0x60,0xA0};
unsigned char anticlockwise1[4]={0x0A,0x06,0x05,0x09};
unsigned char anticlockwise2[4]={0xA0,0x60,0x50,0x90};
unsigned char valid_data[10],c[10],rec[80],check=0,chk_msg=0;
TMOD=0x20;
TH1=0xFD;
TL1=0x00;
SCON=0x50;
TR1=1;
for(i=0;array[i]!='\0';i++)
{SBUF=array[i];
while(TI==0);
TI=0;
}SBUF=0x0d;
while(TI==0);
TI=0;
}//**************************DELAY
FUNCTION*************************
void delay(unsigned long int y)
{
int x;
for(x=0;x<y;x++);
}//********FUNCTION TO AUTOMATE THE STEPPER
MOTOR******************
void stepper(unsigned char array[])
{unsigned int i,j;
for(i=0;i<13;i++)
{for(j=0;j<4;j++)
{P0=array[j];
delay(800);
}
}
}/*************************DELAY**************************
*************/
void busy_check()
{unsigned char z;
for(z=0;z<1000;z++);
}
/****************** LCD COMMAND
FUNCTION********************************/
void lcd_command()
{unsigned int i;
RS=0;RW=0;EN=0;
for(i=0;i<5;i++)
{
P2=command1[i];
EN=1;
busy_check();
EN=0;
}
}
//*************** LCD DISPLAY
FUNCTION*****************************/
void lcd_display(unsigned char array[])
{
unsigned char i;
for(i=0;array[i]!='\0';i++)
{
RS=1;
P2=array[i];
EN=1;
busy_check();
EN=0;
}
}//**************************LCD SINGLE
COMMAND************************/
void lcd_com(unsigned char code c)
{
RS=0;RW=0;EN=0;
P2=c;
EN=1;
busy_check();
EN=0;
}//**************************LCD SINGLE
COMMAND************************/
void lcd_data(unsigned char code d)
{
RS=1;RW=0;EN=0;
P2=d;
EN=1;
busy_check();
EN=0;
}
//***************TO RECEIVE THE SINGLE
CHARACTER****************
unsigned char single_rx()
{unsigned char ch;
while(RI==0);
RI=0;
ch=SBUF;
return(ch);
}//*************************TO READ THE
MESSAGE******************
void compare()
{
unsigned int i;
unsigned char dat;
while(single_rx()!='+');//CHECK FOR NEW MESSAGE
ACKNOWLEDGMENT
{
while(single_rx()!='T');
{
while(single_rx()=='I')
{
delay(1000);
transmit(read);
while(single_rx()!=':');
dat=single_rx();
while(single_rx()!=':');
while(single_rx()!=':');
while(single_rx()!='"');
dat=single_rx();
dat=single_rx();
for(i=0;rec[i-1]!=0x0D;i++)
{
while(RI==0);
RI=0;
rec[i]=SBUF;
}for(i=0;i<4;i++)
{
valid_data[i]=rec[i];
}valid_data[i]='\0';
delay(100);
transmit(valid_data);
if((strcmp(valid_data,"open")==0)||(strcmp(valid_data,"Open")==0))
{
{transmit(del);
delay(10000);
check=0;
}}}}}
if(key1==0)
{
key[count]=0x31;
count=count+1;
lcd_data('*');
delay(3000);
}
else if(key2==0)
{key[count]=0x32;
count=count+1;
lcd_data('*');
delay(3000);
}
else if(key3==0)
{key[count]=0x33;
count=count+1;
lcd_data('*');
delay(3000);
}
else if(key4==0)
{
key[count]=0x34;
count=count+1;
lcd_data('*');
delay(3000);
}
else if(enter==0)
{key[count]=0x35;
count=count+1;
lcd_data('*');
delay(3000);
}
else
goto loop;
}void security_mode()
{
int i;red_led=1;
lcd_com(0x80);
lcd_display(" Key Open In ");
lcd_com(0xc0);
lcd_display(" Security Mode ");
delay(10000);
lcd_com(0x80);
");
stepper(anticlockwise2); //close the 2nd door
lcd_com(0x80);
lcd_display("Message sending ");
lcd_com(0xc0);
lcd_display("
....
");
delay(500000);
transmit(init);
delay(5000);
transmit(text);
delay(10000);
transmit(no);
delay(10000);
transmit(sms);
delay(1000);
SBUF=0X1A;
while(TI=0);
TI=0;
lcd_com(0x80);
compare();// get the control to open the second door through sms
lcd_com(0x80);
lcd_display(" Key Open In ");
lcd_com(0xc0);
lcd_display(" Security Mode ");
while(security_sw==0);
red_led=0;
}
void check_password()
{lcd_com(0x80);
");
lcd_com(0xc6);
do
{psw();
} while(count<5);
key[count]='\0';
count=0;
if(strcmp(key,"11253")==0)
{
lcd_com(0x80);
lcd_display("Allowed to Access");
lcd_com(0xc0);
lcd_display("
key
");
check=check+1;
stepper(clockwise1);
delay(10000);
}
if(strcmp(key,"11253")!=0)
{
lcd_com(0x80);
lcd_display(" Not allowed to ");
lcd_com(0xc0);
lcd_display(" Access key ");
delay(10000);
}
}
//*************************MAIN
FUNCTION**************************
void main()
{
int i,j;
red_led=green_led=0;
lcd_command();
transmit(init);
delay(3000);
transmit(del_all);
delay(3000);
green_led=1;
while(1)
{
next:
lcd_com(0x80);
lcd_display(" BANK LOCKER ");
lcd_com(0xc0);
lcd_display(" SYSTEM
");
//**********get the password from the
keyboard to open the first
door*******************
if(sw1==0)
{
for(i=0;i<2;i++)
{
if(check==0)
check_password();
else
goto next;
}
}while(sw1==0);
check=0;
while(sw2==0);
//*********************check if the system in security
mode***************
if(security_sw==0)
{
if(locker==1)
security_mode();
}
if(locker==1)
red_led=1;
if(locker==0)
red_led=0;
}
}