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.

<p>the sketch/software or the on board code so that i can upload</p>
<p>please i need the sketch</p>
<p>Not working..</p><p>after uploading code relays are automatically on and sms commands not working.</p>
<p>not working, help please</p>
<p>I'm planning to do a home automation project</p><p>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 ?</p><p>_I'm new to arduino </p>
<p>Thanks friends.</p><p>I have also desin as per your.</p><p>Junior Design Engineer</p><p>www.nrdcentre.com</p>
<p>Awesome job bro!! keep up the good work, I will make sure I will do <br>your project. I have some question if I may ask. How to control all the <br>four relays separately through a phone call or/and SMS? How can I set <br>relay one to go one for one seconds only, and relay four to stay on for 3<br> seconds. Can I have it code protected so in case someone calls the <br>numbers none of the relays would trigger? Thank you once again. Yazen</p>
Awesome job
<p>Need help guys.</p><p>We have been given a Final Year Project.</p><p>In which we have any vehicle, and we have to do these 3 tasks with the vehicle.</p><p>First task:</p><p>Using RFID, we have to make some User ids and one Administrator. Only these users and admin can Start the Vehicle. If someone else tries to do it, then a message will be sent to the Users and Administrator via GSM.</p><p>Second task:</p><p>We have a GPS tracking system in the vehicle, if we want to know the location, then we can send a command through GSM and we will get the location through GSM message.</p><p>Third Task:</p><p>We have controlled ON OFF system for the vehicle. Only Administrator has the rights for it. If the administrator sends command through GSM for ON, then the Vehicle will Start instantly. If the administrator sends command through GSM for OFF, then the Vehicle will Stop immediately.</p>
<p>hi,thanks for the wonderful project..i have ordered for the relay that you have provided in the link..it actually consists of 9 pinouts......</p><p>in1,in2.........in8 and a com pin..</p><p>how should i connect it to arduino..</p>
<p>Awsome project...will u help me with documentation....plz</p>
<p>Awsome project...will u help me with documentation....plz</p>
sir code please
<p>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?</p>
<p>Sir can u please upload the code</p>
<p>hi,<br>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.<br>regards<br>jh</p>
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?
<p>Hi, I liked your Project very much, I'm going make this project,even i have the same doubt as NikoV1 mentioned below &quot;How would I have to change the code to only allow commands from certain phone numbers?&quot; 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 </p><br>
<p>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!</p>
<p>Well done Himshekhar.das. This project sounds really interesting. I want to try it. Kindly assist with more detail on the Relay module.</p>
<p><a href="http://www.ebay.in/itm/EIGHT-CHANNEL-8-CH-12V-ULN2803-RELAY-BOARD-MODULE-for-RASPBERRY-PI-ARDUINO-AVR-/331446063367?pt=IN_Home_Appliances&hash=item4d2bb99107" rel="nofollow">http://www.ebay.in/itm/EIGHT-CHANNEL-8-CH-12V-ULN2...</a><br> </p><p>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 .</p><p>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 <br></p>
<p>Hi.</p><p>I now have all the components I need. This is the link to the GSM module that i bought: </p><p><a href="http://www.elecfreaks.com/wiki/index.php?title=EFCom_Pro_GPRS/GSM_Module" rel="nofollow">http://www.elecfreaks.com/wiki/index.php?title=EFC...</a></p><p>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.</p>
<p>Sorry for the delayed reply had my semester exams.<br>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</p>
<p>Thanks for the quick response. I'm excited. I have ordered the components, I will soon post the results of my work.</p>
<p>good project</p>
Thank You !!
<p>good project</p>
<p>good project</p>
<p>good project</p>
<p>Nicely done. Thanks for sharing this!</p>
<p>Thanks for the appreciation !</p>

About This Instructable




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