A beginner’s guide to AT commands

Tags: IoT
A picture of Muhammad Hashaam
Written by
Muhammad Hashaam

The world of IoT and cellular connectivity is full of complex features, uses, and industry-specific jargon. Today we want to introduce and explain everything behind the term "AT commands" and how these commands can simplify communication with your cellular module.

"Attention Commands" (AT commands) are simple commands used to control and configure IoT devices. These commands can be sent to the device via a serial port, text, or a connectivity management platform (like 1oT Terminal). They can be used to change device settings, get a status update, reboot the device, and perform other functions.

One of the main advantages of using AT commands is that they are supported by many IoT devices. Consider AT commands as a powerful tool for communicating with and controlling IoT modules, as they provide a simple and easy-to-use interface for interacting with the device and can be used in a variety of applications.

AT commands are useful in several cases:

  • Remote management: Configure, monitor, and control IoT devices with ease, no matter how far from you the devices are deployed.
  • Configuration: Set up the device's network settings, security settings, and other parameters.
  • Monitoring: Check the device's firmware version, battery level, signal strength, and network status.
  • Diagnostics: Diagnose and troubleshoot problems, like looking into issues with connectivity or identifying the cause of a device failure.
  • Control: Have full control over your IoT module by exchanging data with your device.
  • Automation: Schedule updates or trigger actions based on pre-set conditions.
  • Firmware updates: Update the device, add new features, or fix bugs with ease.

AT commands are very popular when device troubleshooting is required.

Let’s now go through some of the most frequently used commands with Quectel EC25 as an example.

1. Restarting the Device

For IoT devices, one of the most important steps to fix a problem is to reboot the device. This will solve most of the problems related to the device.

To restart the Quectel EC25 cellular module, you can use the AT+CFUN command.

  • To do a full restart of the device, you can use the command, AT+CFUN=0. This command sets the device to minimum functionality, effectively shutting it down.
  • You can also use the command, AT+CFUN=1 to restart the device and set it back to full functionality.

Note: Please note that a value of "1" means full functionality, while a value of "0" means minimum functionality. You can restart the device by setting the functionality to minimum and then back to full.

2. Enabling the Roaming services

Roaming services are essential in IoT modules as they allow devices to seamlessly connect to different networks when they move between geographic locations.

AT command to enable roaming services on the Quectel EC25 module is AT+QCFG="roamservice",1

Note: It should be noted that this command is used to configure the roaming service status. It does not configure the roaming network itself. The device may need additional configurations like a proper APN and credentials for the roaming network. Also, the device must be registered to the network before enabling roaming.

3. Selecting the cellular network manually/automatically

AT commands can also improve overall performance and reliability and ensure that the device is connected to the best available network. This can be done by manually selecting the best available network, setting the device to automatic network selection, or getting the list of available networks.

The following AT commands can be used for automatic/manual network selection and checking the available network operators in Quectel EC25;

  • Automatic Network Selection: AT+COPS=0
  • Manual Network Selection: AT+COPS=1,2,"MCC MNC" , Where MCC is (Mobile Country Code) and MNC is (Mobile Network Code).
  • List of currently available network operators: AT+COPS=?

Note: It's important to note that the exact options available and the format of the AT+COPS command may vary depending on the modem's firmware version and the network's specific requirements. It is recommended to consult the modem's firmware manual or the manufacturer's website for more detailed information on the correct AT command syntax for your specific use case.

4. Checking the network registration status of the module

Regularly checking the status of the IoT module can ensure that it is functioning properly and resolve any issues that may arise.

  • To check the network registration status of a Quectel EC25, AT+CREG? is used
  • To check the network availability, reporting of location, and network registration status, AT+CREG=2 is used

The response to the first command will be in the following format:

+CREG: <n>, <stat>

Where <n> is the status reporting mode (0, 1, or 2) and <stat> is the registration status:

  • 0: Not registered, module is not currently searching for a new operator to register to
  • 1: Registered, home network
  • 2: Not registered, but the module is currently searching for a new operator to register to
  • 3: Registration denied
  • 4: Unknown
  • 5: Registered, roaming

To send the AT command from the 1oT Terminal, type the command in the text box and click send. Visual shared below for assistance.

In summary, the AT commands have proven useful when you need to check your devices remotely. They are useful for setting up or configuring the device by simply sending a text message. The AT commands mentioned above are the most commonly used commands.

If you have any further questions about this topic or have difficulty understanding your own device's AT commands, please feel free to contact us at support@1oT.com.