GSM Based Intruder Alerting System

Introduction
Did you know that most of the thefts at home happen when it is empty? But not everyone is rich enough to hire a security for their house and at the same time they themselves cannot be at home 24 by7. Now what if there is a system which alerts you about an intruder through a text message? The following tutorial teaches how to make you own intruder alerting system.
Components Required
1. PIR Sensor
2. ATMega16 Development board
3. LCD board
4. SIM 300/900 GSM Module
5. 12V/2A Power Supply
6. SIM card with balance (or at least message offer maybe)
7. A PC or a Laptop (Optional. Needed in case of debugging)

Initial Setup and Testing of GSM modem
If you are already familiar with a GSM Modem then you may skip this step. This part of the tutorial is for the beginners.


Step 1: Inserting the SIM






Step 2: Attach the antenna to the SMA connector shown in the picture


Step 3: Attaching the power supply and Powering the modem


Step 4: Attaching the RS232 to USB Converter 




Step 5: Testing the modem through a PC/ Laptop



Once you have connected the modem and PC, you can open your default serial communication software on your PC and start sending AT commands to the modem and observing its replies.



As you can see from the above screen shot, when I sent “AT”, the modem sends back “OK”. Similarly after every correct command the modem would reply with necessary parameters and an “OK”. If you enter any wrong or inappropriate command then the modem says “ERROR”
Why PIR sensor?
Well PIR sensors are designed to detect human beings specifically and so there is very low chance for a false alarm. You can use Infrared TX-RX pair also but their range is lesser and there is more probability for false alarm. Say, for example a cat comes close to the sensor’s field range or if there is a light variation in the room where you fixed the sensor. In both cases the IR sensor would react and generate a false alarm but PIR sensor will remain immune. 

Amplifier Circuit for the Sensor

Since the output signal from the PIR is very weak we use a simple amplifier circuit to get a stronger output.

Code Explanation
- Initialize the USART and LCD functions
- Assign PB0 as input pin and put it in HIGH state
- Enter an infinite loop
- Check the status of PB0 pin. If it goes low, then go to Notify() function
Notify() function sends the following commands:


Here <CR> is nothing but the special character ‘\r’ whose ASCII code is 13. Ctrl+Z has a ASCII code of 26
Testing the System
1. Connect everything according to the circuit diagram after burning the program into the microcontroller.
NOTE: TX of modem <-> RX of controller
RX of modem <->TX of controller
GND of modem <-> GND of controller
2. Place the PIR sensor facing away from you before you power ON the system.
3. Now power ON the system.
4. Wait a while for the SIM to get registered to the Network. It may take from 10-50 seconds for that. (You can know if it is registered or not by observing the network LED status. If the blinking rate is very low then it means the SIM is ready now)
5. Wave your hand in front of the PIR sensor. Now you should see the LED attached to the amplifier circuit light up and the LCD displaying “Motion Detected”. Within few seconds, you should get a message to the number you have given in the program. Like this:


Troubleshooting
A. The SIM is not getting registered to the network
Possible Reasons:
1. The signal strength of the modem maybe weak. Make sure the Antenna is fixed firmly
2. Make sure the Network provider gives enough signal strength in your area and there are no jammers around.
3. Make sure the SIM card is valid.
B. Message not received by the user’s phone
Possible Reasons:
1. Check your program and see if you gave the right phone number or not.
2. See if the user’s phone has enough signal strength to receive a message.
3. You waved it too soon after powering ON the device. Remember the SIM card takes time to get registered to a Network.
4. There is no balance in the SIM card. Make sure the SIM card has some balance or a message offer.

Here is the link to my YouTube video demo:


This article was published by me on EngineersGarage

Please Like us to Receive updates on FB