Friday, August 30, 2013

GSM Multifunction Alarm with SIM900


It’s small but packed with features. The GSM alarm we present today, sports a PIR motion sensor, can be battery operated and it’s capable to communicate via GSM. It can transmit alarm conditions and receive commands from remote. It’s also capable to indicate problems such as is insufficient voltage supply or tampering.
It’s not so conventional for antitheft system: to integrate a movement sensor, a PIR motion sensor and a temperature probe in a single appliance: all this accompanied by an SMS sending GSM / GPRS module. This circuit was born as a very versatile, ready to use, built-in alarm system: no installation is required, you can just drop it and it’s ready to work. It’s not by chance that is designed to be battery operated: it also features a battery state control to check the power.
Moreover, it has two digital inputs, one which was is set up to detect tension: with it, you could detect important conditions such as the state of a protection system or even other parameters of various kinds, simply by adding additional sensors.


The diagram

All is quite simple, since most of the tasks are managed by a PIC18F46K20 (U1), all is powered between 6 and 32 VDC (even unregulated), thanks to a DC / DC buck converter configuration that is present in the circuit.
The switching regulator is based on the MC34063 (U2), used in the classical configuration of a winding inductance series PWM regulator, whose output voltage depends on the energy stored in L1, the output voltage from the DC / DC is stabilized with reference to the potential demoted to pin CII by the resistive divider R3/R4.
The two components are designed to get 4 V in C8 and C9.

After power-on-reset, the microcontroller, initializes its I/O settings: RB0 reads the state of the motion sensor, RB1 and RB2 serve to detect the logical condition in inputs IN1 and IN2; RB3 reads the state of the P1 button and RB4 the logical condition of the output of the passive infrared radar PIR. The latter normally has zero on OUT and 5-volt pulses when detects something in its field of action. P1 button serves for the local management of the operation mode.
Note that both IN1 and IN2 are protected by a diode which prevents the application to RB1 and RB2 of voltages exceeding that with which the microcontroller is powered. In the case of  PIC18F46K20, a voltage below 1 V or a short circuit of IN1 or IN2 corresponds to the low logic state, while the opening of said inputs or the application of a DC voltage of 1 to 5 V generates 1.
The AN0 line is an input assigned to the A / D converter contained in the microcontroller and reads the value of the voltage supply through the resistive divider formed by R1 and R2.
The RC0 line is initialized by the PIC as a bidirectional I / O, as it serves to communicate with the temperature sensor, which, in our case is a Dallas DS18B20. This sensor is very precise and it’s capable of measuring temperatures between -5 and 150 ° C with an accuracy of ± 0.5 ° C (in -10 ÷ 85 ° C), making them available over a serial line, in this case going to the RC0 pin of the microcontroller.
Let us now look to the outputs: RD6 and RD7, used to manage the lighting of the LD1 and LD2 LEDs .
Regarding the cellular module, this is an FT900M based on the SIMCOM SIM900. The microcontroller contains a UART that accessible from pins 44 (transmission) and 1 (reception): it’s used to communicate with the GSM module.
The set of I/Os is completed by RC5 and RD0: the first one controls the switching of the GSM (via a transistor arranged in the base) while the second line provides to phone reset when necessary; in any case after the initialization after resetting circuit.

BOM
[code]
R1: 10 kohm (0805)
R2: 1 kohm (0805)
R3: 2,2 kohm (0805)
R4: 1 kohm (0805)
R5: 0,1 ohm 1W (1206)
R6: 330 ohm (0805)
R7: 330 ohm (0805)
R8: 4,7 kohm (0805)
C1: 100 nF (0805)
C2: 470 µF 6,3 VL (X)
C3: 470 µF 6,3 VL (X)
C4: 100 nF (0805)
C5: 22 µF 25 VL (D)
C6: 100 nF  (0805)
C7: 100 nF (0805)
C8: 470 µF 6,3 VL (D)
C9: 100 nF (0805)
C10: 100 nF (0805)
C11: 100 pF (0805)
C12: 22 µF 25 VL (D)
L1: 22 µH
U1: PIC18F46K20-I/PT
U2: MC34063AD
LD1: LED red 5 mm
LD2: LED green 5 mm
P1: Microswitch
D1: GF1M
D2: GF1M
D3: MBRA140TRPBF
MOV: Motion sensor
PIR: PIR sensor

TEMP: DS18B20+
[/code]
How it works
The system is designed to be configured via SMS and, when alarms are triggered, it sends one ore more SMS to the numbers stored in a secial list, to warn one or more persons.
Our system fires an alarm on the verification of one or more of the following conditions:
- the IN1 input changes state, moves at high or low state,
- the motion sensor detects a vibration
- the PIR sensor detects presence,
- the temperature goes out of a preset range
- the supply voltage drops below a certain value

When one of these events occurs, the circuit sends a text message to te contact list.
You can also set a custom message for each event.
RB2 is used to activate and deactivate the alarm: leaving it open or putting a high logic level, after an interval can be set between 0 and 59 seconds with the SMS command TATT, the circuit will be activated.
After activation of IN1, the green LED LD2 will flash until activation.
You can also ask the device to send a text message when activated.
You can define a sensors inhibition time thanks to the SMS command INI:xx, ( xx is the time in minutes). Inhibition time is to avoid multiple alarms for the same event. caused by something that produces more pulses (such as an unstable contact in IN2, an oscillating temperature around the threshold value etc..).
One particular feature of the circuit is the Sleep mode, useful to prolong the operating time when the circuit is battery powered: sending the SLEEP:xxx command the system goes to a sleep mode (low power) for xxx seconds. During this mode, the operation is minimal, ie, the circuit neither detects any alarm, nor it sends or reads i ncoming SMS. Sleep mode suspends every xxx seconds, when the circuit queries the phone to verify the arrival of messages and move on the execution of commands.

Sleep mode enables automatically only if the circuit is turned off, or if the IN1 is at a low logic level.
If the circuit is on sleep, but you need to read data you can awaken it momentarily in two ways: locally, by pressing the P1 button, or remotely, making a phone call to it. Upon awakening, we can send an SMS command to read the data we want, the circuit will respond and then will automatically go back to sleep.

Configuration

All circuit settings can be made ​​by SMS: note that the system will only accept SMS from phone numbers stored in the approved numbers list, a maximum of 8. This list is the same to which the system will send the SMS to. Alternatively you must send commands accompanied by a password, which by default and following a reset (imposed by SMS).
The command to store a new number is the following (a SMS containing the text): NUMxnnnnnnnnnnnpwd, where x is the position (1 to 8) where to save the number amd pwd is the current password (required if the SMS command originates from a phone is not in the list and needed when you store the first number)
The pwd is due in any case if the position is already taken by another number. Each number can be up to 19 characters and must contain the national prefix.
You can also query the device to find all the numbers stored: just issue the command SMS NUM?;pwd.
Our device implements also an Easy Setup functionality: after switching on, keeps waiting for a phone call and then saves the caller’s phone number and enters the normal operation.
Once you stored the numbers in the list, you must define which ones to send SMS alarms. The command is SMSxxxxxxxx:ON or SMSxxxxxxxx:OFF, where xxxxxxxx is the position in the list where the numbers are stored.
For example, SMS1346: ON sets that the numbers in positions 1, 3, 4 and 6 will receive the SMS. OFF will than deactivate the corresponding SMS sending.
At the first start and after each reset, the tracker sends SMS to all numbers stored.
Certain commands can be executed only when accompanied by a password: the default password (reset after every hard reset of the system) is 12345, and you can replace it by issuing the command PWDnewpwd, pwd, where newpwd is the password to be stored and pwd is the current one.
A reset, which restores the default settings and clears phone numbers list is done thanks to the RESpwd command, where pwd is the current password.
You can send text messages containing multiple comma separated commands, and with a special command, you can disable answers to some of the commands by inputting the command RISP.

Let’s disuss of how to manage the alarm functions. Let’s start with the temperature. By sending the TEMPcommand you get the current temperature, by ALLMAX:YXX and ALLMIN:YXX (where y is the sign and xx corresponds to the Celsius degrees) you can set maximum and minimum temperatures (before issuing alarms).
Temperature settings can be reset by sending the command TRES. The ALL?   command instead queries the system, which responds with the currently
set temperatures. Temperature alarms are activated by the SAT:1 command: to deactivate you can issue the SAT:0 command. The setting will be stored until reset.

Let’s look at the commands of the motion alarm: SAM:1 enables sensor, and SAM:0 disables it, settings are saved until hard reset.
The PIR sensor, is activated and deactivated via SAP:1, SAP:0 commands. The settings are kept until reset as well.

Command SAI:1 and  SAI: 0 activate and deactivate control on the IN2 input line. The commands to define what the system should consider an alarm are the following: LIV:A  makes the input sensitive to the logic high, LIV: B activates it with zero and LIV:V activates the alarm when there’s a change in the logic level. The LIV? command asks the system to send a text message containing the current setting for the IN2 alarm input.
Command: SAV:1 gives alarm if the battery voltage drops below 6 volts; with SAV: 0 we can disable this function.

To get an SMS when circuit is activated (meaning IN has been activated) you must send the command AVV:1; you can disable this feature with AVV:0.

No comments :

Post a Comment

feel free and ask...

IP Address Checker