The SMS Based Device Switching Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

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.


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 are controlled by a simple SMS.

SMS based device switching provide 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 it's done. Sender mobile sends a simple SMS which is received by the receiver mobile attached in the system, SMS is then fetched by the micro controller 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.

Sender Mobile



Receiver Mobile

AT commands


Micro Controller

Fig.1 General Overview of System


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



Power Consumption


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 F-Bus/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.

Total eight devices can be connected to the output port 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.


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.

Pin Description:

Following are the description of pins as shown in figure 2 of AT89C51.

VCC: Supply voltage.

GND: Ground.

Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 may also be configured to be the multiplexed loworder address/data bus during accesses to external program and data memory. In this mode P0 has internal pullups. Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program verification. External pullups are required during program verification.

Port 1: Port 1 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups.Port 1 also receives the low-order address bytes during Flash programming and program verification.

Port 2: Port 2 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 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 bidirectional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of various special features of the AT89C51 as listed below:

Table 1 Description of Port 3

Port Pin



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: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

ALE/PROG: Address Latch Enable 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.

PSEN: Program Store Enable is the read strobe to external program memory.  When the AT89C51 is executing code from external program memory, PSEN is  ctivated 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 beinternally 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, for parts that require 12-volt VPP.

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

XTAL2: Output from the inverting oscillator amplifier.

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. That's 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 don't 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 SMS based device switching the modem of mobile phone is initialized by sending AT command through micro controller. 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, the mobile phone has to support either of following AT commands.




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.


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.

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.


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.


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.



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