Introduction to AT Commands: Controlling Modems with Text
AT Commands
Many of us know that mobile/devices silently in automatic manner communicate over vast networks, but may not know the magic behind is few lines of plain text in a sequence controlling the modem. As development or testing engineer when we are working with IoT systems, debugging network issues, or automating SMS-based alerts, AT Commands are your go-to language for talking to Modem.
In this post, we will discuss from the origins of AT Commands to their critical role in today’s 4G and 5G-based applications, with examples and insights for modern developers/testers. Whether you’re working with legacy GSM devices or advanced 5G modules, AT Commands remain the core communication method between microcontrollers or PCs and cellular modems.
What Are AT Commands?
AT Commands (short for Attention Commands) are simple text-based instructions used to control modems. They allow you to send SMS, dial phone numbers, access network parameters, and interact with IoT modules—all via a serial or USB interface.
Every AT Command begins with the prefix AT, signaling the modem to listen and prepare for instruction.
Example:
AT+CSQ // Checks signal quality
AT+CMGF=1 // Set SMS mode to text
In modern 4G/5G and IoT systems, AT Commands can be used to:
- Establish and manage data sessions
- Read SIM and device information
- Monitor signal and registration status
- Send/receive SMS and MMS
- Manage TCP/IP and GPS functions
AT Commands A Brief History
AT Commands, first introduced in 1981 by Dennis Hayes, where it was part of the Hayes 300 Baud Smart Modem. It was started as a method to manage dial-up communication and now become a universal control language for modems used in smartphones, routers, IoT devices, and many more.
AT commands have evolved with technology from making simple phone/SMS calls on early mobile phones to querying GPS and managing 5G links also maintaining backward compatibility.
Why Are AT Command Still Relevant?
Despite having new libraries, SDKs, and cloud integrations, AT commands offer:
- Simplicity – No need for heavy software layers
- Universality – Works across vendors and modules
- Low Bandwidth – Perfect for constrained or embedded systems
- Remote Access – Great for diagnostics and configuration in the field
How Are AT Commands Sent?
Modems don’t need fancy GUIs—they just need a PC/ Microcontroller (Raspberry Pi) kind of device to send them text commands through some of following common Interfaces.
- UART (Serial) – Microcontrollers like Arduino or ESP32
- USB – PC tools and Raspberry Pi-based applications
- Wireless APIs – For remote diagnostics or OTA control
Each command is followed by a carriage return (\r), and the modem responds with a result code like OK, ERROR, or data output (e.g., +CSQ: 20,99).
AT Commands Syntax and Types
AT commands follow a basic structure:
AT<COMMAND><SUFFIX><DATA>
- AT – Required prefix
- COMMAND – Function name (e.g., +CMGS for send SMS)
- SUFFIX – Indicates type (Test, Read, Set, Execute)
- DATA – Parameters for the command
There are following four types of AT commands available
Type | Suffix | Use Case | Example |
---|---|---|---|
Test | =? |
Check if a command is supported | AT+CSQ=? |
Read | ? |
Read current setting or value | AT+COPS? |
Set | = |
Configure a setting | AT+CMGF=1 |
Exec | (none) | Perform an action (e.g., dial) | ATD123456789; |
Real-World Use Cases Developers use AT Commands
Developers/testers can use AT Commands in a variety of domains:
- IoT & Embedded Systems
- Setup GPRS/LTE sessions for sensors
- Trigger cloud uploads via MQTT
- Retrieve GPS coordinates from asset trackers
- Automotive/Telematics
- Fetch vehicle location data over LTE/5G
- SMS alerts on crash/failure conditions
- Industrial Automation
- Modem-based control of PLCs
- Remote diagnostics in inaccessible areas
Commonly Used AT Commands
Command | Function |
---|---|
AT+CSQ |
Signal strength check |
AT+CREG? |
Network registration status |
AT+CGATT? |
Packet-switched data attach status |
AT+CMGF=1 |
SMS text mode |
AT+CMGS |
Send SMS |
AT+COPS? |
Operator info |
AT Command Response Codes Meaning
Once an AT command is sent, modems may return following result code.
- OK – Success
- ERROR – Invalid syntax or unsupported command
- +CME ERROR – Extended error with specific cause
- NO CARRIER, BUSY, CONNECT – Call/data states
If you get ERROR, it might be because:
- The modem doesn’t support the command
- Incorrect syntax
- Trying to change settings while active
Tips for Developers
- Read the AT Command Manual of your module e.g., Quectel, SIMCom, etc.
- Use a serial monitor tool like PuTTY or TeraTerm to manually test commands.
- Automate commands with Python, Node.js, or C using serial libraries.
- Log and parse responses for robust error handling.
Conclusion
AT Commands are a deceptively simple yet powerful tool. Whether you’re building a prototype or deploying devices at scale, this text-based interface helps you control, configure, and communicate with your modem—without the need for complex firmware or GUIs.
In a world dominated by cloud dashboards and wireless APIs, AT Commands remain the root-level language of machines—lean, efficient, and incredibly effective.
Related Post
- 4G Important QXDM Log | QXDM Tool
- QXDM Tool – How to use QXDM ?
- Modem Test Engineer Interview Question – Apple, Qualcomm
- 50 + Top RF Planning and Optimization Interview Question