AT Commands Cheat Sheet for Cellular IoT Communication


The very thing that provides connectivity to your IoT devices is: a modem. Naturally the first step of entering the Internet of Things is connecting your hardware to a modem. This connection is achieved with the help of a set of commands called AT commands. In this blog post, you will find a cheat sheet of AT commands to get started with your cellular IoT solutions.

AT commands are nothing but an interface between your hardware - the micro controller of your IoT device - and the cellular modem through a serial interface. These are commands based on the 3GPP standard as well as custom commands based on the modem manufacturer. These commands mainly have four functions:

  1. Test AT+<x>=?  :  Checks supported services of the modem (e.g. list supported SMS modes, list supported PDP states)
  2. Read AT+<x>? : Returns the settings of the modem  (IMEI, firmware version)
  3. Write AT+<x>=<...>: Sets the user-definable parameter values of the modem (e.g., set SMS text mode)
  4. Execute AT+<x> : Reads information about the network or its status (e.g. Display name of registered network)

There are several tools that can be used to send AT commands to your cellular modules. The most common one is minicom - a text based application that runs on Linux. It supports commands over USB and UART. There are several UI based applications available as well, like TerraTerm, YAT, CuteCom depending on th OS of your device.

Let's quickly go through the most basic commands that you will need to set up a connection using your cellular modem.

  1. Check Communication AT
  2. Get IMEI AT+GSN
  3. Is SIM ready AT+CPIN?
  4. Get SIM identity AT+CIMI , AT+CCID
  5. Select network - Automatic AT+COPS=0
  6. Select network - Manual AT+COPS=1
  7. Network Status AT+CREG?
  9. Signal strength AT+CSQ
  10. Send Data AT+CGDATA
  11. Set SMS format AT+CMGF
  12. Errors AT+CMEE=2

* Note: Before you start sending AT commands to your modem, be sure the check the port your modem is connected to as well as the baudrate and open the minicom application accordingly.
For e.g., if your modem is connected via USB and baudrate 115200

sudo minicom -b 115200 -D /dev/ttyUSB2

If your modem is connected via UART and baudrate 115200

sudo minicom -b 115200 -D /dev/ttyS0

Check communication with the modem


This command indicates that you are connected to the modem and can send it AT commands. The 'OK' represents that the modem has read the command and acknowledged it.

Get the IMEI of the modem

<IMEI of the modem >


This command gives the International Mobile Equipment Identity (IMEI) of the module. This is a unique number used to identify the modem and can be used for security features like locking a SIM to a specific IMEI.

Is the SIM card ready and does SIM require a password?

Once you insert the SIM card, you can check if the SIM card properly inserted command and whether the SIM needs a PIN.


This command is used to check whether the SIM needs a PIN. If the response is READY, you do not need a PIN and the SIM is ready to use.

SIM identity

You can identify the SIM by its IMSI or its ICCID. To get these from the modem, you can use the following commands.

295050901183774			//IMSI of the SIM

+CCID:8988303000005737285		// ICCID of the SIM


Network selection - Automatic

Once you have identified the SIM, you can set it to automatically search for a network or manually search for one. To select a network automatically, you can send the following command.



The '0' here indicates Automatic mode. When you select the Automatic mode, the modem scans for networks in order defined by the module manufacturer. You can also change this order. For e.g, the order can be  : LTE Cat M1 > LTE Cat NB1 > GSM.

Network selection - Manual

As indicated above, you can manually scan specific networks you want to connect to. To list available networks, you can use the above command in the read mode.

+COPS: 0,0," EMnify",0


What this response tells you is that the modem is in Automatic selection of operator mode and is connected to Vodafone Germany through EMnify.

To manually select this network, you can send the above command in the following format:
 AT+COPS = <mode>,<format>,<operator> where mode =1- Manual operator selection method, format =0- Alphanumeric representation of selected operator and operator =" EMnify"  - Operator name you want to select.  If you set the format to '2', you can refer to the operator with its numeric identification instead of the string value

AT+COPS= 1,0,""

Network Status

Once you select either of the modes, give it a minute and you can check the network registration status.

+CREG: 0,5


What this command tells you is - the SIM is registered and roaming is enabled. You can check other response codes and their meanings in the data sheets provided by your cellular module maker.

Setting the APN

Now that you know that the modem is connected to the EMnify network, you can set the APN to "em" or "emnify"



Here you are specifying that the packet data protocol type for the first PDP context definition is "IPv4", the APN is "em" and the target IP address is "". You can set several PDP context definitions with different APN s and different target IP addresses. In fact, you can also set the target IP address by using the AT+CGPADDR command using the same number scheme as the PDP context definitions and specify the definition you want to use while activating the PDP context. Here the PDP context is nothing but the data channel you will open to send data over the internet connection.

Signal Quality

The signal quality of the network is essential to know if you want to switch to another network or determining battery consumption (need input here). You can get the signal quality with the help of a simple command

+CSQ: 16,99


The response format is [RSSI(Received Signal Strength Indicator) ,BER]. Below are the possible values and explanations for the two.  For context - any RSSI value lower than -80dBm is considered poor signal strength although you can still work with a  -93dBm. As for BER, the lower the value, the better.

RSSI : Received Signal Strength Indicator

  • 0  : -113dBm or less
  • 1 : -111dBm
  • 2 to 30 : -109 to -53dBm
  • 31 : -51 dBm or greater
  • 99 : Nor known or not detectable

BER : Channel Bit Error Rate (in percent)

  • 0  : less than 0.2%
  • 1 : 0.2% to 0.4%
  • 2  : 0.4% to 0.8%
  • 3 : 0.8% to 1.6%
  • 4 : 1.6% to 3.2%
  • 5 : 3.2% to 6.4%
  • 6 : 6.4% to 12.8%
  • 7 : more than 12.8%
  • 99 : Nor known or not detectable

SMS format

To send an SMS, you need to first specify the format of the SMS. The two possible formats are 0 - PDU (Protocol Description Unit) mode and 1 - Text mode where the PDU mode sends the message in a binary format and the Text mode, as the name suggests, sends it in the text format. 

To set the message format to text mode, send the following command.


Sending Data

To start sending data over the modem, you need to activate the PDP context (data session) definitions you have set up before.


The format of this command is AT+CGDATA= L2P,cid  where L2P is the layer 2 protocol which can be "PPP", "M-RAW_IP" etc., and CId  is the numeric identifier of the saved PDP context definition. By sending this command, you can activate the data channel and start sending data.

Error messages

In the previous commands, if there is an error in detecting the SIM or entering the PIN, the response you get is just the word "ERROR". To get a better error response, you need to enable the error code with numeric values or with string. So, an error in the above command will look like this

AT+CMEE=1 // Enable error codes with numeric values
+CME ERROR: 11 //(U)SIM PIN required
AT+CMEE=2 //Enable error codes with string values

+CME ERROR: SIM not inserted

This can help you debug properly and make sure that you can use the SIM card successfully.

These were the basic AT-Commands to get you going. With these commands you can make sure your device is connected to the network and get the details of the network you are connected to. Hope this helps you get get started with AT commands. There are several other AT commands that you can use for specific tasks. You will find these in the datasheet of your cellular module.

Until next time, Stay Connected!