AT Commands

AT Commands

Dec 25 2018

The key function of a modem is to take a digital signal and to encode it so it can be transmitted, either over an old-styled phone line or more recently over a wireless network. The first modems that existed were designed to allow computer Bulletin Board Systems (BBS’s) to communicate with users over a standard phone line. This was achieved by the user setting their computer to ‘originate’ mode, and then manually dialling the phone number of the BBS from their home phone. They would then either place the handset against a receiver unit or they might let the modem speak directly through the phone line. The computers would then be able to talk to each other over the phone line.

This approach was enough for a BBS in the 60’s and 70’s, but it had several limitations. The user was required to dial and hang up the line manually, and as the number of users on a network increased this became impractical. What was needed was a way for the computer to tell the modem which number to dial, and a way for the modem to end the call when it was completed.

Early modems solved this issue by adding a second COM port to the modem. One port would be used by the computer to send instructions – ‘Dial this number’, ‘Hang up’, etc. The other would be used to send data. This approach proved to be expensive, as many computers of the time did not have a second COM port and as it required the modem to be more powerful.

In 1981 Hayes Communication released a product called the Hayes Smartmodem. This modem solved the problem using a single COM port. The modem could be in one of two modes – in Command mode, the modem would receive so called ‘AT Commands’ which would instruct the modem to dial, hang up or configure itself. Once the call was established, the modem would be set to Data mode. In Data mode information can be sent across the phone line to the computer on the other end of the line. An escape sequence ‘+++’ would then be used to swap between data mode and command mode.

The Hayes modem proved to be a commercial success, and its command set was copied directly by many other manufacturers. The Hayes Command set, now referred to as ‘AT Commands’ became the defacto standard for serial modems. Manufacturers added to the command set, until today AT commands are used by practically all Cellular modems. AT commands are used, with some variation between manufacturers, to perform all functions from dialling a remote number to sending an SMS to querying the base station for a 4G module. Extensions of the Hayes command set were even used to control voicemail systems in analogue phones.

The basic commands of the Hayes Command set (henceforth referred to as AT commands) look like this:

Command Meaning Explanation
AT Attention Modem should respond ‘OK’. Confirms that the modem is connected and is working
+++ Escape Sequence Switches modem from Data mode to Command mode
ATD<NUMBER> Dial Phone Number Causes the modem to dial a phone number, and then enter data mode.
AT0 or ATA Answer incoming call Answer an incoming phone call
ATE<1/0> Enable/Disable Echo Enables or disables echo on the modem – this determines if the modem will echo back commands you send it to the users terminal for readability.
ATI <digit> Information Responds with information about the modem, such as manufacturer and model number.

 

There are other commands, but these are the most significant.

While each manufacturer added its own proprietary commands, the most useful of these proprietary commands would eventually get merged into the accepted standards. When 3G modems became available, more commands were added to interface with 3G devices:

Command Meaning Explanation
AT+CPIN SIM Pin Code Enter or set a pin to the installed SIM card.
AT+CSQ Signal Strength Measure the signal strength of the 3G modem.
AT+COPS=? List available networks Lists the available networks (Telstra, Vodaphone, etc)
AT+CGDCONT Enter PDP context Enter the PDP context (Packet Data Network). For example, AT+CGDCONT=1,”IP”,”APN”
AT+CMGF Set message format Changes the modem from Text mode to PDU mode (1 for text mode, 0 for pdu mode)
AT+CMGS Send text message Sends a text message.

 

This is only a small subset of the available commands. When working with AT commands, it is best to download a copy of the AT Commands Manual for your modem. At Intercel, we use multiple module providers to ensure that customers have plenty of options and to avoid any issues with any module or manufacturer. Our suppliers include Telit, Sierra and Quectel. Please contact us for more information on your particular use case.

Intercel’s SAM modems include an on-board processor running our own software. This software is designed to add additional smart commands to the modem and operates using our own AT commands. These are proprietary commands, as they add functions not standardised by 3GPP for 4G modems. These commands work in addition to commands offered by the module manufacturer.

The following commands are the most significant added by Intercel:

Command Meaning Explanation
AT$PARAMETERS Set parameters Sets the parameters for the modem’s smart software, such as password and APN. The modem can use these parameters to handle the module without any user interaction, and to dial automatically.
AT$TCPCONNECT Open TCP Port Used to ‘dial’ with TCP, like how a classic Hayes modem would dial a remote number.
AT$UDPCONNECT Open UDP Port Used to ‘dial’ with UDP, like how a classic Hayes modem would dial a remote number.
AT$DDNS Dynamic DNS Sets the modem to use DDNS for remote access
AT$ACCESS Remote Access Sets parameters for remote access
AT$LOGIN Remote Access Sets the login details for remote access
AT$VERSION Version Info Responds with the version of the Intercel Software running on the modem
AT$DOTA Update the modem Updates the modem remotely over the air
AT$GETLOG Reads the log Reads the log of events from the modem

AT Commands provide a standardised method for communicating with modems of all stripes. Because the command set applies to modems from the 80’s through to the modern era, it is well standardised and supported by all reputable vendors and software systems.

Intercel has a great deal of in-house experience and knowledge on AT commands. If you encounter issues communicating with our modems using AT commands, please contact us for support.

Tags: N/A