GSM/GPRS/GNSS HAT

From ingcool
Revision as of 10:31, 19 April 2020 by INKU-admin123 (talk | contribs) (撤销INKU-admin123讨论)的版本32)
Jump to: navigation, search

产品简介

本产品是具有GSM(全球移动通信系统)、GPRS(通用分组无线服务)、GNSS(全球导航卫星系统)和Bluetooth(蓝牙)功能的树莓派扩展板。
体积小、功耗低、功能强!带上我,你的树莓派将可以轻松实现打电话,发短信,无线上网,全球定位,蓝牙数据传输等功能。

产品特性

  • 基于树莓派标准接口设计,兼容并可直接插入Raspberry Pi 2代B/3代B/Zero/Zero W
  • 支持短信、电话、GPRS、DTMF、HTTP、FTP、彩信、邮件等功能
  • 支持GPS、北斗、Glonass、LBS基站定位,全方位定位
  • 支持蓝牙3.0,可进行蓝牙数据传输
  • 板载CP2102 USB转UART芯片,方便进行串口调试
  • 板载6个LED指示灯,方便查看模块运行状态
  • 板载SIM卡槽,支持1.8V和3V SIM卡
  • 支持RTC实时时钟,带备用电池卡座
  • 支持自动识别波特率(1200bps ~115200bps)
  • 支持AT命令控制(3GPP TS 27.007,27.005和SIMCOM增强型AT命令集)
  • 支持SIM应用工具包:GSM 11.14 Release 99
  • 提供完善的配套资料手册(Raspberry/Arduino/STM32等示例程序)

GSM/GPRS参数

频段

  • GSM 850/EGSM 900/DCS 1800/PCS 1900 MHz
  • 支持自动搜索4个频段
  • 满足GSM phase 2/2+ 标准

发射功率

  • Class 4 (2W @ GSM 850/EGSM 900 MHz)
  • Class 1 (1W @ DCS 1800/PCS 1900 MHz)

GPRS连接特性

  • GPRS multi-slot class 12 (默认)
  • GPRS multi-slot class 1~12 (可配置)

GPRS 数据特性

  • 下行/下行传输速率:≤85.6kbps
  • 支持分组广播控制信道(PBCCH)
  • 编码格式:CS-1、CS-2、CS-3、CS-4
  • 支持用于PPP连接的PAP协议(密码验证协议)
  • 支持非结构化补充数据业务(USSD)

短信(SMS)

  • 支持类型:MT、MO、CB、Text、PDU
  • 短信存储设备:SIM卡

音频特性

  • 语音编解码模式:Half Rate、Full Rate、Enhanced Full Rate、Adaptive Muti Rate
  • 支持回音消除功能
  • 支持噪声抑制功能

GNSS参数

接收

  • 33个跟踪通道
  • 99个采集通道
  • GPS L1 C/A code

灵敏度

  • 追踪 :-165 dBm
  • 冷启动 :-148 dBm

首次定位时间

  • 冷启动:28s(typ.)
  • 热启动:<1s
  • 暖启动:26s

精度

  • 确定位: < 2.5米CEP

Bluetooth参数

  • 集成AT指令控制
  • 符合蓝牙specification3.0 + EDR
  • 支持 SPP, OPP, HFP/HSP 等功能

其他参数

  • 工作电压:5V
  • 产品尺寸:30.2mm x 65mm
  • 工作温度:-40°C ~ 85°C
  • 存储温度:-45°C ~ 90°C

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

资料

程序

软件

数据手册