AT commands are used in many applications. In this tutorial you will learn what are AT commands, their types, and format? How to use them for gsm modem or gsm module? How to use it for SIM300D Gsm module.AT is a mnemonic code for Attention. It is just like saying attention to anyone you want to communicate with. To know whether that person is ready to communicate with you or not, we want a response. Similarly ‘AT’ command is sent to Modem, as an attention command to communicate, and a very basic response is ‘OK’ from the modem. By using these commands gsm module can be used to send sms using gsm and many others tasks. You can easily interface gsm with microcontroller by using AT commands.
AT Commands Format
Every AT command has three important parts which are prefix, a body, and a terminator.
- Prefix is known to be the AT.
- Body is the instruction/command to be executed(using ‘+’ or ‘&’ operator).
- Terminator is the carriage return<CR>.
The characters entered in the AT command must be in the same case, either upper or lower. The command is analyzed by the modem after receiving the ENTER key character.
Response of AT commands
- AT commands response always start with <CR><LF>, and after this the response may be different according the execution statement
- In case of incorrect syntax of the command, an ERROR is returned by the modem
- In case of correct syntax but with something inappropriate in parameters, INVALID INPUT PARAMETERS error is returned.
- If the command executed successfully, along with the reply that was required an OK is also received.
Types of AT commands
AT commands can be handled in different ways. The types and the purpose of their difference in types are mentioned below:
- Test command: This command when deal with a ‘?’, is known as the test command. This command tells about the value ranges of the parameters.
- Read command: This command is also deal with a ‘?’, but this command tells us the values set by the user. This command can be used in a situation where you want to know the time of the Modem.
- Write command: This type of command consists of complete command to be executed. It actually sets the parameter values of the command.
- Execution command: This command is used very rarely. It reads the non-variable parameters of the modem that are only affected by internal processes executed in the GSM Modem.
AT Commands with gsm module
Turns OFF/ON the echo mode of the modem. ATE1 turns ON the echo of the modem as sh0wn in figure below:
ATE0 turns OFF the echo mode of the modem. The instruction written after turning OFF the echo, are not visible but their responses can be seen. It is shown in figure below:
Sets the baud rate on which the communication can be done.Figure below shows AT+IPR Hyper-terminal Demonstration. The figure shows that the baud rate set is 9600 for the communication.
Modem stores the previous executed instruction into its non-volatile memory.Figure below AT+IPR Hyper-terminal Demonstration.
This command is used as read command, this command when used with’?’ reads the time of the modem in this format “year/month/day,hour:min:sec+/time zone”.Figure below shows AT+CCLK results.
Sets the alarm of the desired time for the modem. This command has variety of options to tackle with the alarm. The purpose for this command is used to set the alarm to turn ON the power of the modem, as the alarm timer gets UP. To set the alarm, proper format is required as shown in the figure below.
This command turns the power OFF of the modem. As the Modem 300z is not hot removal, so we need to turn OFF the modem, while switching to another network.Figure below shows AT+CPOWD Hyper-terminal Demonstration.
When we turn OFF the modem, and ON it through the alarm, we need to set its phone functionality to ‘1’, to attain full phone functionality.Figure shows AT+CFUN Hyper-terminal Demonstration.
It selects the memory sim/phone to access the messages. The memory is divided into three parts. The response shows the total memory and used memory.
It deletes the message specified, from the sim/phone memory.
The message format needs to be decided, whether to be in PDU or TEXT mode. PDU mode is selected through ‘0’ whereas TEXT mode by ‘1’.
The message can be read by using above mention command, by just specifying the number of the message to be read.
This command sets a timer for the sim, the minimum time that the sim should get a response. It can be set from 1sec to 3600sec.
This command is used in the STK toolkit, to keep check on the reported errors.
The command sets integer for the number of bytes of data and the data in hexadecimal notation. Just like an initialization of sim.
This command is used to excess the next menu, by entering the ID returned from previous Instruction.
To access the main menu of any sim, we can use this command by just specifying the menu number. As a response sub menu are listed.
To send data to a specific menu or on the network. The menu number should also be given in the command.
Another demonstration to show the use of this command, by sending the message on the network
This is all about this article on AT commands introduction and implementation. I hope that after reading this article you will be able to use AT commands in your gsm based projects. let me know if you came across any issue while using these commands in your project. You may also check wireless temperature sensor using gsm. Good luck 🙂