- How to Adjust X and Y Axis Scale in Arduino Serial Plotter (No Extra Software Needed)Posted 2 months ago
- Elettronici Entusiasti: Inspiring Makers at Maker Faire Rome 2024Posted 2 months ago
- makeITcircular 2024 content launched – Part of Maker Faire Rome 2024Posted 5 months ago
- Application For Maker Faire Rome 2024: Deadline June 20thPosted 6 months ago
- Building a 3D Digital Clock with ArduinoPosted 11 months ago
- Creating a controller for Minecraft with realistic body movements using ArduinoPosted 12 months ago
- Snowflake with ArduinoPosted 12 months ago
- Holographic Christmas TreePosted 1 year ago
- Segstick: Build Your Own Self-Balancing Vehicle in Just 2 Days with ArduinoPosted 1 year ago
- ZSWatch: An Open-Source Smartwatch Project Based on the Zephyr Operating SystemPosted 1 year ago
GSM Remote Control – 2 IN and 2 OUT
Part 4 – SMS Command
Now you have to get to know the commands needed to manage it and use them at their best. Relevant commands must be given by SMS, on the understanding that a message can contain multiple messages properly separated; some commands, due to their importance, they require a password which is 12345, set by default during the first activation of the device (and is reestablished after the execution of a complete reset), but can be changed as you please. If, by mistake, we send a command that needs a password, it will not be executed and as a reply we will get a SMS saying “Insert the password to execute the command”.
Let’s start with the command used to change the password, its syntax is PWDxxxxx;attpwd: in this command, x stands for the 5 digits of the new password, while attpwd is the current one, this one needs to be added to complete the command.
Once the command is given, the remote replies by sending a message saying “New password stored” to the phone number from which it received the command.
The device is able to send a SMS to up to eight phone number when events that may stand for variations of tension in the inputs take place; those numbers are stored in a dedicated list with command: NUMx+nnnnnnnnnnnn;attpwd where nnnnnnnnnnnn is the phone number (including the Italian code +39) that cannot be over 19 digits; attpwd is the current valid password and x is the position (1÷8) where you want to store the number.
Note that when you store a number in a position already occupied by another one, this operation cancels the old number to overwrite the new one in that place.
The command used to store a number in an empty position can be sent without a password when coming from a stored phone number; the remote replies with a confirmation SMS to every storing or overwriting command. The SMS looks like this: “Stored numbers: Posx+nnnnnnnnn”; x is the position where then number nnnnnnnnnn has been stored. It is possible to include several commands in just one SMS so as to store several numbers at the same time, anyway the SMS limit of 160 characters still remains valid; in such a case, the reply message summarizes all stored numbers. In order to cancel a number stored in the list, use the string NUMx;attpwd where x is the number of the position to be deleted and attpwd is the valid confirmation password. For instance, if you want to delete the number stored in the third position in the list, you need to send a SMS with the string NUM3;attpwd.
Command NUM?;attpwd lets us receive a SMS with the list of all stored numbers; to this SMS the remote replies by sending a SMS that lists the registered numbers (all including also the position where they are stored) to the number the message came from.
The text is “Stored numbers: Pos1+nnnnnnnnn, Pos2+nnnnnnnnn” etc.
The remote, when special events (programmed by the user) take place, can send an alarm to the numbers in the list by means of a SMS or a call (ring tone); the following command activates this function: SMSxxxxxxxx:ON;attpwd. Here x stands for the memory positions corresponding to the numbers you want to send the SMS to. For instance, SMS24678:ON;attpwd enables the possibility to send SMS only to the numbers stored in positions 2, 4, 6, 7, 8. With every setting, the remote replies with a SMS with the text: “Stored numbers: Posx S+nnnnnnnnnnnn, Posx S+nnnnnnnnnnn” etc.; x is always the position (1÷8) of a number whose function of sending SMS is active, nnnnnnnnnnnnn is the corresponding number. For example the SMS
“Stored numbers:
Pos2 S +393501239876
Pos5 S +447772345775”
indicates that the SMS sending function in case of alarm is active for numbers in positions 2 and 5.
The message the remote generates as a reply to every command to set the alert SMS lists all numbers for which it is expected to send a SMS and not just those specified in the above command. This allows the person managing the remote to know the result of the sent command as well as the situation of all numbers in the list.
To define which numbers in the list have to receive calls, the message VOCxxxxxxxx:ON;attpwd must be sent to the remote, the same considerations made for managing the numbers for which it is expected to send the SMS are valid.
The reply message is also very similar: “Stored numbers: Posx V+nnnnnnnnnnnn, Posy V+nnnnnnnnnnn.”: note that the S from SMS has been replaced by the V (voice).
Two different commands – similar in their syntax – have been set for deactivation, just as it works for the activation of an alarm notification: SMSxxxxxxxx:OFF;attpwd disables the sending of messages while VOCxxxxxxxx:OFF;attpwd disables the calls. In both cases x stands for the positions of the numbers (1÷8) that do not have to receive notification of alarms. Both commands can be placed together in just one SMS.
Let’s now turn to the command used for setting the numbers that will receive the alarm calls or alarm SMS: by firmware default or after a complete reset, the remote sends the calls and the SMS to all stored numbers. As a result, in order to exclude some of them, deactivation commands need to be sent: SMSxxxxxxxx:OFF;attpwd or VOCxxxxxxxx:OFF;attpwd specifying the positions to exclude. It is understood that for the rest of the numbers, the previous setting does not change.
The remote sends a notification SMS to the phone number in the first position of the list every time it is powered.
Of course, this function can be disabled or enabled by means of two simple specific commands, AVV0 (disable) and AVV1 (enable), to which the remote replies by sending the SMS “Send message on start-up disabled” or “Send message on start-up enabled”. The text of the message is set by a special SMS string: TINS:xxxxxxxxxxxxxxx where x stands for the desired text (the default message is SYSTEM STARTUP) using the desired characters, and upper or lower case; the only restriction is the total length of the message (text and string) that can not be over the 160 characters accepted on a standard SMS.
Let’s now take a look at the commands used to manage the outputs, though them we can know the present condition and define the operating mode. In order to interrogate the unit about the output status, it is necessary to send a SMS with the text STAOD? The remote replies with a SMS “Output status xxxxxxxx”; the x are replaced by 0 if at rest or by 1 if active (logical condition 1) depending on the status of that output; please note that the figure on the left stands for the eighth channel and the one on the right for the first one.
Regarding the commands used to program the outputs, these are OUTx:ON e OUTx:OFF in case you want to enable or disable the channel indicated by an x. For instance, in order to enable output 4, you need to send a SMS with the string OUT4:ON.
Outputs can be enabled by impulses (monostable) or in a bistable mode; the activation commands so far listed regard the bistable mode: once they are given, the corresponding output remains in the set status till a subsequent command requests a different status, or until the device is turned off (if reestablishing has not been programmed), or until a complete reset takes place. The monostable mode reverses the current condition of the concerned output. For example, acting on an output currently active, this can be disabled till the end of the desired time. If, in the meanwhile, the bistable command OUTx:OFF arrives, at the end of the monostable range the output does come back on
Similarly, if upon receipt of the impulsive command SMS the corresponding output is at rest, the same is activated; if, before the end of the set time the remote receives the command OUTx:ON, once the monostable activation range is over, the output remains active.
The command to revert the (monostable) condition is OUTx:ss where x is the number of the output to which it is directed. For the bistable mode you can store the outputs’ states so that in case of power failure the remote can restore the condition of each of them during the next start-up; the restore mode for the outputs is set with command RIP1, if it is already enabled, it can be disabled with RIP0. The remote control replies with the message “Output configuration: Restore relay enabled” in the first case and “Output configuration: Restore relay disabled” in the second one. If the current state of the restore function is unknown, the system can be interrogated by means of the command RIP?; as a reply you get the message: “Output configuration: Restore relay enabled/disabled” according to the current condition.
Done with the outputs, we can now talk about the inputs’ commands, which are more complex since more parameters can be defined. Let’s start with the request of the state of the on-board digital inputs, corresponding to the command STAID?; the remote replies with the message “Input status: xxxxxxxx”, where x stand for the inputs (on the right there is the first channel, on the left the eighth). For instance, if only input 1 is at a low level, the Input status text is: 11111110.
It is possible to define the logical level to consider as an alarm condition for the inputs; this is done by sending the command LIVx:0 if you want to consider a low state as an alarm, or LIVx:1 if the alarm is to be determined by a high logical state. x defines the desired input number, so those commands can be different for every input (the default setting is 1 for all eight inputs). Every setting determines the remote’s reply, as a SMS with the text “Inputs alarm level Inx(0/1)”, between brackets you see the chosen state for the corresponding on-board digital input.
For the purpose of the remote alarm, the microcontroller evaluates the achievement and not the remaining of the inputs of the logical condition set via SMS: for example, LIV2:1 requires that on input 2, the alarm goes off when tension presence is achieved (high logical state).
That means that if the input status variation was frequent we will continue receiving notification SMS. In order to avoid continuous alarm notifications, we have established an inhibition time for the reading after the alarm notification; that time (by default set as 0 minutes) is defined by sending the command INIBxmm, where x is the number of the input the setting refers to and mm the desired inhibition time (00-59) in minutes. When the command is received, the remote replies with the message “Inhibition times Inx: mm”, where x is the input corresponding to the received command and mm are the set inhibition minutes.
During the inhibition time eventual commutations are not considered and do not determine any alarm.
Once the inhibition range is over, a new change in the logical status determines the sending of the alarm message.
Any time, if you do not remember the inhibition time for the on-board digital inputs, it is possible to request them by means of the command INIB?, the remote replies with a SMS with the text “Inhibition times IN1: mm…….IN8: mm”.
The message summarized the set times for all inputs, of course for those with 00 as mm no inhibition range has been defined.
The remote alarm function can be enabled or disabled with specific commands: ALLD:ON and ALLD:OFF enable and disable the alarms indicated by the outputs; by default none of the inputs determines an alarm.
We can now describe the commands that allow the user to store or overwrite the text of every single remote alarm message; their syntax follows the type TINn:xxxxxxxxx, where n is the input number the message is about, while x corresponds to the text of the message that cannot have more than 100 characters. By default the text of all alarm messages is ALARM. Every modification command is confirmed, by the remote, by an “echo”: The system sends an SMS with the text of the message to the number that sent the command, as it would do in case of a related alarm.
Let’s close the overview on the commands by describing the one you send to restore the default settings: a SMS with the text RES;attpwd.
Again, there is a reply message (Reset done).
The remote accepts messages with more than one command, even of a different nature; the single command must be separated by a comma. In multiple command SMS, the systems sends the corresponding reply SMS (one for each command) to the phone number that originated the message with the commands. In order to save money, it is possible to tell de device not to reply: you just start the multiple command message with the string RISP.
The RISP command can be introduced also at the beginning of any SMS with just one setting; its purpose is always the same: it disables the reply sent from the remote.
SMS Command
Firmware | |
English Manual | |