Arduino Projects

Security Alarm Using PIR Sensor With GSM

PIR sensor interfacing with Arduino


In this article, we will guide you through the process of creating a security alarm system using an Arduino Uno microcontroller board, a PIR (Passive Infrared) sensor, a SIM800L GSM module, and a buzzer. This system will detect motion using the PIR sensor and alert you via Call using the GSM module in case of any intrusions.

Components Needed

  1. Arduino Uno
  2. PIR Sensor
  3. GSM sim800l Module
  4. Buzzer
  5. Wire
  6. Zero PCB
  7. 9V power supply

Arduino Uno

  • The Arduino Uno has used an ATmega328P microcontroller chip.
  • The ATmega328P operates at a clock speed of 16 MHz.
  • Flash memory 32KB.
  • SRAM of 2KB.
  • 1KB of EEPROM.


  • The Uno is significantly smaller compared to other Arduino boards.
  • The Arduino Uno provides a total of 14 digital I/O pins.
  • 6 PIN used for PWM (Pulse Width Modulation) output.
  • 6 PIN analog input pins.
  • 10-bit resolution.

PIR Sensor

The PIR (Passive Infrared) sensor is a type of motion sensor commonly used in security systems and automation applications.

PIR Sensor

  • The PIR sensor consists of a pyroelectric sensor, which is capable of detecting infrared radiation, and a lens that focuses the incoming radiation onto the sensor. The pyroelectric sensor is made of a crystalline material that generates an electrical charge when exposed to infrared radiation.

GSM sim800l Module

GSM SIM800L is a popular module that enables communication over GSM (Global System for Mobile Communications) networks. It provides functionalities for making calls, sending and receiving SMS messages, and connecting to the internet.

Esp32 cam Motion Detection using Ultrasonic Sensor1

  • The GSM SIM800L module is designed to work with GSM networks, allowing devices to establish communication through cellular networks. It operates on various frequencies and supports 2G, and 3G connectivity, making it compatible with most GSM networks worldwide.
  • The module requires a power supply of around 3.7 to 4.2 volts.

Circuit Diagram

PIR Sensor

  • The VCC pin of the PIR sensor to the 5V pin on the Arduino Uno.
  • The GND (ground) pin of the PIR sensor to the GND pin on the Arduino Uno.
  • The OUT pin of the PIR sensor to any digital input pin (6) on the Arduino Uno.

GSM Module

  • The positive (VCC) and negative (GND) pins of the SIM800L GSM module to the 3.7 and GND pins on the LM2596 Step down converter, respectively.
  • The TX (transmit) pin of the SIM800L GSM module to the RX (receive) pin (2) on the Arduino Uno.
  • The RX (receive) pin of the SIM800L GSM module to the TX (transmit) pin (3) on the Arduino Uno.

circuit diagram 14

Source Code

Let’s go through the code and explain its functionality.

  • Includes the required libraries and defines the necessary variables.
  • Replace +918830584864xx with the desired phone number.

  • The setup() the function is called once at the start of the program.
  • It sets the pir_sensor pin as an input.

  • The loop() the function runs continuously after the setup() function.
  • It first checks if there is any data available from the GSM module. If so, it reads and prints it on the serial monitor.

Make sure to replace +918830584864xx it with the correct phone number.

Project Demo

  • Set up the PIR sensor pin as an input and the buzzer pin as an output.

Screenshot 2023 06 14 at 1.27.15 PM

  • If the motion is detected, trigger the alarm by sounding the buzzer and Call an alert using the GSM module.

Screenshot 2023 06 14 at 1.27.42 PM



This DIY project can be used for the security system of your home and office. if you used the Pir sensor then be care full is detect some time fault signal. I suggest you if you try to make a motion-based security system you used an ultrasonic sensor.

Arduino Based Projects


Hi, Prateek Here I’m interested in Electronics That's why I Make Soo Many Projects, I’m currently Pursuing M Tech.. if you Relay Like To My Blog Plz Comment Below...Thanks To All Electronics Lover...❤️

Leave a Reply

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

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker