Playing with a GSM modem (SIM800L)
Sunday night playing with AT commands and a SIM800L GSM modem.
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.
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.
Mostly I use CLI tools for this project. One of the following(whichever you might be more comfortable with):
Basic AT check
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.
Check the firmware version
Check the signal strength
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.
Signal strength table
Check the SIM card
Check the network selection mode
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.
Check the available networks
Make a phone call
Hang up the phone
Repeat the last call
Repeat the last command
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.
Receive a phone call
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:
Read the IMEI
Name of manufacturer
Model of the modem
Read the battery voltage