The AT+CMGL command lists messages received on the GSM modem. It can be used to get all received messages, all unread messages or all read messages.
Setelah program selesai diupload, pengetesan dilakukan via serial monitor. Kita dapat melakukan beberapa pengetesan yang disesuaikan dengan fitur dari modul SIM800l yang kita gunakan seperti baca SMS, cek jumlah SMS, call, delete SMS, send USSD (cek pulsa), dll. SIM800L Module is a small GSM/GPRS Module and ideal for small ideal projects. The module supports quad-band GSM/GPRS network, available for SMS and GPRS message data remote transmission. SIM800L is advanced than its previous SIM900 modules.
- To set the GSM Module in SMS mode, use the following code. Once it returns OK, then use the second command to read the SMS. To Send an SMS, set the GSM Modem to SMS mode using ‘AT+CMGF=1’ and then use the following command. AT+CMGS='98XXXXXXXX' The modem will return an arrow to enter the message. Type the message.
- SMS sent from Docklight are received on my cellphone and appear as expected, not blank. On day 0, before integrating module with Launchpad hardware, I have tested the overall firmware state machine with exact copy of expected responses from SIM800L.
Command | Positive Response |
---|---|
AT+CMGL=<stat><CR> | +CMGL: <index>,<stat>,<oa>,[<alpha>],[<scts>]<CR><LF><data><CR><LF> ... OK |
Parameters
<stat>: Status = 'ALL', 'REC UNREAD' or 'REC READ'
<index>: Index number of the message
<oa>: Originator address
<alpha>: Originator name (if available in the phonebook)
<scts>: Service Center Time Stamp
<data>: The content of the text message
<CR>: ASCII character 13
<LF>: ASCII character 10
Example
Set the GSM modem to Text Mode SMS, list all received messages and remove the messages from the GSM modem.
See also
AT+CMGF - Set SMS Text Mode or SMS PDU Mode
AT+CMGD - Delete a Received Message
Introduction to SIM800L
There are so many GSM modules that came to market right now. And SIM800L almost the cheapest. It cost under 10$ and has the same feature as other. So, this module is a great one.
This module works just like another module, it uses AT Command to communicate with arduino and has the same command. You can download the AT command list it uses here.
Just like another GSM module like SIM900A that we’ve wrote the tutorial here. This is of course use serial communication to communicate with arduino. So we need Tx and Rx here.
Arduino and SIM800L Wiring Diagram
arduino and SIM800L wiring diagramConnect your arduino and SIM800L like above. But this seems like to be wrong. Because in the datasheet it says that VCC must be at 4.4V maximum. But in last version of this module, it works given 5V for it’s VCC.
if it is doesn’t work for you can try to drop the VCC to not more than 4.4V. You can use buck converter, or the simplest way just use a diode. I will prefer use only a diode because it simplicity. So, wiring diagram become like below :
The Code
Sending a message:
Sim800l Delete All Sms Contacts
In this example, we made two function that is SendMessage() and _readSerial(). SendMessage() to send message and _readSerial() to read the answer from SIM800L.
To make a call you can create another function and call that function from your loop. And this is the function :
I mixed up the code to send and receive sms and make a call. Every task in a function. So it has three function, SendMessage(), ReceiveMessage() and Call(). In this code you just type in serial monitor “s” to send, “r” to receive SMS, and “c” to make a call.
Sim800l Delete All Sms Card
And that’s all the code. That is easty Isn’t it? And if you need a tutorial on how to send data over GPRS with this module, wait our next tutorial.
Watch also complete video tutorial below :