AT Commands are instructions that provide communication and control between any cellular modem and a host controller. Cellular modems can be controlled using special AT commands provided by the module manufacturer. There are several serial monitor tools that can be used to send AT commands to the cellular module. The most common is the minicom application on Linux. One can use Cutecom as GUI supported tool.
As long as the right configurations such as the device port, baud rate are selected right; any tool can be used. This tutorial will explain how to use the ATCom and Minicom tools. These tools can communicate with cellular modems on Sixfab HATs.
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. Use the built-in logs to identify the different serial ports on your system. Follow the steps below to find the name of your port(s).
Before connecting USB to your HAT, open Terminal and type the following command:
This should return all USB devices currently plugged into your computer. Now that we know which devices are not cellular modems, it will be easier to identify when plugged in.
Connect USB and run:
Whatever new entries appear is your cellular modem.
Alternatively, you can check dmesg:
In order to, send AT commands to a cellular device, one needs to check several parameters and might need a serial monitor tool. ATCom is a command-line interface tool that makes AT command operations easier.
pip3 is required to install the ATCom. pip3 can be intalled by
sudo apt install python3-pip
ATCom can be installed with pip3:
pip3 install atcom
Running ATCom without --port parameter, scans for available ports, and selects a valid modem port if available.
If you need to send " or ' character, you should use escape character \ before it.
Example: atcom AT+CGDCONT=1,\"IP\",\"internet\"
Configuration file(configs.yaml) can be created for persist args. ATCom first checks the current working directory for the configs.yml to read the arguments from. The path of the configuration file can also be specified using the --config parameter. The configuration file must be in yaml format, for example:
port: /dev/ttyUSB2 baudrate: 115200 timeout: 10
|-p / --port||-||PORT of modem|
|-b / --baudrate||115200||Baudrate for serial communication|
|-t / --timeout||10||Communication timeout|
|-c / --config||./configs.yaml||Configurations file Path|
|-v / --verbose||-||Enable full log output|
|--rts-cts||-||Enable RTS-CTS mode|
|--dsr-dtr||-||Enable DSR-DTR mode|
Minicom is a text-based serial port communications program.
Install the program with:
sudo apt install minicom
Type the following to send AT command to HAT via device: ttyUSBx at baudrate 115200. Where x represents the port number you want to open.
sudo minicom -b 115200 -D /dev/ttyUSB2
It should result in an OK reply if successfully received by the module or an ERROR if not interpreted correctly.
If the configurations are not selected from the command line as mentioned before, the following command can be used to select the detailed configuration.
For details on how to use minicom, refer to the following webpage.
To know about the supported AT commands by the module, check the following links.