GSM based home security system | GSM project | Arduino GSM Project


Hey guys, hope you are doing fine. In this post, we are going to make an GSM based home security system using Arduino UNO. This project can detect any type of obstacle present in front of it.

HTML Image as link

For detection of the obstacles, we are using an IR sensor with Arduino. You can read more articles on Arduino and IoT written by us. We are using AT commands for sending the SMS via the GSM module.

You just have to complete the circuit and then upload the given code to the Arduino.

GSM based home security system


  • For sending the notifications to the mobile phone we are using a GSM module.
  • You have to write the mobile number in the code so that Arduino can process the code and successfully send the notification on it.
  • When the IR sensor detects something in front of it then the LED will turn on.
  • You can also view the live working of this project by opening the serial monitor tab in the Arduino IDE.
  • When the SMS is successfully sent to your phone a message will display on the serial monitor that ‘ message has been sent ‘.
  • You can also check the GSM based fire alarm project made by us.
serial monitor
obstacle detector

Components Required for GSM based home security system

GSM Project component

GSM based home security system Circuit diagram

GSM project circuit
Arduino UNOGSM SIM 900 Module
11 PinRX Pin
10 PinTX Pin
Arduino UNOIR Sensor
7 PinOUT Pin
Arduino UNOLED220 Ohm Resistor
4 PinAnode Terminal  
GND Terminal 1
 Cathode TerminalTerminal 2
  • If you are not famalier with the interfacing of a GSM module with Arduino then do check it first.
  • Take a GSM sim 900 module and connect its GND pin with the GND pin of the Arduino.
  • Join the RX pin of the GSM module with the digital-11 pin of the Arduino.
  • Attach the digital-10 pin of the Arduino with the TX pin of the GSM module.
  • You have to provide a 12 volts 2 amp DC power supply to the GSM module.
  • Now take an IR sensor and connect its VCC pin with the 5 volts pin of the Arduino.
  • Join the GND pin of the IR sensor with the GND pin of the Arduino. Attach the OUT pin of the IR sensor with the digital-7 pin of the Arduino.
  • Connect the negative leg of the LED with the GND pin of the Arduino via a 220 ohm resistor.
  • Join the positive leg of the LED with the digital-4 pin of the Arduino.
  • Your circuit is ready to use now.
  • now you can our latest project
IR sensor

Code for GSM Project

NOTE: Please upload the code which is given below to the Arduino. First of all install <SoftwareSerial.h> library to the Arduino IDE. If you don’t know how to install a zip library in the Arduino IDE then check it out first.

HTML Image as link
 // Download Library of SoftwareSerial link given
  #include <SoftwareSerial.h>
  SoftwareSerial SIM900A(10,11);  // SoftSerial( RX , TX );
 // 10 pin connect to TX of GSM SIM 900 Module
 // 11 pin connect to RX of GSM SIM 900 Module

int val = 0 ;
void setup()
    Serial.begin(9600);   // sensor buart rate
    SIM900A.begin(9600);  // GSM buart rate
    pinMode(4,HIGH);      // LED connect D4
void loop() 
  val = digitalRead(7);  //  IR sensor output pin connected D7
  Serial.println(val);   // see the value in serial mpnitor in Arduino IDE

  if (Serial.available()>0)

    if (SIM900A.available()>0)
  if(val == 0 )  // Check your sensor Value 1 or 0
  // in my case IR sensor detect then value is 0 otherwise 1 you can change value
     Serial.println ("Obstacle Detecting");
     digitalWrite(4,HIGH);   // LED ON
    Serial.println ("Sending Message");
  SIM900A.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  Serial.println ("Set SMS Number");
   SIM900A.println("AT+CMGS=\"xxxxxxxxxx\"\r"); //Mobile phone number to send message, replace x by your number
  Serial.println ("Set SMS Content");
  SIM900A.println("Some one IS comming, be safe");// Messsage content
  Serial.println ("Finish");
  SIM900A.println((char)26);// ASCII code of CTRL+Z
  Serial.println ("Message has been sent ");
  digitalWrite(4,LOW);   // LED OFF

We hope that you liked this project and understand the concept behind it. If you have any doubts regarding this project then feel free to ask them in the comments section which is given below. Also, do check out more projects on Arduino and Raspberry Pi.

Thanks for reading.

Arduino gsm Project
Spread the love

6 thoughts on “GSM based home security system | GSM project | Arduino GSM Project”

Leave a Comment