You are on page 1of 7

www.electroniclinic.

com
/arduino-gsm-project-security-alert-message-to-multiple-numbers/

Arduino GSM Project: Security Alert message to multiple


numbers
⋮ 5/5/2019

Description:

Arduino GSM Project: Security Alert message to multiple numbers-In this tutorial, you will learn how
to make an Advanced security system and send the Security Alert message to multiple numbers
using Arduino and A GSM Sim900A Module. For the demonstration purposes, I will be using an LDR,
which makes this project as the laser security system, but if you want you can also replace the LDR with
a PIR sensor or Magnetic reed switch Sensor or a limit switch and so on. You can also use multiple
sensors.

This is basically the 2nd version of the GSM laser security system in which I used the LDR sensor for the
intruder detection and I used the same GSM sim900A module. in this project, the security alert message
is only sent to one number. If you want to watch this Tutorial.

But in many situations, we need to send the same security alert message to multiple numbers. So this
tutorial is all about how to write a very simple program and how to connect all the components together to
make the advanced security system. In this tutorial, we will cover

1. GSM SIM900A module Pinout explanation


2. Complete Circuit Diagram
3. Arduino GSM project Programming and finally
4. Testing

1/7
Without any further delay, let’s get started!!!

For the step by step explanation watch Video tutorial given in the end.

Amazon Links.
12v Adaptor:

Arduino Uno

Arduino Nano

Mega 2560:

Sim900A GSM Module:

DC 5V 2A Adaptor

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through
these links. I would appreciate your support in this way!

GSM SIM900A module pinout:


Arduino GSM Project: Security Alert message to multiple numbers

2/7
This is the GSM sim900A module, in the market, we have different types of GSM modules, the one I will
be using today is GSM sim900A if you want you can also use any other gsm module, like for example
sim900D. I have also tested the same programming using sim900D but with a different baud rate, the rest
of the program remains the same. If you want to study more about the GSM Sim900A module then read
my article “GSM sim900A Complete Guide“

If you are from Pakistan, Bangladesh or India make sure you double-check the GSM module and
purchase the unlocked version of the sim900A module. This GSM sim900A module as you can see on
the screen has no Onboard voltage regulator, so be careful while applying the voltage. Ideal voltage for
this GSM module is 4.7v but you can also connect it with a 5v adaptor. If you don’t have a 5v adaptor
then you can make your power supply using an lm317t adjustable variable voltage regulator, I have a
very detailed tutorial on lm317t explaining everything. If in case you want to watch this tutorial.

As you can see clearly in the picture above this module has so many pins that are clearly labeled, but we
will be using only 5 of these pins, the power supply pins, GND, Rxd 5v, and TXD 5v. The GND will be
connected with the Arduino’s GND, TXD will be connected with the Arduino’s pin number 7 and RXD will
be connected with the  Arduino’s pin number 8.

Arduino GSM Project Circuit Diagram:

3/7
This schematic is designed in Cadesoft eagle 9.1.0 version, if you want to learn how to make schematics
and PCB’s then you watch my tutorial.

Tx of the sim900A is connected with pin number 7 of the Arduino, the Rx pin of the sim900A module is
connected with pin number 8 of Arduino, and GND is connected with the Arduino’s ground. a power
supply is connected with the sim900A module ideal voltage is 4.7v to 5v as already explained.

An LDR is connected in series with a 10k resistor which makes a voltage divider circuit. As you know an
LDR is basically a variable resistor, whose resistance changes with the amount of light falling on the LDR.
So a change in resistance will result in a change in voltage. This change in voltage can be monitored
using the analog pin A1 of the Arduino.

GSM Sim900A Module Interfacing with Arduino:

4/7
All the components are interfaced as per the circuit diagram, this is the LDR circuit, as you can see an
LDR is connected in series with a 10k resistor. A wire from the middle of the LDR and 10k resistor is
connected with the analog pin A1 of the Arduino.

The GSM sim900A module Txd and Rxd pins are connected with the Arduino pin number 7 and pin
number 8, and make sure you connected the ground of the gsm module with the ground of the Arduino.
This GSM module will be powered up using this Regulated 5v power supply. Now let’s discuss the
Arduino Programming.

Arduino GSM Project Programming:


Arduino GSM Project: Security Alert message to multiple numbers

For the step by step program explanation watch video tutorial given at the end.

1 #include <SoftwareSerial.h>
2 SoftwareSerial SIM900(7, 8); // gsm module connected here
3 String textForSMS;
4 int data = 0;
5  
6 int sensor = A1; // LDR is connected with the analog pin A1 of the Arduino
7  
8  
9 // cell numbers to which you want to send the security alert message
10 String f1001 = "+923351920959";
11 String f1002 = "+923108688660";
12 String f1003 = "+923339218213";
13  
14 void setup() {
15  
16  
17   randomSeed(analogRead(0));
18   Serial.begin(9600);

5/7
19       SIM900.begin(9600); // original 19200. while enter 9600 for sim900A
20 Serial.println(" logging time completed!");
21 pinMode(sensor, INPUT);
22 delay(5000); // wait for 5 seconds
23   
24 }
25  
26 void loop() {
27  
28 data = analogRead(sensor);
29 Serial.println(data);
30   
31      if ( data < 400) //
32   {
33        textForSMS =  "\nIntruder detected";  
34   //sendSMS(textForSMS);
35   sendsms(textForSMS, f1001); // you can use a variable of the type String
36   Serial.println(textForSMS);
37   Serial.println("message sent.");
38 delay(5000);
39  
40   sendsms("Intruder Detected!!!!!!!!!", f1002); // you can also write any message that you want
41 to send.
42   Serial.println(textForSMS);
43   Serial.println("message sent.");
44 delay(5000);
45  
46   sendsms("Intruder Detected!!!!!!!!!", f1003); // you can also write any message that you want
47 to send.
48   Serial.println(textForSMS);
49   Serial.println("message sent.");
50 delay(5000);
51   }
52 }
53  
54  
55 void sendsms(String message, String number)
56 {
57 String mnumber = "AT + CMGS = \""+number+"\"";
58    SIM900.print("AT+CMGF=1\r");                  
59   delay(1000);
60 SIM900.println(mnumber);  // recipient's mobile number, in international format
61   delay(1000);
62   SIM900.println(message);                         // message to send
63   delay(1000);
64   SIM900.println((char)26);                        // End AT command with a ^Z, ASCII code 26
65   delay(1000);
66   SIM900.println();
67   delay(100);                                     // give module time to send SMS
68 // SIM900power();  
}

Watch Video Tutorial:

6/7
Other GSM-based Projects:
How to use GSM and Bluetooth Together To monitor Any Sensors wirelessly using Arduino

RFID & GSM based student Attendance Alert message to parents

Request Temperature Data Using GSM and Arduino

Arduino and Gsm based laser security system

Car accident location tracking using GSM, GPS, and Arduino

GSM Alarm System Using Arduino and a PIR Sensor

Arduino Gas leakage detection and SMS alert MQ-2 sensor

RFID based students attendance system with message Alert

7/7

You might also like