AT Commands
AT commands are text-based instructions sent to a modem (communication module) over a serial interface. They are used to control the modem's behavior, check its status, and configure its connection settings. The name comes from the word "attention" - each command begins with the prefix AT to signal the modem that an instruction follows.
AT commands are standardized by 3GPP and ETSI, which means that a core set of commands works across modems from different manufacturers. However, each manufacturer may also provide additional vendor-specific commands. This page covers the generic, standards-based commands that apply to most cellular modems.
Overview
When working with cellular IoT devices, you may need to interact directly with the modem to:
- Verify that the modem detects the SIM and reads its identity
- Check whether the modem is registered to a network
- Inspect the signal quality at the device's location
- View or change the selected network operator
- Configure the APN (Access Point Name) and data connection settings
- Enable or disable modem functionality
AT commands give you direct control over these operations, making them essential for initial device setup, troubleshooting connectivity issues, and verifying modem behavior in the field.
Accessing the AT Command Interface
To send AT commands, you need a serial or USB connection between your computer (or terminal) and the modem. The typical setup involves:
- Connect your computer to the modem's serial or USB interface using an appropriate cable or adapter.
- Open a serial terminal application and connect to the correct port at the modem's configured baud rate.
Common serial terminal applications include:
- Windows: PuTTY or Tera Term, connected to the COM port where the modem is attached.
- macOS / Linux: The
screenorminicomcommand, connected to a device file such as/dev/tty.usbmodem*or/dev/ttyUSB*. For example:screen /dev/ttyUSB0 115200orminicom -D /dev/ttyUSB0 -b 115200.
Some devices also provide access to the AT command interface through a built-in console, web interface, or debug port. Check your device's documentation for details.
Not all devices expose the modem's serial interface. If you are unsure whether your device allows direct access, review the device manual or contact the device manufacturer.
Soracom does not provide a way to send AT commands to a modem that does not already support them. While Soracom offers remote access services that can be used to reach a device over the network, these services only work if the device itself natively supports and has been configured for remote access to its AT command interface. The ability to execute AT commands depends entirely on your device's capabilities and configuration.
Command Format and Responses
Every AT command starts with the AT prefix and ends with a carriage return. Commands are not case-sensitive, but uppercase is conventional.
There are three standard forms for most commands:
| Form | Syntax | Purpose |
|---|---|---|
| Test | AT+CMD=? |
Query the range of supported parameters |
| Read | AT+CMD? |
Query the current value or setting |
| Write | AT+CMD=<value> |
Set a new value |
After you send a command, the modem responds with one of the following:
OKindicates the command was accepted and executed successfully.ERRORor+CME ERROR: <code>indicates the command failed. The error code provides details about what went wrong. By default, some modems return only a genericERRORresponse. SettingAT+CMEE=2configures the modem to return readable error descriptions instead of numeric codes, which can simplify troubleshooting. Look up CME error codes in your modem's AT command manual for specific details about each error.
Some commands produce one or more lines of output before the final OK or ERROR response. For example, AT+CSQ responds with +CSQ: 15,99 followed by OK on a separate line.
Safety Considerations
Before sending AT commands, be aware of the following:
- Persistent settings: Some commands change modem settings that survive a reboot. Incorrect values can affect the modem's ability to connect until they are corrected.
- Connection loss: Commands such as
AT+CFUN=0disable the modem's radio, which immediately drops any active connection. If you are connected to the device remotely, this can make it unreachable. - Network disruption: Changing the APN, authentication, or operator selection to incorrect values can prevent the modem from reconnecting to the network.
- Read before write: Use the read form (
AT+CMD?) before using the write form (AT+CMD=<value>) so you understand the current configuration before changing it.
Always have your modem's AT command manual available. Incorrect parameters can leave the modem in a state that requires a factory reset to recover. If you are unsure about a command or its parameters, consult the manual or contact the modem manufacturer before proceeding.
Common AT Commands
The following commands are defined by 3GPP standards and are supported by most cellular modems. For each command, the expected response format and key values to look for are described.
Modem and SIM Identification
ATI
Display modem identification information.
ATI
Quectel
BG96
Revision: BG96MAR02A07M1G
OK
The response format varies by manufacturer but typically includes the modem model and firmware version.
AT+CIMI
Display the IMSI (International Mobile Subscriber Identity) stored on the SIM.
AT+CIMI
295050012345678
OK
The response should be a 15-digit number that matches the IMSI of your Soracom IoT SIM.
AT+CCID
Display the ICCID (Integrated Circuit Card Identifier) of the SIM.
AT+CCID
+CCID: 8942310000012345678
OK
The response should be a 19- or 20-digit number that matches the ICCID of your Soracom IoT SIM.
Modem Functionality
AT+CFUN?
Query the current modem functionality level.
AT+CFUN?
+CFUN: 1
OK
A value of 1 means full functionality is enabled (radio on). A value of 0 means the radio is disabled.
AT+CFUN=1
Enable full modem functionality (turn on the radio).
AT+CFUN=1
OK
AT+CFUN=4
Enable flight mode. The radio is turned off, but the SIM remains accessible. This is useful when you need to read SIM data or change modem configuration without maintaining a network connection.
AT+CFUN=4
OK
Network Operator Selection
When specifying an operator in AT+COPS commands, always use the numeric PLMN format (2) rather than the alphanumeric name. Alphanumeric operator names can vary between regions, firmware versions, and network configurations. For example, a device configured to select "Verizon" may fail to connect in locations where the network identifies itself as "Verizon Wireless". Numeric PLMN codes are standardized and do not change, so using AT+COPS=X,2,"PLMN" avoids these issues.
AT+COPS=?
Scan for available network operators. This command typically takes 2-3 minutes to complete.
AT+COPS=?
+COPS: (2,"T-Mobile","T-Mo","310260",7),(1,"AT&T","AT&T","310410",7)
OK
Each entry in the response includes the operator name and a numeric PLMN code (MCC + MNC).
AT+COPS?
Display the currently selected network operator.
AT+COPS?
+COPS: 0,0,"T-Mobile"
OK
AT+COPS=1,2,"<PLMN>"
Manually select a network operator by its PLMN code. For example, to select AT&T in the United States:
AT+COPS=1,2,"310410"
OK
The parameters are: 1 = manual selection mode, 2 = numeric PLMN format.
Using manual selection mode overrides all network steering, including preferences configured with AT+CPOL. The modem will not select any other network, even if the specified operator becomes unavailable. This can lock you out if there are problems or changes related to that network.
In most cases, using AT+COPS=4,2,"<PLMN>" (manual with automatic fallback) is preferred over AT+COPS=1, as it allows the modem to automatically select an alternative operator if the specified one is unavailable.
AT+COPS=0
Return to automatic network operator selection.
AT+COPS=0
OK
AT+COPS=3,<format>
Set the format used when displaying operator information in AT+COPS? responses, without changing the current operator selection. The format values are:
| Format | Display Type |
|---|---|
0 |
Long alphanumeric (e.g., "T-Mobile") |
1 |
Short alphanumeric (e.g., "T-Mo") |
2 |
Numeric PLMN (e.g., "310260") |
For example, to display the operator as a numeric PLMN code:
AT+COPS=3,2
OK
AT+COPS?
+COPS: 0,2,"310260"
OK
AT+COPS=4,2,"<PLMN>"
Attempt manual operator selection first, and fall back to automatic selection if the manual selection fails. This is useful when you prefer a specific operator but want the modem to find an alternative if that operator is unavailable.
AT+COPS=4,2,"310410"
OK
The parameters follow the same format as manual selection (AT+COPS=1), but with mode 4 instead of 1.
AT+CPLS and AT+CPOL
These commands allow you to view and configure the UPLMN (User-controlled PLMN selector with Access Technology) list stored on the SIM. The UPLMN list defines which network operators the modem should prefer when searching for networks, and which radio access technologies to use with each operator.
AT+CPLS selects which PLMN list subsequent AT+CPOL commands will read or modify:
| Value | List | Description |
|---|---|---|
0 |
UPLMN | User-controlled preferred list (read/write) |
1 |
OPLMN | Operator-controlled preferred list (read only) |
2 |
HPLMN | Home PLMN list (read only) |
AT+CPOL? displays the entries in the currently selected PLMN list.
AT+CPOL= adds or modifies entries in the UPLMN list. The parameters are: slot number, format (2 = numeric PLMN), PLMN code, followed by flags for each supported radio access technology.
For example, to configure the UPLMN list with T-Mobile US on all radio access technologies and AT&T on 4G only:
AT+CPLS=0
OK
AT+CPOL=1,2,"310260",1,0,1,1
OK
AT+CPOL=2,2,"310410",0,0,0,1
OK
The radio access technology flags in AT+CPOL are positional:
| Position | Radio Access Technology |
|---|---|
| 1st | 2G (GSM) |
| 2nd | GSM Compact (legacy, typically set to 0) |
| 3rd | 3G (UTRAN) |
| 4th | 4G (LTE, LTE-M, and NB-IoT) |
A value of 1 enables the radio access technology and 0 disables it. In the example above, T-Mobile is configured with 2G, 3G, and 4G enabled (1,0,1,1), while AT&T is configured with 4G only (0,0,0,1).
Modifying the UPLMN list changes persistent SIM data. The OPLMN and HPLMN lists are read-only and cannot be modified with AT+CPOL.
Network Registration
AT+CREG?
Check network registration status (2G/3G networks).
AT+CREG?
+CREG: 0,5
OK
AT+CEREG?
Check network registration status (4G/LTE networks).
AT+CEREG?
+CEREG: 0,5
OK
In both responses, the second value indicates the registration status:
| Value | Meaning |
|---|---|
0 |
Not registered, not searching |
1 |
Registered, home network |
2 |
Not registered, searching |
3 |
Registration denied |
5 |
Registered, roaming |
When using a Soracom IoT SIM with a global coverage plan such as plan01s, the expected value is 5 (registered, roaming). For plans with local coverage, the expected value is 1 (registered, home network).
Signal Quality
AT+CSQ
Query signal strength (RSSI) and bit error rate.
AT+CSQ
+CSQ: 15,99
OK
The first value is the RSSI index:
| RSSI Value | Approximate Signal Strength |
|---|---|
0-9 |
Poor (below -95 dBm) |
10-14 |
Fair (-95 to -85 dBm) |
15-19 |
Good (-85 to -75 dBm) |
20-31 |
Excellent (above -75 dBm) |
99 |
Unknown or not detectable |
The second value is the bit error rate. A value of 99 means it is not available, which is normal for most network types.
AT+CESQ
Query extended signal quality measurements. This command provides more detailed metrics than AT+CSQ, including values specific to 3G and 4G networks.
AT+CESQ
+CESQ: 99,99,255,255,20,55
OK
The response contains six values:
| Position | Metric | Network Type |
|---|---|---|
| 1st | RXLEV (received signal level) | 2G |
| 2nd | BER (bit error rate) | 2G |
| 3rd | RSCP (received signal code power) | 3G |
| 4th | Ec/No (energy per chip to noise ratio) | 3G |
| 5th | RSRQ (reference signal received quality) | 4G |
| 6th | RSRP (reference signal received power) | 4G |
Values of 99 or 255 indicate that the measurement is not available, which is expected for metrics that do not apply to the current network type. In the example above, the device is connected to a 4G network, so only RSRQ and RSRP contain valid measurements.
For RSRP, higher values indicate stronger signal:
| RSRP Value | Approximate Signal Strength |
|---|---|
0-30 |
Poor |
31-50 |
Fair |
51-70 |
Good |
71-97 |
Excellent |
AT+CESQ is defined in 3GPP TS 27.007 and supported by most modern modems, but some older modems may not support it. If the command returns an error, use AT+CSQ instead or check your modem's AT command manual for a vendor-specific alternative.
APN and Data Connection
AT+CGDCONT?
Query the current PDP context configuration.
AT+CGDCONT?
+CGDCONT: 1,"IP","soracom.io","",0,0
OK
AT+CGDCONT=1,"IP","soracom.io"
Define a PDP (Packet Data Protocol) context with Soracom's APN settings. This saves the configuration to PDP context slot 1.
AT+CGDCONT=1,"IP","soracom.io"
OK
AT+CGAUTH=1,2,"sora","sora"
Set CHAP (Challenge-Handshake Authentication Protocol) authentication credentials for PDP context 1. The parameters are: 1 = PDP context identifier, 2 = CHAP authentication type, followed by the username and password.
AT+CGAUTH=1,2,"sora","sora"
OK
For Soracom APN settings including the APN name, username, password, and authentication type, see Service Endpoints.
AT+CGATT?
Check whether the modem is attached to the packet domain.
AT+CGATT?
+CGATT: 1
OK
A value of 1 means the modem is attached. A value of 0 means it is not attached.
AT+CGACT?
Check whether a PDP context is activated.
AT+CGACT?
+CGACT: 1,1
OK
The first value is the PDP context identifier and the second value is the activation status. 1 = activated, 0 = deactivated.
AT+CGPADDR=1
Display the IP address assigned to PDP context 1.
AT+CGPADDR=1
+CGPADDR: 1,"10.0.123.45"
OK
If the modem has been assigned an IP address, the data connection is established and the device should be able to send and receive data.
Generic vs. Manufacturer-Specific Commands
The commands described above are defined by 3GPP standards and are supported by most cellular modems. However, modem manufacturers often provide additional proprietary commands that offer:
- More detailed diagnostic information (such as serving cell details, band information, or connection quality metrics)
- Simplified configuration for device-specific features
- Access to hardware-specific functionality not covered by the 3GPP standard
For the full set of commands available on your modem, refer to the AT command manual published by your modem's manufacturer. If you cannot find the manual, contact the manufacturer directly.
Example: Generic vs. Vendor-Specific Signal Information
The generic AT+CSQ command returns a basic signal strength index:
AT+CSQ
+CSQ: 15,99
OK
This provides a general indication of signal strength but limited detail. Some modem manufacturers offer proprietary commands that return much more detailed information. For example, a vendor-specific command might return the serving cell details including the frequency band, channel number, and multiple signal quality measurements such as RSRP, RSRQ, and SINR:
AT+VENDORCMD="servingcell"
+VENDORCMD: "servingcell","NOCHANGE","LTE","FDD",310,260,BFD3,318E202,100,7,5,5,-95,-8,15,25
OK
The vendor-specific command shown above is a fictional example for illustration purposes. The actual command name, syntax, and output format will differ depending on your modem manufacturer and model. Refer to your modem's AT command manual for the correct command.