Vous êtes sur la page 1sur 5

SMS BASED DEVICE SWITCHING

Chaudhry Saqib Naseer


School of Engineering, Design and Technology
University of Bradford
saqibnaseer@gmail.com
Abstract- Human being always searches for ease of life;
this is his desire from first day to make things more
comfortable. For search of ease and comfort human race
has undergone from a lot of revolutionary changes. The
dynamic control of device in general and home appliances in
specific is the dream of human society from the starting of
machines. Switching the home appliances like turning lights
on wirelessly without any extra remote is like a dream.
Suppose someone is on vacations and want to turn on the
porch light at night and turn it off in day, it will provide
remote access to any device at anytime from anywhere in
world where mobile device work. You can send SMS
anytime from anywhere and change the status of device.
This paper discusses a device switching technique. In this
technique a microcontroller and mobile phone are
interfaced using AT commands. Short Messaging Service
(SMS) is a text-based service that enables characters to be
sent from one mobile to another. Sending a simple SMS,
such as "A ON" to a receiver mobile will switch the device.
Mobile receives the incoming text message and sends it to
microcontroller which changes the states of devices by
comparing text message with stored values.
Keywords: Short Messaging Service (SMS), Mobile Phone,
AT commands, Microcontroller.

I. INTRODUCTION
Controlling devices remotely is a vision in which
humans are working hard since early times. Imagine not
only controlling device remotely but also wirelessly from
far away distance where your mobile phone works. In
this design all the home appliances can be controlled by a
simple SMS.
SMS based device switching provides a new gateway
to control your devices. SMS System is the very useful
for practical life. If you are away from your house and
want to turn on heater before you reach home simply
send a SMS to your system and its done. Sender mobile
sends a simple SMS which is received by the receiver
mobile attached in the system, SMS is then fetched by the
microcontroller which then decodes the SMS and change
the state of that device by using relays. Lights, fans,
heating, pumps, air conditioning, television, electric gates
and other home devices can be controlled simply by
sending SMS. In this system a device operating on 220V
can easily be controlled.

Sender
Mobile
SMS

Receiver
Mobile

Device

AT commands

Micro
Controller

Relay

Fig.1 General Overview of System


II. OVERVIEW
Following are the main features that lead to effective
SMS based system design.

Cost
Performance
Power Consumption
Reliability
Future Enhancements

The system is designed by interfacing a mobile device


with the micro controller. There are different techniques
by which microcontroller can be interfaced with the
mobile device. The two common techniques are FBus/M-Bus and AT commands. Due to more flexibility
of AT commands the microcontroller and mobile device
are interfaced using AT commands in this system. A
serial connection is used to communicate between mobile
device and microcontroller. When a SMS is received it is
send to controller which check the characters in the text
message and send the signal to its relative port to which a
relay is attached to turn on or off any device which is
connected to that relay.
A lot of devices can be connected to the output ports of
the microcontroller using relays. Each of the port has its
own code which controller compares with the SMS
which is send to the receiver mobile.

III. MICRO CONTROLLER


Micro controllers are widely used in automation and
system control nowadays. Microcontrollers have wide
range of types depending on their usage in specific
system. In this specific system AT89C51 is used.
Following are the main key features of this specific micro
controller.

Low Power Consumption


Programmable Serial Channel
Six Interrupts
Two 16 Bit Timers
Fully Static Operation
4Kbytes of EPROM
32 Programmable I/O Lines

The AT89C51 is a high performance and low power


CMOS micro controller. It is a powerful microcontroller
which is cost effective and highly flexible to use in many
control systems.

pull up are used in this mode of port 0. During Flash


programming port 0 receives the code bytes and during
program verification outputs gets the code bytes. External
pull ups are required for port 0 output.
Port 1: This port is an eight-bit two way input/output
port with built in internal pull ups. The output of port 1
can sink or source four transistor-transistor inputs. When
high is given to Port 1 pins they are pulled high by the
built in internal pull ups and its ports can be used as
inputs. When using port 1 as inputs the pins are
externally pulled low. During flash programming Port 1
receives the program verification and low-order address
bytes.
Port 2: Port 2 is an eight-bit two directional input/output
port with built in internal pull ups. The Port 2 output pins
buffers can sink/source four transistor-transistor logic
inputs. When port 2 is set high it is pulled high by the
internal pull ups and can be used as inputs. Port 2 pins
when used as inputs that are externally being pulled low
will source current because of the internal pull ups. Port 2
is the high-order address byte that fetches data from
external program memory and during accesses to external
data memory 16-bit addresses are used. Example is
MOVX@DPTR. This port also receives the high order
address bits and during flash programming some control
signals are also used.
Port 3: Port 3 is also an eight-bit two directional
input/output port with internal pull ups. The Port 3 output
pins can sink/source four transistor-transistor logic
inputs. When Port 3 pins are given high that is 1 is given
to the port pins they are pulled high by the internal pull
ups and can be used as inputs. This Port plays an
important role in microcontroller as it handles all the
interrupts, timers and most importantly serial
communication by RXD and TXD. There are two
external interrupts and two timers. T0 acts as timer0 and
T1 is for timer1. External data write and external data
read are also included in port 3. This port also serves the
functions of various special features of the AT89C51
which are listed below.

Pin Description:
Following are the description of pins as shown in figure 2
of AT89C51.
VCC: Pin 40 is supply voltage VCC, it is +5V DC.
GND: Pin 20 is Ground in this microcontroller.
Port 0: It is a port with 8-bit open drain two way
input/output ports. When it is used as output each pin can
be sink in eight TTL inputs. When high is given to port 0
pins, the pins of this port can be used as high impedance
inputs. To access external program and data memory port
0 is used as multiplexed address and data bus. Internal

Port
Pin
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

Table 1
Description of Port 3
Functions
RXD (Serial Input Port)
TXD (Serial Output Port)
INT0 (External Interrupt 0)
INT1 (External Interrupt 1)
T0 (Timer 0)
T1 (Timer 1)
WR (External Data Write)
RD (External Data Read)

RST: RST is the reset pin. This pin is usually high for
two machine cycles while the oscillator connected resets
the device.
ALE/PROG: ALE stands for Address Latch Enable. For
latching the low byte of the address during access to
external memory address latch enable is used. Address
latch enable is an output pulse. During flash
programming ALE pin is also the program pulse input
(PROG).
PSEN: To read external program memory PSEN
(Program Store Enable) is used as read strobe. During the
code execution in AT89C51 from external program
memory, PSEN is activated twice for each machine
cycle, except for the two PSEN activations are skipped
during each access to external data memory.
EA/VPP: EA stands for External Access Enable. EA
must be grounded in order to enable the device to get the
code from external program memory locations. EA
should be supplied VCC for internal program executions.
This pin is also called VPP as this pin also receives the
12-volt programming enable voltage (VPP) during Flash
programming of the microcontroller, for the parts that
require 12-volt VPP.
XTAL1: It is the input to the inverting oscillator
amplifier and also to the internal clock operating circuit.
XTAL2: It is the output from the inverting oscillator
amplifier. On chip oscillator can be used if not then both
XTAL1 and XTAL2 are connected to a ceramic resonator
or quartz crystal.

In SMS based device switching the modem of mobile


phone is initialized by sending AT command through
microcontroller. Then microcontroller reads for any
incoming SMS to the receiving mobile. When receiver
mobile gets a SMS it is send to micro controller.
Microcontroller can read SMS from a message storage
area in mobile device. The mobile phone should support
either of following AT commands.

AT+CMGR=1
AT+CMGL=REC UNREAD
AT+CMGL=ALL

To get SMS from a known index of mobile memory


AT+CMGR command is used and the exact location of
index is given. To get all unread SMS from mobile
memory AT+CMGL=REC UNREAD command is used
and AT+CMGL=ALL is used to get all the messages in
the mobile memory.
V. RELAY
Relay is a very useful device when large amount of
current and voltage are meant to be controlled with very
small amount of electrical signal. The coil which
produces magnetic field in the relay consumes minimum
amount of power whereas contacts which are opened or
closed can conduct heavy amount of power to load.
Operation of relay can simply be referred as a binary (off
or on) amplifier. When current flows through the coil of
relay it creates a magnetic field which pulls a lever
towards it due to magnetism and switch changes it states
it goes from on to off or vice versa.

IV. AT Commands
To control a modem in the mobile phone AT command
instruction set is used. AT is short form of Attention.
Every command is given by AT or at. Thats why
commands given to the modem are called AT commands.
Most mobile phones support AT command set that is
specific to the GSM technology, in which SMS related
commands can be used such as send SMS message, list
SMS message, read SMS message etc. There are two
types of AT commands.

Basic Commands
Extended Command

Basic AT commands are simple and they dont start


with +. For example D (Dial), A (Answer) are basic
commands. Extended AT commands are those which are
started with +. In this system extended commands are
used. +CMGS (Send SMS massage), +CMGR (Read
SMS message) are examples of extended commands.

In above figure a relay is connected to a 12V DC


power supply through a switch. When the switch is
closed the current passes through the coil of the relay, so
it gets magnetized and switch of the relay is closed and
main circuit is completed in which 220V AC power
supply is used. Microcontroller can also switch the device
directly but it does not provide enough power for devices
operating at 220V. So relays are used as switch, there are
many advantages of relays as a switch. Relays can switch
both DC and AC for high voltage and currents whereas
transistors can only switch DC with low current and
voltage specification. There are also few disadvantages of
relays. The main disadvantage of relay is that the most of
common relays cannot switch rapidly but this does not
affect the overall efficiency of this system.

VI. SMS

well as it should have modem supporting AT commands


which is interfaced with a microcontroller.

SMS is abbreviation of Short Message Service. It is a


text based communication service component of GSM
communication system. Using standard GSM protocol it
allows to send and receive simple and short text
messages. SMS text messaging is widely used by all
generations around the world with almost 2.4 billion
users active at a time. The term SMS is a synonym for all
sort of short text messages. Mostly text messages are up
to 160 characters and most SMS messages are from
mobile to mobile.
In SMS based device switching a simple text based
SMS can do wonders. Text based messaging has become
a part of our life as in 2008, 4.1 trillion SMS were sent.
People prefer to inform someone on text message rather
than calling. SMS is now a massive commercial industry,
worth over 81 billion dollars globally. SMS are now
cheap almost free within the network however at least
0.03 interconnecting fees is charged when SMS is sent
to another network.
In a similar matter as email, the text messages are
stored and forwards at a SMS center, it allows the
messages to be retrieved later if the receiver mobile is not
available to receive text message immediately. SMS
messages are sent over the low speed control channel of
mobile network. Due to the convenience of SMS in this
system a simple SMS can be sent to control devices, such
as light1 on, fan2 off, heat1 on, pump off etc. All of these
are preprogrammed in the microcontroller.
VII. MOBILE DEVICE
A mobile device is typically known as cell phone, it is
a small pocket sized computing device with a screen and
a key pad. It is an electronic device used for
telecommunication. It is used as mobile telephone, text
messaging and data transmission over a specific network.
Mobile phones have a lot of different functions and
features but in this system basic features are used which
are available in every mobile device. A keypad is used to
type SMS and it is send over the cellular network and it is
received by the receiver mobile attached to the system.
Following two mobile devices are used in the system.

Sender Mobile
Receiver Mobile

Sender mobile can be of any type because all the


typical mobile phones have basic features for sending
SMS. The sender mobile is just used to send the SMS
which is received by the receiver and specific device is
switched by the micro controller after getting the SMS
from receiver mobile. Receiver mobile is fixed in the
system it should have basic feature of receiving SMS as

VIII. SCHEMATIC EXPLANATION


In SMS based device switching system microcontroller
is the main component which is interfaced with all the
devices. Receiver mobile and relays are connected with
the microcontroller. The main devices which are intended
to be switched are connected to relays because
microcontroller cant handle high current and voltages.
The basic connections of microcontroller are normal for
almost all systems. Pin 40 is VCC connected to +5V, pin
20 is grounded, Pin 18 and 19 (XTAL1 and XTAL2) are
connected are to 11.0592 MHz crystal which is grounded
by two 33pF capacitors.
The main part is connection of receiver mobile with
the microcontroller. Different mobile devices have
different pin layouts, so their user manual must be
referred to check for correct pins for RXD and TXD. The
RXD of mobile device is connected to the pin 3.0 of the
microcontroller which is RXD of it. The TXD of mobile
device is connected to pin 3.1 of microcontroller which
acts as TXD of it. Also the ground pin of mobile device is
also grounded with the ground which is already
connected to pin 20 of microcontroller.
Relays can be connected to any output ports of
microcontroller. The output ports which can be used for
connection of relays are ports 0.0-0.7, ports 1.0-1.7 and
ports 2.0-2.7. The coil side of the relay is connected to
the microcontroller and switch side of the relay is
connected to device which is usually operated at 220v.
Relay is driven through NPN transistor; the base of
transistor is connected to the output pin of
microcontroller. A current limiting resistor is used to
limit the current. Emitter of transistor is grounded and
collector is connected to the coil of the relay. When
microcontroller gives the signal to the base of transistor it
completes the path and +5v completes its path to ground
via transistor and due to the magnetic field in coil of relay
the circuit of 220V device connected to relay is
completed and the state of that device is changed.

IX. FUTURE ENHANCEMENTS


Once the mobile phone has been interfaced with micro
controller than with the help of AT commands this
system can be modified to following enhancements.

GPS Tracking System


Fire System (Indication of fire via call or SMS)
Sending of Temperature and Humidity by SMS
SMS Remote Control
Prepaid Energy Meter
X. CONCLUSION

In general control of any device wirelessly is a


revolutionary technology which is discussed in this
paper. GSM technology is used to control device via
SMS. In this paper the concept of SMS BASED
DEVICE SWITCHING is thoroughly discussed. All the
hardware components are carefully detailed with aspect
to this research paper. This research has a lot of attraction
as it can be further enhanced to many systems. The
system that it is researched in this paper consists of
highly advanced IC and all other components are reliable.
The main problem in this system is that the receiver
mobile should be charging all the time with the power
supply of system.
With the growing number of cell phone users day by
day and their preference on SMS rather than call gives a
new hope towards this system. Finally it is concluded that
SMS based device switching is a field in which SMS can
control devices remotely and it has a huge resources and
scope for research and further development.
REFERENCES
[1] Muhammad Ali Mazidi and Janice Gillispie Mazidi,
The 8051 Microcontroller and Embedded System,
Prentice-Hall, N.J., 2000.
[2] Myke Predko, Programming and Customizing the
8051 Microcontroller, McGraw-Hill, NY, 1999.
[3] Gene McWhorter and Alvis J. Evans, Basic
Electronics, Master Publishing, Illinois, 2000.
[4] Vladimir Gurvich, Electric Relays Principles and
Applications, Taylor and Francis, FL, 2006.
[5]
http://www.developershome.com/sms/atCommandsIntro.
asp
[6] http://www.palowireless.com/sms/tutorials.asp

Vous aimerez peut-être aussi