The portal about the repair of the bathroom. Useful advice

Home alarm or using motion sensor and LCD monitor with Arduino. Wireless Alarm based on Arduino How it works

Her author wanted to fulfill homemade to be cheap and wireless.
This homemade uses the PIR motion sensor, and the transmission of information occurs with RF module.

The author wanted to use the infrared module, but since it has a limited range, and plus can work only On the line of sight of the receiver, so he chose the RF module, with which the range can be achieved approximately 100 meters.


In order for visitors to be more convenient to view an alarm assembly, I decided to divide the article on the 5th stages:
Step 1: Creating a transmitter.
Step 2: Creating a receiver.
Step 3: Installing Software.
Step 4: Testing the collected modules.
Stage 5: Build the case and installing the module into it.

All that needed the author, it is:
- 2 Arduino Uno / Arduino Mini / Arduino Nano boards for a receiver and transmitter;
- RF receiving module (433 MHz);
- PIR motion sensor;
- 9B batteries (2 pieces) and connectors for them;
- buzzer;
- Light-emitting diode;
- resistor with a resistance of 220 ohms;
- Bread board;
- jumpers / wires / jumpers;
- Circuit board;
- inter-spot pin connectors;
- switches;
- enclosures for the receiver and transmitter;
- colored paper;
- assembly tape;
- a set scalpel;
- a thermoclate gun;
- soldering iron;
- plug / tool for removing isolation;
- Scissors for metal.


Stage 1.
We start creating a transmitter.
Below is the scheme of the motion sensor.


The transmitter itself consists of:
- motion sensor;
- Arduino boards;
- Module of the transmitter.


The sensor itself has three outputs:
- VCC;
- GND;
- Out.

After that, I checked the work of the sensor


Attention!!!
Before loading the firmware, the author is convinced that in the Arduino IDE settings the current board and the serial port are correctly installed. After that, loaded the sketch:

Later, how the motion sensor will lock the movement in front of them, the LED will be lit, and in the monitor you can see the corresponding message.


According to the scheme, just below.


The transmitter has 3 outputs (VCC, GND, and DATA), connect them:
- VCC\u003e 5V with the output on the board;
- GND\u003e GND;
- Data\u003e 12 with the output on the board.

Stage 2.


The receiver himself consists of:
- Module RF receiver;
- Arduino fees
- buzzer (dynamics).

Receiver scheme:


The receiver, as well as the transmitter, has 3 outputs (VCC, GND, and DATA), connect them:
- VCC\u003e 5V with the output on the board;
- GND\u003e GND;
- Data\u003e 12 with the output on the board.


Stage 3.
The basis of the entire firmware by the author chose the library file. I downloaded, which he, and placed it in the folder with Arduino libraries.

Software for transmitter.
Before downloading the firmware code in the fee, the author put the following parameters IDE:
- Board -\u003e Arduino Nano. (or the board you use);
- Serial Port -\u003e


After installing the parameters, the author downloaded the Wireless_tx firmware file and loaded it on the fee:

Software for receiver
The author repeats the same actions for the receiving board:
- Board -\u003e Arduino Uno (or the board you use);
- Serial Port -\u003e COM XX (Check the COM port to which your fee is connected).



After the author set the parameters, downloads the Wireless_RX file and loads it in the fee:


After, using the program you can download, the author generated the sound for the buzzer.

Stage 4.
Next, after downloading the author decided to check whether everything works properly. The author connected power supplies, and ran his hand in front of the sensor, and it earned a buzzer, which means everything works as it should.


Stage 5.
Final assembly of transmitter
At first the author cut off protruding conclusions from the receiver, transmitter, Arduino boards, and so on.


After that, combined the Arduino fee with a motion sensor and RF transmitter with jumpers.


The author further began to make the case for the transmitter.

At first it cut out: a hole for the switch, as well as a round hole for the motion sensor, after which it glued to the body.




Then the author turned the sheet of colored paper, and glued to the front cover of the image, in order to hide the inner parts of the homemade.


After that, the author began to insert an electronic filling inside the housing, with the help of bilateral tape.



Final assembly receiver
The author decided to connect the Arduino fee with a rubber tape circuit board, as well as install RF receiver.


The author further cuts two holes on another case, one for a buzzer, another for a switch.


And sticks.


After that, the author sets on all the details of jumpers.




Then the author inserts a ready-made fee into the body, and fixes it with double-sided glue.

GSM Alarm on Arduino

In this article you will learn how (buy) make GSM itself alarm with the GSM module and Arduino is very cheap. The GSM Alarm Protection Object is perfect for cottage, house, garage, apartment.


Step 1: Elements
For this project you will need:


GSM Shield.

Buzzer
Siren alarm 12V.
12V Power Source

Keyboard for Arduino.
Case.

Step 2: Connecting Components


First, you place the GSM module on Arduino Uno, you will need to solder the GND and VCC wires along with two sensors, the buzzer and the input of the relay module. After that, connect these soldering wires to the corresponding GSM Shield connector. Next, you will make an input / output connector of signals from these parts, and the last thing it will be necessary - to connect the keyboard

Arduino Uno / GSM Terminals:

Conclusion 0: Not related;
Conclusion 1: Not related;
Conclusion 2: Unrelated (GSM will use this pin);
Output 3: unrelated (GSM will use this pin);
Conclusion 4: Last string using the keyboard (Keyboard contact 4 - from 8);
Conclusion 5: Not related;
Conclusion 6: Second column using the keyboard (keyboard contact 6 - from 8);
Conclusion 7: Third column from the keyboard (finger keyboard 7 - from 8);
Conclusion 8: Unbound (GSM will use this pin);
Conclusion 9: Unrelated (GSM will use this pin);
Conclusion 10: PIR sensor data number 2;
Conclusion 11: Siren Beep (enters the input of the relay module);
Conclusion 12: PIR data sensor No. 1;
Conclusion 13: the input signal of the buzzer;

As you can see, although the keyboard has 8 outputs, only three (one line and two columns are connected, which allows you to use two numbers for reading - 1 × 2 matrix), so I can make passwords using these three wires, and there is no need to use All contacts from the keyboard. This is because after the motion sensor detects a person walking in the room, the person will have only 5 seconds to disable the alarm. After the alarm is not turned off on this moment Time, GSM Shield sends SMS to you, or calls the phone number. Arduino was programmed to call and as soon as you answer the phone call, it will put the phone.

Of course, you can get false sensor readings, so the option is to turn off the alarm, simply by sending SMS from your phone to Arduino. In addition, one more option that you can do is configure Shield to send you one message a day so that you know that it works correctly.

Step 3: Code

Just download the code below and compile. It uses libraries Keypad.h and gsm.h.
Download File: (Dropping: 181)
Download File: (Dropping: 104)

Step 4: Conclusion


Considering that Arduino Uno code will send SMS messages and call your phone just five seconds after someone penetrate your home, I guess you will have enough time to call the police. Of course, the siren will scare the thieves and your home or other premises will be safer using this article.

Today we will talk about how with Arduino Collect security system. Our "guard" will watch out one contour and manage one infidel.

For Arduino, this is not a problem, and, as you will see on the program code and by the device diagram, you can easily increase the number of protected access points and the number of alert or indication devices.
Security system You can apply for protection of both large objects (buildings and structures) and small objects (boxes, safes), and even portable cases and suitcases. Although you need to be careful if you install the security system, for example, on a suitcase with which you decide to go on a journey, and the alert system will work in some airport, then I think you have a serious conversation with your local security service :-)

Simplified the principle of operation of the device is as follows (Fig. 1). After powering on the power, the device switches to the operating mode and waits for protection. Staging and disarming is carried out by one button. To enhance the security, this button is better to arrange inside the protected area (safe or casket). Before turning on the security mode, the door must be opened. When you turn on the security mode (pressing the button) electronic circuit Waiting until you close the door to the room (safe door, casket cover, etc.).

On the door (or door) there must be a terminal switch of any type, about it later. Climbing (or blurring), the limit switch will inform the device that the protected circuit is closed, and the device will go into the protection mode. On the transition to the protection mode, the system will notify two short signals (as in automotive alarms). In this mode, the device "catches" the opening of the door. After opening the door, the system is waiting for a few seconds (this is the value is customizable, for the premises of about ten seconds, for the box of one or two) shutdown of the protection mode, if this does not occur, the siren turns on. The algorithm and scheme are designed so that it is possible to disable the siren, only completely dismissed the case and turning off the power.

Device security system Very simple (Fig. 2). At the heart of the fee Arduino. Limit switches Connected as the usual button through pull-up resistors. On the contractions will stop separately. They are normally closed and normally open. You can enable the usual button as a terminal, only the course of the ordinary button is very large, the play of the door is usually more. Therefore, it is necessary to come up with some pusher for the button and spring so as not to break the door button. Well, if not too lazy, you can walk to the store and buy a magnetic switch (GERCON) (Fig. 3), it is not afraid of dust and contamination.

A limit switch for auto alarms is suitable (Fig. 4). It should be noted, the program is written in German. With the door closed, its contact is closed. If you use a switch from car alarm, then with the door closed it will most likely open, and in the appropriate locations the code will need to be changed 0 on 1 and vice versa.

As a siren, we propose to use the sounding of sound PKI-1 Ivolga of Belarusian production (Fig. 5). Power supply 9 - 15 V, operating current 20 - 30 mA. This allows you to use it with battery powered. At the same time, he "issues" 95 - 105 dB.

With such characteristics from the Crohn battery, it will sound several dozen minutes. I found it on the Internet for 110 rubles. There is a geron with a magnet worth about 30 rubles. The switch from car alarm in auto parts was purchased for 28 rubles. The CT315 transistor can be taken with any letter or replace any modern low-power silicon transistor with appropriate conductivity. If the volume of one batch is not enough (who knows, maybe you want to be heard for many kilometers), you can connect several alarms in parallel or take more powerful, only in this case and the transistor must be replaced with a more powerful one (for example, a familiar transistor Assembly ULN2003). As connectors for connecting Hercon and Siren, I used the simplest connectors for audio / video devices - the price of Radiore 5 rubles. For a couple.

The device body can be glued from plastic or plywood; If a serious object is protected, it is better to make it metallic. Batteries or nutrition batteries to increase reliability and safety should be placed inside the case.

To simplify the program code, elements of energy saving were not used, and the batteries are not enough for a long time. You can optimize the code, and even better to convert radically by applying the processing of events to interrupts and sleep MC mode. In this case, nutrition from two square batteries included in series (9 V) must be enough for several months.

Now code

// Permanent
Const int button \u003d 12; // PIN for the button
Const int gerkon \u003d 3; // PIN for Herkeon
Const int sirena \u003d 2; // PIN Expirene
Const int led \u003d 13; // PIN indicator
// Variables
int buttonstate \u003d 0; // Button status
int gerkonstate \u003d 0; // State of Herkeon
int n \u003d 0; // Counter Disable Protection Button
void setup () (
// Sirena and Indicator Management - Exit
Pinmode (Sirena, Output);
Pinmode (LED, Output); // Button and Gueron - Inputs
Pinmode (Gerkon, Input);
Pinmode (Button, Input);
}
void loop () (
DigitalWrite (LED, HIGH);
while (buttonstate \u003d \u003d 0) (// Waiting cycle until you click the button
ButtonState \u003d DigitalRead (Button); // For the transition to the security mode
}
DigitalWrite (LED, LOW);
ButtonState \u003d 0; // reset the value of the button
While (gerkonstate \u003d 0) (// cycle until you close the door

}
Delay (500); // :-)
DigitalWrite (Sirena, High); // The code
Delay (100); // Indications
DigitalWrite (Sirena, Low); // Inclusion
Delay (70); // Mode
DigitalWrite (Sirena, High); // Security
Delay (100); // Alert
DigitalWrite (Sirena, Low); // Sound
While (gerkonstate \u003d 1) (// We are waiting for the opening of the door
gerkonstate \u003d DigitalRead (Gerkon);
}
for (int i \u003d 0; i<= 5; i++){ // 7,5 секунды на нажатие
ButtonState \u003d DigitalRead (Button); // Secret Button
if (buttonstate \u003d \u003d high) (// track your own - someone else's
N \u003d n + 1;
}
Delay (1500); // Secret Fich :-)))
}
if (n\u003e 0) (// Most importantly
DigitalWrite (Sirena, Low); // do not turn on siren
}
ELSE (
DigitalWrite (Sirena, High); // or turn on siren
}
DigitalWrite (LED, HIGH); // Turn on the indicator N \u003d 0;
ButtonState \u003d 0;
Delay (15000); // Reminder "Teapots", which like
DigitalWrite (LED, LOW); // put pressure on the buttons without interruption Delay (1000);

Hello everyone, today we will look at the device called the motion sensor. Many of us heard about this thing, someone even dealt with this device. What is the motion sensor? Let's try to figure out, so:

Motion Sensor, or Travel Sensor - device (device) detecting a movement of any objects. Very often, these devices are used in protection systems, alarms and monitoring. Forms of factors of these sensors There are a great set, but we will consider the motion sensor module for connecting to charges Arduino,and it is from the companyRobotdyn. Why exactly this company? I do not want to engage in advertising of this store and its products, but it is the products of this store that has been chosen as laboratory samples due to the high-quality feeding of their products for the end user. So, we meet - the motion sensor(Pir Sensor) From Robotdyn:


These sensors are small in dimensions, consume little energy and easy to use. In addition, Robotdyn's motion sensors have also labeled with silk screen of contacts, this is of course a trifle, but very pleasant. Well, those who use the same sensors, but only other firms, do not worry - they all have the same functionality, and even if contacts are not marked, then the ceiling of such sensors is easy to find on the Internet.

The main technical characteristics of the motion sensor (PIR SENSOR):

Sensor operation zone: from 3 to 7 meters

Tracking angle: up to 110 o

Operating voltage: 4.5 ... 6 volts

Current consumed: up to 50mk

Note: The standard functionality of the sensor can be expanded by connecting the illumination sensor to Pins in and GND, and then the motion sensor will only work in the dark.

Initialization of the device.

When turned on, the sensor requires almost a minute for initialization. During this period, the sensor can give false signals, it should be taken into account when programming a microcontroller with a sensor connected to it, or in actuator circuits, if the connection is made without using a microcontroller.

Corner and detection area.

Detection angle (tracking) is 110 degrees, a range of detection distance from 3 to 7 meters, the illustration below shows all this:

Adjusting sensitivity (detection distance) and time delay.

The table below shows the main adjustments of the motion sensor, the left is a temporary delay control, respectively, in the left column, a description is given. possible settings. In the right column, the description of the detection distance adjustments.


Sensor connection:

  • Pir Sensor - Arduino Nano
  • Pir Sensor - Arduino Nano
  • Pir Sensor - Arduino Nano
  • PIR SENSOR - for light sensor
  • PIR SENSOR - for light sensor

A typical connection diagram is given in the diagram below, in our case the sensor is shown conditionally from the back and connected to the Arduino Nano board.

Skatch showing the operation of the motion sensor (we use the program):

/ * * Pir Sensor -\u003e Arduino Nano * Pir Sensor -\u003e Arduino Nano * Pir Sensor -\u003e Arduino Nano * / void setup () (// Set a connection to the Serial.Begin port monitor (9600);) void loop () ( // Read the threshold value from the port A0 // Usually it is above 500 if there is an IF signal (AnalogRead (A0)\u003e 500) (// Signal from the SERIAL.PRINTLN motion sensor ("there is a movement !!!");) ELSE (/ / No signal serial.println ("everything is quiet ...");))

Sketch is the usual check of the operation of the motion sensor, there are many drawbacks in it, such as:

  1. Possible false responses, the sensor requires self-initialization for one minute.
  2. Rigid binding to the port monitor, no output performing devices (relay, siren, light-index)
  3. Too short signal time at the output of the sensor, when motion is detected, it is necessary to programmatically delay the signal for a longer period of time.

Complicating the scheme and expanding the functionality of the sensor, you can avoid the deficiencies described above. To do this, you will need to complement the relay module schema and connect the usual 220 volts lamp through this module. The relay module itself will be connected to Pin 3 on the Arduino Nano board. So a schematic diagram:

Now it's time to improve the sketch that the motion sensor was checked. It is in the sketch that the relay turns off will be implemented, since the motion sensor itself has a too short signal time at the output when triggered. The program implements a 10 second delay when the sensor is triggered. If you wish, this time can be increased or decreased by changing the value of the variable DeLayValue. . Below is sketch and video operation of the entire collected scheme:

/ * * PIR SENSOR -\u003e Arduino Nano * Pir Sensor -\u003e Arduino Nano * Pir Sensor -\u003e Arduino Nano * Relay Module -\u003e Arduino Nano * // RELOUT - PIN (Output Signal) for the Const int RELOUT \u003d 3 relay module; // Prevmillis - variable for storing the time of the previous program scanning cycle // Interval - time interval for counting seconds before turning off the Relay unsigned long prevmillis \u003d 0; INT interval \u003d 1000; // DelayValue - the period during which the relay is held in the included state INT DELAYVALUE \u003d 10; // INITSECOND is the iteration variable Initsecond \u003d 60 initialization cycle; // COUNTDELYOFF - STATIC INT COUNTDELYOFF \u003d 0 time interval counter; // Trigger - Static Bool Trigger \u003d False movement sensor response flag \u003d false; Void setup () (// Standard port initialization procedure to which the relay module is connected // Important !!! - so that the relay module remains in the initially off state // and did not work when initializing, you need to write to the input / output port // High Value This will avoid false "motels", and will save // \u200b\u200bthe state of the relay as it was before turning on the entire scheme to work Pinmode (RELOUT, OUTPUT); DigitalWrite (RELOUT, HIGH); // Everything is simple - we are waiting for 60 cycles (variable initsecond) // lasting in 1 second, during this time the sensor "self-initialized" for (int i \u003d 0; i< initSecond; i ++) { delay(1000); } } void loop() { //Считать значение с аналогового порта А0 //Если значение выше 500 if(analogRead(A0) > 500) (// Set the IF (! Trigger) motion sensor response flag (TRIGGER \u003d TRUE;)) // While the movement sensor flag is set to While (Trigger) (// execute the following instructions // Save in the Currmillis variable // Milliseconds From the moment of start // executing the UNSIGNED Long Currmillis \u003d Millis (); // comparing with the predicted millisecond value // If the difference is more than the specified interval, then: if (Currmillis - Prevmillis\u003e Interval) (// Save the current millisecond value in the variable prevmillis prevmillis \u003d currmillis; // Check the delay meter comparing it with the value of the period // during which the relay must be kept in the // COUNTDELYOFF\u003e \u003d DelayValue state) (// if the value is compared, then: // reset the sensor response flag motion trigger \u003d false; // reset the countdelayoff \u003d 0 delay meter; // Turn off the DigitalWrite relay (RELOUT, HIGH); // interrupt the Break cycle;) else (// if The value is still less, then // increment the delay meter per unit CountDelayoff ++; // hold the relay in the on-line DigitalWrite (RELOUT, LOW); ))))

The program has a design:

unsigned long prevmillis \u003d 0;

iNT interval \u003d 1000;

...

unsigned long currmillis \u003d Millis ();

if (Currmillis - Prevmillis\u003e Interval)

{

Prevmillis \u003d Currmillis;

....

// Our operations enclosed in the body of the design

....

}

To make clarity, it was decided to comment separately to this design. So, this design Allows you to perform a parallel task in the program. The body of the design is triggered by about once per second, this contributes to the variable interval.. First, the variable currmillisassigns the value returned when calling a function millis (). Function millis () Returns the number of milliseconds that have passed since the start of the program. If difference currmillis - Prevmillis more than the value of the variable interval.this means that it has already passed more than a second from the start of the program, and you need to save the value of the variable currmillisin a variable prevmillis.then perform the operations enclosed in the body structure. If the difference currmillis - Prevmillis less than the value of the variable interval.Between the scanning cycles of the program, a second has not passed, and the operations enclosed in the body are skipped.

Well, at the end of the article video from the author:

Please enable JavaScript to work comments.

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 signaling process was delayed for several months and some sellers no longer sell those components that were purchased from them, links will be updated on the goods of other sellers in which the maximum or approximate maximum number 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 AddPhone and Deletephone Console Commands, 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 setting module. 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 a blue LED for 2 seconds, signaling about normal work 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 external devicesFor this, the conclusions are A1 (D15) and A2 (D16). The alarm set / removes protection when the high-level A1 (D15) is appeared on the + 5V or on the output A2 (D16) output of the 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 - Teams AddPhone and EditmainPhone Added parameter "I" (INFO) responsible for sMS notification About the formulation or removal of the device with protection. 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 teams. 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 anyone can be connected to Pins D6 and A0. digital sensors With a high or low response, 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 change logical level The device will automatically reboot. 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. Unable to add two identical numbers.
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 Modem modem modem. 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