R800C GSM/GPRS HAT

From Waveshare Wiki
Revision as of 06:52, 7 December 2022 by Eng52 (talk | contribs) (Created page with "<div class="wiki-pages jet-green-color"> {{Infobox item|colorscheme=green |img=File:R800C GSM.jpg|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
R800C GSM/GPRS HAT
R800C GSM.jpg

GSM
UART
RPI
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Introduction

R800C GSM/GPRS HAT features GSM (Global System for Mobile Communications) and GPRS (General Packet Radio Service) functions for Raspberry Pi. It has the advantages of small size and low power consumption, and can easily realize functions such as making calls, sending text messages, and surfing the Internet wirelessly.

Feature

  • Support Raspberry Pi Zero/Zero W/Zero WH/2B/3B/3B+/4B
  • Supports SMS, phone call, GPRS, TCP/IP, DTMF, HTTP, FTPl, etc.
  • 2x LED indicators, easy to monitor the working status
  • SIM card slot, supports 1.8V/3V SIM card
  • Baudrate: 2400bps ~ 115200bps (115200bps by default)
  • 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 online development resources and manual (examples for Raspberry Pi/Jetson Nano/Arduino/STM32)

GSM/GPRS Parameters

  • Frequency band
    • EGSM 900/PCS 1900MHz
    • Support Quad-band auto search
    • Compliant with GSM phase 2/2+
  • Emitting power
    • Class 4 (2W @ GSM 850/EGSM 900 MHz)
    • Class 1 (1W @ DCS 1800/PCS 1800 MHz)
  • GPRS connectivity
    • GPRS multi-slot class 12 (by default)
    • GPRS multi-slot class 1~12 (configurable)
  • GPRS data feature
    • UL/DL speed: ≤85.6kbps
    • Supports Packet Broadcast Control Channel (PBCCH)
    • Coding schemes: CS-1, CS-2, CS-3, CS-4
    • Supports PAP (Password Authentication Protocol) for PPP connection
    • Supports Unstructured Supplementary Service Data (USSD)
  • SMS
    • Supports: MT, MO, CB, Text, PDU
    • SMS storage: SIM card

Others

  • Power supply: 5V
  • Logic level: 5V / 3.3V (default)
  • Operating temperature: -40°C ~ 85°C
  • Storage temperature: -45°C ~ 90°C
  • Dimensions: 30.2 x 65mm

Interface Introduction

5V Power input (5V)
GND Ground
RX1 Serial port 1 data receiving
TX1 Serial port 1 data transmitting
DTR Sleep control pin is pulled high to sleep, pulled low to wake up (must set "AT+CSCLK=1")
RI The interrupt wake-up pin defaults to a high level, and there will be a 120ms low-level pulse when receiving a short message or URC report (must set "AT+CFGRI=1")
RX2 Serial port 2 data receiving
TX2 Serial port 2 data transmitting
PWR Switch control pin
RESET The reset pin can be reset when the power-on state is pulled low, and the power-off state is invalid

Jumper Cap Description

Raspberry Pi pin definition diagram

VCCIO The working level can be set to 3.3V or 5V via the jumper cap
PWR On/off control pin, connected to P4 pin of Raspberry Pi by default

Indicator LED Description

PWR Lights up when power is supplied to the 5V and GND of the module
NET 64ms on/800ms off - unregistered on the network
64ms on/3000ms off - registered on the network
64ms on/300ms off - data transmission
off - power off or PSM sleep mode

Connect To Computer For Debugging

Hardware Connection

Access to computer with UART module

Before using the R800C module, in addition to the micro USB cable and the GSM/Bluetooth antenna, the user also needs to prepare the following items:

Hardware connection operation:

  1. Install the GPRS card into the card slot on the back of the module and connect the LTE antenna. (When using it, the LTE antenna must be rotated to the outside of the board, as shown on the right.)
  2. Connect the CP2102 module pins to serial port 1 (or serial port 2) of R800C and then connect it to the computer with a USB cable.
  3. Supply power to the R800C module, at this time the PWR light is red, and the NET light is off.
  4. Press the PWRKEY button for about 1s and release it, wait for about 2 seconds, and see that the NET light starts to flash, then the module is powered on successfully.
  5. Use the supporting serial port assistant to open, select the corresponding serial port and baud rate 115200, check and add carriage return and line feed, and open the extension to see the AT command for recording, click the corresponding command to send it directly.

Simple Networking Test

Simple networking test screenshot

The following table lists some commonly used AT commands, which can quickly and easily detect whether the AT serial communication and network connection of R800C is normal. Before performing the network communication experiment demonstrated below, it is recommended to do a simple network test first to confirm that the network connection is normal before operating.
Related AT command details can be found in R800C Series_AT Command Manual.

Command Description Return value
AT AT test command OK
ATE ATE1 set echo, ATE0 disable echo OK
AT+CSQ Network signal quality query, return signal value OK
AT+CGMR Query firmware version OK
AT+CREG? Query network registration status OK
AT+CGATT? Check GPRS attachment status OK

Phone Call

【Make A Call】

Make A Call
  1. Correctly install the SIM card, and GSM antenna, connect the TTL serial port and connect the power supply;
  2. Observe whether the indicators are normal, the PWR indicator is always on, the STA indicator is always on, and the NET indicator is flashing;
  3. Query the status of the SIM card, send "AT+CPIN?+Enter", return +CPIN: READY is normal;
  4. Dial number: "ATD10086;", here we take 10086 as an example;
  5. Hang up the phone: "ATH+Enter", as shown in the figure below;





【Answer A Call】

Answer the call
  1. Set caller ID: "AT+CLIP=1+Enter"
  2. Connect: "ATA+Enter", hang up: "ATH+Enter"







SMS Sending and Receiving

【Send English SMS】

Send English SMS

Test steps:

  1. AT+CMGF=1: set SMS mode to TEXT.
  2. AT+CMGS="phone number"<Enter>, set the receiver's phone number, and then return: ">".
  3. Send the required content, such as "Send message test!", no need to enter at the end.
  4. After editing the text message, send 1A in hexadecimal format to send the message.
    (1A is the key value of "CTRL+Z", which is used to tell the module to perform the sending operation, and you can also send 1B, which is "ESC" to cancel operate).
  5. After the sending is successful, the module returns +CMGS: 15 to confirm the sending is successful.


【Receive English SMS】

Receiving English SMS

Test steps:

  1. Send a message on the mobile phone: "This is a receive test for SIM7600X!" to the test module.
  2. When the message is received, the serial port will stop reporting the message, "SM", 20, which means there are 20 messages in the SM, and the message just sent is the 20th message.
  3. Read information: AT+CMGR=20 read the 20th information (AT+CMGL="ALL" means to read all information).
  4. Delete information: AT+CMGD=20, as shown in the figure below.
  5. Convert the displayed information into text through a code converter.

【Send Chinese SMS】

Send Chinese SMS

Test steps:

  1. AT+CMGF=1, set to text mode.
  2. AT+CSCS="UCS2" , set the message text to UCS2 code set.
  3. AT+CSMP=17,167,2,25 //Set text mode parameters.
  4. AT+CMGS="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", set the UCS2 set of the receiver's phone number.
  5. Waiting for return>, the content of the converted information sent at this time: 005200380030003000436D4B8BD5 (R800C test).
  6. Enter is not required at the end, after editing the text message, send 1A to send the message in hexadecimal format.



【Recieve Chinese SMS】

  1. Send AT+CMGF=1 to set the text display.
  2. Send AT+CSCS="GSM" to set the GSM code set.
  3. When the message is received, the serial port will automatically report the message, "SM", 59, means that there are 59 messages in the SM, and the message just sent is the 59th.
  4. Read information: AT+CMGR=59 to read the 59th information (AT+CMGL="ALL" means to read all information) and convert the information into Chinese in the software, as shown in the figure below.

TCP/IP Communication

TCP/IP Application Structure

The TCP/IP application of R800 series modules has two connection modes, which can be set by the command AT+CIPMUX=<n>. When AT+CIPMUX=0, it is single-link mode; when AT+CIPMUX=1, it is the multi-link mode. The default setting is the single-link mode.
When in single link mode, R800 series modules can work in transparent transmission mode and non-transparent transmission mode. In these two transmission modes, the module can be configured as a TCP/UDP client or a TCP server.

When in multi-link mode, R800 series modules only work in non-transparent mode.

In this mode, the module can be used as an absolute TCP/UDP connection client, and it can establish a total of 6 connections; it can also be configured as a TCP server, and it can also be configured as a 5-way TCP/UDP client. R800C TCP/IP is a multi-channel client architecture by default, supporting 5 sockets in total, including TCP or UDP.

The following will focus on demonstrating the client communication of the R800C in single-link non-transparent mode and transparent mode.

For detailed instructions related to TCP/IP communication, please refer to: R800C Series_TCPIP_Application_Note.

【Client Communication In Non-transparent Mode】

Related commands:

TCP Client Non-transparent Mode Test
AT Command Command Description Return Value
AT+CGATT? Check GPRS attachment status OK
AT+CSTT="CMNET" Set APN OK
AT+CIICR Establish a wireless link OK
AT+CIFSR Get local IP address OK
AT+CIPSTART="TCP","118.190.93.84",2317 Establish a TCP client connection OK
AT+CIPSTART="UDP","118.190.93.84",2317 Establish UDP client connection OK
AT+CIPSEND=<Character length> Send a string of specified length OK
AT+CIPCLOSE Close link communication OK
AT+CIPSHUT Close the PDP context connection OK

【Client Communication In Transparent Mode】

Related commands:

TCP Client Transparent Mode Test
AT Command Command Description Return Value
AT+CGATT? Check GPRS attachment status OK
AT+CIPMODE=1 Set to transparent transmission mode OK
AT+CSTT="CMNET" Set APN OK
AT+CIICR Establish wireless link OK
AT+CIFSR Get local IP address OK
AT+CIPSTART="TCP","118.190.93.84",2317 Establish a TCP client connection OK
AT+CIPSTART="UDP","118.190.93.84",2317 Establish UDP client connection OK
AT+CIPSEND=<Character length> Send a string of specified length OK
AT+CIPCLOSE Close link communication OK
AT+CIPSHUT Close the PDP context connection OK

You can freely switch between transparent transmission mode and command mode through the following methods.

(1) If the fourth parameter of AT+CIPCCFG is 1, it supports to exit the transparent transmission mode through the escape sequence. The default escape sequence is +++. To use this sequence correctly, you must ensure that there is a 1000ms idle before the sequence and a 1000ms idle after the sequence. It should also be noted that the interval between each + should not exceed 1000ms, otherwise it may be regarded as TCP/IP data.

(2) The DTR pin of the serial port can be used. To use this method, first set up AT&D1, ground the DTR pin for at least 1 second, and then pull it high. This method can switch from data mode to command mode. The reported string "OK" indicates that the module is currently in command mode.

(3) For the TCP client connection, if the remote server disconnects, the module will automatically switch to the command mode.

(4) For the TCP server connection, if the remote client disconnects, the module will automatically switch to the command mode.

(5) Restart the module.

HTTP Communication

This chapter mainly introduces the HTTP communication function of the R800C module, mainly divided into HTTP GET and HTTP POST.

For detailed usage instructions of HTTP and FTP communication functions, please refer to R800C Series_IP_Application_Note.

【HTTP GET】

Related commands:

HTTP GET Test
AT Command Command Description Return Value
AT+SAPBR=3,1,"Contype","GPRS" Configuring Bearer Scenario 1 OK
AT+SAPBR=3,1,"APN","CMNET" Configure bearer scenario APN OK
AT+SAPBR=1,1 Activate a GPRS context OK
AT+SAPBR=2,1 Query GPRS context OK
AT+SAPBR=0,1 Close the GPRS context. OK
AT+HTTPINIT Check the HTTP connection status OK
AT+HTTPPARA="CID",1 Set HTTP session parameters OK
AT+HTTPPARA="URL","www.sim.com" Set HTTP session parameters OK
AT+HTTPACTION=0 GET session start OK
AT+HTTPREAD Read data from the HTTP server OK
AT+HTTPTERM End HTTP service OK

【HTTP POST】

Related commands:

HTTP POST Test
AT Command Command Description Return Value
AT+SAPBR=3,1,"Contype","GPRS" Configuring Bearer Scenario 1 OK
AT+SAPBR=3,1,"APN","CMNET" Configure bearer scenario APN OK
AT+SAPBR=1,1 Activate a GPRS context OK
AT+SAPBR=2,1 Query GPRS context OK
AT+SAPBR=0,1 Close the GPRS context. OK
AT+HTTPINIT Check HTTP connection status OK
AT+HTTPPARA="CID",1 Set HTTP session parameters OK
AT+HTTPPARA="URL","www.sim.com" Set HTTP session parameters OK
AT+HTTPDATA=100,10000 Upload 100 bytes of data, wait for 10000 milliseconds OK
AT+HTTPACTION=1 GET session start OK
AT+HTTPTERM End HTTP service OK