From Waveshare Wiki
Revision as of 09:41, 14 September 2017 by Waveshare-eng11 (talk | contribs) (Created page with "Category:Modules Category:Raspberry Pi {{Infobox item|colorscheme=blue |name=GSM/GPRS/GNSS HAT |brief=Compatible with Raspberry Pi 2B/3B/Zero...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Compatible with Raspberry Pi 2B/3B/Zero/Zero W
GSM-GPRS-GNSS-HAT-1.jpgSIM868 module supports GSM, GPRS, GNSS, Bluetooth





GSM/GPRS/GNSS HAT, Compatible with Raspberry Pi 2B/3B/Zeo/Zero W


How to use

Hardware configuration

1.SIM card connection
2.Hardware connection
3.Devices Manager
4.Power on

This module comes with power adapter, micro USB cable, GSM antenna, GPS antenna and Bluetooth antenna. Besides these you should prepare two more things:

  • A SIM card, the card should be usable and GPRS access (for testing the GPRS)
  • An earphone with a microphone on it (For testing Call function)
  1. Insert the SIM card to the card slot, plug the earphone and connect the GSM antenna
  2. Install CP2102 driver, plug the jumper B, and connect the USB to UART interface of GSM/GPRS/GNSS HAT to PC with a micro USB cable. Then the PWR indicator will keep bright.
  3. Open Device Manager to get the corresponding COM port number of CP2102. For example, it is COM7 as below. Users need to choose the correct port according to the Manager.
  4. Press the PWRKEY button and hold for 1s, the NET indicator will blink as below. Generally, the NET indicator will fast flash firstly (1 time per second), which means that the module has not logged in the Network. After logging in, the indicator become to flash slowly (1 time every three seconds). Up to the local GSM network, this process that logging in will last several seconds to dozens of seconds.
    If you take too much time to log in and failed, please check that whether the GSM antenna is connected correctly, and whether the SIM card is usable and insert correctly.

GSM Debugging

General AT commands

Command Description Return
ATE ATE1 Echo mode on
ATE1 Echo mode off
AT+COLP AT+COLP=1 Enable +COLP notification
AT_COLP=0 Disable +COLP notification
AT+CLIP AT+CLIP=1 Enable +CLIP notification
AT+CLIP=0 Disable +CLIP notification
ATD<phone_number>; Call a phone number, for example: ATD10086;
Must finished with Halfwidth semicolon
ATA Answer the phone OK
ATH Hang up the phone OK
AT+CNMI AT+CNMI=2,1 Enable new SMS message indicator OK
AT+CMGF AT+CMGF=1 Set the format of messages to Text mode
AT+CMGF=0 Set the format of messages to PDU mode
AT+CSCS Select TE character set
AT+CSCS="GSM" GSM 7 bit default alphabet
AT+CSCS="UCS2" 16-bit universal multiple-octet coded character set
AT+CSMP AT+CSMP=17,168,2,25 Set SMS text mode parameters OK
AT+CMGR AT+CSMP=17,168,2,25 Set SMS text mode parameters OK
AT+CMGS AT+CMGS="phone_number"
Send SMS to the corresponding phone
0x1A End mark. Check the option ”Send As Hex” then send it

For more details of AT commands, please refer to:SIM800 Series_AT Command Manual_V1.09

Make calls

  1. Insert the SIM card, connect the GSM antenna and TLL serial wires correctly. Then power on the board;
  2. Check whether the indicators blink correctly (PWR’s and STA’s keep bright, NET’s flashes).
  3. Send “AT+CPOM?” and Enter to query the status of SIM card. Getting “+CPIN: READY” if the SIM card is OK
  4. Call number: for example, “ATD10086;” (10086 is the number of China Mobile Communications Corporation)
  5. Send “ATH” and Enter to hang up the call, as below:
Note:Check “发送新行” is equal to Enter

Answer calls

  1. Enable CLIP notification: AT+CLIP=1 then Enter
  2. Answering: ATA and Enter; Hang up: ATH then Enter

Send English messages

  1. Plug the SIM card, connect the GSM antenna and TLL serial wire correctly. Then power on;
  2. Check whether the indicator blink correctly (PWR and STA keep bright, NET flashes).
  3. Set the local SMSC:AT+CSCA="+8613800755500" then Enter, get response “OK”. Note: The SMSC will be different on different area. In this part, it is Shenzhen China as examples.
  4. AT+CMGF=1: Set SMS to TEXT mode;
  5. AT+CMGS="xxxxxxxxxxx” then Enter, set the number of receiver, then you will get response: >, edit the content of message (needn’t Enter at the end). After editing, send 1A in HEX format to send the message (0x1A is key value of “CTRL+Z”, it will tell the module to send). If the message is send successfully, module will get the reply +CNGS: 174 as below figures.

Receive English messages

  1. Send a message “this is a receive test” to the GSM/GPRS/GSNN HAT
  2. While receiving messages, module will report it through UART: “SM”, 3, it means that there are 3 messages in SM, and the message we received just now is the third message.
  3. Reading messages:AT+CMGR=3 to read the third message (AT+CMGL="ALL" to read all messages)
  4. Deleting message:AT+CMGD=3, to delete a message as below

Send Chinese message

  1. AT+CSCS="UCS2", Set the characters set as UCS2
  2. AT+CSMP=17,128,2,25
  3. AT+CMGS="00310038003500360035003700300038003600340030", set the phone number of receiver with UCS2 set
  4. After getting the response >, edit the contents of message (has been converted) without Enter at the end. Then send 1A in HEX format as below

Receive Chinese message

  1. Send AT+CMGF=1 to set Text mode
  2. Send AT+CSCS="GSM" to set characters set as GSM
  3. If receiving messages, module will report it through UART. Reading message: AT+CMGR=3, Then convert the message to Chinese characters with the software as below.

GPS Debugging


General AT commands

Command Description Return
AT+CGNSPWR AT+CGNSPWR=1 Turn on the power of GPS
AT+CGNSPWR=0 Turn off the power of GPS
AT+CGNSIPR AT+CGNSIPR? Enquiry the baud rate of GPS
AT+CGNSIPR=<Baudrate> Set the baud rate of GPS
The current baud rate
AT+CGNSTST AT+CGNSTST=1 Send data received to UART
AT+CGNSTST=0 Stop sending data received to UART
AT+CGNSINF GNSS navigation information parsed from NMEA sentences Print the GPS information

For more details of AT commands, please refer to:SIM868 Series GNSS Application Note V1.00

GPS Configuration

  1. Connecting the GPS antenna, and place the receiver on open area outdoor
  2. Turn on power of GPS: AT+CGNSPWR=1
  3. Check the baud rate: AT+CGNSIPR?
  4. Start to sending data received to UART: AT+CGNSTST=1:
  5. Close the Com Assistant software SSCOM. Open u-center and set the Port and Baudrate. The Port is the port number recognized by PC. Set Baudrate as the value we got before (You can configure them in Receiver option or click icons which is on the panel directly):
  6. Choose Player>, then you can see the information of GPS:

GPRS Debugging

General AT commands

Command Description Return
AT+CGATT AT+CGATT? Check the state of GPRS attachment +CGATT:1
1 Attached
AT+CIICR Bring up wireless connection with GPRS OK
AT+CIFSR Get local IP address OK
Mode: connection type;
IP_Add: Remote server IP address;
Port: Remote server port
1A (HEX format) Tell module to send data SEND OK
AT+CIPCLOSE Close TCP or UDP connection CLOSE OK

For more details of AT commands, please refer to:SIM800 Series_AT Command Manual_V1.09

Local virtual severs settings

Virtual servers define the mapping between service ports of WAN and web servers of LAN. All requests from Internet to service ports of WAN will be redirected to the computer (web servers of LAN) specified by the server IP. (see your router’s guide manual)

  1. Log in Management Console of your router with browser (read your router’s guide manual for specific address)
  2. Set Port:5000 (The Port can’t be conflict to other’s. Here we set 5000)
  3. Set LAN IP address of your computer (you can run CMD on your computer, and execute command ipconfig to enquiry the address of IPv4), as examples

Searching WAN IP

You can search “IP” on browser to get your WAN IP address, as below:


GPRS Setting

  1. AT+CSQ To enquiry the quality of signal. The first parameter of response is signal quality (Max is 31). The signal stronger, the value bigger.
  2. AT+CREG? Check Network registration. If the second parameter of response is 1 or 5, it means that Network has been registered successfully
  3. AT+CGATT? Check the state of GPRS attachment
  4. AT+CSTT="CMNET" Set the Network according to actual situation. Here we use CMNET
  5. AT+CIICR Bring up wireless connection with GPRS
  6. AT+CIFSR Get the local IP address
  7. AT+CIPSTART="TCP","",5000 Established TCP/IP connection

Sending data

  1. AT+CIPSEND GSM/GPRS/GNSS module ready to send data to server
  2. After getting the response >, edit the contents of message (has been converted) without Enter at the end. Then send 1A in HEX format as below
  3. If the data sent successfully, the server will receive the data.

Receiving data

  1. Choose the IP address of module on peers input box
  2. Input the data which you want to send:hello,i am server,please receive my message
  3. Click Send button, you can see that module receive the data with COM assistant software

Deactivating Connection

Send AT+CIPCLOSE or AT+CIPSHUT to deactivate connection.


Bluetooth Debugging

General AT Commands

Command Description Return
AT+BTPOWER=1 AT+BTPOWER=1 Turn on Bluetooth
AT+BTPOWER=0 Turn off Bluetooth
AT+BTHOST AT+BTHOST? Enquiry the name and address of Bluetooth
AT+BTHOS=<Name> Change the name of Bluetooth
The name and MAC address of Bluetooth
AT+BTSCAN AT+BTSCAN=1,10 Search nearby Bluetooth devices Information of Bluetooth device searched
AT+BTPAIR AT+BTPAIR=0,1 Pair with device 1
AT+BTPAIR=1,1 Confirm pairing
AT+BTUNPAIR AT+BTUNPAIR=0 Delete the pairing data stored OK
AT+BTACPT AT+BTACPT=1 Confirm SPP connection OK
AT+BTSPPSEND AT+SPPSEND Send data nput data after getting > response

Bluetooth Setting

  1. Connecting the Bluetooth antenna to the GSM/GPRS/GNSS HAT. Open the Bluetooth of your telephone, and make it visible to all nearby Bluetooth.
  2. AT+BTPOWER=1, Turn on Bluetooth
  3. AT+BTHOST? Enquiry the name and MAC address of module, you can also use AT+BTHOST=<Name> Command to change the Bluetooth name of GSM/GPRS/GNSS HAT
  4. AT+BTSCAN=1,10 To search available nearby devices. Search time is 10s. During searching, module will print the information of available device via UART. For example, +BTSCAN: 0,2,"H60-L01",50:a7:2b:bb:a4:50,-47 “0,2” is the ID of this device, “H60-L01” is name of device, “50:a7:2b:bb:a4:50” is MAC address of device, and “-47” is the RSSI value.
  5. AT+BTPAIR=0,2 , Pair with available device proactively, the second parameter here is the ID we got at step 4 . If get the response Error, just use AT+BTUNPAIR to delete the pairing data and pair again.
  6. After sending the pair command successfully, you can see that your telephone prompt the pair request. Then you need to click Pair to accept the request, and send AT+BTPAIR on PC to confirm the pair behavior. With these, module pair with the telephone successfully. If you don’t send the AT command to confirm pairing, the telephone will prompt information that fail to pair after a while. In this case, you need to send the pair command again. You can also use the telephone to originate the pairing request, then input AT+BTPAIR=1,1 to confirm it.

Bluetooth Connecting

To test Bluetooth connection and communication with GSM/GPRS/GNSS, you can use the Bluetooth APP. Scanning the QR code below to download the APP, then you can use it’s Serial function for test. (The APP is just used for simply test)


  1. Open the APP, click SCAN button on the upper right to scan the available devices. Then choose “SIM868” (“SIM868” is the Bluetooth name of GSM/GPRS/GNSS HAT) and click UART. Then you will get the information that +BTCONNECTING on the COM assistant, which means there are connecting request. If you don’t reply it for a while, the APP will prompt that connecting failed. And the Assistant software will print +BTDISCONN to prompt you connecting failed.
  2. Connecting again, send command AT+BTACPT=1 to confirm and accept Bluetooth connection. You can see that +BRCONNECT is printed on the Assistant shows that succeed SPP connection. Then you can send data to the module with the APP.
  3. While receiving the data send from the telephone, the data will be print with ID of device, the length of string and the content on the Assistant software.
  4. Send AT+BTSPPSEND command to transmit data. After getting the response >, input the content without Enter at the end. Send 1A in HEX begin to transmit the data. Then you can see that the data is received by your phone.

Using with Raspberry Pi

UART configuration of Raspberry Pi

Because UART of Raspberry Pi is used for Linux console output by default, if we want to use the UART, we need to change the settings. Executing this command to enter the configuration page :

sudo raspi-config

Choose Advanced Options -> Serial -> no, to disable Linux’s use of console UART Open /boot/config.txt file, find the below statement and uncomment it to enable the UART. You can directly append it at the end of file as well.


Then reboot.

Minicom for UART debugging on Raspberry Pi

Inserting the module to Raspberry Pi and plug the jumper B,

Install minicom,minicom is a text-based modem control and terminal emulation program for Linux:

sudo apt-get install minicom

Execute command: minicom -D /dev/ttyS0(ttyS0 is the UART of Raspberry Pi 3B)

Baud rate is 115200 by default. If you need to change the baud rate, for example 9600, you can add the parameter -b 9600.

The user UART device of Raspberry Pi 2B/Zero is ttyAMA0, and ttyS0 of Raspberry Pi 3B

Testing Bluetooth function as examples:



Python examples are provided for Raspberry Pi

  • Executing sudo python to make a call, if you want to change the phone number on code, just need to modify the parameter W_buf_phone as below:

  • Executing sudo python to send a message.
  • Changing the number of receiver: the penultimate parameter of W_buff array.
  • Changing the content of message:The last parameter of W-buff array

  • Executing sudo python to get the GPS information



SIM868 Related

Other Chips



If you require technical support, please go to the Support page and open a ticket.