In a private house      06/14/2019

GSM home security system based on Arduino. Creating a burglar alarm with a motion sensor based on Arduino and infrared sensors Gsm alarm with brains from arduino

This project concerns the development and improvement of a system to prevent/control any attempted entry by thieves. The developed security device uses an embedded system (includes a hardware microcontroller using open source code and a gsm modem) based on GSM (Global System for Mobile Communications) technology.

The security device can be installed in the house. Interface sensor burglar alarm also connected to the security system based on the controller.
When an intrusion is attempted, the system sends a warning message (for example, sms) to the owner on mobile phone or to any pre-configured mobile phone for further processing.

The security system consists of an Arduino Uno microcontroller and a standard SIM900A GSM/GPRS modem. The whole system can be powered by any 12V 2A power supply/battery.

Below is a diagram of an Arduino-based security system.

The operation of the system is very simple and self-explanatory. When power is applied to the system, it goes into standby mode. When J2 connector pins are shorted, a pre-programmed warning message is sent to the desired mobile number. You can connect any intrusion detection detector (such as a light guard or motion detector) to the input connector J2. Note that an active-low (L) signal on pin 1 of connector J2 will activate the burglar alarm.

Moreover, an optional “call-alarm” device has been added to the system. It activates phone call when the user presses the S2 button (or when another electronic unit initiates an alarm). After pressing the “call” (S2) button, the call can be canceled by pressing another S3 button, the “end” button. This option can be used to generate a “missed call” alarm in the event of an intrusion.

The circuit is very flexible, so it can use any SIM900A modem (and of course the Arduino Uno board). Read the modem documentation carefully before assembling. This will facilitate and make the process of manufacturing the system enjoyable.

List of radio elements

Designation Type Denomination Quantity NoteShopMy notepad
Arduino board

Arduino Uno

1 To notepad
GSM/GPRS modemSIM900A1 To notepad
IC1 Linear Regulator

LM7805

1 To notepad
C1 100uF 25V1 To notepad
C2 electrolytic capacitor10uF 16V1 To notepad
R1 Resistor

1 kOhm

1 To notepad
LED1 Light-emitting diode 1 To notepad
S1 ButtonWith fixation1
Car theft has been one of the most significant places in the structure of crimes committed in the world. This is due not so much to the specific weight of this category of theft relative to the total number of crimes, but to the significance of the damage caused due to the high cost of cars. The weak effectiveness of the measures taken in the field of combating the theft of motor vehicles by the end of the 90s led to the creation of stable groups specializing in the commission of these crimes and having the hallmarks of organized crime; you've probably heard the term "black car business". The car park of European states annually misses ≈ 2% of cars that become the subject of criminal encroachments. So I got the idea to make a gsm alarm for my car based on Arduino Uno.

Let's start!

What will we collect from?

We must choose the heart of our system. In my opinion, for such signaling, there is nothing better than the Arduino Uno. The main criterion is a sufficient number of "pins" and the price.


Key Features of the Arduino Uno

Microcontroller - ATmega328
Operating voltage - 5 V
Input voltage (recommended) - 7-12 V
Input voltage (limit) - 6-20 V
Digital I/O - 14 (6 of which can be used as PWM outputs)
Analog inputs - 6
DC current through input/output - 40 mA
DC current for output 3.3V - 50mA
Flash memory - 32 KB (ATmega328) of which 0.5 KB is used for the bootloader
RAM - 2 Kb (ATmega328)
EEPROM - 1 Kb (ATmega328)
Clock frequency - 16 MHz


Fits!

Now you need to select a gsm module, because our alarm system should be able to notify the car owner. So, you need to “google” ... Here, an excellent sensor is SIM800L, the size is just wonderful.


I thought and ordered it from China. However, everything was not so rosy. The sensor simply refused to register the SIM card on the network. Everything possible was tried - the result is zero.
There were kind people who gave me a cooler thing - Sim900 Shield. Now this is some serious stuff. The Shield has both a microphone and headphone jack, a full-fledged phone.


Key Features of Sim900 Shield

4 operating frequency standards 850/ 900/ 1800/ 1900 MHz
GPRS multi-slot class 10/8
GPRS mobile station class B
Complies with GSM phase 2/2+
Class 4 (2 W @850/ 900 MHz)
Class 1 (1 W @ 1800/1900MHz)
Control via AT commands (GSM 07.07 ,07.05 and SIMCOM extended AT commands)
Low power consumption: 1.5mA(sleep mode)
Operating temperature range: -40°C to +85°C


Fits!

Ok, but you need to take readings from some sensors in order to notify the owner. Suddenly the car is evacuated, then the position of the car will obviously change in space. Take an accelerometer and a gyroscope. Great. Taxi, now we are looking for a sensor.

I think that the GY-521 MPU6050 will definitely fit. It turned out that it also has a temperature sensor. It would be necessary to use it, there will be such a “killer feature”. Suppose the owner of the car put it under the house and left. The temperature inside the car will change “smoothly”. What happens if an intruder tries to get into the car? For example, he will be able to open the door. The temperature in the car will begin to change rapidly, as the air in the cabin will begin to mix with the air environment. I think it will work.


Key Features of GY-521 MPU6050

Module 3-axis gyroscope + 3-axis accelerometer GY-521 on the chip MPU-6050. Allows you to determine the position and movement of an object in space, the angular velocity during rotation. It also has a built-in temperature sensor. It is used in various copters and aircraft models, and based on these sensors, you can assemble a motion capture system.

Chip - MPU-6050
Supply voltage - from 3.5V to 6V (DC);
Gyro range - ± 250 500 1000 2000 ° / s
Accelerometer range - ± 2 ± 4 ± 8 ± 16g
Communication interface - I2C
Size - 15x20 mm.
Weight - 5 g


Fits!

A vibration sensor is also useful. Suddenly, they will try to open the car with “brute force”, well, or in the parking lot, another car will touch your car. Let's take the vibration sensor SW-420 (adjustable).


Key Features of SW-420

Supply voltage - 3.3 - 5V
Output signal - digital High/Low (normally closed)
Used sensor - SW-420
Used comparator - LM393
Dimensions - 32x14 mm
Additionally - There is an adjusting resistor.


Fits!

Screw the SD memory card module. Let's write a log file.


Key Features of the SD Memory Card Module

The module allows you to store, read and write to the SD card the data required for the operation of the device based on a microcontroller. The use of the device is relevant when storing files from tens of megabytes to two gigabytes. The board contains an SD card container, a card power stabilizer, a connector for the interface and power lines. If you need to work with sound, video or other volumetric data, such as logging events, sensor data or storing web server information, then the SD memory card module for Arduino will make it possible to use an SD card for these purposes. Using the module, you can study the features of the SD card.
Supply voltage - 5 or 3.3 V
SD card memory capacity - up to 2 GB
Dimensions - 46 x 30 mm


Fits!

And add a servo drive, when the sensors are triggered, the servo drive with the DVR will turn and shoot a video of the incident. Take the MG996R servo.


Key features of MG996R servo

stable and reliable protection from damage
- Metal drive
- Double row ball bearing
- Wire length 300 mm
- Dimensions 40x19x43mm
- Weight 55 gr
- Angle of rotation: 120 degrees
- Operating speed: 0.17sec/60 degrees (4.8V no load)
- Operating speed: 0.13sec/60 degrees (6V no load)
- Starting torque: 9.4kg/cm at 4.8V supply
- Starting torque: 11kg/cm with 6V supply
- Operating voltage: 4.8 - 7.2V
- All drive parts are made of metal


Fits!

Collecting

There are a huge number of articles about connecting each sensor in Google. And I have no desire to invent new bicycles, so I will leave links to simple and working options.

Good afternoon Again, a multi-review of Chinese electronic components, as usual, a little about everything, I will try to be shorter, but will it work? So, meet, GSM alarm system costing up to 700 ₽. Interesting? Please under "cut"!

Let's get started! Before starting, I recommend looking into this one, fewer components and greater autonomy. So, the "terms of reference", the basic requirements for signaling:

1) Notify when sensors are triggered.
2) In the event of a power failure, some autonomy must be provided.
3) Alarm management via sms and calls.

Due to the fact that the process of creating an alarm was delayed for several months and some sellers no longer sell those components that were purchased from them, the links will be updated to the goods of other sellers who have the maximum or close to the maximum number of sales of goods and best price. The prices in the review are current as of the date of writing.

List of what you need:

List of changes

GSM_03_12_2016-14-38.hex- Fixed device operation with M590 modem.
GSM_05_12_2016-13-45.hex- added console command memtest, optimization of RAM usage.
GSM_2016_12_06-15-43.hex- Added output of command results to the console, memory optimization. Occupied: 49% SRAM.
GSM_2016_12_07-10-59.hex- now phone numbers are added and removed correctly. Occupied: 49% SRAM, 74% Flash Memory.
GSM_2016_12_07-15-38.hex- added the ability to connect a motion sensor, connects to pin A0 (in this case, pin A0 is used as a digital one). Added SMS commands PIRON, PIR Off. Occupied: 48% SRAM, 76% Flash Memory.
GSM_2016_12_08-13-53.hex- Now, after successful execution of a command that does not send an SMS message in response, the device blinks a blue LED once. Now, after an incorrect execution of a command that does not send an SMS message in response, the device blinks twice with a blue LED. Now, after initialization of the device parameters, if the "silent" mode is enabled (SendSms = 0), the device blinks rapidly with a blue LED for 2 seconds. Fixed a bug due to which the number was not always deleted from memory by the DeletePhone command. Occupied: 48% SRAM, 78% Flash Memory.
GSM_2016_12_11-09-12.hex- Added console commands AddPhone and DeletePhone, the syntax is similar to SMS commands. Memory optimization. Occupied: 43% SRAM, 79% Flash Memory.
GSM_2017_01_03-22-51.hex- Implemented support for similar I / O port expanders on the PCF8574 chip, for connecting an additional 8 sensors, including reed switches. Automatic address search and automatic module setting. The standard names of sensors and the logical level of their operation are changed using the EditSensor command. Changed the content of alarm SMS for the main sensor (pin D0) “Alarm! main sensor! and motion sensor (pin A0) “Alarm! PIR sensor! Added EditSensor and I2CScan commands. Occupied: 66% SRAM, 92% Flash Memory.
GSM_2017_01_15-23-26.hex- Support for A6_Mini modem. Availability control external power supply(pin D7). Added SMS commands WatchPowerOn, WatchPowerOff. Added console commands ListConfig, ListSensor. Now the EditSensor sms command works correctly. The output of debugging information to the port monitor has been slightly "cut down". Occupied: 66% SRAM, 95% Flash Memory.
GSM_2017_01_16-23-54.hex- Now in the response message to the SMS command "Info" the state of the motion sensor is also reported. Fixed a bug due to which empty response SMS messages were sometimes sent. Now the device notifies not only about the shutdown, but also about the resumption of external power. All modems began to “talk less”, now the port monitor has become a little cleaner. Occupied: 66% SRAM, 95% Flash Memory.
GSM_2017_02_04-20-23.hex- Fixed "Watch the power on" bug. Now, after disarming, the “alarm pin” is turned off. Now, after deleting the number, the correct information is displayed in the console. Perhaps a bug has been fixed due to which empty response SMS messages were sometimes sent. Occupied: 66% SRAM, 90% Flash Memory.
GSM_2017_02_14-00-03.hex- Now, by default, SMS messages are sent, the SendSms parameter is again equal to 1. Now, when the contacts of the main reed switch are closed (the door is closed), the device flashes a blue LED for 2 seconds, signaling the normal operation of the sensor. Occupied: 66% SRAM, 90% Flash Memory.
GSM_2017_03_01-23-37.hex- The WatchPowerOn command has been removed. Added console command WatchPowerOff, identical to SMS command. Added commands WatchPowerOn1, WatchPowerOn2. WatchPowerOn1 - external power monitoring is enabled if the alarm is armed, WatchPowerOn2 - external power monitoring is always enabled. The function of arming and disarming by external devices has been implemented, for this purpose terminals A1(D15) and A2(D16) are used. The alarm will arm/disarm when it appears on output A1(D15) high level+5V or at pin A2(D16) low level GND. Pin A1(D15) is pulled up to GND, pin A2(D16) is pulled up to +5V through 20 (10) kOhm resistors. Added GuardButtonOn and GuardButtonOff commands. Now, after arming, the red LED flashes until the integrity of the main reed sensor circuit is checked. If the circuit is complete, the red LED lights up. Occupied: 66% SRAM, 95% Flash Memory.
GSM_2017_03_12-20-04.hex- Now the console is even cleaner, but if the "TestOn" test mode is enabled, additional information is displayed in the console. The "Sent!" bug has been fixed, now information about sending messages is correctly displayed in the console. Fixed "repeated fake call" bug. Now the balance request should work correctly on all modems. Occupied: 67% SRAM, 95% Flash Memory.
GSM_2017_04_16-12-00.hex- Fixed. Now the Info and Money commands will always send a response SMS. The GuardButtonOn command has been replaced by the GuardButtonOn1 and GuardButtonOn2 commands. Occupied: 67% SRAM, 99% Flash Memory.
GSM_2017_04_21-09-43.hex - not recommended for use, only as a test, thanks for the errors found :) - Now the sendsms parameter does not affect the sending of SMS messages for monitoring the power grid. Added SMS command DelayBeforeGuard responsible for the delay when arming, the value cannot exceed 255 seconds. Added SMS command DelayBeforeAlarm responsible for delaying sending notifications and turning on the "alarm pin" when sensors are triggered, the value cannot exceed 255 seconds. Removed ClearSMS commands, now messages are deleted automatically upon receipt. Occupied: 68% SRAM, 100% Flash Memory.
GSM_2017_04_22-20-42.hex- Fixed multiple bugs. ClearSMS commands are back in the firmware. Memory optimization. Occupied: 68% SRAM, 98% Flash Memory.
GSM_2017_04_23-17-50.hex- Now the balance request should work correctly on all modems. Arming and disarming by external devices now works correctly. Info command SMS response messages must not be empty. Memory optimization. Occupied: 68% SRAM, 98% Flash Memory.
GSM_2017_04_24-13-22.hex- Now passing console commands to GSM module performed only if the test mode is enabled. Now there is no division into SMS commands and console commands, all existing commands can be sent both via SMS and via the console. Possibly fixed a bug with the Info command. Memory optimization. Occupied: 68% SRAM, 94% Flash Memory.
GSM_2017_04_25-20-54.hex- Fixed a bug where the ListConfig command changed the value of the last event. Now, when entering commands through the console, unnecessary SMS messages are not sent. Possibly fixed a bug with the Info command. Memory optimization. Occupied: 66% SRAM, 94% Flash Memory.
GSM_2017_04_30-12-57.hex- Temporarily enabled output of additional information to the console when sending SMS messages and forming a response to the Info command. Possibly fixed a bug with the Info command. Memory optimization. Occupied: 66% SRAM, 92% Flash Memory.
GSM_2017_05_06-11-52.hex- Fixed with DelayBeforeAlarm function. Occupied: 66% SRAM, 93% Flash Memory.
GSM_2017_05_23-21-27.hex- Slightly changed the output of information to the console. Added support for port expansion modules on PCF8574A with addresses from 0x38 to 0x3f inclusive. Fixed c bug. Now the device reboots automatically after the FullReset, ResetConfig, ResetPhone commands and in case of successful execution of the MemTest command. Added WatchPowerTime command. Now it is possible to set the time after which an SMS message about disconnection will be sent external source nutrition. Occupied: 67% SRAM, 94% Flash Memory.
GSM_2017_05_26-20-22.hex- Fixed sensor memory initialization of the expansion board. The syntax of the AddPhone command has been changed. Added EditMainPhone command. The principle of operation of the notification system has been changed, when the sensor is triggered, sms messages will be sent first, after which voice calls will be made. Alarm sms messages will be sent to telephone numbers marked with "S" (SMS). Voice calls will be made to numbers with the sign "R" (Ring). Messages about turning off/on an external power source will be sent to telephone numbers with the sign "P" (Power). Added RingTime command. Now it is possible to set the duration of the alarm voice call, the parameter can have a value from 10 to 255 seconds. Now the RingOn/RingOff command globally enables/disables notification by voice calls. Added ResetSensor command. Occupied: 68% SRAM, 99% Flash Memory.
GSM_2017_06_02-17-43.hex- The "I" (Info) parameter has been added to the AddPhone and EditMainPhone commands, which is responsible for sms notification of arming or disarming the device. Now, after adding the main number, the device will automatically reboot. Now you can enter the same numbers into the device's memory. When adding the second and subsequent duplicate numbers, the attributes "M", "S", "P" and "I" will be automatically removed from them. These numbers will be used for repeated voice calls when the sensors are triggered. Fixed a bug with wry output to the console after executing the AddPhone command, now information is not displayed automatically after adding a number. Added Reboot command. Occupied: 69% SRAM, 99% Flash Memory.
GSM_2017_06_11-00-07.hex- Now again, when the contacts of the main reed switch are closed (the door is closed), the device flashes with a blue LED for 2 seconds, signaling the normal operation of the sensor, while the device is not taken into account when the device is armed or disarmed. The RingOn/RingOff commands have been removed. Now the device can be disarmed during an alarm call, now they are made in the background. Occupied: 69% SRAM, 99% Flash Memory.
GSM_2017_07_04-21-52.hex- Now the Pause command does not send a response SMS. Removed TestOn and TestOff commands. All numbers have the sign Management removed. Occupied: 68% SRAM, 96% Flash Memory.
GSM_2017_07_24-12-02.hex- Added ReedSwitchOn/ReedSwitchOff commands for monitoring the main reed sensor, now it can be enabled/disabled in the same way as a motion sensor. Fixed Info command bug. The TestOn and TestOff commands are back in the firmware. Occupied: 68% SRAM, 96% Flash Memory.
GSM_2017_07_26-10-03.hex- Added ModemID command. The modem is automatically detected only if the value of this parameter is equal to 0. After setting the parameter value to 0, the device is automatically rebooted. Occupied: 68% SRAM, 98% Flash Memory.
GSM_2017_08_03-22-03.hex- Now the alarm can control external devices. The analog output A3 is used for control (D17 is used as a digital one). The output logic level (+5V or GND) can be changed, after changing the level through the setting command, the device will automatically reboot. The duration of the external device control signal can be changed. Added commands ExtDeviceLevelLow, ExtDeviceLevelHigh, ExtDeviceTime, Open. Some changes in the logic of the control commands. Memory optimization. Occupied: 68% SRAM, 99% Flash Memory.
GSM_2017_08_10-12-17.hex- Removed commands SmsOn/SmsOff, ReedSwitchOn/ReedSwitchOff, PIROn/PIROff and everything connected with them. The DelayBeforeAlarm command has been replaced with extended commands. Changed the output of the Info command. Optimized the output of the ListConfig command to the console. Now any high or low level digital sensors, including reed switches, can be connected to pins D6 and A0. Pins D6 and A0 must be pulled to ground (GND) through a resistance of 10 (20) kOhm. If the sensor is set to a low level of operation (enabled in the reed switch mode), then the integrity of the circuit is checked. The logic level of operation on inputs D6 and A0 (+5V or GND) can be changed, after changing the logic level the device will be automatically rebooted. For each of the sensors (main, second, PCF-extension cards), when triggered, a specific time can be set, after which a notification will be made (sms and/or voice call). "PIR Sensor" renamed to "Second sensor". Fixed the operation of the expansion board, an error due to which the device always notified about the operation of sensors, regardless of whether the device was armed or not. Now you can select the operating mode in which the device can monitor the sensors of the expansion board both in the armed mode (GuardOn) and in the disabled mode (GuardOff). Added commands PCFForceOn/PCFForceOff, MainSensorLevelHigh/MainSensorLevelLow/MainSensorLevelOff, SecondSensorLevelHigh/SecondSensorLevelLow/SecondSensorLevelOff, MainDelayBeforeAlarm, SecondDelayBeforeAlarm, PCFDelayBeforeAlarm. Occupied: 68% SRAM, 99% Flash Memory.

*Subsequent firmware versions include changes to previous versions.


Arduino Nano v3 ports used

D4- output of the "alarm" pin, when the sensor is triggered, a high level signal is set on this pin
D5- inverted output of the "alarm" pin, when the sensor is triggered, a low level signal is set on this pin

D6- reed sensor. Starting from the GSM_2017_08_10-12-17.hex version, any digital sensors with a high or low response level, including reed switches, can be connected to pin D6. Pin D6 must be pulled to ground (GND) through a resistance of 10 (20) kOhm.
D7- connected to a voltage divider from an external +5V power supply. Upper arm 2.2 kΩ, lower arm 3.3 kΩ.

Voltage divider


D8- TX modem
D9- RX modem

D10- red LED
D11- blue LED
D12- green LED

Peripheral connection:
A0- Motion Sensor . Starting from the GSM_2017_08_10-12-17.hex version, any digital sensors with a high or low response level, including reed switches, can be connected to pin A0. Pin A0 must be pulled to ground (GND) through a resistance of 10 (20) kOhm.

A1- Input for external control. The alarm sets/disarms when a high level +5V appears at the input.
A2- Inverted input for external control. The alarm sets/disarms when a low GND level appears at the input.

A3- Configurable (+5V or GND) output for controlling external devices. When a control command is received, the value at this output changes depending on what was set for the set time period.

A4- SDA I2C
A5- SLC I2C
, to connect additional 8 sensors.


Control commands for hex firmware

Attention! Commands highlighted in bold can only be performed from the main number, as they are responsible for the configuration of the device. The remaining commands can be executed from numbers with the "Management" attribute.

SMS - control commands are not case sensitive:
Add Phone- Add phone number. In total, no more than 9 numbers can be added + 1 main number, which is automatically stored in memory the first time you call the device after resetting to factory settings by commands reset phone or Full reset. Those. whoever called the device first after resetting it to factory settings is the “main” one, this number is entered in the first memory cell and it cannot be changed or deleted via SMS. It is not possible to add two identical numbers.
Command example:



Command syntax:

Add Phone- team
: - delimiter
5 - write to the fifth memory cell
+71234567890 - phone number
Up to version GSM_2017_05_26-20-22.hex:
a - "Alarm" parameter - SMS messages will be sent to numbers with this parameter - alarm messages and messages for arming or disarming.
Starting from version GSM_2017_05_26-20-22.hex:
m - "Management" parameter - alarm management is allowed
s - "SMS" parameter - an SMS message will be sent when sensors are triggered
r - "Ring" parameter - a voice call will be made when the sensors are triggered
p - "Power" parameter - an SMS message will be sent when the external power is turned on / off
i - "Info" parameter - an SMS message will be sent when arming or disarming
In the absence of the parameters "m", "s", "r", "p", "i", the phone is stored in memory, but is not used in any way.


DeletePhone- Delete phone number.
Command example:

Command syntax:

DeletePhone command
: - delimiter
+71234567891 - phone number


EditMainPhone- Change the parameters "s", "r", "p", "i" of the main phone, this number is entered in the first memory cell.
Command example:

Command syntax:

EditMainPhone command
: - delimiter
srpi - parameters


BalanceNum- Changing the number of the balance request and processing the length of the request response. Default value for Beeline: #100#L22.
Command example:

Command syntax:

BalanceNum - team
: - delimiter
#103# - balance request number
L24 - The length (len) of the forwarded response is 24 characters, we cut off the spam from the balance request.


EditSensor- Change the name of the sensor and the logical level of operation. There can be no more than 8 additional sensors in total. After changing the settings, the device must be rebooted.
Command example:
EditSensor:1+Datchik dvizheniya v koridore#h

Command syntax:

EditSensor - command
: - delimiter
1 - write to the first memory cell
+ - separator
Datchik dvizheniya v koridore - the name of the sensor, cannot exceed 36 characters, including spaces.
#h - A sign of a high logic level from the sensor, upon receipt of which an alarm will be triggered. If "#h" is missing, the alarm will be triggered when a low logic level is received from the sensor.


SleepTime- The time of "falling asleep" of the alarm when receiving SMS - the "Pause" command, is indicated in minutes. Default value: 15, cannot be less than 1 and more than 60.
Command example:

Command syntax:

SleepTime - team
: - delimiter
20 - 20 minutes of "sleep".


AlarmPinTime- The time for which the alarm / inverse pin is turned on / off is indicated in seconds. Default value: 60, cannot be less than 1 second and more than 43200 seconds (12 hours).
Command example:

Command syntax:

AlarmPinTime - command
: - delimiter
30 - 30 seconds to enable/disable the alarm pin.


DelayBeforeGuard- The time until the device is armed, after receiving the appropriate command.
Command example:

Command syntax:

DelayBeforeGuard command
: - delimiter
25 - 25 seconds before arming


DelayBeforeAlarm- The time after which an "alarming" SMS notification will be sent, if the alarm has not been disarmed during this period of time. Replaced by extended commands starting from version GSM_2017_08_10-12-17.hex
Command example:

Command syntax:

DelayBeforeAlarm - command
: - delimiter
40 - 40 seconds before sending an "alarm" notification


WatchPowerTime- Time in minutes after which an SMS message will be sent about the disconnection of the external power source. If the external power is restored before the set time has elapsed, the message will not be sent.
Command example:

Command syntax:

WatchPowerTime - team
: - delimiter
5 - 5 minutes before sending an SMS message


RingTime- The duration of the alarm voice call, the parameter can have a value from 10 to 255 seconds.
Command example:

Command syntax:

RingTime - command
: - delimiter
40 - 40 the duration of the call will be 40 seconds, after which the next subscriber will be called.


Modem ID - Force installation model of the modem used. Possible values: 0 - modem autodetection, 1 - M590, 2 - SIM800l, 3 - A6_Mini.
Command example:

Command syntax:

ModemID - command
: - delimiter
2 - modem ID.


ExtDeviceTime- The number of seconds for which the signal level at the external device control output will change.
Command example:

Command syntax:

ExtDeviceTime command
: - delimiter
5 - 5 seconds


ExtDeviceLevelLow- An external device connected to output A3 is driven low (GND). The default output will be high +5V until an external device control command is received.
ExtDeviceLevelHigh- An external device connected to output A3 is controlled by a high signal level (+5V). The output will default to GND low until an external device control command is received.

ResetSensor- reset the parameters of the sensors of the port expander

resetconfig- factory reset

reset phone- deletion of all phone numbers from the memory

Full reset- Reset settings, delete all phone numbers from the memory, restore the default value of the BalanceNum command.

Ring On- enable notification by a call to the "main" number recorded in the first memory cell when the sensor is triggered. Removed since version GSM_2017_06_11-00-07.hex
Ring Off- turn off the notification by a call when the sensor is triggered. Removed since version GSM_2017_06_11-00-07.hex

SmsOn- enable sms notification when the sensor is triggered. Removed since version GSM_2017_08_10-12-17.hex
sms off- turn off sms-notification when the sensor is triggered. Removed since version GSM_2017_08_10-12-17.hex

PIRON- enable motion sensor processing
PIR Off- disable motion sensor processing

ReedSwitchOn- enable processing of the main reed sensor
ReedSwitchOff- turn off the processing of the main reed sensor

WatchPowerOn- turn on the control of external power, an SMS message about the disconnection of external power will be sent, provided that the alarm system is armed. Removed since version GSM_2017_03_01-23-37.

WatchPowerOn1- turn on the control of external power, an SMS message about the disconnection of external power will be sent, provided that the alarm system is armed.
WatchPowerOn2- turn on external power control, SMS message about external power failure will be sent in any case

Watch Power Off- turn off external power control

GuardButtonOn- control of the alarm by external devices or a button is enabled Removed starting from the version GSM_2017_04_16-12-00.
GuardButtonOn1- function placing or withdrawing protection by external devices or the button is turned on
GuardButtonOn2- function only performances armed by external devices or by the button is turned on, disarming is carried out by a call to the device or using an SMS command.
GuardButton Off- alarm control by external devices or by button is disabled

PCFForceOn- continuous monitoring of a group of all sensors of the expansion module
PCFForceOff- monitoring of a group of all sensors of the expander only when the device is armed

MainSensorLevelHigh- an alarm notification will be sent when a high level signal (+5 V) appears at the input (D6) from the sensor
MainSensorLevelLow- an alarm notification will be sent when a low level signal (GND) appears at the input (D6) from the sensor
MainSensorLevelOff- input sensor processing (D6) disabled

SecondSensorLevelHigh- an alarm notification will be sent when a high level signal (+5 V) appears at the input (A0) from the sensor
SecondSensorLevelLow- an alarm notification will be sent when a low level signal (GND) appears at the input (A0) from the sensor
SecondSensorLevelOff- input sensor processing (A0) disabled

MainDelayBeforeAlarm- the time after which an “alarm” SMS notification will be sent when the main sensor (D6) is triggered, if the alarm has not been disarmed during this period of time. The syntax is the same as the DelayBeforeAlarm command.
SecondDelayBeforeAlarm- the time after which an "alarm" SMS notification will be sent when an additional sensor (A0) is triggered, if the alarm has not been disarmed during this period of time. The syntax is the same as the DelayBeforeAlarm command.
PCFDelayBeforeAlarm- the time after which an "alarm" SMS notification will be sent when the sensors of the expansion board (PCF8574) are triggered, if the alarm has not been disarmed during this period of time. The syntax is the same as the DelayBeforeAlarm command.

GuardOn - arm
GuardOff - remove protection

Open - external device control command

Info - check the status, in response to this message, an SMS will be sent with information about the number from which the security was turned on / off

Pause - pauses the system for the time set by the sleeptime command in minutes, the system does not respond to sensor triggers.

TestOn - the test mode is turned on, the blue LED blinks.
TestOff - the test mode is turned off.

LedOff - turns off the standby LED.
LedOn - turns on the standby LED.

Money - balance request.

ClearSms - Delete all sms from memory

Console commands (up to version GSM_2017_04_24-13-22.hex) - are entered in the Arduino IDE port monitor:

AddPhone - similar to the AddPhone sms command

DeletePhone - similar to the DeletePhone sms command

EditSensor - similar to the EditSensor sms command

ListPhone - output to the port monitor a list of phones stored in memory

ResetConfig - similar to the ResetConfig sms command

ResetPhone - similar to the ResetPhone sms command

FullReset - similar to the SMS command FullReset

ClearSms - similar to the ClearSms sms command

WatchPowerOn1 - similar to WatchPowerOn1 SMS command
WatchPowerOn2 - similar to WatchPowerOn2 sms command
WatchPowerOff - similar to WatchPowerOff sms command

GuardButtonOn - similar to GuardButtonOn sms command. Removed since version GSM_2017_04_16-12-00
GuardButtonOn1 - similar to GuardButtonOn1 SMS command
GuardButtonOn2 - similar to GuardButtonOn2 SMS command
GuardButtonOff - similar to GuardButtonOff sms command

Memtest - a test of the non-volatile memory of the device, all device settings will be reset, similar to the FullReset command.

I2CScan - search and initialization of supported devices on the I2C bus.

ListConfig - output to the port monitor of the device's current configuration.

ListSensor - output to the port monitor of the current sensor configuration.

UPD. When using motion sensor, to exclude false positives when the modem is running, between pins GND And A0 Arduino put resistance thank you friend
AllowPhone = ("70001234501", "70001234502", "70001234503", "70001234504", "70001234505") - Numbers that are allowed to manage security.
AlarmPhone = ("70001234501", "70001234502") - Numbers for sending SMS notifications when a sensor is triggered and notifications about disarming or arming. The first number in the list will be called when the sensor is triggered if the RingOn command is executed, by default this option is enabled. This is done because sms messages may arrive with some delay, and the call should go through immediately.

If a call is received from an authorized number or an SMS message with the GuardOn/GuardOff command, then depending on current state protection, an SMS message about arming or disarming will be sent to the numbers listed in the AlarmPhone array, an SMS message will also be sent to the number from which the call came.

When the sensor is triggered SMS messages are sent to all numbers from the AlarmPhone array (list) and a voice call is made to the first number from this array.

Light indication:
The LED glows red - armed.
LED lights up in green- disarmed, enabled/disabled by SMS command LedOn/LedOff.
The LED is constantly blinking blue - it indicates that everything is in order with the Arduino, the board has not hung, is used exclusively for debugging, is enabled / disabled by the TestOn / TestOff sms command.
* The LedTest() function is present in the code, it blinks with a blue LED, it is made only to monitor the Arduino, it blinks - it means it's working, it doesn't blink - it's frozen. Haven't hung up yet :)

Not relevant!

Connection of 2 or more sensors for open firmware (applies only to this firmware sketch_02_12_2016.ino)
To connect additional reed sensors, we use free digital pins D2, D3, D5 or D7. Wiring diagram with additional sensor on D7.

Necessary firmware changes
... #define DoorPin 6 // Input number connected to the main sensor int8_t DoorState = 0; // Variable for storing the state of the main sensor int8_t DoorFlag = 1; // Variable for storing the state of the main sensor #define BackDoorPin 7 // Number of the input connected to the additional sensor int8_t BackDoorState = 0; // Variable for storing the state of the additional sensor int8_t BackDoorFlag = 1; // Variable for storing the state of the additional sensor...
void setup() ( ... pinMode(DoorPin, INPUT); pinMode(BackDoorPin, INPUT); ...
... void Detect() ( // Reading values ​​from sensors DoorState = digitalRead(DoorPin); BackDoorState = digitalRead(BackDoorPin); //Processing the main sensor if (DoorState == LOW && DoorFlag == 0) ( DoorFlag = 1; delay(100); if (LedOn == 1) digitalWrite(GLed, LOW); Alarm(); ) if (DoorState == HIGH && DoorFlag == 1)( DoorFlag = 0; delay(100); ) //Process additional sensor if (BackDoorState == LOW && BackDoorFlag == 0) ( BackDoorFlag = 1; delay(100); if (LedOn == 1) digitalWrite(GLed, LOW); Alarm(); ) if (BackDoorState == HIGH && BackDoorFlag == 1)( BackDoorFlag = 0; delay(100); ) ) ...

And one more thing:
1. It is better to use diodes designed for a current of 2 A, since the module infects with a current of 1 A and we still need to feed the Arduino and the modem with something. In this instance, 1N4007 diodes are used, if they fail, I will replace them with 2 A.
2. I used all the resistors for the LED at 20 kOhm, in order not to illuminate the entire corridor at night.
3. I also hung a 20 kOhm resistor on the reed sensor between the GND pin and the D6 pin.

That's all for now. Thank you for your attention! :)

I plan to buy +207 Add to favorites Liked the review +112 +243

Infra-red (IR) sensors are usually used to measure distances, but they can also be used to detect objects. By connecting several IR sensors to the Arduino, we can create a burglar alarm.

Review

Infra-red (IR) sensors are usually used to measure distances, but they can also be used to detect objects. IR sensors consist of an infrared transmitter and an infrared receiver. The transmitter emits pulses of infrared radiation while the receiver detects any reflections. If the receiver detects a reflection, it means that there is some object in front of the sensor at some distance. If there is no reflection, there is no object.

The IR sensor we will be using in this project detects reflections within a certain range. These sensors have a small linear charge-coupled device (CCD) that detects the angle at which IR radiation returns to the sensor. As shown in the figure below, the sensor transmits an infrared pulse into space, and when an object appears in front of the sensor, the pulse is reflected back to the sensor at an angle proportional to the distance between the object and the sensor. The sensor receiver detects and outputs the angle, and using this value, you can calculate the distance.

By connecting a couple of IR sensors to the Arduino, we can make a simple burglar alarm. We'll put sensors on the door frame, and by properly aligning the sensors, we'll be able to detect when someone walks through the door. When this happens, the output of the IR sensor will change, and we will detect this change by constantly reading the output of the sensors from Arduino. In this example, we know that an object passes through the door when the IR sensor output exceeds 400. When this happens, the Arduino will trigger an alarm. To reset the alarm, the user can press the button.

Accessories

  • 2 x IR distance sensor;
  • 1 x Arduino Mega 2560
  • 1 x buzzer;
  • 1 x button;
  • 1 x 470 ohm resistor;
  • 1 x NPN transistor;
  • jumpers.

Connection diagram

The circuit for this project is shown in the figure below. The outputs of the two IR sensors are connected to pins A0 and A1. The other two pins are connected to the 5V and GND pins. A 12 volt buzzer is connected to pin 3 via a transistor and a button used to disable the alarm is connected to pin 4.


The photo below shows how we glued the sensors onto the door frame for this experiment. Of course, in the case of constant use, you would install the sensors differently.


Installation

  1. Connect the 5V and GND pins arduino boards to the power and GND pins of the sensors. You can also supply external power to them.
  2. Connect the output pins of the sensors to pins A0 and A1 of the Arduino board.
  3. Connect pin 3 of the Arduino to the base of the transistor through a 1K resistor.
  4. Apply 12V to the collector of the transistor.
  5. Connect the positive lead of the 12V buzzer to the emitter and the negative lead to the ground rail.
  6. Connect pin 4 to pin 5V via a button. For safety reasons, it is always best to do this through an additional small resistor to avoid high current flow.
  7. Connect the Arduino board to your computer via a USB cable and upload the program to the microcontroller using the Arduino IDE.
  8. Power up the Arduino board using the power supply, battery, or USB cable.

Code

const int buzzer=3; // pin 3 is the output to the buzzer const int pushbutton=4; // pin 4 is the button input void setup() ( pinMode(buzzer,OUTPUT); // set pin 3 to output pinMode(pushbutton,INPUT); // set pin 4 to input ) void loop() ( // read the output of both sensors and compare the result with the threshold value int sensor1_value = analogRead(A0); int sensor2_value = analogRead(A1); if (sensor1_value > 400 || sensor2_value > 400) ( while(true) ( ​​digitalWrite(buzzer,HIGH) ; // enable the alarm if(digitalRead(pushbutton) == HIGH) break; ) ) else ( digitalWrite(buzzer,LOW); // disable the alarm ) )

Video

Good day 🙂 Today we will talk about signaling. The service market is full of firms, organizations that install and maintain security systems. These firms offer the buyer wide choose alarm. However, their cost is far from cheap. But what about a person who does not have so much personal money that can be spent on a burglar alarm? I think the conclusion suggests itself - do alarm their hands. This article is an example of how you can make your own coded security system using a board. arduino uno and several magnetic sensors.

The system can be deactivated by entering the password from the keyboard and pressing the ‘ * ‘. If you want to change your current password, you can do so by pressing the ‘ B', and if you want to skip or abort the operation, you can do this by pressing the key ‘#’. The system has a buzzer to play different sounds when performing a particular operation.

The system is activated by pressing the ‘A’ button. The system gives 10 seconds to leave the room. After 10 seconds the alarm will be activated. The number of magnetic sensors will depend on your own desire. The project involved 3 sensors (for two windows and a door). When the window is opened, the system is activated and the buzzer alarm is activated. The system can be deactivated by entering a password. When the door opens, the alarm gives the person who enters 20 seconds to enter the password. The system uses an ultrasonic sensor that can detect movement.

Video of the device

craft Made for informational/educational purposes. If you want to use it at home, you will need to modify it. Enclose the control unit in a metal case and secure the power line from possible damage.

Let's begin!

Step 1: What we will need

  • board Arduino uno;
  • high contrast LCD display 16×2;
  • keyboard 4×4;
  • 10~20kΩ potentiometer;
  • 3 magnetic sensors (they are also reed switches);
  • 3 2-pin screw terminals;
  • HC-SR04 ultrasonic sensor;

If you want to build a system without using Arduino, you will also need the following:

  • DIP header for atmega328 + microcontroller atmega328;
  • 16MHz quartz resonator;
  • 2 pcs. 22pF ceramic, 2 pcs. 0.22uF electrolytic capacitor;
  • 1 PC. 10kΩ resistor;
  • socket for power (DC power jack);
  • bread board;
  • 5V power supply;

And one box to pack it all!

Tools:

  • Something that can cut through a plastic box;
  • Hot glue gun;
  • Drill / screwdriver.

Step 2: Alarm Diagram

The connection scheme is quite simple.

Small clarification:

High contrast LCD:

  • Pin1 - Vdd to GND
  • Pin2 - Vss to 5V;
  • Pin3 - Vo (to the central output of the potentiometer);
  • Pin4 - RS to Arduino pin 8;
  • Pin5 - RW to GND
  • Pin6 - EN to Arduino pin 7;
  • Pin11 - D4 to Arduino pin 6;
  • Pin12 - D5 to Arduino pin 5;
  • Pin13 - D6 to Arduino pin 4;
  • Pin14 - D7 to Arduino pin 3;
  • Pin15 - Vee (to the right or left output of the potentiometer).

Keyboard 4×4:

From left to right:

  • Pin1 to A5 Arduino pin;
  • Pin2 to A4 Arduino pin;
  • Pin3 to Arduino pin A3;
  • Pin4 to Arduino pin A2;
  • Pin5 to Arduino pin 13;
  • Pin6 to Arduino pin 12;
  • Pin7 to Arduino pin 11;
  • Pin8 to Arduino pin 10.

Step 3: Firmware

The step shows the code that is used by the built-in !

Download the codebender plugin. Click on the "Run" button in the Arduino and flash your board with this program. That's all. You have just programmed the Arduino! If you want to make changes to the code, click the "Edit" button.

Note: If you are not using the Codebender IDE to program the Arduino board, you will need to install additional libraries in the Arduino IDE.

Step 4: Making Your Own Control Board

After successfully assembled and tested new project based on Arduino uno, you can start making your own board.

A few tips for a more successful completion of the undertaking:

  • A 10kΩ resistor must be connected between pin 1 (reset) and pin 7 (Vcc) of the Atmega328 microcontroller.
  • A 16MHz crystal should be connected to pins 9 and 10 labeled XTAL1 and XTAL2
  • Connect each resonator lead to 22pF capacitors. Connect the free leads of the capacitors to pin 8 (GND) of the microcontroller.
  • Don't forget to connect the second power line of the ATmega328 to the power supply, pins 20-Vcc and 22-GND.
  • You can find additional information on the pins of the microcontroller in the second image.
  • If you plan to use a power supply with a voltage higher than 6V, you must use an LM7805 linear regulator and two 0.22uF electrolytic capacitors, which should be mounted at the input and output of the regulator. It is important! Don't apply more than 6V to the board!!! Otherwise, you will burn your Atmega microcontroller and LCD display.

Step 5: Place the Circuit in the Case