What you need to build an alarm on arduino. Creating a security alarm with a motion sensor based on Arduino and infrared sensors. Key Features of Sim900 Shield

They are special hardware platforms on the basis of which you can create various electronic devices, including and . Devices of this type are characterized by a simple design and the ability to program their operation algorithms. Thanks to this, created with Arduino GSM alarm, can be maximally adjusted to the object that it will protect.

What is an Arduino module?

Arduinos are implemented as 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 sensors used for security systems.

The Arduino processor allows you to load a program written by the user yourself. By creating your own unique algorithm, you can provide optimal operating modes security alarms for different objects and different conditions use and tasks to be solved.

Is it difficult to work with Arduino?

Arduino modules are very popular among many users. This was made possible due to its simplicity and accessibility.

Programs for module control are written using regular C++ and additions in the form of simple functions for controlling input / output processes on module contacts. In addition, the free software environment Arduino IDE, which operates under Windows, Linux or Mac OS, can also be used for programming.

With Arduino modules, the procedure for assembling devices is greatly simplified. GSM alarm on Arduino can be created without the need for a soldering iron - the assembly takes place using a breadboard, jumpers and wires.

How to create an alarm with Arduino?

The main requirements that a do-it-yourself gsm alarm system created on Arduino must meet include:

  • notify the owner of the object about breaking or entering;
  • support for external systems such as a sound siren, signal lights;
  • alarm control via SMS or call;
  • Autonomous operation without external power supply.

To create an alarm you will need:

  • Arduino module;
  • a set of functional sensors;
  • or modem;
  • autonomous power source;
  • external executive devices.

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

How it works?

When one of the connected sensors is triggered, a signal is transmitted to the Arduino module processor. Using the downloaded user software, the microprocessor processes it according to a certain algorithm. As a result, a command to actuate an external actuator can be generated, which is transmitted to it through the corresponding expansion-interface board.

To provide the possibility of sending warning signals to the owner of a house or apartment that is being guarded, a special GSM module is connected to the Arduino module through an expansion board. It installs a SIM card from one of the providers cellular communication.

In the absence of a special GSM-adapter, a regular mobile phone can also play its role. In addition to sending SMS warnings about alarms and dialing, the presence of a cellular connection will allow you to control the GSM alarm on Arduino 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 can also be used, which provide communication via the Internet.

In this case, when the sensor is triggered, the signal processed by the processor is transmitted via modem to a special portal or site. And already from the site, automatic generation of warning SMS or mailing to the attached e-mail is carried out.

conclusions

The use of Arduino modules will allow users to independently design GSM alarms that can work with different functional sensors and control external devices. Thanks to the possibility of using various sensors, the alarm functions can be significantly expanded and a complex can be created that will monitor not only the safety of the object, but also its condition. For example, it will be possible to control the temperature at the facility, detect water and gas leaks, shut off their supply in the event of an accident, and much more.

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 the components that were purchased from them, the links will be updated to the products of other sellers that have the maximum or close to the maximum number of sales of goods and the 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 digital). 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 the 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. Control of the presence of 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 status 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 console displays correct information. 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 SMS messages are sent by default, 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 about normal operation 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 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 enabled test mode"TestOn", then 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 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 the external power supply being disconnected will be sent. 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 automatic reboot devices. 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.


Ports used Arduino Nano v3

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" sign.

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 possible to add two identical numbers, but then the duplicate number automatically has only the sign "r" - exclusively for repeated voice calls.
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 supply. 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.


ModemID - 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 avoid false positives during modem operation, it is necessary to 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

Spring, as you know, is accompanied by all sorts of aggravations, and now the main "aggravation" crawled out of its holes into the street in order to appropriate for itself what does not belong to it. This means that the topic of protecting one's property becomes more relevant than ever.
The site already has several reviews on homemade -. They are functional, of course, but they all have common feature- depending on the outlet. If this is not a problem with real estate where electricity is already connected, then what about property where the outlet is far away or the surroundings are completely de-energized? I decided to go the other way - to assemble a long-lived, as simple as possible and independent of mains power device, which will sleep all the time, and when robbers enter, it will start up and call back to the owner’s phone, signaling with a simple alarm call.

Review Items

Purchased:
1. Bread board one-sided 5x7 cm: getinaks- or fiberglass
* - fiberglass is much better than getinaks.
2. Module Neoway M590 - , with PCB antenna -
3. Arduino Pro Mini "RobotDyn" ATmega168PA 8MHz 3.3V -
4. Lithium charge-discharge control board -

Obtained from the ruins of civilization:
1. Racks for the board, sawn from the cases of devices - 6 pcs.
2. Lithium flat battery 1300mAh
3. Staples used to fix the cable to the wall
4. Stationery eraser
5. Copper wire 1.5mm thick
6. Instrument case from the local radio market - 1.5$
7. Pair of LEDs different color(taken from a VHS player)
8. Antenna and button with a cap (taken from a Wi-Fi router)
9. 4-pin terminal block (taken from a dimmer)
10. Power connector (taken from an old charger for 18650)
11. 6-pin connector (taken from a DVD drive)
12. Can(from under coffee for example)

Arduino Pro Mini "RobotDyn" Atmega 168PA 3.3V 8MHz

Specifications:
Microcontroller: ATmega168PA
Operating voltage direct:.8 - 5.5 V
Operating voltage through the stabilizer LE33: 3.3 V or 5 V (depending on model)
Working temperature:-40°C… 105°C
Input voltage: 3.35-12V (3.3V model) or 5-12V (5V model)
Digital Inputs/Outputs: 14 (6 of which can be used as PWM outputs: 3, 5, 6, 9, 10, and 11)
Analog inputs: 6
Timers-counters: two 8-bit and one 16-bit
Power saving modes: 6
DC current through input/output: 40 mA
Flash memory: 16 KB (2 used for bootloader)
RAM: 1 Kb
EEPROM: 512 bytes
Memory write/erase resource: 10,000 Flash/100,000 EEPROM
Clock frequency: 8 MHz (3.3V model) or 16 MHz (5V model)
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK)
I2C: A4 (SDA) and A5 (SCL)
UART TTL: 0 (RX) and 1 (TX)
Datasheet:

The choice fell on this atmega quite by accident. on one forum where energy-efficient projects were discussed, in the comments I got advice to use exactly the 168th atmega.
However, I had to tinker to find such a board, since very often all the lots were inundated with 328 atmegas at a frequency of 16 MHz, operating from 5V. For my project, such characteristics were redundant and inconvenient from the very beginning, the search became more complicated.
As a result, I came across a 3.3-volt Pro version Mini on Atmega 168PA on eBay, and not a simple Chinese one, but under the RobotDyn brand from a Russian developer. Yes, I, too, at first, like you, had a grain of doubt. But in vain. When the project was already assembled, and AliExpress introduced a mandatory paid delivery for cheap goods (after which parcels began to be lost much more often), then later I ordered a regular Pro Mini Atmega168 (without PA) 3.3V 8MHz. I experimented a little with power saving modes with both boards, flashing into each a special sketch that immersed the microcontroller in the maximum power saving mode and this is what happened:
1) Arduino Pro Mini "RobotDyn": ~250uA
2) Arduino Pro Mini "No Name": when power is supplied to the voltage regulator (RAW output) and the LED is soldered, the current consumption is ~3.92mA




- as you understand, the difference in power consumption is almost 16 times, all because NoName's Moscow Pro Mini uses a bunch of Atmega168 +, of which the MK itself eats only 20uA current (I checked this separately), all the rest of the gluttony falls on the AMS1117 linear voltage converter - the datasheet only confirms this:


In the case of the board from RobotDyn, the connection is already somewhat different - this is Atmega168PA + - another LDO stabilizer is already used here, whose characteristics in terms of energy saving turned out to be more pleasant:


I didn’t solder it, so I can’t say how much current the Atmega168PA consumes in pure form. In this case, I had ~250uA when powered by a Nokia lithium battery. However, if you unsolder the AMS1117 with the NoName "of the Moscow board, then the ATmega168 is ordinary, in its pure form, as I said above, consumes 20uA.
Power LEDs can be knocked off with something sharp. It's not a problem. The stabilizer was soldered with a hairdryer. However, not everyone has a hair dryer and the skills to work with it, so both of the above options have a right to exist.

Neoway M590E module

Specifications:
Frequencies: EGSM900/DCS1800 Dual-band, or GSM850/1900 or Quad-band
Sensitivity:-107dBm
Maximum transmission power: EGSM900 Class4(2W), DCS1800 Class1(1W)
Peak current: 2A
Working current: 210mA
Sleep Current: 2.5mA
Working temperature:-40°C… +85°C
Operating voltage: 3.3V…4.5V (recommended 3.9V)
Protocols: GSM/GPRS Phase2/2+, TCP/IP, FTP, UDP etc.
Internet: GPRS CLASS 10
Datasheet:

The cheapest GSM module that can be found on the market, usually second-hand, not always desoldered Chinese hands from equipment. Why not always smart? Yes, all because of soldering with a hairdryer - often these modules come to people with a shorted plus and minus, which is one of the reasons for their inoperability. Therefore, the first step is to ring the power contacts for a short circuit.

Note. I would like to note a separate, important, in my opinion, point - these modules can come with a round coaxial connector for the antenna, which allows you to separately order a more serious antenna and connect it to the module without dancing with a tambourine. And they can come without this connector. This is if we talk about the cheapest sets. If you don’t want to rely on a lucky chance, then there are sets that are a little more expensive, where this connector is present + the kit comes with an external antenna on a textolite board.

This module is also capricious before power supply, since at its peak it consumes up to 2A current, and the diode that comes with the kit seems to be designed to lower the voltage from 5V (which is why it is written on the board itself 5V) to 4.2V, but judging by according to the complaints of the people, he creates more trouble than good.
Suppose you have already assembled this module, and a jumper is soldered instead of a diode, since we are not going to supply 5V voltage to it, but we will power it directly from a lithium battery, which is within the limits allowable stresses 3.3-4.2V.
It will be necessary to somehow connect it to the computer, and check for operability. For this case, it is better to buy ourselves in advance - through it we will communicate with the Arduino module and boards via the UART (USART) serial interface.
The connection is shown below in the picture (I drew it as best I can):
TX modem >>> RX converter
RX modem<<< TX конвертера
Battery Plus - Modem Plus
The minus of the lithium battery is combined with the GND of the modem and the GND of the converter
To start the modem, connect the BOOT output through a 4.7 kΩ resistor to GND


In the meantime, run the program on the computer. Pay attention to the settings:
1) Select the COM port to which the TTL converter is connected, in my case it is COM4, ​​yours may be different.
2) Select the baud rate. (There is a nuance here, because the modules themselves can be configured for different speeds, most often 9600 baud or 115200 baud. Here you need to select empirically, choosing some speed, connecting, and sending the AT command, if cracks come in response, then it will turn off , select a different speed and repeat the command until the answer is OK).
3) Select the packet length (in this case 8 bits), parity bit disabled (none), stop bit (1).
4) Be sure to tick +CR, and then a carriage return character will be automatically added to each command we send to the module at the end - the module understands commands only with this character at the end.
5) Connection, everything is clear here, clicked and we can work with the module.

If you click on "Connection" and then start the module by applying BOOT through a 4.7K resistor to the ground, then first the message "MODEM:STARTUP" will be displayed in the terminal, then, after a while, the message "+PBREADY" will be displayed, which means that the phone number has been read. book, even though it may be empty:

Under this spoiler AT commands with examples

We print the AT command - in response, the module sends us our command, since the echo mode is enabled, and OK:

Let's check the status of the modem with the AT + CPAS command - in response, our team again, + CPAS: 0 and OK.
0 - means that the module is ready to work, but depending on the situation, there may be other numbers, for example, 3 - incoming call, 4 - in connection mode, 5 - sleep mode. I couldn't find any info on 1 and 2.

Changing the data transfer rate via UART occurs with the command AT + IPR = 9600 - this is if you need a speed of 9600. If some other, similar to AT + IPR = 19200 for example or AT + IPR = 115200.

Let's check the network signal. AT + CSQ, + CSQ comes in response: 22.1 - the value before the decimal point has a range of 0 ... 31 (115 ... 52 dB) - this is the signal level, the more, the better. But 99 means its absence. The value after the decimal point - signal quality 0 ... 7 - is the opposite here, the smaller the number, the better.

Let's turn off the echo mode by sending the ATE0 command so that duplicate commands do not interfere. This mode is switched back on with the ATE1 command.

View AT+GETVERS firmware version



These and many other commands can be viewed

Board Combination

If Pro Mini is not difficult to solder to a breadboard, then with a GSM module the situation is somewhat more complicated, because. its contact comb is located only on one side, and if only it is soldered, then the other side of the board will simply hang in the air. Then, again, by eye, I had to drill additional 3 holes near three corners on the board. The areas around each of the holes were then de-masked. For convenience, I placed the disconnected leads from the comb on the solderless breadboard (white) and, having installed the GSM module board on them, normally soldered:

Later I had to make another hole, in my case on the letter "I", where it says "Made In China", on the edge of the board.


It so happened that the added contact, which is essentially GND, became close to the GND of the Pro Mini board, and thus it became possible to combine the ground of the GSM module and the Pro Mini with a drop of solder (a long lead in the middle and to the right of it is the Pro Mini lead) - marked them with arrows. It turned out crooked, of course, but now it holds securely:



There was some space left between the boards - I placed a lithium discharge charge control board with a pre-soldered microUSB connector and soldered wires in it.

The scarf enters there very tightly, while the glow of the LEDs on the side will be clearly visible through a small hole in the case.



Board racks

To securely fix the board inside the case, I had to spend a couple of days thinking about how this could be implemented. The option with hot melt adhesive was not considered for several reasons - it can fall off, deform, and most importantly, the design would turn out to be difficult to disassemble.
I came to the conclusion that the simplest and most correct option here would be to use racks, which naturally I did not have. However, there were a couple of non-working chargers, from where one long rack with a thread for self-tapping screws was cut out. Each rack was sawn in half and finished with a file to about 9.5mm - it is at this height that the battery located under the board has a sufficient margin, about 2mm - this is done so that the soldered contacts of the board do not touch it with their tips and so that it is possible to put a piece between them foam for fixation.
As for attaching the board directly to the case, here I cut four strips from a coffee can, drilled a hole at the ends of which, then fixed them on the same self-tapping screws that are screwed into the racks. See the photo below to see how it looks.
The next step is to screw a pair of stands on the other side of the board, that is, from above, so that when the case is closed, the lid rests slightly against these stands, creating additional fixation. A little later, under this case, I came across a building from under the Soviet propaganda radio (if it had been found earlier, I would have taken all the racks from here), where I found a couple of more or less suitable heights, but first I drilled them in the center with a drill under self-tapping screws. Then he cut them down and also finished them off with a file, removing the excess. Here I came up with one subtlety - in the photo you can see that one white stand is screwed to the getinax board from the edge, and the other white stand is directly to the module board, because. from one edge, the modem board completely covers the bottom board, and from the opposite edge, on the contrary, the bottom one looks out. At the same time, holes had to be additionally drilled in both boards so that the heads of the self-tapping screws could pass freely.
And finally, it remains to make sure that the board is always parallel to the case - the brackets that are used to fix wires and cables on the wall fit perfectly under this case, I previously removed the nails from them. The brackets cling well to the board with their concave side without any additional devices, the only thing is to the right of the SIM card, the width of the bracket turned out to be excessive and had to be sanded as well.
All the details were adjusted by eye and empirically, below is a photo of all of the above:



Connectors. LEDs. Button.

Since I ran out of comb, I had to dismantle the 6-pin connector from the DVD drive board, which I then soldered to the Pro Mini, this is for the convenience of flashing the board. Nearby, I soldered a round connector (Nokiev 3.5mm) for charging lithium.

The body of the 6-pin connector was slightly finished with a file, because its edges protruded slightly above the body. The charging socket fits perfectly into the wall of the case.

On the other side of the board, I soldered a button to reset the device and two LEDs for debugging the firmware - the red LED is connected to the GSM module, the second green LED is connected to the 10th output of the Pro Mini - it's easier for me to debug the program.

Battery upgrade

A flat Nokian battery from Nokia phones is no less common than the 18650, but many simply refuse to use it because of the inconvenience of connecting contacts that are recessed deep into the battery itself. It is undesirable to solder them, so it was decided to use the method proposed by these, namely, to make a contact block from a stationery eraser and copper wire (1.5 mm thick).
First, I pierced a piece of eraser with two wires with previously stripped ends, and figured it out to the battery contacts so that the distance between them coincided,
he bent the ends, tinned them with a soldering iron, and pulled them back a little by the long ends so that the resulting contacts were sunk into the eraser.



Battery example:

You can fix the terminal block with a rubber band or wrap it with blue electrical tape, which I did in the end.

Assembly.

The main part of the work is done, it remains to collect and fix it all.
Between the battery and the board, I put a piece of foam rubber so that it would not crawl inside the case later. I additionally soldered a 2200 uF capacitor to power the module.

When charging is connected:

Frame. External terminal block.

The case got on the local radio market for about $ 1.5, if translated into dollars, 95x60x25mm in size, almost the size of a pack of cigarettes. I drilled a few holes in it. First, for a 4-pin terminal block taken from a non-working dimmer.
I completely freed the two extreme contacts from bolts with gaskets, drilled holes for longer bolts, on which the entire terminal block will be held on the case. On the case itself, of course, the two extreme holes will be large, and the two in the middle will be smaller - they will have contacts threaded through them, one of which is connected to the VCC Pro Mini, and the second contact to pin 2.

Drilling holes, although simple at first glance, is no less time consuming, it is very easy to miss, so I did it first with a smaller diameter drill, then a larger one.

For the clock button, I picked up a cap with a slightly concave top, so that through a narrow hole in the case it was convenient to hit it with a match or a paper clip.

Board in a case with a connected USB-TTL converter cable:

About the antenna.
The antenna, as you may have noticed in the course of the review, was constantly changing, as I experimented with different homemade antennas. Initially, there was a round coaxial connector on the module board, but on the fifth time it was used for an external antenna, it simply fell apart, so keep in mind that it is flimsy. As a result, I tore out the textolite antenna from the old router, and soldered it to the module board, because. it catches the net a little better than the spring and wire.

Well, completely assembled with the connected charging looks like this:

Test. How it works:

In addition to tests with antennas, I checked how the alarm system would behave on the street, in frost -15. To do this, I simply placed the entire insides in a container and left it on the balcony for the night, while the alarm did not start, the reason turned out to be generally obvious - lithium does not like frost. This was confirmed by another test, where I left the battery at home, and brought the board through long wires to the street and left it like that for a day in the same frost - operation, as if nothing had happened. On the other hand, it would be strange if the alarm did not work. in the datasheets for atmega, for the module, for quartz - the allowable operating temperatures are up to -40 degrees.

The principle of operation is organized by an external interrupt, initially pin 2 is closed to VCC and thus a logical 1 is maintained on the output, and the controller is sleeping. As soon as the contact is broken and 0 appears on pin 2, the microcontroller wakes up, lowers the 3rd pin (to which the modem's BOOT is connected through a resistor) to the ground - the module starts, the MK periodically polls the module for readiness, and as soon as it catches the network, it immediately sends a call to the owner's phone number specified in the code. After rejecting the call, the device turns off without sending more endless calls than many Chinese alarms sin.

Additional Information

#include #include // software UART library SoftwareSerial gsm(7, 6); // RX(7), TX(6) void wakeUp()() // empty interrupt handler ////////////////////////////////////// /////////////// void gsmOFF()( // PORTD|=(1<<3); // ВЫКЛЮЧЕНИЕ МОДУЛЯ _delay_ms(10); // gsm.println("AT+CPWROFF"); // ПЕЧАТАЕМ КОМАНДУ OFF PORTB &=~ (1<<2); // выключить LED 10 } // //========================================= void gsmON(){ // PORTD|=(1<<6); // 6-му порту (TX) назначить 1 PORTD &= ~(1<<3); // ЗАПУСК МОДУЛЯ _delay_ms(10); // while(!gsm.find("+PBREADY")); // ждём прочтения тел. книги PORTB |= (1<<2); // включить LED 10 _delay_ms(100); // while(1){ // gsm.println("AT+CREG?"); // проверяем в сети ли модуль if (gsm.find("0,1")) break; // если сеть есть, выходим из цикла _delay_ms(400); // проверка раз в 0,4 сек } // } // /////////////////////////////////////////// // void sleepNow(){ // функция засыпания ADCSRA = 0x00; // отключить подсистему АЦП (экономия 140 мкА) PORTD&=~(1<<6); // в вывод TX поставить 0 _delay_ms(100); // set_sleep_mode(SLEEP_MODE_PWR_DOWN); // режим сна PWR_DOWN sleep_enable(); // включение сна attachInterrupt(0, wakeUp, LOW); // включить прерывания sleep_mode(); // sleep_disable(); // detachInterrupt(0); // отключить прерывания } void setup(){ gsm.begin(9600); // скорость работы UART DDRD = B01001000; // 3-й и 6-й выводы на выход DDRB |= (1<<2); // вывод 10 на выход gsmON(); // запуск модуля для теста gsmOFF(); // выключаем модуль } void loop(){ if (!(PIND&(1<<2))){ // если на 0-ом прерывании появился 0 gsmON(); gsm.println("ATD+79xxxxxxxxx;"); // отзваниваемся, в ответ приходит OK и CONNECT _delay_ms(100); if (gsm.find("OK")) while(1){ // ожидание сброса вызова gsm.println("AT+CPAS"); // при каждой итерации опрашиваем модуль if (gsm.find("0")) break; // если 0, то выходим из цикла while _delay_ms(100); // проверка раз в 0,1 сек } for (char i=0; i<14; i++){ PORTB|=(1<<2); // LED 10 ON _delay_ms(200); PORTB&=~(1<<2); // LED 10 OFF _delay_ms(200); } gsmOFF(); // выключить модуль _delay_ms(10); while(1); // блокируем программу } else { sleepNow(); // укладываем контроллер спать } }

Diagram (without charge-discharge control board)



Conclusions and thoughts. Plans.

The alarm is used in the country, I am satisfied with the work, however, with further study of the AVR, more and more ideas come up for its further modification. Arduino with its pseudo-language Wiring upset me a lot, because. There was one unpleasant moment in the work. When I used the functions to work with the digitalWrite(); ports; or pinMode(); - then the GSM-module for some reason very often hung up. But it was worth replacing them with tricks like DDRB|=(1<Only the operation of direct access to ports made the device work, as it was intended.

For energy saving...
The assembled device worked for four full months without recharging and continues to work, although it’s more correct to say “sleep”. This is checked by a simple reboot through the white button. With a power consumption of 250 μA (through the LE33 stabilizer) and a battery of ~1430 mAh, although okay, due to the non-newness of the battery we will round up to 1000mAh, it turns out that the device can sleep for about 5.5 months without recharging. If you still unsolder the stabilizer, then the operating time can be safely multiplied by 10 times. But in my case, there is no need for this, because you still need to spend the balance from the SIM card every three months, at the same time the device can be checked and recharged.
The example of energy saving given in the review is far from the limit, because. judging by the information from the datasheet, it is possible to lower the clock frequency of the microcontroller (and this is done by installing fuses) to 1 MHz and, if 1.8V voltage is applied, then the consumption will drop below the 1 μA bar in active mode. Very foolish! But if the MK is clocked from the internal RC generator, then another problem will appear - the UART ether will be clogged with garbage and errors, especially if the controller is heated or cooled.

Upon completion...
1) A conventional wire set to break is not very convenient, I plan to experiment with a Hall sensor and a reed switch, although they say about the latter that it is not very reliable, because the contacts inside it can stick.
2) It would be nice to add the ability to change the "owner number" without the participation of a computer and flashing. This already with EEPROM will have to work.
3) Try interrupts from the watchdog timer, but not just for the sake of curiosity, but for the microcontroller to periodically wake up by itself, measure the battery voltage and send the resulting value via SMS to be aware of how low the battery is.
4) A solar panel can completely eliminate the need to recharge the device, this will be especially true for low-capacity batteries.
5) For a long time I wanted to buy LiFePo4 batteries, which, according to reviews, normally tolerate frost, but while I was looking for a suitable lot, spring had already imperceptibly come.
6) Work on the aesthetic component

Which Pro Mini should I buy?
If there is no hair dryer, then Pro Mini "RobotDyn" Atmega168PA 3.3V, pick up the LED with something sharp and have ~ 250 μA.
If there is a hair dryer, then any board, solder the stabilizer and the power LED - you get ~ 20 μA of current consumption.

That's all for now, I hope the review was interesting and useful.

I plan to buy +174 Add to favorites Liked the review +143 +278

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. The burglar alarm interface sensor is also connected to the controller-based security system.
When an intrusion is attempted, the system sends an alert message (eg sms) to the owner's mobile phone or 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 the pins of connector J2 are shorted, a pre-programmed warning message is sent to the required 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 will activate a 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 case of 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

Today we will talk about how to use Arduino collect security system. Our "guard" will guard one circuit and control one annunciator.

For Arduino, this is not a problem, and, as you will see from the program code and device diagram, you can easily increase the number of protected access points and the number of notification or indication devices.
security system can be used to protect both large objects (buildings and structures), and small items (caskets, safes), and even portable cases and suitcases. Although you need to be more careful with the latter, if you install a security system, for example, on a suitcase with which you decide to go on a trip, and the warning system works at some airport, then I think you will have a serious conversation with the local security service :-)

Simplified principle of operation of the device is as follows (Fig. 1). After turning on the power, the device enters the operating mode and waits for arming. Arming and disarming are carried out with one button. To increase security, it is better to place this button inside the protected room (safe or box). Before turning on the security mode, the door must be slightly opened. When you turn on the security mode (pressing the button), the electronic circuit waits until you close the door to the room (door of the safe, lid of the box, etc.).

Any type of limit switch must be installed on the door (or door), more on that later. Closing (or opening), the limit switch will inform the device that the protected circuit is closed, and the device will go into armed mode. The system will notify you about the transition to the armed mode with two short signals (as in car alarms). In this mode, the device "catches" the opening of the door. After opening the door, the system waits for a few seconds (this is a configurable value, for rooms about ten seconds, for a box one or two) for disarming, if this does not happen, the siren turns on. The algorithm and circuit are designed in such a way that the siren can be turned off only by completely disassembling the case and turning off the power.

Device security system very simple (Fig. 2). At the heart of the board Arduino. Limit switches are connected like a regular button, through pull-up resistors. I will dwell on the limit switches separately. They are normally closed and normally open. You can turn on a regular button as a limit switch, only the travel of a regular button is very large, the door play is usually larger. Therefore, it is necessary to come up with some kind of pusher for the button and spring it so as not to break the button with the door. Well, if not too lazy, then you can go to the store and buy a magnetic switch (reed switch) (Fig. 3), he is not afraid of dust and pollution.

A limit switch for car alarms is also suitable (Fig. 4). It should be noted that the program is written for the reed switch. When the door is closed, its contact is closed. If you use a switch from a car alarm, then when the door is closed, it will most likely be open, and in the appropriate places in the code you will need to change 0 to 1 and vice versa.

As a siren, I propose to use the sound annunciator PKI-1 IVOLGA of Belarusian production (Fig. 5). Supply voltage 9 - 15 V, operating current 20 - 30 mA. This allows it to be used with battery power. At the same time, it "gives out" 95 - 105 dB.

With such characteristics from the Krona battery, it will sound for several tens of minutes. I found it on the Internet for 110 rubles. In the same place, a reed switch with a magnet costs about 30 rubles. The switch from the car alarm in auto parts was bought for 28 rubles. The KT315 transistor can be taken with any letter or replaced with any modern low-power silicon transistor of the appropriate conductivity. If the volume of one annunciator is not enough (who knows, maybe you want to be heard for many kilometers), you can connect several annunciators in parallel or take a more powerful one, only in this case the transistor needs to be replaced with a more powerful one (for example, the familiar transistor assembly ULN2003). As connectors for connecting a reed switch and a siren, I used the simplest connectors for audio / video devices - the price on the radio market is 5 rubles. for a couple.

The body of the device can be glued from plastic or plywood; if a serious object is guarded, then it is better to make it metal. Batteries or accumulators to increase reliability and safety, it is desirable to place inside the case.

To simplify the program code, energy-saving elements were not used, and the batteries are not enough for a long time. You can optimize the code, or even better, radically redo it by applying event handling on interrupts and MK sleep mode. In this case, the power supply from two square batteries connected in series (9 V) should last for several months.

Now the code

// permanent
const int button = 12; // button pin
const int gerkon = 3; // pin for reed switch
const int sirena = 2; // siren control pin
const int led = 13; // indicator pin
// variables
int buttonState = 0; // button state
intgerkonState=0; // state of the reed switch
int N = 0; // counter of the disarm button
void setup()(
// siren and indicator control - exit
pinMode(sirena, OUTPUT);
pinMode(led, OUTPUT); // button and reed switch - inputs
pinMode(gerkon, INPUT);
pinMode(button, INPUT);
}
void loop()(
digitalWrite(led, HIGH);
while(buttonState= =0)( // wait loop until button is pressed
buttonState = digitalRead(button); // to switch to armed mode
}
digitalWrite(led, LOW);
buttonState=0; // reset button value
while(gerkonState= =0)( // loop until we close the door
}
delay(500); // :-)
digitalWrite(sirena, HIGH); // Code
delay(100); // indications
digitalWrite(sirena, LOW); // include
delay(70); // mode
digitalWrite(sirena, HIGH); // guards
delay(100); // notification
digitalWrite(sirena, LOW); // sound
while(gerkonState= =1)( // wait for the door to open
gerkonState = digitalRead(gerkon);
}
for (int i=0; i<= 5; i++){ // 7,5 секунды на нажатие
buttonState = digitalRead(button); // secret button
if (buttonState = = HIGH) ( // keep track of our own - someone else's
N=N+1;
}
delay(1500); // secret feature :-)))
}
if (N > 0) ( // most important
digitalWrite(sirena, LOW); // do not turn on the siren
}
else(
digitalWrite(sirena, HIGH); // or turn on the siren
}
digitalWrite(led, HIGH); // turn on the indicator N = 0;
buttonState=0;
delay(15000); // reminder for dummies who like
digitalWrite(led, LOW); // push buttons without interruption delay (1000);

 
Articles By topic:
Pasta with tuna in creamy sauce Pasta with fresh tuna in creamy sauce
Pasta with tuna in a creamy sauce is a dish from which anyone will swallow their tongue, of course, not just for fun, but because it is insanely delicious. Tuna and pasta are in perfect harmony with each other. Of course, perhaps someone will not like this dish.
Spring rolls with vegetables Vegetable rolls at home
Thus, if you are struggling with the question “what is the difference between sushi and rolls?”, We answer - nothing. A few words about what rolls are. Rolls are not necessarily Japanese cuisine. The recipe for rolls in one form or another is present in many Asian cuisines.
Protection of flora and fauna in international treaties AND human health
The solution of environmental problems, and, consequently, the prospects for the sustainable development of civilization are largely associated with the competent use of renewable resources and various functions of ecosystems, and their management. This direction is the most important way to get
Minimum wage (minimum wage)
The minimum wage is the minimum wage (SMIC), which is approved by the Government of the Russian Federation annually on the basis of the Federal Law "On the Minimum Wage". The minimum wage is calculated for the fully completed monthly work rate.