Build it step by step
0 of 5 doneSet the buck converter first
Power the LM2596 from 12 V, and turn its trimmer until the output reads 4.0 V on a multimeter. Only then connect the SIM800L.
Insert the SIM
Remove the SIM PIN lock on a phone first. Insert the micro-SIM and screw on the antenna.
Wire the GSM
VCC/GND from the buck with the 1000 µF across them. TXD to D7, D8 to RXD through the divider.
Check the network
Upload and open the serial monitor. AT should reply OK, AT+CSQ a number above 10, and AT+CREG? "0,1" or "0,5".
Wire the PIR and test
PIR OUT to D2. Walk in front of it and wait for the SMS.
How do you build a GSM intruder alert by SMS?
When a PIR sensor sees movement, a SIM800L module sends an SMS to your phone, with a cool-down so you get one message per event. You need Arduino Uno R3, SIM800L GSM module, LM2596 Buck Module, 12 V 2 A DC adapter, DC barrel to screw terminal adapter (female), Electrolytic capacitor 1000 µF, PIR Motion Sensor HC-SR501, Resistor 1 kΩ, Resistor 2.2 kΩ and Jumper wires male to female (40 pcs). It takes 5 steps and about 100 minutes.
- Level
- Intermediate
- Time
- About 100 min
- Parts
- 10
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- WirelessBuyNeeds a 2G-capable SIM
- PowerBuySet to 4.0 V before connecting
- PowerBuy
- PowerBuy
- PassivesBuy
- SensorsBuy
- PassivesBuyResistor 1 kΩ × 1
- PassivesBuyResistor 2.2 kΩ × 1
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| 12 V adapter | LM2596 IN+ / IN− | Supply for the buck converter |
| LM2596 OUT+ / OUT− (set to 4.0 V) | SIM800L VCC / GND | GSM power, up to 2 A peaks |
| 1000 µF | Across SIM800L VCC and GND | Holds the voltage during transmit bursts |
| Uno VIN / GND | 12 V adapter + / − | Board power, all grounds joined |
| SIM800L TXD | Uno D7 | Replies from the module |
| Uno D8 | 1 kΩ to SIM800L RXD, 2.2 kΩ from RXD to GND | Commands, divided to about 3 V |
| PIR OUT | Uno D2 | Motion |
Code
Arduino IDE, board "Arduino Uno". SoftwareSerial is built in. Put your number with +91 in PHONE. Many Indian operators are switching off 2G, so check your SIM still works on 2G, or use a 4G module (A7670C) with the same AT commands.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <SoftwareSerial.h>
SoftwareSerial gsm(7, 8); // RX, TX
const char* PHONE = "+91XXXXXXXXXX";
const int PIR = 2;
unsigned long lastSms = 0;
const unsigned long COOLDOWN = 120000; // at most one SMS every 2 minutes
void at(const char* cmd, int wait = 500) {
gsm.println(cmd); delay(wait);
while (gsm.available()) Serial.write(gsm.read());
}
void sendSms(const char* text) {
at("AT+CMGF=1"); // text mode
gsm.print("AT+CMGS=\""); gsm.print(PHONE); gsm.println("\"");
delay(500);
gsm.print(text); delay(200);
gsm.write(26); // Ctrl+Z sends the message
delay(5000);
while (gsm.available()) Serial.write(gsm.read());
}
void setup() {
pinMode(PIR, INPUT);
Serial.begin(9600);
gsm.begin(9600);
delay(10000); // let the module find the network
at("AT"); at("AT+CSQ"); at("AT+CREG?");
}
void loop() {
if (digitalRead(PIR) == HIGH && (lastSms == 0 || millis() - lastSms > COOLDOWN)) {
Serial.println("Motion: sending SMS");
sendSms("ElectroLark alert: movement detected at home.");
lastSms = millis();
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Module LED after 10 to 30 s | Blinks every 3 s (registered); every 1 s means still searching |
| AT+CSQ | "+CSQ: 10" to "31"; below 10 is a weak signal |
| Movement | "+CMGS: n" in the monitor and an SMS within 10 s |
| A second movement within 2 minutes | No second SMS (cool-down) |
If it does not work
The module keeps restarting
The supply sags during transmit. Use the 2 A buck converter, short thick wires and the 1000 µF capacitor.
No reply to AT
Swap TX and RX, and check the divider on D8.
Registered but SMS fails
Check SMS balance, the number format and that the operator still runs 2G where you are.
Never power the SIM800L from 5 V
Its maximum is 4.4 V. 5 V can destroy it.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the GSM intruder alert by SMS?
Arduino Uno R3, SIM800L GSM module, LM2596 Buck Module, 12 V 2 A DC adapter, DC barrel to screw terminal adapter (female), Electrolytic capacitor 1000 µF, PIR Motion Sensor HC-SR501, Resistor 1 kΩ, Resistor 2.2 kΩ and Jumper wires male to female (40 pcs). SIM800L GSM module: Needs a 2G-capable SIM. LM2596 Buck Module: Set to 4.0 V before connecting.
How long does the GSM intruder alert by SMS take to build?
About 100 minutes for a intermediate maker, in 5 steps.
How do I know the GSM intruder alert by SMS works?
Module LED after 10 to 30 s: Blinks every 3 s (registered); every 1 s means still searching. AT+CSQ: "+CSQ: 10" to "31"; below 10 is a weak signal. Movement: "+CMGS: n" in the monitor and an SMS within 10 s.
The module keeps restarting: what should I check?
The supply sags during transmit. Use the 2 A buck converter, short thick wires and the 1000 µF capacitor.
No reply to AT: what should I check?
Swap TX and RX, and check the divider on D8.
Registered but SMS fails: what should I check?
Check SMS balance, the number format and that the operator still runs 2G where you are.
Never power the SIM800L from 5 V: what should I check?
Its maximum is 4.4 V. 5 V can destroy it.
