Contents

Playing with a GSM modem (SIM800L)

Sunday night playing with AT commands and a SIM800L GSM modem.

Introduction

It has been a while since I bought a SIM800L GSM modem, but I needed more time to play with it. I was always busy with other projects, but I had some free time this weekend, and I decided to play with it. The most challenging part is to work with AT commands, as there is a massive list to go through. I found a great website with a list of AT commands for the SIM800L modem. I will use this website as a reference for the AT commands that I will use in this post.

Hardware

The hardware that I used for this project is the following:

If the power to the SIM800L is enough, the onboard LED starts blinking. If it blinks every second, it is searching for a network. You will know if it’s connected to the network when it blinks every three seconds. If the LED blinks very fast, it’s connected through GPRS.

Software

Mostly I use CLI tools for this project. One of the following(whichever you might be more comfortable with):

  • screen
  • picocom
  • minicom

The Commands

Basic AT check

Command: AT

1
2
AT
OK

Check the modem

Command: AT+CGREG? / AT+CEREG
Queries for the packet-switched network status. If the response is +CGREG: x, 5 or +CEREG: x,5, then you can jump ahead to step 5. The x in the x,5 part indicates the URC status and is not essential for this step; the 5 indicates that the modem is registered to a network and is roaming. With Onomondo SIMs, you will always be roaming, which is why the response x,5 is always expected.

1
2
3
4
AT+CGREG?
+CGREG: 0,0

OK

Check the firmware version

Command: AT+CGMR

1
2
3
4
AT+CGMR
Revision:1418B04SIM800L24

OK

Check the signal strength

Command: AT+CSQ
That return corresponds to a RSSI value of -93 dBm. This is only slightly better than marginal coverage. We should still be able to make a call on this signal condition, but the throughput may not be that good.

1
2
3
4
AT+CSQ
+CSQ: 20,0

OK

Signal strength table

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| Value | RSSI dBm | Condition |
| ----- | -------- | --------- |
| 2     | -109     | Marginal  |
| 3     | -107     | Marginal  |
| 4     | -105     | Marginal  |
| 5     | -103     | Marginal  |
| 6     | -101     | Marginal  |
| 7     | -99      | Marginal  |
| 8     | -97      | Marginal  |
| 9     | -95      | Marginal  |
| 10    | -93      | OK        |
| 11    | -91      | OK        |
| 12    | -89      | OK        |
| 13    | -87      | OK        |
| 14    | -85      | OK        |
| 15    | -83      | Good      |
| 16    | -81      | Good      |
| 17    | -79      | Good      |
| 18    | -77      | Good      |
| 19    | -75      | Good      |
| 20    | -73      | Excellent |
| 21    | -71      | Excellent |
| 22    | -69      | Excellent |
| 23    | -67      | Excellent |
| 24    | -65      | Excellent |
| 25    | -63      | Excellent |
| 26    | -61      | Excellent |
| 27    | -59      | Excellent |
| 28    | -57      | Excellent |
| 29    | -55      | Excellent |
| 30    | -53      | Excellent |

Check the SIM card

Command: AT+CPIN?

1
2
3
4
AT+CPIN?
+CPIN: READY

OK

Check the network selection mode

Command: AT+COPS?
Checks if the modem is in automatic selection mode. Some modems are set by default and don’t need to be set manually. If the response is anything other than +COPS: 0, you will need to set it to choose the network operator automatically using AT+COPS=0.

Beware of manually using AT+COPS=0 and AT+COPS=2, however.

1
2
3
4
AT+COPS?
+COPS: 0

OK

Check the available networks

Command: AT+COPS=?

1
2
3
4
AT+COPS=?
+COPS: (3,"T-Mobile","TMO UK","23430"),,(0-4),(0-2)

OK

Make a phone call

Command: ATD+447572785067;

1
2
ATD+447123456789;
OK

Hang up the phone

Command: ATH

1
2
ATH
OK

Repeat the last call

Command: ATDL

1
2
ATDL
OK

Repeat the last command

Command: ATE1
This command will repeat the last command that was sent to the modem. This is useful if you want to repeat a command without typing it again.

1
2
ATE1
OK

Receive a phone call

Command: ATA

1
2
ATA
OK

Send SMS

Command: AT+CMGS="+447572785067"
The +CMGS command is used to send SMS messages. The +CMGS command is followed by the phone number of the recipient. The phone number must be enclosed in double quotes. The phone number must be in international format. The +CMGS command is terminated by a carriage return (CR) character. The modem will then respond with >. This indicates that the modem is ready to receive the SMS message. The SMS message must be terminated by a CTRL+Z character. The modem will then respond with +CMGS: , . A message reference is a number that uniquely identifies the SMS message. The message length is the length of the SMS message in bytes.

1
2
3
4
5
AT+CMGS="+447123456789"
> This is a test message
+CMGS: 1, 20

OK

Read the IMEI

Command: AT+CGSN

1
2
AT+CGSN
865691037901980

Name of manufacturer

Command: AT+CGMI

1
2
AT+CGMI
SIMCOM_Ltd

Model of the modem

Command: AT+CGMM

1
2
AT+CGMM
SIMCOM_SIM800L

Read the battery voltage

Command: AT+CBC

1
2
AT+CBC
+CBC: 0,100,4200

Resources/References