Gsm Sim900a Module and Arduino: Security Alert message to multiple numbers
Description:
Gsm Sim900a Module and Arduino: 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 Sim900a 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.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
- GSM SIM900A module Pinout explanation
- Complete Circuit Diagram
- Programming and finally number
- Testing
Amazon purchase links
470uf capacitors: 5×7 cm Vero board:
Super Starter kit for Beginners:
Soldering iron kit: “best” definitely purchase this:
PCB small portable drill machine:
DISCLAIMER:
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:
Gsm Sim900a Module: Security Alert message to multiple numbers
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 Module 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 are from Pakistan, Bangladesh or India make sure you double check the GSM module and purchase the unlocked version of the Gsm 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 Sim900a 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 lm317t adjustable variable voltage regulator. As you can see clearly in the picture above this module has so many pins which 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.
Gsm Sim900a Module and Arduino – Circuit Diagram:
This schematic is designed in cadesoft eagle 9.1.0 version,
Tx of the Gsm Sim900a Module is connected with pin number 7 of the Arduino, the Rx pin of the Gsm 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 Gsm 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.
Interfacing Gsm Sim900a Module And Arduino:
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 Sim900a Module will be powered up using this Regulated 5v power supply. Now let’s discuss the Arduino Programming.
Gsm Sim900a Module and Arduino Programming:
Gsm Sim900a: Security Alert message to multiple numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
#include <SoftwareSerial.h> SoftwareSerial SIM900(7, 8); Gsm Sim900a Module connected here String textForSMS; int data = 0; int sensor = A1; // LDR is connected with the analog pin A1 of the Arduino // cell numbers to which you want to send the security alert message String f1001 = "+923351920959"; String f1002 = "+923108688660"; String f1003 = "+923339218213"; void setup() { randomSeed(analogRead(0)); Serial.begin(9600); SIM900.begin(9600); // original 19200. while enter 9600 for sim900A Serial.println(" logging time completed!"); pinMode(sensor, INPUT); delay(5000); // wait for 5 seconds } void loop() { data = analogRead(sensor); Serial.println(data); if ( data < 400) // { textForSMS = "\nIntruder detected"; //sendSMS(textForSMS); sendsms(textForSMS, f1001); // you can use a variable of the type String Serial.println(textForSMS); Serial.println("message sent."); delay(5000); sendsms("Intruder Detected!!!!!!!!!", f1002); // you can also write any message that you want to send. Serial.println(textForSMS); Serial.println("message sent."); delay(5000); sendsms("Intruder Detected!!!!!!!!!", f1003); // you can also write any message that you want to send. Serial.println(textForSMS); Serial.println("message sent."); delay(5000); } } void sendsms(String message, String number) { String mnumber = "AT + CMGS = \""+number+"\""; SIM900.print("AT+CMGF=1\r"); delay(1000); SIM900.println(mnumber); // recipient's mobile number, in international format delay(1000); SIM900.println(message); // message to send delay(1000); SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26 delay(1000); SIM900.println(); delay(100); // give module time to send SMS // SIM900power(); } |
Programming Explanation:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8); Gsm Module connected here
String textForSMS;
int data = 0;
int sensor = A1; // LDR is connected with the analog pin A1 of the Arduino
// cell numbers to which you want to send the security alert message
String f1001 = “+923351920959”;
String f1002 = “+923108688660”;
String f1003 = “+923339218213″;
void setup() {
randomSeed(analogRead(0));
Serial.begin(9600);
SIM900.begin(9600); // original 19200. while enter 9600 for sim900A
Serial.println(” logging time completed!”);
pinMode(sensor, INPUT);
delay(5000); // wait for 5 seconds
}
void loop() {
data = analogRead(sensor);
Serial.println(data);
if ( data < 400) //
{
textForSMS = “\nIntruder detected”;
//sendSMS(textForSMS);
sendsms(textForSMS, f1001); // you can use a variable of the type String
Serial.println(textForSMS);
Serial.println(“message sent.”);
delay(5000);
sendsms(“Intruder Detected!!!!!!!!!”, f1002); // you can also write any message that you want to send.
Serial.println(textForSMS);
Serial.println(“message sent.”);
delay(5000);
sendsms(“Intruder Detected!!!!!!!!!”, f1003); // you can also write any message that you want to send.
Serial.println(textForSMS);
Serial.println(“message sent.”);
delay(5000);
}
}
void sendsms(String message, String number)
{
String mnumber = “AT + CMGS = \””+number+”\””;
SIM900.print(“AT+CMGF=1\r”);
delay(1000);
SIM900.println(mnumber); // recipient’s mobile number, in international format
delay(1000);
SIM900.println(message); // message to send
delay(1000);
SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(1000);
SIM900.println();
delay(100); // give module time to send SMS
// SIM900power();
}
Watch Video Tutorial:
Related Tutorial:
Arduino Gas/smoke leakage detection and sms alert system programming