GSM Based Home Security System Project using Arduino PIR Sensor

Nowadays we use the different type of gsm based home security system in our home to protect from Intruder and thief. There are the different PIR home security system in the market depending on their applications.

This arduino PIR sensor project based security system is one of them. This motion sensor based security system detects any trespassing that occurs in the range of the motion sensor. Depending on the movement of the object it sends a signal to the arduino board.

This gsm home security alarm system with arduino  has the capability of sending SMS alert once any PIR motion sensor detects the movement. This SMS sending gives the user a great safety feature remotely. It also has one arduino burglar alarm in the system.

Working with PIR motion sensor and arduino is very easy. When it detects some movement, it sends a digital output to arduino and arduino take decisions accordingly like turn ON/OFF the alarm, lights or sending SMS alert
message to the owner of the home.

How to Build Motion Sensor SMS Alert System

For this project you should know:

At the end connect all the modules.

Hardware Required

  • Arduino Uno
  • PIR Motion Sensor
  • GSM Modem
  • Piezo Buzzer
  • NPN Transistor BC548
  • Resistor 1K ohm
  • Breadboard

Pinout and Rating of PIR

Pin Name Function
GND Connects to Ground or Vss
+ Vcc Connects to Vdd (3.3V to 5V) @ ~100uA
OUT Output Connects to an I/O pin set to INPUT mode

Jumper Setting in PIR

Position Mode Description
H Retrigger Output remains HIGH when the sensor is retriggered repeatedly. The output is LOW when idle (not triggered).
L Normal Output goes HIGH then LOW when triggered. Continuous motion results in repeated HIGH/LOW pulses. The output is LOW when idle.

PIR Sensor Calibration

PIR sensor needs some “warm-up” time to function correctly. Because there is some settling time involved in learning its environmental conditions. This time is approx 10-60 seconds. During this time there should be a slow motion in sensors field of view.

PIR Sensor Sensitivity

PIR sensor has a range approx 20feet and depends on environmental conditions. It is designed to adjust in slowly changing conditions this generally happens when day progresses. It responds by giving a high signal on the sudden change in its environment.

PIR Motion Sensor Arduino Connection

Piezo Buzzer Arduino Connection

PIR Motion Sensor GSM Modem Connection with Arduino

In the previous tutorial, we have interfaced PIR motion sensor and piezo buzzer with the arduino. And the interfacing and programming are quite easy to understand.

The good feature of this project is to send SMS with GSM Modem when the PIR sensor detects any movement. The interrupt in this project makes it very reliable in detection of PIR Sensor.

PIR motion sensor is connected with arduino digital pin 2 using the interrupt feature. The piezo buzzer is connected to the arduino digital pin 13 for indication of the alarm. The main feature of this arduino burglar alarm project is to send the SMS to the mobile phone of an owner when it detects any trespassing or movement in the PIR sensor area.

For sending the SMS we have used the SIM300. You can use the SIM900 or equivalent. The important thing is, we should know how to interface gsm module with arduino and send the SMS. The second important part is using interrupt we are reading the motion sensor value. So the question is why to use the interrupt.

What is Interrupt

An interrupt is a great way of serving the input connected to the CPU like arduino. Depending on the importance of the input we use the interrupt. Using interrupt, the CPUs execute its normal program which is less important. And keep an eye on the most important input like fire alarm input, smoke sensor, and burglar alarm. And CPU wants never miss reading this input while executing the other low priority code. By connecting this input to the interrupt pin and programming the CPU for that. If input occurs on the interrupt pin, CPU serve it first by pausing other less important code.

Arduino Security System Code – Sending SMS

As we have used the interrupt to read the motion sensor input. When arduino receives the signal from the motion sensor. It stops executing the normal code and control goes to the ISR(Interrupt Service Routine). ISR is the location of the code. And after the interrupt, control come here and execute the code available at this location. The different interrupt has its own ISR. Here the function void makeSMS_Alarm()is executed when some movement is detected by the PIR sensor. In this section, arduino sending the SMS to the owner of the home and activated the alarm.

/*#####PIR Motion Sensor GSM Home Security System - SMS Alert Arduino Project####
Connection:Buzzer        - Digital Pin 13
Motion Sensor - Digital Pin 02
GSM Modem RX  - Digital Pin 01(TX)
And Connect the supply to above module*/

int pin = 13; //Piezo Buzzer Connected
volatile int state = LOW;

void setup()
  pinMode(pin, OUTPUT);     // buzzer as output
  digitalWrite(pin, state); //make buzzer OFF
  //PIR Motion Sensor connected at digital pin 2 i.e. interrupt 0
  attachInterrupt(0, makeSMS_Alarm, RISING);
  Serial.begin(9600);  //set Baud Rate  

void loop()


void makeSMS_Alarm()
  // Piezo Buzzer ON
  state = HIGH;
  digitalWrite(pin, state);
  //Send SMS
  //Phone number you want to send the sms
  //Text to send                             
  Serial.print("Intruder Alert - Someone At Home |\r");
  //sends ctrl+z, end of message    

24 Comments on “GSM Based Home Security System Project using Arduino PIR Sensor”

  1. Hi friends… I have trouble false trigger its send massage after 1 hour repeatedly some 3 hour . what we do I have not idea ways ware worng any buddy have suggested I wait. Its urgent

    1. Hello Zohaib,
      Make sure all connections are correct. And no person is in the range of PIR motion sensor when you don’t want to trigger it.
      Check the same project using a different PIR module.

        1. Hello Arang,
          You can use any sensor. While sensor having some input, it will make a call.
          You can use SIM 800 or any equivalent GSM modem. But make sure the same AT command work with SIM800.
          Try it should work.
          Thanks, MaxPhi.Com

    1. Hey dariel,
      We will help you understand the arduino. It’s a lollipop. Just go through our arduino tutorial section and make comment if you have any doubt.
      Step 1:
      Make sure your GSM modem is working perfectly. Just insert the SIM Card into the gsm modem and power it. And make a call to it. A buzzer will ring if there is a buzzer on GSM or you will hear a dial tone from calling mobile. If it like this everything is perfect.
      Step 2:
      Now check if arduino can make a call by writing this simple code.
      /* Arduino GSM Call */
      void setup()
      Serial.begin(9600); //Baud rate of the GSM Module
      Serial.print(“ATD +91xxxxxxxxxx;\r”); //Phone number you want to call
      void loop()

      Apply this steps and let me know by commenting here.

  2. dariel you tried this code Serial.println(“ATD +91xxxxxxxxxx;”); //Phone number you want to call
    gsm powersupply must be 5 volt 1 amp

      1. Hi dariel,
        The code should be same. Make sure SIM 800 is working and no power issue.
        Insert the SIM in it and make call to it. If it works then try this code.

    1. Hello John Calvin Agno,
      You can use any NPN transistor.
      Yes, you can other GSM modems also but make sure you know the baud rate of it. Instead of making a complete project. first, try to use only GSM modem. If it works then connect the motion sensor and other parts.

  3. Hello Admin, I want to know, how you power this two things( arduino and GSM module) do you need two different batteries or can you power both things only with arduino? What do I need?
    Thank you very much. 🙂

    1. Hello zanex,
      As GSM is power hungry sometimes. And while you connect with the arduino, it looks like it will work. Its better you connect with the separate power supply. I connected here with between 12 Volt 1-2 Amp Supply only if GSM has the onboard 5Volt regulator.
      Before doing any programming connect all the circuits. And make a call to the SIM card inserted into the GSM modem. If Call is going then it will work on the Arduino Code. This way you can check GSM and power supply issues.

  4. HELLO admin, In My Serial Monitor not any Command is Working If I give any command like ATD88xxxxxxxx; but these are nothing response in serial monitor;

    1. Hello Amit,
      You just make the circuit as given in the tutorial. If everything is fine then on detection of any motion the sensor will trigger. And it will make a call automatically. This project doesn’t take any input from the serial monitor. For any further help Mail me at

  5. hi dear… i try your project on simulation it work but in reality i don’t have sms alert. can you help me to fix it please.

  6. Arduino is totally new to me.
    I want to connect a camera and then the gsm module should send me the photo captured with the sms.
    Can anyone tell me that how can I do this? or is it even possible?

Leave a Reply

Your email address will not be published. Required fields are marked *