beroni 650-991-8119 firstname.lastname@example.org
email@example.com Kelly center
- 1 SIM800L
- 1.1 Troubleshooting
- 1.2 serial communications with the SIM800L 44module
- 1.3 Headline text
- 1.4 Do something actually useful
- 1.5 Other Documentation
The SIM800L module is a small, easy to use GSM modem/cellphone. It may be controlled through a serial port using AT commands. They sell for less than $10.
The documentation will refer to the ME. They mean the SIM800L module itself. It means Mobile Equipment. It a weird convention from the telephony industry.
I purchased two SIM800L modules. One came configured for 9600 baud. The other was configured for 115200 baud. Perhaps one had been a customer return.
If you see this over and over it probably means your batter is low and cannot source enough current. Alkaline cells may be high enough voltage left to keep the device running above the under voltage warning level, but a sudden demand of power can cause a voltage will drop causing a sudden reset of the device.
RDY +CFUN: 1 +CPIN: READY Call Ready SMS Ready RDY +CFUN: 1 +CPIN: READY Call Ready SMS Ready
serial communications with the SIM800L 44module
The communications interface to the SIM800L is an RS-232 style serial port, with just two pins with signal levels under 5 Volts, but it seems to be compatible with 5V GPIO pins on the Raspberry Pi. In theory you should drop the voltage when connecting to the input pins on the SIM800L. A diode in series will drop 1/3V, so three in series will drop a volt. The input lines of the SIM800L have proven to be tolerant of 5V. Maybe not to spec, but it seems harmless and lots of other people seem to be using it with the Raspberry Pi with no issues. The main power supply; however, is a different story. It does not like overvoltage (4.4 V). I don't know that it will destroy the device, but the device knows and will startup and print "OVER VOLTAGE" on the serial port and then turn itself off, so go into a boot->shutdown->restart loop. Even three brand new alkaline cells will give complaints. So fresh will just put you over the top. A diode in series will easily drop the voltage enough to run off three alkaline cells. A standard 3.7 Volt LiPo cell is the best choice as it can supply high current surges.
The USART is specified to handle 2.8V signals. In practive I found it can tolerate the GPIO pins from a Raspberry Pi. I've run it take way for a while, but you part of the fact I had no trouble is likely due to the short amount of time I drive the pins. When used with some automated that pushes a lot of data you might quickly fry the input pins. Since the comm signals for this device follow RS-232 conventions you will need a terminal and you will need to worry about serial port settings, which are usually of the following 9600/8 or 115200/N/1. The baud speed may be customized after connecting. The voltage into the Rx pin should be to spec. It works at the levels found from a Raspberry Pi GPIO pins. I add a diode to drop the voltages down to 2.8V
A terminal emulator is also handy for working with the SIM800L. I usually use screen as my serial terminal emulator. minicom is also popular, but screen comes already installed on the Raspberry pi. I think that many people are unaware that screen can act as a terminal emulator. . Examples showing both in 9600 and 115200 speeds
screen /dev/ttyAMA0 9600,cs8,-parenb,-cstopb,-hupcl screen /dev/ttyAMA0 115200,cs8,-parenb,-cstopb,-hupcl minicom -D /dev/ttyAMA0 -b 9600 -o minicom -D /dev/ttyAMA0 -b 115200 -o
Start the serial terminal then power up or reset the SIM800L.
Next type AT then Enter. You should get a response that says OK. If you see OK but don't see what you type then turn on echo mode by entering ATE1. You may turn echo off using ATE0. For programming it is often preferable to have echo turned off.
The first quirk when talking to this device is that the Backspace key does not work. You may use Ctrl-H as a backspace key for correcting a line, but invariably you will hit the Backspace key by mistake and see that nothing happens. Then you will remember the Ctrl-H, and it will appear to work, but after your correction and you press Enter you will get and error. This might then make you think you are doing something wrong. This happens because the Backspace key did insert an invisible character then the subsequent Ctrl-H will delete the visible characters from the display, but it will remove the invisible character from the buffer. It's all very confusing. Basically when you accidentally hit the Backspace key just give up trying to fix that line.
Next, you will want to turn on verbose error messages.
Save configuration in non-volatile memory.
This will display the network operator, which means the mobile carrier for your SIM card. This might not be the name printed on the card. A lot of smaller providers lease their network from bigger networks. Or the better known name sells accounts through a different name for marketing purposes. For example, I have a "Mont Mobile" SIM in my SIM800L. This will tell me that I am actually on the T-Mobile USA network.
AT+COPS? +COPS: 0,0,"T-Mobile USA" OK
This does not actually tell you which Mobile Network Code (MCC/MNC) you are connected to. T-Mobile has 11 different codes. The following query will using query current setting syntax will hang a long time -- 10 to 15 seconds -- and then finally return the name as well as the Carrier Code. The 6 digits number after TMO is the MCC/MNC
AT+COPS=? +COPS: (2,"T-Mobile USA","TMO","310260"),,(0-4),(0-2) OK </pre Want a huge 600+ row list of every mobile carrier the SIM800L knows about? I'm still looking for a use for this... Just just run this command: <pre> +COPN: "20201","COSMOTE" +COPN: "20205","vodafone" +COPN: "20209","Q-TELECOM" +COPN: "20210","TIM" ... +COPN: "74404","Telecel Paraguay" +COPN: "74405","Personal" +COPN: "74601","ICMS NV" +COPN: "74602","TELESUR.GSM" +COPN: "90112","Maritime Comm Partner AS" OK
Finding your SIM card's IMSI can be useful:
Do something actually useful
AT+CREG? +CREG: 0,1 OK
AT+CCLK? +CCLK: "04/01/01,01:00:08-28" OK AT+CCLK="19/04/24,04:53:00-07" OK AT+CCLK? +CCLK: "19/04/24,04:53:10-07" OK
This is a soft power-off. The battery will still be supplying power to the SIM800L. Ground the RST pin to bring the unit back on.
# Urgent powerdown. No events are sent warning of power loss. AT+CPOWD=0 # Normal powerdown. "NORMAL POWER DOWN" is sent and should be logged before power cut. AT+CPOWD=1
AT+CBC +CBC: 0,92,4137 OK
field 0: Charging or not? 0 if not charging, 1 if charging. field 1: Percentage of battery charge remaining. field 2: Battery voltage.
Ring on Incoming Text Message
This configures the unit so that the RI pin will go low for at least 100 ms every time a new text message is received. There is no RI pin on the SIM800L break-out board. There are RING, RST, and RXD pins that begin with R. I would guess RI is the same as RING.
Set the serial baud rate
AT+IPR=? +IPR: (),(0,1200,2400,4800,9600,19200,38400,57600,115200,230400,460800) OK
AT+IPR? +IPR: 115200 OK
After setting the baud your terminal will stop talking to the SIM800L. Set your terminal speed to '9600' baud then you should be able to confirm the speed as set. If you wish to make this change be the default speed when the SIM800L boots up then use the AT&W command to write the configuration to non-volatile memory.
AT+IPR=9600 OK AT&W OK
Get Location and Time
You must first activate a bearer profile before asking for time and location information. Location information is approximate. It is not a GPS.
AT+SAPBR=1,1 OK AT+CIPGSMLOC=1,1 +CIPGSMLOC: 0,-122.354200,38.008579,2019/04/24,14:49:17 OK AT+SAPBR=0,1 OK
Get Mobile Subscriber Number associated with SIM
AT+CNUM +CNUM: "","14155551212",129,7,4 OK
Send a text message via SMS
Press Ctrl-Z after the last line of text to complete the text. In this example Ctrl-Z was pressed at the second > just after the line This is a test."
The following is a critical prerequisite. I see this mentioned nowhere, perhaps because this is often a default value. However, in my SIM800L the default was USC2, which is that the many of the commands that require phone numbers do not recognize Unicode strings even if they are effectively identical to a string of numbers in ASCII.
This next command is critical to allow SMS text messages to be manually formatted in plain text for sending; otherwise, the default configuration requires that you to construct messages in hexadecimal coded binary.
Now send a text message.
AT+CMGS="14155551212" > This is a test. > +CMGS: 14 OK
Read all the text messages
AT+CMGL="ALL" OK A +CMTI: "SM",1 T+CMGL="ALL" +CMGL: 1,"REC UNREAD","+14155551234","","19/04/20,14:24:01-28" This is a test response. OK
Search for the following manuals online:
This archive contains the application notes for SimCom SIM800 Series. They explain how yo use certain functions. SIM800 Series_Serial Port_Application Note_V1.01.pdf SIM800 Series Embedded AT Sleep Application Note_V1.01.pdf SIM800 Series Embedded AT_Application Note_1.02.pdf SIM800 Series Embedded AT_Compiling Environment_V1.01.pdf SIM800 Series_Bluetooth_Application_Note_V1.07.pdf SIM800 Series_Email_Application Note_V1.01.pdf SIM800 Series_FM_Application Note_V1.02.pdf SIM800 Series_FS_Application Note_V1.03.pdf SIM800 Series_GNSS_Application Note V1.00.pdf SIM800 Series_GSM Location_Application Note_V1.01.pdf SIM800 Series_IP_Application Note_V1.03.pdf SIM800 Series_MMS_Application Note_V1.01.pdf SIM800 Series_Multiplexer_Application Note_V1.02.pdf SIM800 Series_NTP_Application Note_V1.02.pdf SIM800 Series_PCM_Application Note_V1.01.pdf SIM800 Series_Software Upgrade_Application Note_V1.04.pdf SIM800 Series_SSL_Application Note_V1.02.pdf SIM800 Series_STK_Application Note_V1.02.pdf SIM800 Series_TCPIP_Application Note_V1.02.pdf