Sending AT Commands

Cellular modules 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.

Minicom is a text-based serial port communications program.
Using minicom, AT commands can be sent to Shield/HATs available on Sixfab.

MinicomMinicom

Minicom

Install minicom

Install the program with:

sudo apt install minicom

Using the minicom

Use the built-in logs to identify the different serial ports on your system. In order to find the name of your port(s) enter this command in the terminal:

[email protected]:~ $ dmesg | grep tty [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 smsc95xx.macaddr=DC:A6:32:49:FB:39 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=PARTUUID=9c0c76f5-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait [ 0.001546] printk: console [tty1] enabled [ 1.193107] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 29, base_baud = 0) is a PL011 rev2 [ 35.807711] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB0 [ 35.808358] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB1 [ 35.808916] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB2 [ 35.810673] usb 1-1.1: GSM modem (1-port) converter now attached to ttyUSB3

Send Command

There are two ways to send AT commands to the cellular module, USB and UART ports.

1. USB

Type the following to send AT command to HAT via device: ttyUSBx at baudrate 115200

sudo minicom -b 115200 -D /dev/ttyUSB2
Welcome to minicom 2.7.1 OPTIONS: I18n Compiled on Aug 13 2017, 15:25:34. Port /dev/ttyUSB2 Press CTRL-A Z for help on special keys AT OK AT+CPIN? +CPIN: READY OK AT+CSQ +CSQ: 17,99 OK CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB2

2. UART

To use the UART follow the steps mentioned in the UART Configuration guide first.


Type the following to send AT command to HAT via device: ttyS0 at baudrate 115200

Note: For Raspberry Pi Zero, Raspberry Pi 2, and older versions, use /dev/ttyAMA0 as device name.
sudo minicom -b 115200 -D /dev/ttyS0
Welcome to minicom 2.7.1 OPTIONS: I18n Compiled on Aug 13 2017, 15:25:34. Port /dev/ttyS0, 10:47:06 Press CTRL-A Z for help on special keys AT OK AT+CPIN? +CPIN: READY OK AT+CSQ +CSQ: 17,99 OK CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyS0

It should result in an OK reply if successfully received by the module or an ERROR if not interpreted correctly.

Setup Minicom

If the configurations are not selected from the command line as mentioned before, the following command can be used to select the detailed configuration.

minicom -s

Help Menu

We can get help with the CTRL+A, Z like below.

Exit Minicom

To exit Minicom when in terminal mode press CTRL+A to get a message bar at the bottom of the terminal window and then press X.

For details on how to use minicom, refer to the following webpage:
https://linux.die.net/man/1/minicom

AT commands manuals

To know about the supported AT commands by the module, check the following links.