The AT Emulator can be used to emulate the AT command set, also known as the Hayes command set, and the GSM AT command set (refer to ETSI GSM 07.07 and 3GPP TS 27.007). The AT commands are typically used to interact with phones, modems and other communication devices. Most GSM/3G/LTE modems implement the AT command set over a serial port interface, for example: RS232 or USB. Sometimes the AT interface is implemented over TCP or telnet.
The AT Emulator can be useful to test various communication software, which require a physical modem device. If a physical modem is not available the AT Emulator can come in handy. You can play with the emulator without risking to damage the real device. Therefore, the emulator can be used as an AT tester tool as well.
Two interfaces are supported by the AT Emulator: console and optionally raw TCP/telnet. The console interface can be used directly by launching the emulator in the shell. In order to setup the raw TCP or telnet interface it's necessary to edit the launcher script to configure the TCP port. A terminal emulator like telnet in Linux/Unix or PuTTY in Windows can be used to connect to the TCP port.
The TCP interface has a timeout of 1 minute. Therefore, it's necessary to input an AT command at least every minute to keep the connection alive. The console interface has no timeout.
The TCP connection can be terminated using either the Hayes escape sequence +++ or the time independent escape sequence (TIES) +++AT or waiting for the timeout.
The AT Emulator uses the following IDs:
- IMEI 00100000000123 (Test ME according to GSMA)
- IMSI 999999012345678 (Reserved for internal use)
- ICCID 8999999012345678 (Reserved for internal use)
Unzip and run
Just unzip the AT Emulator to any suitable location:
Java 1.5 or later is required. It is recommended to configure the JRE_HOME or JAVA_HOME environment variable pointing to the Java installation path.
In Windows run AT.bat to launch the emulator. In Linux/Unix run AT.sh to launch the emulator. Ctrl+C will stop the emulator.
In order to configure the optional TCP interface edit the AT.bat or AT.sh to modify the following parameters:
Only the AT_PORT parameter is mandatory. The AT_WORKERS and AT_MAXCONN parameters are optional. They can be used to limit the number of TCP connections.
Console and TCP/Telnet
The following example configures the AT interface to echo verbose status codes, queries the modem manufacturer and model name, then writes some S-registers and reads them back:
ATV1 ATQ ATI4 ATS10=255 ATS11=99 ATS10? ATS11?
Refer to the Hayes command set for the description of the available AT commands and S-registers.
Multiple AT commands can be specified on the same line. It is known as AT command concatenation. The commands must be separated by semicolons. The "AT" prefix must be removed for each subsequent command. The previous example can be rewritten as a concatenated sequence as follows:
Note: Some modems don't support AT command concatenation or restrict the AT commands which can be combined or limit the number of such commands.
The following example uses the GSM/3G AT command set to test the signal strength, query the modem status, verify the network registration and send a plain text SMS:
AT+CSQ AT&V AT+CREG? AT+CMGF=1 AT+CMGS="+1234567" >This is a test message^Z
According to ETSI GSM 07.07 or 3GPP TS 27.007 it's mandatory to use Ctrl+Z to mark the SMS message end. However, if you use the console interface to input the AT commands the Ctrl+Z may generate conflicts. In Unix/Linux the Ctrl+Z will send the active session to the background. As a workaround you can input "set +m" before launching AT.sh to disable the job control.
The Ctrl+Z character doesn't flush the console buffer automatically. In Windows it's necessary to press Enter after the Ctrl+Z. In Linux it's necessary to press Ctrl+D after the Ctrl+Z.
Virtual COM port
It's possible to access the AT Emulator through a virtual COM port. In Linux it can be done using socat:
socat pty,link=/dev/virtualcom0,raw tcp:127.0.0.1:2001
If the AT Emulator is listening on port 2001 it will be possible to input AT commands through the virtual COM port /dev/virtualcom0.
There is a free solution for Windows as well: com0com.
Let's suppose that the default virtual COM ports installed by the com0com driver are COM18 and COM19:
command> list CNCA0 PortName=- CNCB0 PortName=- CNCA1 PortName=COM#,RealPortName=COM18 CNCB1 PortName=COM#,RealPortName=COM19
Let's set AT_PORT to 2001 in AT.bat and launch the AT Emulator. In this case we can launch com2tcp pointing to COM18 like follows:
com2tcp \\.\COM18 127.0.0.1 2001
After that the AT interface will be available on COM19. It can be opened in PuTTY, Hyper Terminal or any other similar tool.