SIM800 Reference
Module requires 3.4-4.6V supply voltage, so it's best connected to a standard li-ion cell. Comms over UART 9600 8N1 CRLF. Led steady blinking means network is available (but doesn't mean connected to net). Returns OK (OD 0A) after command success.
AT commands
* AT+CMEE=2 -> verbose errors * AT+CBC -> battery voltage in mV * AT+COPS? -> network available? * AT+COPS=? -> return a list of networks * AT+CREG? * 0,0 – SIM Error * 0,2 – Searching * 0,3 – Registration denied * 0,5 – Connected roaming * 0,1 - Connected * AT+CSQ -> signal strength (should be higher than about 8-10). * ATD+41... ; -> call a phone (semicolon **important**!) * AT+CGDCONT -> Displays/edits/changes the configured APN * AT+CGDCONT? -> Displays the current APN set * AT+CGDCONT=1,"IP","gprs.swisscom.ch" -> Set an APN * AT+CGATT=1 - Attach gprs session * OK – command successful * Other CMEE code – See possible errors via CMEE result specific module documentation * AT+CGATT=0 – Detach gprs session * AT+CGACT=1,1 -> attach specific context 1: * OK – Command successful * CMEE error code
SMS Commands
* AT+CMGF=1 -> Select Text mode for command format. NEED to do this in the beginning in order to make the following commands to work. * AT+CMGS="<phonenumber>"<return><message><ctrl-z> -> send SMS with <message> to <phonenumber>. In C, <return> is made with the '\r' token and ctrl-z with '\x1A' token. * AT+CMGL="ALL" -> list all messages in memory * AT+CMGR=1 -> show message at position 1 (replace 1 by desired index). Max response: 5 sec. * AT+CMGD=<index>[,<flag>] -> delete message at given location in memory (<index> from 1....n_msg). If <flag>=4, delete all messages in memory (even unread) * Response on incoming SMS -> +CMTI: "SM",<index>
Opening a remote TCP connection over GPRS
* at+cipstatus -> get PDP connection status (gprs) * AT+CGATT? -> 1 = gprs available * at+cstt="gprs.swisscom.ch","gprs","gprs" -> select APN for this connection * at+ciicr -> bring up connection * at+cifsr -> get devices ip addr * AT+CIPSTART="TCP","178.62.248.152", "9999" -> open TCP connection * AT+CIPSEND -> Issue Send Command
Unlock SIM and remove PIN code
AT+CPIN? AT+CPIN="1234" AT+CLCK="SC",0,"1234" AT+CPIN? -> should output ready
POST to HTTP server
AT+SAPBR=3,1,"APN","gprs.swisscom.ch" AT+SAPBR=1,1 AT+HTTPINIT at+httppara="url","http://basestation.octanis.org:9999/gsm_packets/..." at+httppara="cid",1 AT+HTTPPARA="CONTENT","text/plain" at+httpdata=100,10000 AT+HTTPACTION=1 AT+HTTPREAD AT+HTTPTERM
GPRS APN data “apn” = gprs.swisscom.ch “DNS” = 164.128.036.034 username = gprs password = gprs
SIM800 ref: https://www.adafruit.com/datasheets/sim800_series_ip_application_note_v1.00.pdf