Electronics > GSM Module >> Arduino and GSM Module Views : 7405
Rate This Article :

Control AC Appliances using Arduino and GSM Module


This article will help you to understand to control AC Appliances using ARDUINO based on messages received by GSM Module. In turn, ARDUINO will control Relays to turn On/Off AC appliances. Before starting this, reader should have basic understanding about serial interface and its communication between GSM Module and ARDUINO.

I have explained how to control LEDs instead of AC appliances in this article. Check it to get better understanding.

Required Components:

  2. 8 to 10 Jumper Male and Female Pins
  3. Bread Board
  4. GSM Module SIM900A and Working SIM to receive messages
  5. Relay
  6. LED Light
  7. Bulb (or) Fan
  8. Wires

Interface between Components:

GSM Module sends messages to ARDUINO which will Control AC Appliances based incoming messages.

I have used Electric bulb to do this POC. Extra care should be taken when dealing with 240V, please don't attempt if you are not confident.

Message Format:

I have used below format to Turn ON/OFF LEDs.

1.    @Light On#

2.    @Light Off#

Circuit Design:


 Connecting AC appliances through Relay connected with ARDUNIO explained below.



ARDUINO Source Code:

Given below the code. Copy and Paste it in ARDUINO Code explorer and burn the code in ARDUINO by selecting required COM Port. Then Send Message from Sender Mobile as mentioned above.

String inputString = "";         // a string to hold incoming data

boolean stringComplete = false;  // whether the string is complete

String incomingString ="";

int startIndex = 0;

int endIndex = 0;

int led1 = 4;

int relay1 = 8;

void setup() {

  // initialize serial:


   // prepare the digital output pins

   pinMode(led1, OUTPUT);

   pinMode(relay1, OUTPUT);

   // initially all are off

   digitalWrite(led1, LOW);


  // reserve 200 bytes for the inputString:


  //--Start: Send SMS --



  //Serial.print("AT+CMGD=1,4\r");  // Deletes all SMS saved in SIM memory


  Serial.println("DEL ALL\"");



  Serial.print("AT+CMGS=\"+91XXXXXXXXXX\"\r");    //Number to which you want to send the sms


  Serial.print("Test SMS - It Started Working1..\r");   //The text of the message to be sent






  //--End: SMS--


void loop() {

  // print the string when a newline arrives:

  if (stringComplete && inputString!="") {



    if(inputString=="@light on#")


      digitalWrite(led1, HIGH); 



    else if(inputString=="@light off#")


      digitalWrite(led1, LOW); 




  // Serial.println(inputString);



   Serial.println("DEL ALL\"");

  // Serial.print("AT+CMGD=1,4\r");  // Deletes all SMS saved in SIM memory



   // clear the string:

   inputString = "";

   stringComplete = false;



void serialEvent() 


   if(stringComplete == false)


        incomingString = Serial.readString();



          startIndex = incomingString.indexOf("@");

          endIndex = incomingString.indexOf("#");

          if(startIndex>0 && endIndex>0)


             inputString = incomingString.substring(startIndex,endIndex+1);

             stringComplete = true;





That’s all, Follow the steps to Turn ON/OFF LEDs.

1.    Burn the ARDUINO code into ARDUINO.

2.    Make sure you have connected GSM Module and ARDUINO along with LED.

3.    Make sure the SIM present in GSM Module is working.

4.    Send Message from your mobile.

5.  Experience it!!!

Note: Extra care should be taken when dealing with 240V, please don't attempt if you are not confident. Please your suggestions/queries/experiences to improve this article.

Hope this article gave an idea on how to control AC appliances using Arduino, relays and GSM Module. Thanks for reading this article.

About Author
Raj Kumar
Total Posts 55
Developer in .Net!
Comment this article
Email Address* (Will not be shown on this website.)
Enter Image Text*
View All Comments
Ajit zagade
Sir, I want to Code for misscall through relay on/off. 1> i miss call to sim 900a 2> when a come misscall ,relay will on 3>again miss call sim900a to relay is off help plzzzz.......................
the program did not upload to the board, why is it sir?
really work sir
what a surprise... go ahead sir
does that really work sir?
Nice Article with step by step instructions.
  Privacy   Terms Of Use   Contact Us
© 2016 Developerin.Net. All rights reserved.
Trademarks and Article Images mentioned in this site may belongs to Microsoft and other respective trademark owners.
Articles, Tutorials and all other content offered here is for educational purpose only and its author copyrights.