GSM/GPRS/GNSS HAT

From ingcool
Jump to: navigation, search

Introduction

This is a handy, low power Raspberry Pi HAT which features multi communication functionalities: GSM, GPRS, GNSS and Bluetooth.。
It allows your Pi to easily make a telephone call, send messages, connect to wireless Internet, global position, transfer data via Bluetooth, and so on.

Features

  • Standard Raspberry Pi 40PIN GPIO extension header, supports Raspberry Pi series boards
  • Supports SMS, phone call, GPRS, DTMF, HTTP, FTP, MMS, email, etc.
  • Support GPS, COMPASS, Glonass, LBS base station positioning, Omni-positioning
  • Bluetooth 3.0, supports data transferring through Bluetooth
  • Onboard USB TO UART Converter CP2102 for UART debugging
  • 6x LEDs for indicating the module working status
  • SIM card slot for 1.8V/3V SIM card
  • RTC with backup battery holder
  • 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

GSM/GPRS

Band

  • GSM 850/EGSM 900/DCS 1800/PCS 1900 MHz
  • Quad-band auto search
  • Compliant to GSM phase 2/2+

Emitting 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 speed: max 85.6kbps
  • 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
  • SMS storage: SIM card

Audio

  • Voice encode/decode mode: Half Rate\Full Rate\Enhanced Full Rate\Adaptive muti rate
  • Supports echo cancellation
  • Supports noise reduction

GNSS

Receiver type

  • 33 tracking channels
  • 99 acquisition channels
  • GPS L1 C/A code

Sensitivity

  • Tracking: -165 dBm
  • Cold starts : -148 dBm

Time-To-First-Fix

  • Cold starts: 28s(typ.)
  • Hot starts: <1s
  • Warm starts: 26s

Accuracy

  • Horizontal position : <2.5m CEP

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

Test it in Windows PC

Hardware connection

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

  1. A SIM card, the card should be usable and GPRS access (for testing the GPRS)
  2. An earphone with a microphone on it (For testing Call function)
  • Insert the SIM card to the card slot, plug the earphone and connect the GSM antenna
  • 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.
  • 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.
GSM-GNSS-GPRS COM.png
  • 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 inserted correctly.
Set the jumper to A

GSM-GPRS-GNSS HAT-1.png

Test GSM

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

Take 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 and STA keep bright, NET flashes every three seconds).
  3. Send “AT+CPIN?” and Enter to query the status of the SIM card. Getting “+CPIN: READY” if the SIM card is ready
  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:
GSM-GNSS-GPRS Callphone.png

Answer calls

  1. Enable CLIP notification: AT+CLIP=1 then Enter
  2. Hang up: ATH then Enter
GSM-GNSS-GPRS answercall.png

Send SMS

  1. Set the local SMSC:AT+CSCA="+8613800755500" then Enter, get response “OK”. Note: The SMSC will be different in different areas. Here, it is ShenzhenChina as examples;
  2. AT+CMGF=1: Set SMS to TEXT mode;
  3. AT+CMGS="xxxxxxxxxxx” then Enter, set the number of receivers, then you will get a response: >, edit the content of the message (needn’t Enter at the end). After editing, GSM/GPRS/GNSS HAT User Manual 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 sent successfully, the module will get the reply +CNGS: 174 as below figures
GSM-GNSS-GPRS sendMessage.png

=Receiver SMS

  1. Send a message “this is a receive test” to the GSM/GPRS/GSNN HAT from your phone
  2. . While receiving messages, the module will report it to UART: “SM”, 3, it means that there are 3 messages in SM, and the message we receive 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 the message as below
GSM-GNSS-GPRS revMessage.png

Test GPS

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

  1. Connecting the GPS antenna, and place the receiver on open area to receive GPS signal
  2. Turn on power of GNSS: AT+CGNSPWR=1
  3. Check the baud rate: AT+CGNSIPR?
  4. Start to sending data received to UART: AT+CGNSTST=1:
GSM-GNSS-GPRS GPS.png
  • 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 in Receiver option or click icons on the toolbar directly):
GSM-GNSS-GPRS GPS u-center.png


  • Click Connect, then the GNSS information will be printed as below
GSM-GNSS-GPRS GPS u-center2.png


Test GPRS

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

Seyying local virtual server

The virtual server defines the mapping between service ports of WAN and web servers of LAN. All requests from the Internet to service ports of WAN will be redirected to the computer (web servers of LAN) specified by the server IP. (Please refer to guide manual of your router)

  1. Log in Management Console of your router with a browser (read your router’s guide manual for specific address)
  2. . Set Port:5000 (The Port can’t conflict with others. Here we set it to 5000)
  3. Set LAN IP address for your computer (you can run CMD on your computer, and execute command ipconfig to inquiry the address of IPv4), 192.168.1.14 as examples
GSM-GNSS-GPRS gnss ip.png


Get WAN IP

You can search “IP” on a browser to get WAN IP address of your PC as below: (This method is only workable in China)

GSM-GNSS-GPRS gnss ip2.png


Set GPRS

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

Send data

  1. AT+CIPSEND module is going to send data to the server
  2. After getting the response >, edit the contents of the 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
GSM-GNSS-GPRS gnss sendmsg.png


Receive data

  1. Choose the IP address of module on Peers input box
  2. Input the data which you want to send: hello, I am a server, please receive my message
  3. Click Send button, you can see that module receive the data
GSM-GNSS-GPRS gnss revmsg.png


Deactivate connection

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

Test Bluetooth

For more information about AT command: Please refer to: SIM800 series_BT_application_V1.04

Setting

  1. Connecting the Bluetooth antenna to the GSM/GPRS/GNSS HAT. Open the Bluetooth service of your phone and set it visible to all nearby Bluetooth.
  2. AT+BTPOWER=1 Turn on Bluetooth
  3. AT+BTHOST?,Enquiry the name and MAC address of the module, you can also use
  4. AT+BTSCAN=1,10 ,To search available nearby devices. The search time is 10s. During searching, the module will print the information of the available devices to UART. Examples: +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;“-47” is the RSSI value.
  5. AT+BTPAIR=0,2, Pair with an available device, the second parameter here is the ID we got at step 4. If you 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 pairing request. Then you need to click Pair to accept the request and send AT+BTPAIR on PC to confirm the pairing 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 fails to pair after a while. In this case, you need to send the pair command again. You can also use the telephone to send the pairing request, then input AT+BTPAIR=1,1 to confirm it.
GSM-GNSS-GPRS bt config.png


Connecting

  • To test Bluetooth of GSM/GPRS/GNSS, you should use the Bluetooth APP. Scanning the QR code below to download the APP, then you can use its Serial function to test. (The APP is just used for simply testing)
  1. Open the APP, click the SCAN button on the upper right to scan the available devices. Then choose “SIM868” (“SIM868” is default 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 is a connecting request. If you don’t reply to it for a while, the APP will prompt that connecting failed. And failed information “+BTDISCONN” will be printed on PC
  2. Connecting again, send command AT+BTACPT=1 to confirm and accept Bluetooth connection. You can see that +BRCONNECT is printed on PC shows that succeed in SPP connecting. Then you can send data to the module with the APP.
  3. While receiving the data send from the telephone, the data will be printed with ID of the device, the length of string, and the content on PC.
  4. Send AT+BTSPPSEND command to transmit data. After getting the response >, input the content without Enter at the end. Send 1A in HEX to begin to transmit the data. Then you can see that the data are received by your phone

Workin with Raspberry Pi

Enable serial port

  • Open a terminal and configure interface by the following commands
sudo raspi-config
  • Choose Interfacing Options -> Serial->No->Yes
  • Restart Raspberry Pi
sudo reboot

Install libtaties

  • Install Python libraries
sudo apt-get update
sudo pip install RPi.GPIO
sudo apt-get install python-serial

minicom test

  • Install minicom tool and test
sudo apt-get install minicom
# For Pi 3B\3B+\4B,
sudo minicom -D /dev/ttyS0 -b 9600
# For Pi ZERO\2B
sudo minicom -D /dev/ttyAMA0 -b 9600
# If you want to test with the USB port of Pi, you can change the jumper to A:
sudo minicom -D /dev/ttyUSB0 -b 9600

The default baud rate of minicom is 115200,If you want to change it to 9600, you can add parameter to the command: -b 9600. ttyS0 is the serial port of Pi 3B/3B+, ttyAMA0 of Pi 2B/Zero. If you use USB interface, the port may be ttyUSB*
Here we test Bluetooth as example:

GSM-GNSS-GPRS rpi minicom.png


Demo codes

  • Download
sudo apt-get install p7zip
wget  http://{{SERVERNAME}}/w/images/1/1f/GSM-GPRS-GNSS-HAT-Code.7z
7zr x GSM-GPRS-GNSS-HAT-Code.7z -r -o./GSM-GPRS-GNSS-HAT-Code
sudo chmod 777 -R GSM-GPRS-GNSS-HAT-Code
cd GSM-GPRS-GNSS-HAT-Code/GSM-GPRS-GNSS-HAT-Code/Raspberry\ Pi/
  • We provide some python codes for testing
sudo python call_phone.py 
sudo python send_message.py 
sudo python gps.py

Resources

Examples

Software

Documents