Acoptex.Com

Learn ESP32, ESP8266, Arduino, and Raspberry Pi

Basics: Project 105e SIM900A GSM GPRS mini board – Advanced GSM security system

Basics: Project 105e

Project name: SIM900A GSM GPRS mini board Advanced GSM security system

Tags: SIM900A GSM GPRS module, Simcom, SIM900A GSM GPRS mini module, SIM900A GSM mini module, SIM900A mini module, Arduino Nano, Arduino IDE, Arduino, SIM900A GSM GPRS mini board, SIM900A mini v 3.8.2, SIM900A datasheet, SIM900A pinout, sim900a arduino code, sim900a gsm module pin diagram, gsm sim900a pin diagram, gsm sim900a interfacing with arduino, how to check sim900a gsm module, sim900a gsm module interfacing with arduino nano, sim900a gsm module interfacing with arduino uno, what is sim900a, does sim900a support 4G, doesn sim900a support 3G, what is GSM module, what is a sim900a GSM module, GSM SIM 900A module, sim900a gsm module, sim 900a gsm gprs module, SIM900A mini DEV board v 3.9.2, Arduino, Arduino Uno, GSM based Home Automation, GSM Alarm System, Security system, Advanced GSM security system, PIR sensor, magnetic door contact switch, 5v relay module, door contact switch, Reed switch, magnetic contact switch, magnetic contact

Attachments: SIM900Aadvancedsecuritysystemsketch

WARNING – THIS PROJECT INVOLVES HIGH VOLTAGES THAT CAN CAUSE SERIOUS INJURY OR DEATH. PLEASE TAKE ALL NECESSARY PRECAUTIONS, AND TURN OFF ALL POWER TO A CIRCUIT BEFORE WORKING ON IT. WE ARE NOT RESPONSIBLE FOR ANY DAMAGE, INJURY, DEATH AND OTHER THINGS CAUSED BY THIS PROJECT IMPLEMENTATION. 

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. SIM900A GSM GPRS mini module 1 pc

SIM900A GSM GPRS mini board

2. Breadboard 1 pc

medium breadboard

3. Jumper cables F-M, M-M

jumper cables

4. PIR sensor HC – SR 501 or HC – SR 505 or Mini PIR Motion Sensor Module SC0322 1 pc

pir sensor
pir sensor

5. Standard SIM card 1pc

sim card sizes

6. SIM card size adapter (optional) 1 pc

sim card adapter

7. Arduino Uno R3 (you can also use the other version of Arduino) 1 pc

arduino uno

8. Arduino IDE (you can download it here)

9. 5V relay module 1 pc

5v relay module

10. Magnetic contact switch 1 pc

Magnetic door contact switch

General

We will learn how to make an Advanced GSM security system (Advanced GSM alarm system) using Arduino Uno, PIR sensor, magnetic door contact switch, 5V relay module and SIM900A GSM GPRS mini board. Whenever an unauthorized person is detected by PIR sensor or magnetic contact switch a SMS message will be sent on the desired number.

Project steps:

  • The PIR sensor will detect movement (intruder) or magnetic contact switch detects that the door/windows is opened – the signal will be sent to Arduino Uno board digital pin.
  • Arduino Uno board through serial communication will communicate with the SIM900A GSM GPRS mini board.
  • The smartphone will receive the SMS message from the SIM900A GSM GPRS mini board about the movement.
  • 5V relay module connected to the Arduino Uno board will turn on a light or alarm sound as an indication that intruder is detected.

Understanding the PIR sensor

You can read more about it here.

Understanding the 5V relay module

You can read more about it here.

Understanding the magnetic contact switch

A magnetic contact is a door and window sensor that functions using an internal reed switch in conjunction with a magnet. This is the most common way for a door and window sensor to operate. These devices are known for being particularly easy to use and enroll with security systems.

Like the name implies, a door and window sensor is used to monitor a door or a window and let an alarm system know when it has been opened. These devices are sometimes referred to as “magnetic contacts” because of the way that they operate. While not every door and window sensor functions in the same manner, the majority of these devices operate using the same principles.

The typical door and window sensor consists of a sensor with an internal reed switch and a separate magnet. The sensor is usually installed on the door or window frame, and the magnet is installed on the moving portion of the door or window. For best results, the magnet should be placed within about a half-inch of the sensor. When the door or window is opened, the magnet will separate from the sensor.

Once this happens, the sensor’s internal reed switch will activate. In the case of a wireless zone, this will tell the sensor to send an alert to the alarm system to let it know that the door or window has been opened. In the event of a wired zone, this process will actually open a wired circuit which indicates to the system the door or window has been opened. The system will then perform a predetermined action based on the programming settings for the sensor. So as long the sensor remains in contact with its magnet, the device won’t send an alert to the alarm system.

switch and magnet - reed switch

How to install the door reed switch? We usually mount the switch on fixed surface and the magnet is installed on the moving surface. In our case, we installed the magnet on door and the switch on the wall near to door closing point. Both switch and magnet must be in correct position and at correct distance to make a contact. Below you can see the correct placement and installation of door contact sensor. 

magnetic contact switch

Understanding the SIM900A GSM GPRS module

You can read more about it here.

Signals and connections of the PIR sensor

mini pir sensor
hc-sr501 pir sensor
mini pir sensor

We are going to use Mini PIR Motion Sensor Module SC0322 in this project.

Signals and connections of the 5V relay module

The 5V Relay module has three high voltage terminals (NC, C, and NO) which connect to the device you want to control. The other side has three low voltage pins (GND (0V), VCC (+5V), and S(Signal)) which connect to the Arduino board.

5V Relay Pinout

5v relay module pinout
  • NC: Normally closed 120-240V terminal
  • NO: Normally open 120-240V terminal
  • C: Common terminal
  • Ground: Connects to the ground pin on the Arduino board
  • 5V VCC: Connects the Arduino’s board 5V pin
  • S(Signal): Carries the trigger signal from the Arduino board that activates the relay

Signals and connections of the SIM900A GSM GPRS module

sim900a GSM GPRS mini board

RS232 RXD – RS232 receive pin

RS232 TXD – RS232 transmit pin

5VT – 5V TXD transmit pin

5VR – 5V RXD receive pin

3VT – 3V3 TXD (SIMT) transmit pin

3VR – 3V3 RXD (SIMR) receive pin

GND – ground pin

VCC – power supply 5V pin

SIM900A pinout

sim900a pinout
  • VBAT – 3 VBAT pins are dedicated to connect the supply voltage. The power supply of SIM900A has to be a single voltage source of VBAT= 3.4V…4.5V. It must be able to provide sufficient current in a transmit burst which is typically rises to 2A
  • VRTC – Current input for RTC when the battery is not supplied for the system. Current output for backup battery when the main battery is present and the backup battery is in low voltage state. If the RTC function is enabled, a battery or capacitor should be connected with the VRTC pin. Otherwise the VRTC pin can be keep open.
  • VDD_EXT – 2.8V output power supply. If unused, keep open.
  • GND – Ground
  • PWRKEY – Voltage input for PWRKEY. PWRKEY should be pulled low to power on or power off the system. The user should keep pressing the key for a short time when power on or power off the system because the system need margin time in order to assert the software. It is already pulled up.
  • PWRKEY_OUT – Connecting PWRKEY and PWRKEY_OUT for a short time then release also can power on or power off the module.
  • MIC_P MIC_N – Positive and negative voice band input. If unused keep open
  • SPK_P SPK_N – Positive and negative voice band output
  • LINEIN_R LINEIN_L – Line input
  • DISP_DATA DISP _CLK DISP _CS DISP _D/C – Display interface. If unused keep open
  • STATUS – Indicate working status. If unused keep open
  • NETLIGHT – Indicate net status. If unused keep open
  • SCL – I2C bus clock. If unused keep open
  • SDA – I2C bus data. If unused keep open
  • KBR0~KBR4 – Keypad interface. If unused keep these pins open
  • KBC0~KBC4 – Keypad interface. Pull up to VDD_EXT, if unused keep pins open
  • RXD – Receive data. DTR Pin has been pulled up to VDD_EXT. If unused keep pin open
  • TXD – Transmit data
  • RTS – Request to send
  • CTS – Clear to send
  • RI – Ring indicator
  • DSR – Data Set Ready
  • DCD – Data carry detect
  • DTR – Data terminal Ready
  • DBG_TXD – Serial interface for debugging and firmware upgrade. If unused keep pins open
  • DBG_RXD – Serial interface for debugging and firmware upgrade. If unused keep pins open
  • SIM_VDD – Voltage supply for SIM card. The voltage can be select by software automatically either 1.8V or 3V
  • SIM_DATA – SIM data output. All signals of SIM interface are protected against ESD with a TVS diode array. Maximum cable length 200mm from the module pad to SIM card holder.
  • SIM_CLK – SIM clock
  • SIM_RST – SIM reset
  • SIM_PRESENCE – SIM detect. If unused keep open
  • ADC – General purpose analog to digital converter. If unused keep open. Input voltage range: 0V ~ 3V
  • NRESET – External reset input (Active low). If unused keep open.
  • PWM1 – PWM Output. If unused keep open.
  • PWM2 – PWM Output. If unused keep open.

Wiring

Identify the hot power wire (red wire in the diagram above) in the cord leading to the light bulb and make a cut. Connect the side leading to the light bulb to the NO terminal of the relay, and the side leading to the plug to the C terminal. This way the relay is on the hot side, and current is switched before it reaches the light bulb. It’s dangerous to put the relay on the neutral wire, since if the device fails current can still fault to ground when the relay is off.

Step by step procedure

WARNING – THIS PROJECT INVOLVES HIGH VOLTAGES THAT CAN CAUSE SERIOUS INJURY OR DEATH. PLEASE TAKE ALL NECESSARY PRECAUTIONS, AND TURN OFF ALL POWER TO A CIRCUIT BEFORE WORKING ON IT. WE ARE NOT RESPONSIBLE FOR ANY DAMAGE, INJURY, DEATH AND OTHER THINGS CAUSED BY THIS PROJECT IMPLEMENTATION. 

1.Download, install and open Arduino IDE.

2. Insert standard Sim Card to Sim Card holder of SIM900A GSM GPRS mini board and lock it. Sim card must be unlocked and with credit.

SIM900A GSM GPRS mini board

3.Attach GSM/GPRS antenna to SMA connector of SIM900A GSM GPRS mini board.

4. Power up with 5V DC not more than 2A external power supply or attach to Arduino Uno. The ‘status LED’ (D5) will be on.

5.Do wiring. Plug in Arduino Uno board to your PC USB port.

6. Wait for some time (approx. 1 minute) and see the blinking rate of ‘network LED’ (D6). GSM module will use some time to establish connection with mobile network.

7. Once the connection is established successfully, the status/network LED will blink continuously every 3 seconds. You may try making a call to the mobile number of the sim card inside SIM900A GSM GPRS mini board. If you hear a ring back, the SIM900A GSM GPRS mini board has successfully established network connection.

8.Select the correct board and com port in Arduino IDE. Do not upload a code to your Arduino Uno board while you have the load (light/sound system) connected to the mains. You should unplug it from mains before upload a sketch to your Arduino Uno board.

9.Open, modify, verify and upload the SIM900Aadvancedsecuritysystemsketch to your Adruino Uno board. Make sure to change the phone number in the code to your own phone number.

SIM900A GSM GPRS mini board – Advanced GSM security system

10. Open Serial Monitor at 115200 bps. When the PIR sensor detects movement (intruder) or window/door opens (magnetic door contact switch the SMS message will be send on your smartphone – “Intruder detected”.

11. That’s it! Happy coding!

Code

First, we need to add the software serial library so we won’t have to remove the TX or RX pins while uploading the code. Any message we are going to send will be stored in the outgoingData string. Then we define the Arduino Unio pins where PIR sensor, magnetic contact switch and 5V relay module are attached. We will also define variables for PIR and magnetic contact switch status – pirStatus and switchStatus.

In setup() we set the communication rate at 115200 bps and baudrate for SIM900A GSM GPRS mini board – 19200 bps. We set the pir sensor pin and switch pin as INPUT and relay pin as OUTPUT. By default the relay pin signal is LOW. We will use the NO configuration. So, when an input pin is LOW the relay is OFF, if it is HIGH – the relay is ON, the circuit will be complete, and a light or sound switched on.

In the loop() when motion detected by PIR sensor (signal is HIGH) the SMS message is sent or when door/window opened and detected by magnetic door contact switch (signal is LOW) the SMS message is sent. You can change it in the code and make the SMS sent when both sensors are activated.

sendSMS() function will send SMS message. Make sure to change the number in the code to your own phone number.

Summary

We have learnt how to make an Advanced GSM security system (GSM alarm system) using Arduino Uno, PIR sensor, magnetic contact switch, 5V relay module and SIM900A GSM GPRS mini board.

Libraries

SoftwareSerial library included in Arduino IDE.  The library has the following known limitations:If using multiple software serial ports, only one can receive data at a time.Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).On Arduino or Genuino 101 the current maximum RX speed is 57600bpsOn Arduino or Genuino 101 RX doesn’t work on Pin 13 The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn’t work on Pin 13. You can read about it here.

Sketch

  • See attachment on the begining of this project description.

Check for more DIY projects on Acoptex.lt and Acoptex.com!

If you are looking for high quality PCBs PCBWay is the best choice: