GSM Remote Control – Gate Control
Part 4 – SMS Command

By on January 4, 2011

Commands and settings can be sent by any cell phone via SMSs, as long as the message in question contains a password. Some of the commands can be composed without the use of a password (just so that they can be composed faster), provided that they are sent from one of the first eight numbers stored inside the gate opener. However, a password must be used with those SMSs asking for a number to be added or removed, for the password to be replaced, or for the list itself of the numbers that have already been enabled. As far as adding or removing numbers, requiring the use of a password ensures that only someone authorized to manage the list can modify it. As for the command that can be used to check the stored numbers, it has been included in order to ensure privacy, that is, to protect the identities of those who have access to the gate opener’s commands.
Let’s now turn to a description of the commands and their syntax, on the assumption that the remote control accepts multiple SMSs, that is, SMSs containing more than one command or commands associated with one or more telephone numbers; each command must be separated from the following one by a comma. We should also say that all the commands for which a password is not required are valid only if they come from a known phone, that is, a phone whose number is in the list of numbers stored in the remote control. Again, if a command can be sent without having to use a password, it means that it must be sent by one of the numbers included in the list; a non-user always needs a password.
The first command we are going to examine is the one used to modify the password and entails an SMS of type PWDxxxxx;pwd, where instead of xxxxx the user must type a new password (made up of only numbers, and not exceeding five digits), while pwd stands for the existing password. By the way, please note that the default password in the circuit’s microcontroller is 12345.
Storing one of the eight numbers enabled to send configuration commands is done by sending an SMS containing the string NUMx+nnnnnnnnnnnnn;pwd, where instead of x the user must type the number (position) being stored, in place of n the number itself, while pwd, again, is the existing password. All of this must be typed without any spacing.
Numbers can be up to 19 digits; note that the + sign is what replaces 00 when making an international call from a cell phone. For instance, placing number 00398911512 in eight place can be obtained through the following command: NUM8+398911512;pwd. Note that when storing a number, a password is required only if that number is to be stored in a position already taken by another number; if the desired position is empty, it is enough to send an SMS containing NUMx+nnnnnnnnnnnnn.
Obviously, all of the above applies when the command in question is sent from a phome whose number has already been acquired by the gate control; otherwise, using a password is obligatory. Removing a number must be done through an SMS containing the string NUMx;pwd; In place of the x, one needs to type the position of the number to be deleted, while pwd still stands for password. For example, in order to remove the fourth number from the list, one needs the following message: NUM4;pwd. In order to request the list of the numbers that have been stored, one needs to send the following SMS: NUM?;pwd. The gate opener responds to the phone number from which the request is sent.
Let’s now turn to the commands regarding the relay functions; these commands allow one to activate or disactivate RL1, regardless of its existing state. The first command is the one that allows for a bistable command and has a syntax of the type OUT:state, where state can have the value ON or OFF. Here’s an illustration: when the relay needs to be activated,  we send out the command OUT:ON. If we want the relay to rest after having been activated, we can send an SMS containing OUT:OFF.
Although the two exits can always be activated in the manner anticipated, the remote control also allows for a manual monostable command: when an SMS containing the string OUT:ss is sent out, the relay will invert it state for an interval of time as long as the seconds indicated in place of ss (anywhere between 1 and 59 seconds). For instance, if we send the command OUT:03 after having programmed the bistable activation of the relay, it will get unexcited and will become excited again after three seconds; obviously, it can permanently be unexcited only by using a special command (OUT:OFF) or taking away the power altogether, provided that the restart mode is not active.
If the command is given when the relay is idle, the relay is activated for as many seconds as defined in the corresponding SMS; however, if the command is sent when the relay is impulsively excited due to an incoming phone call, the relay becomes idle for as many seconds as defined in the SMS. If the time in question is longer than that of the relay activation for gate-opening functions, RL1 will not get active again except following a different command.
If at any time the relay state is unknown, one can send the command STA? the gate opener will respond with an SMS containing the current relay and input states. The message is sent to the phone from which the command was given.
The circuit is equipped with an auto-restart function, which allows the user to store the relay state in the event of a black-out and to restore it when the power is back; this function is active by default, through the software uploaded in the microcontroller, but it can be disactivated or reactivated with SMS commands, respectively, with RIP0 and RIP1. In order to find out, at any moment, if the restart function is activated, the user can use the command RIP?, which replies with an SMS indicating the current state. The command that determines how long the relay must be excited following a phone call from one of the 200 numbers in the list is TAC:ss, where in place of ss one must type the length of time during which the relay is to be excited; this length of time must be expressed in seconds and can be anywhere between 00 and 59 seconds. Note that by setting 00 one gets bistable activation: the relay clicks and remains excited until it gets a new call from the same phone that caused it to get activated in the first place, or from any of the other phones enabled to send a call to the gate opener.
Let’s now take a look at those commands related to the handling of the 200 phone numbers enabled to call the gate opener; MAC+xxxxxxxxxxxxxx is in charge of adding the number typed in place of the x’s in the first available position in the list.  Note, again, that the + sign is what preceded international codes and is used instead of 00; therefore, adding number +393339999999, for example, is done by sending the command MAC+393339999999. For the gate opener, there is no specific storage position: each number is saved in the first position available; it follows that, in order to delete a number, one must type the number itself in the relevant command, not the position occupied by that number.
The delete message has the following format: DAC+xxxxxxxxxxxxxx, and everything we said above regarding the previous command applies in this case as well. It is possible to delete all the numbers in the list (except for the first eight) in one swoop by sending the command DAC through an SMS. This function is useful when, for example, the remote control is uninstalled from a building where it was used to control a motorized gate and is moved into a new building.
The three commands to be used to modify the list of numbers associated with the gate opener must always be followed by a password; in other words, if they are sent individually in an SMS, they must be followed by ;pwd, where pwd is the current password. Thus, MAC+343339999999 would become MAC+343339999999;12345 if the current password is 12345. Well, it is now time to talk about those commands that allow users to define notifications sent by the remote control as a response to certain situations or to SMS commands sent from one of the eight enabled numbers. A user who has the password can, at any time, restore the default settings of the system and delete the stored phone numbers all at once, by simply sending out the command RES;pwd, where pwd is the current password.
In conclusion, we remind the reader that our system can accept messages containing more than one command, which was purposely planned to help the user save time and money.
This option entails the possibility that the system may not respond to some commands with more than one SMS; in order to circumvent this problem, a message with multiple commands can be ended with the string RISP.
This way, the remote control will not generate those response SMSs that are normally sent for the commands contained in the message in question.

SMS Command

SMS Command

project_download Firmware
English Manual

About Staff