AT Commands

Everything you need to know about AT Commands

AT Commands (abbreviated from Attention Commands) are the way to control cellular modems. It provides a standardized way to instruct modems on how to behave and where to connect to.

Even though the commands are standardized by the 3GPP, different modems adhere to different versions of the specifications and manufacturers may provide additional vendor-specific AT Commands. Hence we recommend to keep the AT Commands manual of your modem manufacturer close when configuring your cellular modem.

AT Commands Basics

AT Commands usually start with AT, followed by a <command> and in some cases a <value>.

There are 4 types of AT Commands: Set, Read, Test and Execute.

  • Set AT+<command>=<value> Instruct the modem to perform an action, such as activating the modem or enabling roaming. For example, the command to set the modem to active is: AT+CFUN=1

  • Read AT+<command>? Check the current configuration settings of the cellular modem. For example to read the network and cellular technology the modem is using, enter: AT+COPS?

  • Test AT+<command>=? Test the possible input values for specific commands. For example to list the available modes of operations modem, enter: AT+CFUN=?

  • Execute AT+<x> Some commands can be simply executed. For example, the command to check and return the signal quality: AT+CSQ

Pro tip: It is possible to send multiple AT Commands to the modem at the same time. To do so, list the commands in one line separated by a semi column ;, only write AT at the start of the first command.

For examples: AT+CMEE=2;+CPIN?;+CIMI

Connect to the modem

In order to send AT Commands, you need to connect to the modem first. You may need a program which provides the interface between your computer and the modem. You can use minicom, screen or miniterm for Linux/MacOS or PuTTY for Windows. When using Windows, you might need to install a driver to establish a connection. Have a look at the modem manufacturer's website for details about a possible driver.

To test if the connection with the cellular modem has been established, enter AT. When the modem responds with OK you're set.

Before you get start started

Not all modems support the AT Commands listed in the examples in this page. For details, always check the AT Command manual of your specific cellular modem.

Before starting the configuration process, reset the modem to its default configuration and activate the modem:

AT Command

AT+CFUN=1,1

Response

OK

Set the error reporting to verbose, resulting in more descriptive error messages:

AT Command

AT+CMEE=2

Response

OK

Check the status of the SIM card. If you receive an error, the SIM may not be inserted well, or the SIM is locked with a PIN. By default, Monogoto SIMs are not PIN protected.

AT Command

AT+CPIN?

Expected response

+CPIN: READY

OK

Query device information

Request the modem hardware version

AT Command

AT+CGMM

Example response

SARA-R412M-02B

OK

Request the modem firmware version

AT Command

AT+CGMR

Example response

M0.12.00 [Dec 01 2030 12:00:00]

OK

Make sure you run the latest modem firmware version possible. Compare the response with the latest version published by your modem manufacturer.

Request the IMSI (International Mobile Subscriber Identity):

AT Command

AT+CIMI

Example response

XXXXXXXXXXXXXXX

OK

Request the ICCID (Integrated Circuit Card ID), which is the identification number of the SIM card:

AT Command

AT+CCID

Example response

+CCID: XXXXXXXXXXXXXXXXXXXX

OK

Network provider and cellular technology settings

The AT Command related to the Network Provider and cellular technology: AT+COPS

Syntax: AT+COPS=<mode>,<format>,<oper>,<AcT>

mode

Network Selection Mode. Use 0 for automatic, 1 for manual

format

0 for long alphanumeric (e.g. vodafone NL), 1 for short alphanumeric (e.g. voda NL), 2 for numeric/MCCMNC codes (e.g. 20404)

oper

Operator, to be defined as long alphanumeric, short alphanumeric or numeric

AcT

Access Technology. It depends on the modem which value represent which technology, usually the values are:

0 for GSM, 3 for GSM/GPRS/EDGE, 7 for LTE/LTE Cat-M1, 9 for NB-IoT

Read the operator and access technology:

AT Command

AT+COPS?

Example response

+COPS: 0,0,"vodafone NL",7

OK

The test command lets the modem perform a network scan:

AT Command

AT+COPS=?

Example response

+COPS: (1,"NL KPN","NL KPN","20408",7),(1,"vodafone NL","voda NL","20404",0),(1,"T-Mobile NL","TMO NL","20416",0),(1,"T-Mobile NL","TMO NL","20416",7),(1,"vodafone NL","voda NL","20404",7),(1,"NL KPN","NL KPN","20408",0),,(0,1,2,3,4),(0,1,2)

OK

Be patient, it may take several minutes before the modem responds, you cannot send any AT Commands in the meantime.

Set the network and technology parameters

Automatic operator and AcT selection:

AT+COPS=0

Automatic operator and manual AcT selection:

AT+COPS=0,0,<AcT> Example: AT+COPS=0,0,7

Manual operator selection, automatic AcT selection:

T+COPS=1,2,<MMCMNC> Example: AT+COPS=1,2,20404

Manual operator and AcT selection:

AT+COPS=1,2,<MMCMNC>,<AcT> Example: AT+COPS=1,2,20404,7

Response

OK

To find which of the networks Monogoto has roaming agreements with, review the Coverage lists.​

Check the radio signal strength and signal quality:

AT Command

AT+CSQ

Example response

+CSQ: 25,5

OK

+CSQ returns 2 values separated by a comma. The first value represents the signal strength and provides a value between 0 and 31; higher numbers indicate better signal strength. The second value represents the signal quality indicated by a value between 0 and 7. If AT+CSQ returns 99, the signal is undetectable or unknown.

Network Configuration

Set the APN to data.mono:

AT Command

AT+CGDCONT=1,"IP","data.mono"

Response

OK

Read the APN configuration:

AT Command

AT+CGDCONT?

Expected response

+CGDCONT: 1,"IP","data.mono","0.0.0.0",0,0,0,0,0,0

Set the PDP (packet data protocol) context to active:

AT Command

AT+CGACT=1,1

Response

OK

Read if the PDP context is set correctly:

AT Command

AT+CGACT?

Expected response

+CGACT: 1,1

OK

Read network status:

AT Command

AT+CEREG?

Expected response

+CEREG: 0,5

OK

The second variable indicates the status: 0: Not registered 1: Registered, home network 2: Not registered, but the modem is trying to connect 3: Registration denied 4: Unknown (for example, out of coverage) 5: Registered, roaming 90: Not registered due to UICC failure

Validate if your device received an IP address:

AT Command

AT+CGPADDR

Example response

+CGPADDR: 1,10.XXX.XX.XXX

OK

Do you see an IP address? Congratulations! 🎉 You’ve successfully connected your cellular modem to Monogoto. Have a look at the Things logs in the Monogoto Console to find more details about the established connection.

Last updated