House, design, repair, decor. Yard and garden. Do it yourself

House, design, repair, decor. Yard and garden. Do it yourself

» How to make alarm from Arduino. Home alarm or using motion sensor and LCD monitor with Arduino

How to make alarm from Arduino. Home alarm or using motion sensor and LCD monitor with Arduino

Main modules - GSM SIM800L module, ARDUINO NANO (you can any-uno, etc.), lowering board, battery from a cell phone.

Fig. 1. Module location scheme security alarm on Arduino.

Making alarm

We mount on the dump pad through the pads, which will allow you to replace modules if necessary. Turning on the alarm by supplying 4.2 volts through a switch to SIM800L and ARDUINO NANO.



When the first loop is triggered, the system first calls the first number, then drops the call and displicate on the second number. The second number is added just in case if suddenly the first will be disabled, etc. When the second, third, fourth, and the fifth loop is triggered, SMS is sent with the number of the worked zone, also for two rooms. Scheme and Skatch who is interested in the description under the video.
We place all the electronics in a suitable case.



If you do not need 5 loops Connect the 5V Arduino contact with the not necessary inputs. GSM alarm system for 5 loops with a battery, which will allow the device to continue working during several days autonomously, when the electricity is turned off. You can connect any security contact sensors to them, relay contacts, etc. In the result, we obtain a simple, inexpensive compact security device for with the transfer of SMS and dialing to 2 rooms. It is possible to apply it for the protection of cottages, apartments, garage, etc.

Read more in video

Good day! Again, a multi-review of Chinese electronic components, as usual of everything we gradually, I will try to shorter, but will it work? So, meet, GSM alarm cost up to 700 ₽. Interesting? I ask for "Cut"!

Baister! Before starting, I recommend to look into this, less components and large autonomy. So, "technical education", basic alarm requirements:

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

Due to the fact that the alarm creation process was delayed for several months and some sellers no longer sell those components that were purchased from them, links will be updated on goods of other sellers who have the maximum or close to the maximum number of sales of goods and best price. Prices in the review are relevant at the date of his writing.

A list of what will need:

List of changes

Gsm_03_12_2016-14-38.hex - Fixed the operation of the device with the M590 modem.
Gsm_05_12_2016-13-45.hex - Added MemTest Console Command, Optimization of RAM.
GSM_2016_12_06-15-43.HEX - Added the output of command results to the console, memory optimization. Busy: 49% sram.
Gsm_2016_12_07-10-59.hex - Now the phone numbers are added and removed correctly. Busy: 49% SRAM, 74% Flash Memory.
Gsm_2016_12_07-15-38.hex - Added the ability to connect the motion sensor, connects to Pin A0 (in this case, PIN A0 is used as digital). Added SMS - commands Piron., Piroff.. Busy: 48% SRAM, 76% Flash Memory.
GSM_2016_12_08-13-53.HEX - Now after the successful execution of the command, which in response does not send an SMS message, the device flashes a blue LED once. Now, after the incorrect execution of the command, which in response does not send an SMS message, the device flashes the blue LED twice. Now, after initializing the parameters of the device, if "quiet" mode is enabled (sendsms \u003d 0), the device is often blinking with a blue LED for 2 seconds. Fixed a bug due to which the number was not always deleted from the DELETEPHONE command. Busy: 48% SRAM, 78% Flash Memory.
Gsm_2016_12_11-09-12.hex - Added console teams Addphone and deletephone, syntax is similar to SMS commands. Memory optimization. Busy: 43% SRAM, 79% Flash Memory.
GSM_2017_01_03-22-51.HEX - Implemented support and similar input / output extension extensors on the PCF8574 chip, to connect additional 8 sensors, including gerks. Automatic address search and automatic module setup. Standard sensor names and the logical level of their response varies using the EditSensor command. Changed the content of alarm SMS for the main sensor (PIN D0) "ALARM! Main Sensor! " and motion sensor (IDU A0) "ALARM! Pir Sensor! ". Added editsensor and i2cscan commands. Busy: 66% SRAM, 92% Flash Memory.
GSM_2017_01_15-23-26.HEX - Support modem A6_mini. Control of external power supply (PIN D7). Added SMS WatchpowerOn, WatchPowerOff commands. Added ListConfig, ListSensor Console Commands. Now SMS command EditSensor works correctly. Slightly "trimmed" with debug information into the port monitor. Busy: 66% SRAM, 95% Flash Memory.
Gsm_2017_01_16-23-54.hex - Now in the response message to the SMS command "Info" also consists of the state of the motion sensor. Fixed a bug due to which the empty response SMS messages were sent. Now the device is not only not only about shutdown, but also on the resumption of external nutrition. All modems became less than chatting, now in the port monitor, it became a little cleaner. Busy: 66% SRAM, 95% Flash Memory.
Gsm_2017_02_04-20-23.hex - Fixed "Watch the Power ON" error. Now after removing the protection, the "alarming PIN" turns off. Now, after deleting the number in the console, the correct information is displayed. It may be fixed a bug due to which empty response SMS messages were sometimes sent. Busy: 66% SRAM, 90% Flash Memory.
GSM_2017_02_14-00-03.HEX - Now the SMS messages are sent by default, the sendsms parameter is again equal to 1. Now, when contacting the contacts of the main generic sensor (closing the door), the device flashes in a blue LED for 2 seconds, signaling about the normal operation of the sensor. Busy: 66% SRAM, 90% Flash Memory.
GSM_2017_03_01-23-37.HEX - The WatchpowerOn command is removed. Added WatchPowerOff console command, identical to the SMS command. Added commands Watchpoweron1, Watchpoweron2. WatchPowerOn1 - External power monitoring is enabled if the alarm is armed, Watchpoweron2 - EXTERNAL POWER monitoring is always enabled. Implemented function of arming and disarming by external devices, for this, conclusions A1 (D15) and A2 (D16) are used. Alarm set / removes protection when the A1 (D15) appears on the output high level + 5V or on the output A2 (D16) of the low level GND. The output A1 (D15) is tightened to the GND, the output A2 (D16) is pulled up to + 5V through resistors 20 (10) com. Added GuardButtonon and Guardbuttonoff commands. Now, after placing protection, the red LED flashes until the integrity of the loop of the main generic sensor is checked. If the outline lights the red LED. Busy: 66% SRAM, 95% Flash Memory.
Gsm_2017_03_12-20-04.hex - Now the console has become even cleaner, but if the Teston test mode is enabled, additional information is displayed in the console. Fixed the "Sent!" Bug, now information about sending messages is properly displayed. Fixed a bug "Re-false call". Now the balance request must work correctly on all modems. Busy: 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 is replaced by the GuardButtonon1 and GuardButtonon2 commands. Busy: 67% SRAM, 99% Flash Memory.
GSM_2017_04_21-09-43.Hex - Not recommended for use, only as testing, thanks for the identified errors :) - Now the SENDSMS parameter does not affect the sending of an electrical network monitoring messages. Added SMS Team DelayBeforeguard responsible for delay when arming, the value cannot exceed 255 seconds. Added SMS command DelayBeforeAlarm responsible for delayed sending notifications and inclusion of "alarm pine" when the sensors are triggered, the value cannot exceed 255 seconds. Clearsms commands are deleted, now messages are removed automatically after receiving. Busy: 68% SRAM, 100% Flash Memory.
GSM_2017_04_22-20-42.hex - Fixed multiple errors. Clearsms commands are again present in the firmware. Memory optimization. Busy: 68% SRAM, 98% Flash Memory.
GSM_2017_04_23-17-50.HEX. - Now the balance request must work correctly on all modems. Staging and disarming with external devices is now working correctly. Response messages SMS command Info should not be empty. Memory optimization. Busy: 68% SRAM, 98% Flash Memory.
Gsm_2017_04_24-13-22.hex - Now the transmission of console commands in the GSM module is performed only if the test mode is enabled. Now there is no separation on SMS commands and console commands, all existing commands can be transmitted both through SMS and through the console. Perhaps fixed bug with the info command. Memory optimization. Busy: 68% SRAM, 94% Flash Memory.
GSM_2017_04_25-20-54.hex - Fixed the bug in which the ListConfig command has changed the value of the last event. Now, when you enter commands through the Cap, unnecessary SMS messages are sent. Perhaps fixed bug with the info command. Memory optimization. Busy: 66% SRAM, 94% Flash Memory.
Gsm_2017_04_30-12-57.hex - temporarily included with for more information In the console when sending SMS messages and form a response to the Info command. Perhaps fixed bug with the info command. Memory optimization. Busy: 66% SRAM, 92% Flash Memory.
GSM_2017_05_06-11-52.hex - Fixed with the DelayBeforealarm function. Busy: 66% SRAM, 93% Flash Memory.
GSM_2017_05_23-21-27.HEX - slightly changed the output of information into the console. Added support for port expansion modules on PCF8574A with addresses from 0x38 to 0x3F inclusive. Fixed bug c. Now the device restarts automatically after FullReset commands, ResetConfig, ResetPhone and in case of successful execution of the MemTest command. Added WatchPowerTime command. Now it is possible to set the time after which the SMS will be sent to disconnect the external power source. Busy: 67% SRAM, 94% Flash Memory.
Gsm_2017_05_26-20-22.hex - Fixed initialization of the memory sensors of the extension board. ADDPHONE command syntax is changed. Added editmainphone command. The principle of operation of the notification system is changed, when the sensor is triggered, SMS will first be sent, after which voice calls will be performed. Alarm SMS messages will be sent to phone numbers with a sign "S" (SMS). Voice calls will be performed on the numbers with the sign "R" (Ring). Dispensing / enabling messages will be sent to phone numbers with a "P" feature (POWER). Added command Ringtime. Now it is possible to set the duration of alarm voice call, the parameter may be from 10 to 255 seconds. Now the Ringon / Ringoff command globally includes / disables voice call alert. Added command ResetSensor. Busy: 68% SRAM, 99% Flash Memory.
GSM_2017_06_02-17-43.HEX - AddPhone and Editmainphone commands Added parameter "I" (INFO), which is responsible for the SMS notification of the formulation or deregistration of the device. Now after adding the main number, the device automatically reboots. Now you can make the same number in the device. When adding the second and subsequent duplicate numbers, the attributes "M", "S", "P" and "I" will automatically be removed. These numbers will be used to repeat voice call when the sensors are triggered. Fixed the bug of the output curve to the console after executing the AddPhone command, now the information is not displayed automatically after the number is added. Added Reboot command. Busy: 69% SRAM, 99% Flash Memory.
Gsm_2017_06_11-00-07.hex - Now again, when contacting the contacts of the main generic sensor (closing the door), the device flashes a blue LED for 2 seconds, signaling about the normal operation of the sensor, and the device is not taken into account or removed. Ringon / Ringoff commands are removed. Now the device can be removed from the protection during an alarm call, now they are performed in the background. Busy: 69% SRAM, 99% Flash Memory.
GSM_2017_07_04-21-52.HEX - Now the PAUSE command does not send a response SMS. Deleted Teston and Testoff commands. All numbers removed a sign of Management. Busy: 68% SRAM, 96% Flash Memory.
Gsm_2017_07_24-12-02.hex - Added ReeDSWITCHON / REEDSWITCHOFF command to monitor the main germovgo sensor, now it can be turned on / off the same way as the motion sensor. Fixed in the info team bug. Teston and TestOff commands are present in the firmware. Busy: 68% SRAM, 96% Flash Memory.
Gsm_2017_07_26-10-03.hex - Added command modemid. Automatic modem definition is carried out only if the value of this parameter is 0. After setting the parameter value of 0, the device is automatically rebooted. Busy: 68% SRAM, 98% Flash Memory.
GSM_2017_08_03-22-03.Hex - Now the alarm can control external devices. For control, an analog output A3 is used (D17 - used as digital). The logical level of output (+ 5V or GND) can be changed, after changing the level through the setup command, the device will automatically be rebooted. The duration of the external control signal can be changed. Added ExtDeviceLevellow, ExtDeviceLevelHigh, ExtDeviceTime, Open commands. Some changes in the logic of the management commands. Memory optimization. Busy: 68% SRAM, 99% Flash Memory.
GSM_2017_08_10-12-17.HEX. - SMSON / SMSOFF, ReeDSWITCHON / REEDSWITCHOFF, Piron / Piroff commands are removed and all connected with them. The DelayBeForeAlarm team is replaced by advanced commands. Changed the output of the info command. Optimized ListConfig command output into the console. Now any digital sensors with a high or low level of response can be connected to Pins D6 and A0, including Herkes. Pins D6 and A0 must be attracted to the ground (GND) through resistance 10 (20) com. If the sensor is configured to a low response level (enabled in Herrock mode), the integrity of the chain is checked. The logical response level of the inputs D6 and A0 (+ 5V or GND) can be changed, after changing the logical level, the device will automatically be rebooted. For each of the sensors (MAIN, SECOND, PCF extension cards), when triggered, it can be installed on which a notification will be notified (SMS and / or voice call). "PIR SENSOR" is renamed to SECOND SENSOR. Fixed the operation of the extension board, the error due to which the device has always notified about the triggering of the sensors, regardless of whether the device is supplied or not. Now you can select the mode of operation in which the device can monitor the extension board sensors in both the guardon mode and when the GuardOff) is turned off. Added PCFForceon / PCFforceoff commands, MainsensorlevelHigh / Mainsensorlevellow / Mainsensorleveloff, SecondsensorlevelHigh / Secondsensorlevellow / Secondsensorleveloff, MaindelayBeforealarm, SeconddelayBeforealarm, PCFDELAYBEFOREALARM. Busy: 68% SRAM, 99% Flash Memory.

* Subsequent versions of firmware include changes in previous versions.


Used Ports Arduino Nano V3

D4. - The output of the "alarm" Pina, when the sensor is triggered, the high-level signal is installed on this pin.
D5. - Inverse output "Alarm" Pina, when the sensor is triggered, a low level signal is installed on this pin.

D6. - Herkeless sensor. Starting from the version GSM_2017_08_10-12-17.Hex to Pin D6, any digital sensors with a high or low level of response can be connected, including hosts. PIN D6 must be attracted to the ground (GND) through resistance 10 (20) com.
D7. - connected to the voltage divider from the external power source + 5V. Upper shoulder 2.2 com, the lower 3,3 com.

Voltage divider


D8. - TX modem
D9 - modem RX.

D10 - Red LED
D11 - Blue LED
D12. - Green LED

Connection of the periphery:
A0. - Motion Sensor . Starting from the GSM_2017_08_10-12-17.Hex version, any digital sensors with a high or low response level can be connected to a Pin A0, including the German. PIN A0 must be attracted to the ground (GND) through resistance 10 (20) com.

A1 - Entry for external control. The alarm set / removes protection when the high level appears at the input + 5V.
A2. - Inverse input for external control. Alarm sets / removes protection when the low level of GND appears at the input.

A3. - Customizable (+ 5V or GND) Exit for managing external devices. When the control command is received, the value at this output varies depending on which one was set at the set time interval.

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


Control commands for hex - firmware

Attention! Distressed teams 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 made from the numbers with the "Management" feature.

SMS - control commands are not sensitive to register:
Addphone - Add phone number. Not more than 9 numbers can be added + 1 The main number that is automatically saved in memory when the first call to the device after resetting to the factory settings commands ResetPhone. or Fullreset.. Those. Who first called the device after its discharge on the factory settings, the same and the "main", this number is entered into the first memory cell and it is impossible to change or remove via SMS. It is possible to add two identical numbers, but then the duplicate number automatically remains only a sign "R" - exclusively for a repeated voice call.
Sample team:



Team syntax:

Addphone - team
: - delimiter
5 - Write to the fifth memory cell
+71234567890 - phone number
Prior to GSM_2017_05_26-20-22.hex:
A - the "Alarm" parameter - the numbers with this parameter will be sent to the SMS messages about the alarm and message messaging messages or messages.
Starting with the version GSM_2017_05_26-20-22.hex:
M - parameter "Management" - Alarm Management is allowed
S - parameter "SMS" - SMS message will be sent when sensors are triggered
R - the "Ring" parameter - the voice call will be made when the sensors are triggered
P - POWER parameter - SMS message will be sent when / disconnecting external power
i - parameter "info" - SMS message will be sent when setting or disarmed
In the absence of parameters "M", "S", "R", "P", "I", the phone is entered into memory, but not used.


Deletephone - Delete phone number.
Sample team:

Team syntax:

DELETEPHONE - Team
: - delimiter
+71234567891 - phone number


Editmainphone - change the parameters "S", "R", "P", "I" of the main phone, this number is entered into the first memory cell.
Sample team:

Team syntax:

Editmainphone - team
: - delimiter
SRPI - Parameters


BalanceNum. - Changing the balance query number and processing the query response length. Default value for Beeline: # 100 # L22.
Sample team:

Team syntax:

Balancenum - team
: - delimiter
# 103 # - Balance Request Number
L24 - Length (LEN) of the response response 24 symbol, cut spam from the balance query.


Editsensor - change the name of the sensor and the logical level of triggering. There may be no more than 8 additional sensors. After changing the parameters, a restart of the device is required.
Sample team:
Editsensor: 1 + Datchik Dvizheniya V Koridore # H

Team syntax:

Editsensor - team
: - delimiter
1 - Write in 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 logical level from the sensor, upon receipt of which the alarm will work. If there is no "#h", the alarm will be triggered upon receipt from a low logical level sensor.


Sleeptime. - The time of "falling asleep" alarm when receiving an SMS command "PAUSE", indicated in minutes. The default value: 15 cannot be less than 1 or more than 60.
Sample team:

Team syntax:

Sleeptime - team
: - delimiter
20 - 20 minutes "sleep".


Alarmpintime. - the time for which the alarm / inverse PIN is turned on / off is indicated in seconds. The default value is: 60, there can be no less than 1 second and more than 43200 seconds (12 hours).
Sample team:

Team syntax:

Alarmpintime - team
: - delimiter
30 - 30 seconds of turning on / off alarm.


DELAYBEFOREGUARD - Time to set the device for protection, after receiving the relevant team.
Sample team:

Team syntax:

DELAYBEFOREGUARD - Team
: - delimiter
25 - 25 seconds before arming


DelayBeforealarm. - The time after which will be sent "alarm" SMS notification, if during this period of time the alarm was not removed from the protection. Replaced with advanced commands starting from version GSM_2017_08_10-12-17.hex
Sample team:

Team syntax:

DelayBeforealarm - team
: - delimiter
40 - 40 seconds before sending "alarming" notice


WatchpowerTime. - Time in minutes after which the SMS message will be sent to disconnect the external power supply. If the external power is restored before the set time expires, the message will not be sent.
Sample team:

Team syntax:

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


Ringtime - Duration of alarm voice call, the parameter may be from 10 to 255 seconds.
Sample team:

Team syntax:

Ringtime - team
: - delimiter
40 - 40 Call duration will be 40 seconds, after which the next subscriber will be called.


Modemid. - Forced installation of the modem used model. Possible values: 0 - Modem Auto Detection, 1 - M590, 2 - SIM800L, 3 - A6_MINI.
Sample team:

Team syntax:

Modemid - team
: - delimiter
2 - ID modem.


ExtDevicetime. - The number of seconds to which the signal level will change at the output of the external device.
Sample team:

Team syntax:

ExtDeviceTime- Team
: - delimiter
5 - 5 seconds


ExtDevicelevlow. - The external device connected to the output A3 is controlled by a low signal level (GND). At the default output there will be a high level + 5V, until the external control command is received.
ExtDeviceLevelHigh - The external device connected to the output A3 is controlled by a high level of signal (+ 5V). At the default output there will be a low GND level until the external control command is received.

ResetSensor. - Reset port expander sensor parameters

ResetConfig - Reset settings for factory settings

ResetPhone. - Delete from the memory of all phone numbers

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

Ringon - Enable the call notification to the "main" number recorded in the first memory cell when the sensor is triggered. Remote from version GSM_2017_06_11-00-07.hex
Ringoff - Turn off the call notification when the sensor is triggered. Remote from version GSM_2017_06_11-00-07.hex

SMSon. - Enable SMS notification when the sensor is triggered. Remote from version GSM_2017_08_10-12-17.HEX
SMSOFF. - Turn off the SMS notification when the sensor is triggered. Remote from version GSM_2017_08_10-12-17.HEX

Piron. - Enable motion sensor processing
Piroff. - Turn off the processing of the motion sensor

Reedswitchon - Enable the processing of the main generic sensor
Reedswitchoff - Turn off the processing of the main generic sensor

Watchpoweron - Enable External Power Control, SMS Power Disabling Power SMS will be sent under the condition that the alarm is armed. Removed from version GSM_2017_03_01-23-37.

Watchpoweron1 - Enable External Power Control, SMS Power Disabling Power SMS will be sent under the condition that the alarm is armed.
Watchpoweron2. - Enable external power control, SMS message about external power off in any case will be sent

WatchpowerOff - Turn off external power control

GuardButtonon - The signaling control by external devices or the button is turned on, starting from the GSM_2017_04_16-12-00 version.
GuardButtonon1 - Function setting or removing Protection by external devices or the button is enabled
GuardButtonon2. - Function only settings On the protection of external devices or the button is enabled, removal from security is made by call to the device or using an SMS command.
GuardButtonoff - control signaling by external devices or the off button

PCFforceon. - Permanent monitoring of a group of all expansion module sensors
Pcfforceoff - Monitoring of a group of all sensors of the expansion module only when setting a device for security

MainsensorLevelHigh - Alarm notification will be sent when a high-level signal appears (+5 V) at the input (D6) from the sensor
MainsensorLevelow. - The alarm notification will be sent when the low level signal appears (GND) at the input (D6) from the sensor
MainsensorLeveloff - the processing of the sensor at the input (D6) is disabled

SecondSensorlevelHigh - Alarm notification will be sent when a high-level signal appears (+5 V) at the input (A0) from the sensor
SecondSensorLevelow. - Alarm notification will be sent when a low level signal appears (GND) at the input (A0) from the sensor
SecondSensorLeveloff - the processing of the sensor at the input (A0) is disabled

MaindelayBeforealarm. - The time after which will be sent "alarm" SMS notification when the main sensor is triggered (D6), if for this period of time the alarm was not removed from the protection. Syntax is similar to the DelayBeforeAlarm command.
SeconddelayBeforealarm. - The time after which will be sent "alarm" SMS notification when the additional sensor is triggered (A0), if during this period of time the alarm was not removed from the protection. Syntax is similar to the DelayBeforeAlarm command.
PcfdelayBeforealarm. - The time after which will be sent "alarm" SMS notification when the expansion fee sensors are triggered (PCF8574), if during this period of time the alarm has not been removed from protection. Syntax is similar to the DelayBeforeAlarm command.

Guardon - put on guard
Guardoff - Remove Guard

Open - External Device Management Team

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

Pause - suspends the system of the system for a time set by the SleepTime command in minutes, the system does not respond to the sensor response.

Teston - Test mode turns on, blinking with a blue LED.
Testoff - Test mode is turned off.

LEDOFF - turns off the standby LED.
LEDON - Includes the standby LED.

Money - Balance Request.

Clearsms - Delete all SMS from memory

Console Commands (up to version GSM_2017_04_24-13-22.Hex) - Entered in the Arduino IDE port monitor:

ADDPHONE - ADDPHONE SMS SMS

DELETEPHONE - similar to SMS command Deletephone

EditSensor - similar to the EDITSENSOR SMS

ListPhone - output to the list of the list of the list saved in the phone's memory

ResetConfig - similar to the RESETCONFIG SMS command

ResetPhone - similar to the RESETPHONE SMS command

Fullreset - Fullreset SMS SMS

Clearsms - similar to SMS command clearsms

Watchpoweron1 - similar to the SMS command Watchpoweron1
WatchpowerOn2 - similar to the WatchPowerOn2 SMS command
WatchPowerOff - Similar to the WatchPowerOff SMS

GuardButtonon is similar to the GUARDBUTTONON SMS command. Remote from version GSM_2017_04_16-12-00
GuardButtonon1 - similar to SMS team GuardButtonon1
GuardButtonon2 - The GUARDBUTTONON2 SMS command
GuardButtonoff - similar to the SMS team GuardButtonoff

MemTest is a test of non-volatile device memory, 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 current device configuration.

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

UPD. When using motion sensor, To eliminate false positives when working modem, you need between Pina GND. and A0. Arduino. put resistance, thanks talk to a friend
AllowPhone \u003d ("70001234501", "70001234503", "70001234504", "70001234505") - numbers which are allowed to control the protection.
ALARMPHONE \u003d ("70001234501", "70001234502") - numbers for sending SMS notifications when the sensor is triggered and notified for the removal or arming. The first number in the list will be called when the sensor is triggered if the Ringon command is executed, the default option is enabled. This is done because SMS messages can come with some delay, and the call must go right away.

If you have received a call from a permitted number or an SMS message with the Guardon / Guardoff command, then, depending on the current security status, an SMS message on the stage or removal from security to the numbers listed in the Alarmphone array will also be sent to the SMS message to the number from which he received a call.

When triggered the sensor SMS messages are sent to all numbers from the massif (list) of alarmphone and will be called voice call to the first number from this array.

Light indication:
The LED glows in red - put on guard.
LED glows green color - Disabled with security, turns on / off the SMS command LEDON / LEDOFF.
The LED constantly flashes in blue - signals that C arduino is all right, the fee does not depend, is used exclusively for debugging, it turns on / TestOff SMS command.
* The code is present in the code LEDTest (), it flashes the blue LED, is made only to monitor Arduino, flashes - it means it does not blink - it hung. It has not yet hung :)

Not relevant!

Connecting 2 or more sensors for open firmware (only for this firmware Sketch_02_12_2016.ino)
To connect additional generic sensors, use free digital pins D2, D3, D5 or D7. Connection diagram with an additional sensor on D7.

Necessary changes in the firmware
... #define Doorpin 6 // input number connected to the main sensor int8_t doorstate \u003d 0; // variable for storing the state of the main sensor int8_t doorflag \u003d 1; // Variable for storing the status of the main sensor #define Backdoorpin 7 // Input number connected to an additional int8_t backdoorstate \u003d 0; // Variable for storing the status of an additional sensor INT8_T Backdoorflag \u003d 1; // Variable for storing the status of an additional sensor ...
Void Setup () (... Pinmode (Doorpin, Input); Pinmode (Backdoorpin, Input); ...
... void detect () (// Read the values \u200b\u200bfrom the DOORSTATE \u003d DIGITALREAD sensors; BackdoorsTate \u003d DigitalRead; // Processing the main sensor if (doorstate \u003d\u003d low && doorflag \u003d\u003d 0) (doorflag \u003d 1; Delay (100); if (ledon \u003d\u003d 1) DigitalWrite (GLED, LOW); ALARM ();) if (doorstate \u003d\u003d high && doorflag \u003d\u003d 1) (doorflag \u003d 0; delay (100);) // Processing Additional IF Sensor (BackdoorsTate \u003d\u003d Low && Backdoorflag \u003d\u003d 0) (backdoorflag \u003d 1; delay (100); if (ledon \u003d\u003d 1) DigitalWrite (GLED, LOW); Alarm ();) if (backdoorstate \u003d\u003d high && Backdoorflag \u003d\u003d 1) (backdoorflag \u003d 0; delay (100);)) ...

And one more thing:
1. The diodes are better to use 2 A current, as the module infects the current at 1 A and we still need to feed the Arduino and the modem. This instance uses 1N4007 diodes, if we fail to replace 2 A.
2. All resistors for the LED used on 20 com, in order not to light the entire corridor at night.
3. On the armless sensor between the GND pin and pin D6 also hung the resistor on 20 com.

That's all. Thanks for attention! :)

I plan to buy +207 Add to favourites I liked the review +112 +243

Hello, dear reader! Today's article is devoted to creating a simple home security system using affordable components. This small and cheap device will help you protect your dwelling from penetration with Arduino, motion sensor, display and dynamics. Feed the device will be able to batteries or USB port of the computer.

So, let's begin!

How does it work?

Thermalcharmal bodies are emitted in an IR range, which is invisible to human eye, but can be detected using sensors. Such sensors are made from a material that, under the influence of heat, can spontaneously polarize, making it possible to determine the appearance of heat sources within the radius of the sensor.

For a wider radius of action, Fresnel lenses are used, which collect IR radiation with different areas And concentrate it on the sensor itself.

The picture shows how the lens distorts the rays that fall on it.

It is worth noting that the robots without particularly warm parts and cold-blooded radiate in the IR range are very weak, so the sensor may not work in case you are decided to attach Boston Dynamics employees or reptiloids.

When the IR radiation level changes in the action range, it will be processed on Arduino after which the status will be displayed on the LCD display, the LED will flash, and the speaker is to squeeze.

What do we need?

  1. (or any other fee).
  2. (16 characters for two lines)
  3. One connector for connecting the crown to Arduino
  4. (Although you can use the usual speaker)
  5. USB cable - for programming only ( approx. Per.: With our Arduino, he always comes in a set!)
  6. Computer (again only to write and upload the program).

By the way, if you don't want to buy all these details separately - we recommend paying attention to our. For example, everything you need and even more is in our starting set.

Connect!

Connecting the motion sensor is very simple:

  1. PIN VCC plug into 5V Arduino.
  2. PIN GND connect to GND Arduino.
  3. PIN OUT PUBLIC TO DIGITAL PYUN №7 from Arduino

Now join the LED and Speaker. Here everything is just as simple:

  1. Short leg (minus) LED connect to Earth
  2. LED leg (plus) LED connect to exit №13 Arduino
  3. Red Wire Speaker to Exit №10
  4. Black wire - to the ground

And now the most difficult - connecting the LCD display 1602 to Arduino. We have no display without I2C, so many ARDUINO outputs will be required, but the result will be worth it. The scheme is presented below:

We need only part of the scheme (we will not control the contrast by the potentiometer). Therefore, it is necessary to make only the following:

Now you know how to connect the display 1602 to Arduino Uno R3 (exactly as to any version of Arduino from Mini to Mega).

Programming

It's time to go to programming. Below is the code that you only need to fill and, if you have collected everything right - the device is ready!

#Include. int ledpin \u003d 13; // PIN LED int inputpin \u003d 7; // PIN, to which an OUT motion sensor int pirstate \u003d Low; // current state (at the beginning nothing is detected) int val \u003d 0; // variable to read the state of digital inputs int pinspeaker \u003d 10; // PIN to which the speaker is connected. You need to use PIN with PWM (PWM) LiquidCrystal LCD (12, 11, 5, 4, 3, 2); // LCD initial display Void setup () (// Definition of data transfer direction on Pinmode digital Pins; Pinmode (InputPin, Input); Pinmode (Pinspeaker, Output); // Running the debug information over the serial serial port .begin (9600); // Running output on the LCD display LCD.Begin (16, 2); // Install the index on the displays from which we start output // (2 symbol, 0 strings) LCD.Setcursor (2, 0) ; // Conclusion on the LCD display LCD.Print ("Pir Motion"); // re-move LCD.Setcursor (5, 1); // withdraw LCD.Print ("Sensor"); // Pause, to read, What was delay (5000); // Cleaning LCD.Clear (); // Similar to LCD.Setcursor (0, 0); LCD.Print ("Processing Data"); Delay (3000); lcd.clear (); LCD.Setcursor (3, 0); lcd.print ("Waiting For"); lcd.setcursor (3, 1); lcd.print ("Motion ....");) void loop () (// Read Sensor reading VAL \u003d DIGITALREAD (INPUTPIN); if (val \u003d\u003d high) (// if there is a movement, then we light the LED and turn on Sirena DigitalWrite (LEDPIN, HIGH); Playtone (300, 300); Delay (150); // If there is no movement to this point, we display the message // that it is detected // The code below is needed to write only a state change, and not every time to output if (Pirstate \u003d\u003d Low) (serial.printLN ( "Motion Detected!"); Lcd.clear (); lcd.setcursor (0, 0); lcd.print ("Motion Detected!"); Pirstate \u003d High;)) Else (// If the movement ended with DigitalWrite (LEDPIN, Low); Playtone (0, 0); Delay (300); if (pirstate \u003d\u003d high) (// We inform you that the movement was, but it was already over serial.println ("Motion Ended!"); Lcd.clear () ; LCD.Setcursor (3, 0); lcd.print ("Waiting For"); lcd.setcursor (3, 1); lcd.print ("Motion ...."); pirstate \u003d Low;))) / Sound playback function. Duration - in milliseconds, Freq (frequency) - in Hz Void Playtone (Duration * \u003d 1000; int period \u003d (1.0 / freq) * 100000; Long Elapsed_time \u003d 0; while (elapsed_time< duration) { digitalWrite(pinSpeaker,HIGH); delayMicroseconds(period / 2); digitalWrite(pinSpeaker, LOW); delayMicroseconds(period / 2); elapsed_time += (period); } }

Good time by day 🙂 Today we will talk about alarm. The market for services is full of firms, the organization that are engaged in installing and servicing security systems. These firms offer the buyer a wide selection of alarm. However, their value is far from a kopeck. But what to do a person who has not so much personal funds, what can I spend on security alarm? I think the conclusion suggests itself - to do Alarm naughty hands. This article provides an example of how to make your own code security system using the Arduino Uno board and several magnetic sensors.

The system can be deactivated by entering the password with the keyboard and press the ' * '. If you want to change the current password, you can do it by clicking on the ' B.', And if you want to skip or interrupt operation, you can do it by pressing the key ‘#’. The system has a buzzer to play various sounds when performing a different operation.

The system is activated by pressing the 'A' button. The system gives 10 seconds to leave the room. After passing 10 seconds, the alarm will be activated. The number of magnetic sensors will depend on your own desire. The project involves 3 sensors (for two windows and doors). When the window opens the system is activated, and the alarm is turned on with a buzzer. The system can be deactivated by a password set. When the door opens, the alarm gives the logged in 20 seconds to enter the password. The system uses an ultrasonic sensor that can detect movement.

Video operation devices

Cleather Made in prompt / learning purposes. If you want to use it at home, it will be necessary to modify it. Conclusion the control unit into a metal case and protect the power supply from possible damage.

Let's begin!

Step 1: What we need

  • arduino Uno board;
  • high-contrast LCD display 16 × 2;
  • 4 × 4 keyboard;
  • 10 ~ 20K potentiometer;
  • 3 magnetic sensors (they are germs);
  • 3 2-pin screw terminals;
  • HC-SR04 ultrasonic sensor;

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

  • Dip connector for ATMEGA328 + ATMEGA328 microcontroller;
  • 16MGz quartz resonator;
  • 2 pcs. 22pf ceramic, 2 pcs. 0.22uf electrolytic capacitor;
  • 1 PC. 10kom resistor;
  • power Nest (DC Power Jack);
  • bread board;
  • 5B power supply;

And one box so that all this is packaged!

Instruments:

  • Something that can be cut plastic box;
  • Thermoclaysheaver pistol;
  • Drill / screwdriver.

Step 2: Alarm Scheme

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 8 output Arduino;
  • PIN5 - RW to GND;
  • PIN6 - EN to 7 output Arduino;
  • PIN11 - D4 to 6 ARDUINO output;
  • PIN12 - D5 to 5 ARDUINO output;
  • PIN13 - D6 to 4 output Arduino;
  • PIN14 - D7 to 3 output arduino;
  • PIN15 - VEE (to the right or left conclusion of the potentiometer).

Keyboard 4 × 4:

From left to right:

  • PIN1 to A5 output Arduino;
  • PIN2 to A4 output Arduino;
  • PIN3 to A3 withdrawal Arduino;
  • PIN4 to A2 withdrawal arduino;
  • PIN5 to 13 withdrawal arduino;
  • PIN6 to 12 output arduino;
  • PIN7 to 11 output Arduino;
  • PIN8 to 10 ARDUINO output.

Step 3: Firmware

The step presents the code that is used built-in!

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

Note: If you do not use CodeBender IDE to program the Arduino boards, you will need to install additional libraries in Arduino IDE.

Step 4: We make your own management fee

After successfully collected and tested a new project based on Arduino Uno, you can start making your own fee.

Several tips for more successful completion of the started:

  • 10kom Resistor must be mounted between 1 (Reset) and 7 (VCC) by the outputs of the ATMEGA328 microcontroller.
  • 16MGC Quartz Resonator must be connected to 10 and 10 conclusions marked as Xtal1 and Xtal2
  • Connect each output of the resonator with 22pf capacitors. Free conclusion conclusions Write on 8 output (GND) microcontroller.
  • Do not forget to connect the second ATMeGa328 power line with the power supply, the conclusions 20-VCC and 22-GND.
  • Additional information on the conclusions of the microcontroller can be found on the second image.
  • If you plan to use the power supply with a voltage above 6B, you must use the LM7805 linear regulator and two 0.22UF by electrolytic capacitors, which should be mounted at the input and output of the regulator. It is important! Do not apply more than 6V for fee !!! Otherwise, you smear your ATMEGA microcontroller and LCD display.

Step 5: Place the scheme in the case

They are special hardware platforms, on the basis of which you can create various electronic devices, including. The devices of this type are characterized by a simple design and the ability to program the algorithms of their work. Due to this, created using Arduino GSM alarm , It can be maximally adjusted for an object that it will guard.

What is the Arduino module?

Arduino is implemented in the form of small boards that have their own microprocessor and memory. The board also contains a set of functional contacts to which various electrified devices can be connected, including the sensors used for security systems.

The Arduino processor allows you to upload a program written by the user on your own. Creating its own unique algorithm, you can provide optimal modes of operation of security alarms for different objects and for various conditions use and solved tasks.

Is it difficult to work with Arduino?

Arduino modules are highly popular among many users. This became possible due to its simplicity and accessibility.

Programs for managing modules are written using conventional C ++ and add-ons in the form of simple input / output process management functions on the module contacts. In addition, the programming can also use the ARDUINO IDE free software environment operating under Windows, Linux or Mac OS.

The Arduino modules are significantly simplified the procedure for assembling devices. GSM Alarm on Arduino can be created without a soldering iron - assembly occurs using a dumpboard, jumpers and wires.

How to create alarm with arduino?

To the basic requirements that the GSM created the alarm on Arduino must include:

  • notify the owner of the object of hacking or penetration;
  • support external systems such as sound siren, signal lights;
  • control signaling via SMS or call;
  • offline work without external food.

To create alarm, you will need:

  • arduino module;
  • a set of functional sensors;
  • or modem;
  • offline power supply;
  • external executive devices.

A distinctive feature of Arduino modules is the use of special extension boards. With their help, connect all additional devices to Arduino, which are required to build a configuration. security system. Such cards are installed on top of the Arduino module in the form of "sandwich", and the corresponding auxiliary devices are connected to the board themselves.

How it works?

When one of the connected sensors is triggered, the signal is transmitted to the Arduino module processor. Using the downloaded user software, the microprocessor produces its processing on a specific algorithm. As a result, a command can be formed on the operation of an external actuator, which is transmitted to it through the appropriate pairing fee.

To ensure the possibility of mandrel of warning signals to the owner of the house or apartment, which is guarded, to the Arduino module, through the extension fee, is connected special module GSM.. It establishes a SIM card of one of the cellular providers.

In the absence of a special GSM adapter, its role can also be performed by a regular mobile phone. In addition to sending SMS messages with alarm warning and dialing, the presence of a cellular will allow you to control GSM signaling to arduously remotely, as well as monitor the state of the object by sending special requests.

"Note!

To communicate with the owner of the object, in addition to GSM modules, conventional modems that provide communication via the Internet can be used. "

In this case, when the sensor processed by the signal processed by the processor is transmitted via a modem to a special portal or site. And already from the site automatically generates warning SMS or mailing to a tied e-mail.

conclusions

Using Arduino modules will allow users to independently design GSM alarms that can work with different function sensors and manage external devices. Due to the possibility of using various sensors, the alarm function can significantly expand and create a complex that will monitor not only the safety of the object, but for its condition. For example, it will be possible to control the temperature on the object, fix the leakage of water and gas, overlapping them in the event of an accident and much more.