Template: SIM800C GSM/GPRS HAT User Manual

From Waveshare Wiki
Jump to: navigation, search

Features

  • Raspberry Pi connectivity, compatible with Raspberry Pi 2B/3B/3B+/Zero/Zero W
  • Supports SMS, GPRS, DTMF, HTTP, FTP, MMS, email, etc.
  • Bluetooth 3.0, supports data transferring through Bluetooth
  • 2x LEDs for indicating the module working status
  • SIM card slot for 1.8V/3V SIM card
  • Baudrate auto detection (1200bps ~115200bps)
  • Control via AT commands (3GPP TS 27.007, 27.005, and SIMCOM enhanced AT Commands)
  • Supports SIM application toolkit: GSM 11.14 Release 99
  • Comes with development resources and manual (examples for Raspberry Pi/Arduino/STM32)

GSM/GPRS

  • Band
    • GSM 850/EGSM 900/DCS 1800/PCS 1900 MHz
    • Quad-band auto search
    • Compliant to GSM phase 2/2+
  • Enutting power
    • Class 4 (2W @ GSM 850/EGSM 900 MHz)
    • Class 1 (1W @ DCS 1800/PCS 1900 MHz)
  • GPRS connectivity
    • GPRS multi-slot class 12 (default)
    • GPRS multi-slot class 1~12 (configurable)
  • GPRS data feature
    • Downlink/Uplink speed: max 85.6kbps
    • Coding schemes: CS-1\CS-2\CS-3\CS-4
    • Supports PAP (Password Authentication Protocol) for PPP connection
    • Supports PBCCH
    • Supports USSD
  • SMS
    • Supports: MT/MO/CB/Text/PDU mode
    • SMS storage: SIM card
  • Bluetooth
    • Integrates AT commands
    • Compliant to Bluetooth specification3.0 + EDR
    • Supports SPP, OPP, HFP/HSP, etc.
  • MISC
    • Operating voltage: 5V
    • Operating temperature: -40°C ~ 85°C
    • Storage temperature: -45°C ~ 90°C
    • Dimensions: 30.2mm x 65mm

Pinout

PIN Description
5V 5V power input
GND Ground
RX1 Serial port 1 Data receiver
Tx1 Serial port 2 Data transmission
DTR Sleep control pin. High: Sleep; Low: Wake-up (should set AT+CSCLK=1)
RI Interrupt wake-up pin. this pin defaults to high and keep low for 120ms when URCs are reported or SMS received. (should set "AT+CFGRI=1")
RX2 Serial port 2 Data receiver
TX2 Serial port 2 Data transmission
PWR Power control pin
RESET When power is on, you can reset module by pulling-down the reset pin. It is unavailable when power off

Jumpers

VCCIO by change the jumper, you can set the working voltage to 3.3V or 5V
PWR Power control pin,. By default connecting to P4 of Raspberry Pi

Indicators

PWR Light: Module is powered on with 5V voltage input
NET light on for 64ms and off for 800ms: Not registered the network

Working with PC

Hardware connection

In addition to the micro USB cable and GSM/Bluetooth antenna, users need to prepare the following before using the SIM800C module.

  1. Insert the CPRS card into the card slot on the back of the module and connect the LTE antenna (The LTE antenna must be rotated to the outside of the board)
  2. Connect the CP2102 module to the corresponding serial port 1 (or serial port 2) of the SIM800C, and use the USB cable to connect the module to the computer.
  3. Power the SIM800C module. At this time, the PWR light indicator should light up in red and the NET light should be off.
  4. Press the PWRKEY button and hold for about 1 second. Waiting for about 2 seconds. You should see that the NET light starts flashing. This means the module is powered on successfully.
  5. Open the serial assistant software, then select the corresponding serial port, and set baud rate to 115200. Check the "Newlines" Options. By opening the extension you can see the already set AT commands. Click on the corresponding command to send it directly.

Networking testing

The following table lists some common AT commands that can be used to quickly and easily detect whether the SIM800C's AT serial communication and network connection are normal. Before following the steps of the network communication demonstration described in the table below, it is recommended to do a simple network test to confirm that the target network connection is normal and operable.

Commands Description
AT AT Test Command
ATE ATE1: Turns on echoing; ATE0: Turns off e'choing.
AT+CSQ Network signal quality query, returns a signal value
AT+CGMR Request firmware version
AT+CREG? Request network registration status
AT+CGATT? Check for GPRS attachment service status

For details AT commands, please refer to SIM800C Series_AT_Command Manual ===TCP/IP Communication The TCP/IP application of the SIM800 serial module has two connection modes, which can be set by the command AT CIPMUX=<n>. When AT CIPMUX is set to 0 (AT+CIPMUX=0), it is in single link mode; when AT CIPMUX is set to 1 (AT+CIPMUX=1), it is in multi-link mode. The module is set as single link mode by default.

In single link mode, the SIM800 serial module can operate in both transparent and non-transparent modes. In both transmission modes, the module can be configured as a TCP/UDP client or as a TCP server.

In multi-link mode, the SIM800 serial module can only work in non-transparent mode.

In this mode, the module can work as an absolute TCP/UDP connection client, which can establish a total of 6 connections; it can also be configured as a TCP server, and can also be configured with 5 TCP/UDP clients. SIM800C TCP/IP defaults to a multi-client architecture that supports a total of five sockets, including TCP or UDP.

With the following demonstrations we will focus on the client communication of the SIM800C, in single-link non-transparent mode and transparent mode.

【Client communication in non-transparent mode】

AT Commands Description
AT+CGATT? Check GPRS attachment service status
AT+CSTT="CMNET" Set APN
AT+CIICR Establish a wireless connection
AT+CIFSR Retrieve the local IP address
AT+CIPSTART="TCP","118.190.93.84",2317 Establish a TCP client connection
AT+CIPSTART="UDP","118.190.93.84",2317 Establish a UDP client connection
AT+CIPSEND=<string length> Send a specified string length
AT+CIPCLOSE Close the connection
AT+CIPSHUT Close PDP context connection

【Client communication in transparent transmission mode】

AT Commands Description
AT+CGATT? Check GPRS attachment service status
AT+CIPMODE=1 Set to transparent mode
AT+CSTT="CMNET" Set APN
AT+CIICR Establish a wireless connection
AT+CIFSR Retrieve the local IP address
AT+CIPSTART="TCP","118.190.93.84",2317 Establish a TCP client connection
AT+CIPSTART="UDP","118.190.93.84",2317 Establish a UDP client connection
AT+CIPSEND=<string length> Send a specified string length
AT+CIPCLOSE Close the connection
AT+CIPSHUT Close PDP context connection

To switch between the transparent transmission mode and the command mode, any of following methods describe below are available.

  1. The escape sequence can be used to exit from transparent mode if the forth parameter of AT+CIPCCFG is 1. The default escape sequence is +++, and to use this sequence, there should be 1000ms idle period before this sequence and 1000ms idle period after this sequence. Besides, the interval between each + should not exceed 1000ms, otherwise it will be treated as TCP/IP data.
  2. DTR line (pin) of serial port can also be used. To use this method, AT&D1 should be set firstly. Pull DTR line to Low for at least 1 second and then pull up, the module will switch from data mode to command mode and an “OK” string will be returned indicating the module is in command mode.
  3. Unintentionally, for TCP client connection, if the remote server closes the connection, the module will switch back to command mode automatically.
  4. Conversely, for TCP server connection, if the remote client closes the connection, the module will switch back to command mode automatically.
  5. Restarting the module.

HTTP Communication

This chapter introduces the HTTP communication function of SIM800C module, which is mainly divided into HTTP GET and HTTP POST. For more details information about the HTTP and FTP communication, please refer to SIM800C Series_IP_Application_Note 【HTTP GET】

AT Commands Description
AT+SAPBR=3,1,"Contype","GPRS" Configure bearer profile 1
AT+SAPBR=3,1,"APN","CMNET" Configure the bearer profile APN.
AT+SAPBR=1,1 Open a GPRS context
AT+SAPBR=2,1 Query a GPRS context
AT+SAPBR=0,1 Close the GPRS context.
AT+HTTPINIT Check the HTTP connection status
AT+HTTPPARA="CID",1 Set parameters for HTTP session
AT+HTTPPARA="URL","www.sim.com" Set parameters for HTTP session
AT+HTTPACTION=0 GET session start
AT+HTTPREAD Read the data of the HTTP server
AT+HTTPTERM End HTTP service

【HTTP Post】

AT Commands Description
AT+SAPBR=3,1,"Contype","GPRS" Configure bearer profile 1
AT+SAPBR=3,1,"APN","CMNET" Configure the bearer profile APN.
AT+SAPBR=1,1 Open a GPRS context
AT+SAPBR=2,1 Query a GPRS context
AT+SAPBR=0,1 Close the GPRS context.
AT+HTTPINIT Check the HTTP connection status
AT+HTTPPARA="CID",1 Set parameters for HTTP session
AT+HTTPPARA="URL","www.sim.com" Set parameters for HTTP session
AT+HTTPDATA=100,10000 Upload 100 bytes data, waiting for 10000ms
AT+HTTPACTION=0 GET session start
AT+HTTPREAD Read the data of the HTTP server
AT+HTTPTERM End HTTP service

Sending and receiving emails

The TCP/IP application of the SIM800 serial module has two connection modes, which can be set by the command AT+CIPMUX=<n>. 【Sending emails】 For sending emails some of the features this module offers are sending ordinary emails, set the email Carbon-copy; it can also email attachments, send it encoded as UTF-8 etc. We provide a simple operation demonstration of how to send an ordinary email.

AT Commands Description
AT+SAPBR=3,1,"Contype","GPRS" Configure bearer profile 1
AT+SAPBR=3,1,"APN","CMNET" Configure the bearer profile APN.
AT+SAPBR=1,1 Open a GPRS context
AT+SAPBR=2,1 Query a GPRS context
AT+SAPBR=0,1 Close the GPRS context.
AT+EMAILCID=1 Configure email parameters
AT+EMAILTO=30 Set time value of the server response
AT+SMTPSRV="smtp.ym.163.com",25 Set SMTP server address and port
AT+SMTPAUTH=1,"[email protected]","123456" Set username and password
AT+SMTPFROM="[email protected]","kaloha" Set the sender address and name
AT+SMTPRCPT=0,0,"[email protected]","kallanlw" Set a recipient
AT+SMTPRCPT=1,0,"[email protected]","john" Set the CC email and name
AT+SMTPSUB="Test" Set the email subject
AT+SMTPBODY=19 Set the message body
This is a new Email Content of the email
AT+SMTPSEND Send the email
AT+SAPBR=3,1,"Contype","GPRS" Configure bearer profile 1
AT+SAPBR=3,1,"APN","CMNET" Configure the bearer profile APN.
AT+SAPBR=1,1 Activate a GPRS context
AT+SAPBR=2,1 Query GPRS context
AT+SAPBR=0,1 Close the GPRS context.
AT+EMAILCID=1 Configures email parameters
AT+EMAILTO=30 Set time value of the server response
AT+SMTPSRV="smtp.ym.163.com",25 Set SMTP server address and port
AT+SMTPAUTH=1,"[email protected]","123456" Set username and password
AT+SMTPFROM="[email protected]","kaloha" Set sender address and name
AT+SMTPRCPT=0,0,"[email protected]","kallanlw" Set the email recipient address and name
AT+SMTPRCPT=1,0,"[email protected]","john" Set the email CC address and name
AT+SMTPSUB="Test" Set the email subject
AT+SMTPBODY=19 Set the message body
This is a new Email Content of email
AT+SMTPSEND Send email