Using GSM Mobile Phone to Switch Appliances





Introduction: Using GSM Mobile Phone to Switch Appliances


There is no proper article or instructable available which details you every step used to build up a GSM enabled switch to control your home appliances . Thus this instructable demonstrates a way to control your home appliances using your mobile phone. Since the mobile phone uses GSM service so it is called a GSM enabled switch.


1. Arduino UNO

2. SIM 900 GSM Cellular Shield For Arduino

3. 4 channel Relay Module

4. Jumper Wires

5. Cell phone

6. Sim Card

Step 1: Interfacing the 4 Channel Relay Module

Relay Module:

A relay is an electrically operated switch.
Relay breakout module is a smart choice for controlling higher current loads from your microcontroller development board, PC parallel port or Arduino. The relays are driven by popular darlington array ULN2803A . This darlington transistor provide sufficient output to be driven by the arduino digital output.

Connect the V pin to 5V and the GND pin to the corresponding GND of the Arduino. The darlington IC pins are marked 1-n (n here is the number of relay the darlington IC is driving) connect them to the digital output pins of arduino The relay have three terminals N/O(NORMALLY OPEN) , N/C(NORMALLY CLOSED), COM.

One of the AC terminals which is conventionally connected to a manual switch is connected to the COM terminal and the other is connected to the N/O terminal.The pins marked IN1,IN2....IN8 are used for driving the corresponding relay ,connect these to the digital output pins of the arduino.

Step 2: Interfacing the SIM900 GSM Cellular Module for Arduino


1. Power: The Linksprite shield we use needs 5V up to 2A into the onboard DC socket.

2. Antenna. If your module does not have an antenna – get one.

3. SIM: Turn off the PIN lock on the SIM card. The easiest way to do this is to put the SIM in a handset and use the menu function.


We will use the Arduino software serial library and the Linksprite shield has hard-wired the serial from the SIM900 to a set of jumpers, and uses a default speed of 19200. jumpers are to be set to the “SWserial” side.

And thus whenever an instance of SoftwareSerial is created, we use 7,8 as shown below:

SoftwareSerial SIM900(7, 8); // RX, TX


1. Insert the SIM and lock the SIM card to the carrier on the bottom of the shield as shown in the figure.

2. Then plug the shield into your Uno, attach 5V power to the DC socked on the GSM shield, and USB from the Uno to the PC.

3. Press the “PWRKEY” button on the side of the shield for a second.

4. The bright “STATUS” LED will be on, and then the “NETLIGHT” LED will blink once every 800 milliseconds- until the GSM module has found the network, at which point it will blink once every three seconds.

Step 3: Software


The first command to use is AT+CMGF=1 which sets the SMS mode to text (as used in the previous example)

The second is AT+CNMI=2,2,0,0 – which tells the GSM module to send the contents of any new SMS out to the serial line.

The program works in two stages.

First it will wait for an SMS to be received, and then have the contents sent to the Arduino via serial .

The next stage is to filter out the commands in the text message
The commands (that is, the contents of your text message to the Arduino) will be in the form #ON1 or #OFF1 where ‘ON’ will be switching on the bulb 1, 2, 3 and 4 will relate to digital pins 7, 8, 12 and 13. For example, to turn on D7, you would compose your SMS as #ON1.

After processing the SMS we use the AT command AT+CMGD=1,4 to delete all the SMSs from the SIM card, otherwise it will fill up and reject further commands.

When D7,D8.. are HIGH it switches on the corresponding relay to complete the circuit and hence the bulb is on.



  • Pocket-Sized Contest

    Pocket-Sized Contest
  • Pro Tips Challenge

    Pro Tips Challenge
  • Science of Cooking

    Science of Cooking

We have a be nice policy.
Please be positive and constructive.




Hey, help me understand, how can i interface a motion sensor, to send signal to the microcontroller and to the GSM. And from the GSM the message/call will be send to my phone, and the command from the phone to turn motor on?

hello can you assists, i am doing the same project you are you doing and i tried your code but my relays stay on and dont switch on when i sent SMS.

have you made your three projects bro?

the sketch/software or the on board code so that i can upload

please i need the sketch

Not working..

after uploading code relays are automatically on and sms commands not working.

I'm planning to do a home automation project

how can i interface 5V 4 Channel relay and a sim 900 module (without power supply) to arduino uno which has only one 5V pin and one 3.3 V ?

_I'm new to arduino

Thanks friends.

I have also desin as per your.

Junior Design Engineer

Awesome job bro!! keep up the good work, I will make sure I will do
your project. I have some question if I may ask. How to control all the
four relays separately through a phone call or/and SMS? How can I set
relay one to go one for one seconds only, and relay four to stay on for 3
seconds. Can I have it code protected so in case someone calls the
numbers none of the relays would trigger? Thank you once again. Yazen