Introduction: Using GSM Mobile Phone to Switch Appliances

Picture of 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

Picture of 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

Picture of 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.


Ateny gabriel Aguto (author)2017-09-25

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?

Ntebza_N (author)2017-09-21

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.

kuldeephotline (author)2017-06-19

have you made your three projects bro?

JosephO78 (author)2017-04-27

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

JosephO78 (author)2017-04-27

please i need the sketch

Vamshi556 (author)2017-03-11

Not working..

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

kuldeephotline (author)2016-12-21

not working, help please

aaryank4 (author)2016-12-03

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

projects0129 (author)2016-09-19

Thanks friends.

I have also desin as per your.

Junior Design Engineer

yazenaswad (author)2016-09-02

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

Memba28 (author)2016-08-23

Awesome job

navindrapradeesh (author)2016-07-08

hi,thanks for the wonderful project..i have ordered for the relay that you have provided in the actually consists of 9 pinouts......

in1,in2.........in8 and a com pin..

how should i connect it to arduino..

1ajinkya (author)2016-07-04

Awsome project...will u help me with documentation....plz

1ajinkya (author)2016-07-04

Awsome project...will u help me with documentation....plz

DanialN2 (author)2016-04-11

sir code please

ChristoC2 (author)2016-02-22

Hi, I'm interested in doing the same kind of thing, but with a pump and a reservoir. As is illustrated in the image. The only thing is the pump is about 500m from the reservoir. I wish to have a GSM unit at the pump and a GSM unit at the reservoir. Is it possible for the Arduino boards to communicate with each other so no input from a mobile phone is requiered?

makmalhotra (author)2016-01-18

Sir can u please upload the code

jonboy43 made it! (author)2015-09-02

i'm trying to do the same project as this. the only problem is that the boards are slightly different. i've had a look around a number of arduino sites, but can't see any that are similar to mine, insofar as my boards have extra jumpers and switch which i need to identify. is it possible for someone to try and identify the different items outlined on he pics. what size battery do i need for the gsm unit.

lequithoi (author)2015-08-31

Great job. Pls tell me about where pin9 could connect to power up. Do D7 connect to rx and D8 connect to tx of arduino?

Kenrickv (author)2015-08-16

Hi, I liked your Project very much, I'm going make this project,even i have the same doubt as NikoV1 mentioned below "How would I have to change the code to only allow commands from certain phone numbers?" and can u please send me All the AT codes you used in the project it will be very useful and when i finish I'll post the images ........Thank You

NikoV1 (author)2015-06-22

Nice Project! How would I have to change the code to only allow commands from certain phone numbers? Can you tell me where to connect PIN 9 from the Arduino on the GSM board to power it on? Thanks a lot!

mandiechats (author)2015-01-16

Well done Himshekhar.das. This project sounds really interesting. I want to try it. Kindly assist with more detail on the Relay module.

This is the ebay link to the relay module. Interfacing a relay module is really very simple .The relays are marked as Relay1,Relay 2... these relays are fed in with a 12V AC and are driven by ULN 2803 . So all your work is done here you need not worry about the level of voltage output the digital output pin of arduino is providing all you have to do is along the pins of the darlington array IC interface the header strips to the arduino output pins using female male jumper wire .

The relays used are electromechanical relays it has three output terminals normally open ,normally closed and COM .Underside of the PCB youll find NC,NO,COM written on it.Think of connecting relay with the bulb as a switch .what you do when you connect a switch one terminal is connecvted and the other one is bypassed through the switch same thing happen one terminal from the mains is connected here to the COM and the other to NO or NC.if you connected the terminal to NO your bulb will be off only when you put a HIGH output on the digital pin of the arduino to your ULN pin the bulb will be switched on and the vice versa for NC


I now have all the components I need. This is the link to the GSM module that i bought:

It is slightly different from the one you used. I have been trying to use the code you uploaded and nothing is happening. Kindly help.

Sorry for the delayed reply had my semester exams.
you need to power up your gsm board from an external 12 V 2 A dont use the usb cable use an external power source .If you have some other issues do let me know

Thanks for the quick response. I'm excited. I have ordered the components, I will soon post the results of my work.

Chitlange Sahas (author)2015-02-01

good project

Thank You !!

Chitlange Sahas (author)2015-02-01

good project

Chitlange Sahas (author)2015-02-01

good project

Chitlange Sahas (author)2015-02-01

good project

seamster (author)2015-01-13

Nicely done. Thanks for sharing this!

himshekhar.das (author)seamster2015-01-13

Thanks for the appreciation !

About This Instructable




More by himshekhar.das:DIY Keypad matrix  from the principle of operation to implementationUsing PWM to control the light intensity of a LEDTo build a voltage regulator and  measure AC voltage using arduino
Add instructable to: