SIM8202G-M2 5G HAT (B)

From Waveshare Wiki
Jump to: navigation, search
SIM8202G-M2 5G HAT (B)
SIM8202G-M2 4x antennas,Model B
Sim8202g-m2-5g-hat-b-6.png

Mainly applicable for China, Europe, the Middle East, South America...
RM50XQ-XX 5G HAT (with case)
RM500Q-GL/RM500Q-AE/RM502Q-AE 4x antennas,with case
Rm500u-cn-5g-hat-with-case-2.jpg
{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Features

  • Integrates extensive network protocols, with multi drivers and software support, compatible with different OS including Windows / Linux / Android.
  • USB 3.1 port (USB 2.0 compatible) for connecting to PC, Raspberry Pi, or Jetson Nano host board to enable high speed 5G communication.
  • Standard M.2 B KEY slot, compatible with different 5G modules: RM500U-CN / RM500Q-GL / RM500Q-AE / RM502Q-AE series.
  • Onboard UART, PWR, and RST control pin, built-in voltage level translator, enabled via DIP switch, for use with hosts like Raspberry Pi or Arduino.
  • Onboard USB-C connector, enabled via a switch, for connecting standalone power supply for the module, allows more loads, stable amd flexible power supply.
  • Onboard power supply on/off switch, reset button and LED indicator, easy to turn on/off the module or monitor the operating status.
  • 2 x SIM card slot, dual card single standby, switchable via AT command.
  • High-efficiency power supply circuit, up to 3A output current.

Specifications

  SIM8202G-M2
Frequency band
Sub-6G (SA) n1, n2, n3, n5, n7, n8, n12, n20, n28, n38, n40, n41, n48, n66, n71, n77, n78, n79
Sub-6G (NSA) n41, n77, n78, n79
LTE-FDD B1, B2, B3, B4, B5, B7, B8, B12, B13, B14, B17, B18, B19, B20, B25, B26, B28, B29, B30, B32, B66, B71
LTE-TDD B34, B38, B39, B40, B41, B42, B43, B48
WCDMA B1, B2, B3, B4, B5, B8
GNSS GPS, GLONASS, Beidou, Galileo, and QZSS
Data rate
Sub-6G 2.4 Gbps (DL)  /  500 Mbps (UL)
LTE 1 Gbps (DL)  /  200 Mbps (UL)
HSPA+ 42 Mbps (DL)  /  5.76 Mbps (UL)
Software functions
Operating systems Windows/Linux/Android
Communication protocols TCP/IP, IPV4, IPV6, Multi-PDP, FTP, FTPS, HTTP, HTTPS, MQTTS, DNS, SSL3.0
SMS Supports MT, MO, CB, Text, PDU
Firmware upgrade Supports firmware upgrade via USB port
Applications
Applicable regions Regions with 5G Sub-6G signal coverage including China, US, Japan, South Korea, Europe, the Middle East, Latin America, etc.
Application examples CPE, Smart gateway, Drone, Live streaming, Remote medical treatment, Intelligent security


Selection Guide

5G Sub-6 RM500U-CN RM500Q-GL RM500Q-AE RM502Q-AE
RM500U-CN-5G-HAT-details-17-1.jpg RM500U-CN-5G-HAT-details-17-3.jpg RM500U-CN-5G-HAT-details-17-5.jpg RM500U-CN-5G-HAT-details-17-4.jpg
Region / Provider China Global (except US) Global (except China) Global (except China)
Operating Temperature -30 °C ~ +75 °C -30 °C ~ +70 °C
Extension Temperature -40 °C ~ +85 °C
Dimensions 30.0 × 52.0 × 2.3 (mm)
Weight 8.9 (g) 8.7 (g)
Power Supply 3.3~4.4 V, typical 3.7 V 3.135~4.4 V, typical 3.7 V
Power Consumption 90 μA @ shutdown

3.7 mA @ hibernate TBD @ USB 2.0, idle TBD @ USB 3.0, idle

70 μA @ shutdown

4.0 mA @ hibernate 32 mA @ USB 2.0, idle 54 mA @ USB 3.0, idle

80 μA @ shutdown

4.2 mA @ hibernate 39 mA @ USB 2.0, idle 54.5 mA @ USB 3.0, idle

Frequency Band
5G 5G NR NSA n41, n78, n79 n41, n77, n78, n79 n1, n2, n3, n5, n7, n8, n12, n20, n25, n28, n38, n40, n41, n48*, n66, n71, n77, n78, n79
5G NR SA n1, n28, n41, n77, n78, n79 n1, n2, n3, n5, n7, n8, n12, n20, n25, n28, n38, n40, n41, n48*, n66, n71, n77, n78, n79
LTE LTE-FDD B1, B2, B3, B5, B7, B8, B20, B28 B1, B2, B3, B4, B5, B7, B8, B12(B17), B13, B14, B18, B19, B20, B25, B26, B28, B29, B30, B32, B66, B71
LTE-TDD B34, B38, B39, B40, B41 B34, B38, B39, B40, B41, B42, B43, B48
LAA - B46
UMTS WCDMA B1, B2, B5, B8 B1, B2, B3, B4, B5, B6, B8, B19
GNSS - GPS / GLONASS / BeiDou (Compass) / Galileo
Data rate
5G SA Sub-6 downlink 2 Gbps;
uplink 1 Gbps
downlink 2.1 Gbps;
uplink 900 Mbps
downlink 2.1 Gbps;
uplink 450 Mbps
downlink 4.2 Gbps;
uplink 450 Mbps
5G NSA Sub-6 downlink 2.2 Gbps;
uplink 575 Mbps
downlink 2.5 Gbps;
uplink 600/650 Mbps
downlink 2.5 Gbps;
uplink 650 Mbps
downlink 5 Gbps;
uplink 650 Mbps
LTE downlink 600 Mbps;
uplink 150 Mbps
downlink 1.0 Gbps;
uplink 200 Mbps
downlink 1.0 Gbps;
uplink 200 Mbps
downlink 2 Gbps;
uplink 200 Mbps
UMTS downlink 42.2 Mbps;
uplink 11 Mbps
downlink 42 Mbps;
uplink 5.76 Mbps
* means developing/planning/processing

What's On Board

SIM8202G-M2-5G-HAT-B-details-intro.jpg

Number Name Description
Raspberry Pi GPIO header Easy connect to Raspberry Pi
Switch Enable the corresponding pin
M.2 interface Compatible with RM500U-CN / RM500Q-CN / RM500Q-GL /RM50XQ-AE and other series of 5G modules
SIM card holder Onboard two SIM card slots, dual card single standby. The default SIM1 card slot works, SIM2 is on the back, requires module support, and must be switched through AT commands
USB 3.1 connector Backward compatible with USB 2.0, can be used to connect to PC/Raspberry Pi/Jetson Nano, etc.
USB Type-C connector 5V 3A input; stable and flexible power supply
Audio port SIM82XX series support audio function, RM50XX series do not support this audio function
Antenna connector Onboard four-way antenna, strong signal
Reset switch One-key reset
Power switch To facilitate the power supply mode of the control module:

——If set to USB, the module will provide power through the "⑤.USB3.1 interface";
——If set to EXT PWR, the module will provide power through the "⑥.USB Type-C interface" external power supply

Cooling fan Cool down the Raspberry Pi and 5G module at the same time
Indicator Check the module running status anytime, anywhere

Pinout Definition

After connecting to Raspberry Pi, these pins (TX, RX, D4 and D6) can be connected or not through the DIP switch:
M.2-TO-4G-5G-HAT-Pin-defined.jpg

4G/5G modules function testing

Category 4G/5G Module Network Communication GNSS Positioning Voice calls through
Earphone Port
Dual SIMs UART Interface External Power Supply?
5G SIM8202G-M2 5G/4G/3G Support Support Support Support Optional, but recommended
5G SIM8200EA-M2 5G/4G/3G Support Support Support Support Optional, but recommended
5G RM500U-CN 5G/4G/3G NOT Support NOT Support Support Support Recommended
5G RM500Q-GL 5G/4G/3G Support NOT Support Support NOT Support Recommended
5G RM500Q-AE 5G/4G/3G Support NOT Support NOT Support NOT Support Recommended
5G RM502Q-AE 5G/4G/3G Support NOT Support NOT Support NOT Support Recommended
LTE-A EM06-E LTE-A/4G/3G NOT Support NOT Support NOT Support NOT Support Optional
LTE-A A7906E LTE-A/4G/3G NOT Support NOT Support NOT Support NOT Support Optional
4G SIM7600G-H-M2 4G/3G/2G Support Support NOT Support Support Optional

4G/5G Module Compatibility

If you need to use the M.2 TO 4G/5G HAT for other 4G/5G modules, you can refer to the M.2 connection diagram below, check whether there is any pin conflict, and then connect to test:
M.2-Compatibility.jpg

Working with Windows PC

Hardware Preparation

  • In addition to the items in the package,
    5G-HAT-Pack.jpg
  • you need to prepare the following items:
* A 5G SIM card (no downtime and 5G enabled);
* A computer with a Windows operating system (Such as Windows 10)
* A headphone cable with a microphone (optional);

Hardware Connection

Connect the 5G HAT with a usb3.0 cable, and connect an external 5V power supply to the Type-C power supply port of the 5G HAT, as shown in the figure:
M.2-TO-4G-5G-HAT-TO-WIN10.jpg

Install Driver

Download the SIM8200 Driver from the Resources part to your PC and unzip it.
Enter the SIM8200_OS_Driver\Windows directory.
Enter the 1_install directory and run the setup.exe file to install.
Sim8200 windows driver1.png
After connecting, a mobile network icon appears, and you can disconnect the other networks and test the mobile network.

Install driver manually

For some of PC, you need to add a driver manually. If your PC doesn't recognize any COM ports in Device Manager, find unknown devices and update the driver manually:
d Power on the 5G module and set the Switch to ON. four(it may be more than four) unknown devices are recognized by Windows PC.
Sim8200 windows driver0.png
Right-click the device, update the driver manually, choose SIM8200_OS_Driver\Windows, and then choose the driver according to the version of your OS. You need to update all four/five/six devices.:
Sim8200 windows driver1.png
Four COM ports: AT is used for AT command controlling, Audio is used for dailing Diagnostics is used for debugging, and NMEA is used for GPS.
Sim8200 windows driver2.png
Sim8200 windows driver3.png
A mobile network will be set up automatically after updating, you can disconnect other networks and test it.

Common AT Command

Sim7600CE-4.png
  • SIM7600X and SIM820X module supports AT command control, some basic AT commands are shown in the table below:
Command Description Return
AT AT Test Command OK
ATE ATE1 set echo
ATE0 close echo
OK
AT+CGMI Query module manufacturer OK
AT+CGMM Query module model OK
AT+CGSN Query product serial number OK
AT+CSUB Query module version and chip OK
AT+CGMR Query the firmware version serial number OK
AT+IPREX Set the module hardware serial port baud rate +IPREX:
OK
AT+CRESET reset module OK
AT+CSQ Network signal quality query, return signal value +CSQ: 17,99
OK
AT+CPIN? Query the status of the SIM card and return READY, indicating that the SIM card can be recognized normally +CPIN: READY
AT+COPS? Query the current operator, the operator information will be returned after normal networking +COPS:
OK
AT+CREG? Query network registration status +CREG:
OK
AT+CPSI? Query UE system information
AT+CNMP? Network mode selection command:
2:Automatic
13:GSM only
38:LTE only
48 : Any modes but LTE
... ....
OK
  • Open the device manager, find the port number corresponding to AT Port; then open the sscom software, select the corresponding port and baud rate, check "Add carriage return and line feed"; click the sscom "Extension" button and pull out the preset It is best to open the serial port and send the corresponding AT command to test.

Choose SIM card

The 5G HAT has two SIM card slots onboard, dual SIM card, and single standby, which can be switched and enabled by AT command.

  • SIM card 1 is selected by default, You can use the following command to query and confirm:
AT+SMSIMCFG?
  • To switch SIM card 2, please use the following command:
AT+SMSIMCFG=1,2
  • Switch back to the SIM card 1, please use the following command:
AT+SMSIMCFG=1,1
  • Check whether the corresponding card slot recognizes the SIM card:
AT+CPIN?

Manual NDIS dial-up Internet

After installing the driver, some computers cannot automatically dial up to access the Internet, so you need to dial manually, the operation is as follows:

AT$QCRMCALL=1,1

After dialing is successful, as shown in the figure below, the computer can go online normally.
Sim8200 win sendat1.png

GPS Positioning

Connect the passive GPS antenna to the ANT5 of the module, and place the antenna outdoors facing the sky.Then send the AT command to turn on the GPS:

AT+CGPS=1

Sim8200 gps info0.png
Now open the NEMA port, you can get GPS data:
Sim8200 gps info1.png
Finally, turn off the GPS, you can use the AT command:

AT+CGPS=0

Working with Raspberry Pi

Hardware Connection

Connect the 5G HAT with a double-ended usb3.0 data cable, and connect an external 5V power supply to the Type-C power supply port of the 5G HAT, as shown in the figure:

Raspberry Pi Pi 4B Pi 3B/3B+ CM4-IO-BASE
USB adapter USB3.0 adapter USB2.0 adapter USB3.0 adapter
Connection M.2-To-4G-5G-HAT-CM4.jpg M.2-To-4G-5G-HAT-Pi3B.jpg M.2-To-4G-5G-HAT-CM4.jpg
Note
It is recommended to connect an external 5V power supply at the arrow.

If it is used for PI4B, there is a matching case, and the installation diagram is as follows:

The use of Raspberry Pi OS

The following methods are NDIS dialing methods, which do not support the Raspbian system that does not support 2022-04-04. If there is an error, please confirm whether the system is a system before 2022-04-04; 2022-04-04 For the later Raspbian system, it is recommended to use the convenient and fast system built-in driver, internal automatic dialing SIM820X RNDIS dial.

Configuration

This configuration is only needed at the first time.
Open a terminal and run the following commands:

sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/f/fb/SIM8200-M2_5G_HAT_code.7z
7z x SIM8200-M2_5G_HAT_code.7z
sudo chmod 777 -R SIM8200-M2_5G_HAT_code
cd SIM8200-M2_5G_HAT_code
sudo ./install.sh

Please do not modify option, qmi_wwan_simcom, default.script,install.sh files or directorys, otherwise the dirver cannot be installed normally.
If you get error information, please check ifyou use the 2020-08-20-raspios-buster-armhf OS and take screenshot of error information and contact our support team for help.

Run ifconfig -a command to check WWAN0 interface.
SIM8200 RPI 2.png

Testing with AT command

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2

SIM8200 RPI 1.png

5G Networking

cd Goonline
make
sudo ./simcom-cm

After running codes, DNS information is shown as the figure below:
SIM8200 RPI 3.png
After connecting two SIM820X to Raspberry Pi through USB, two network cards—wwan0 and wwan1 can be recognized, and the two network cards can be dialed at the same time through the following commands: (The network speed cannot be superimposed).

sudo ./simcom-cm -i wwan0
sudo ./simcom-cm -i wwan1

SIM8200X Working01.png

  • Note: If the IP cannot be obtained or the networking is not successful, use the following commands to obtain the IP and set the DNS networking:
sudo dhclient -v wwan0
sudo route add -net 0.0.0.0 wwan0

Auto-run

If you want to set the codes auto-run after booting, you can modify rc.local file:

sudo nano /etc/rc.local

Add the line to file as below:

sudo /home/pi/SIM8200-M2_5G_HAT_code/Goonline/simcom-cm &

Note that you have to add "&" to the end of the command, make sure that the command can be run in the background, or the Pi may not boot normally.

5G HAT Power or Reset Control

The 5G HAT is provided with PWR and RESET control pins, and the Raspberry Pi can control the module power on/off or reset through the high and low levels of these two pins.

  • Turn the PWR and RST setting switches to the right to enable Pi control:
    M.2-TO-4G-5G-HAT-PWR-RST-PINS-SETTING.jpg
  • Power Control: The following demonstrates the Shell script to control the PWR (D5 PIN) as an example:
cd /sys/class/gpio
echo 5 > export

cd gpio5
echo out > direction
echo 1 > value    #set to high level to shut down the 5G module
echo 0 > value    #set to low level to power on the 5G module
echo 5 > unexport
  • Reset Control: The following demonstrates the Shell script to control the Reset (D6 PIN) as an example:
cd /sys/class/gpio
echo 6 > export

cd gpio6
echo out > direction
echo 1 > value    #set to a high level to shut down the 5G module
sleep 1           #wait for 1 second
echo 0 > value    #set to low level to power on the 5G module
echo 5 > unexport

The use of OpenWrt

Introduction to OpenWrt

Soft routing is using desktops or servers and other equipment with software. It mainly depends on the settings of the software to achieve the functions of the router. The hard routing is a unique hardware device, including a processor, power supply, and embedded software to provide router functionality.
OpenWrt is a very popular soft routing system. It is a highly modular and highly automated embedded Linux system with powerful network components and scalability. It is often used in industrial control equipment, routers, and other equipment.
In addition to the functions of general home routers, OpenWrt soft routing can also achieve port forwarding, intranet penetration, 4G networking, FTP server and more powerful functions.

Burn the image

Download the RPI OpenWrt system, unzip the system in the Imgs directory, and use the burning tool to burn the system to the SD card.

Login and initial settings

  • After the OpenWrt system is turned on, the Raspberry Pi is equivalent to a router. Therefore, use a network cable to connect the Raspberry Pi to the computer according to the use of the router (you can also use the mobile phone to search for WIFI, the default name is "OpenWrt").
  • You can set the language to auto first.
SIM820x OpenWrt(EN) (1).png
  • Enter 192.168.1.1 on the web page, the default user name: root, and the default password: password, enter the OpenWrt web management interface.
SIM820x OpenWrt(EN) (2).png
  • Set WIFI password: Network —> Wireless —> interface configuration —> Wireless security.
SIM820X OpenWrt01.png
  • Create the new interface: Network -> Interface -> Create interface.
  • Modify the IPv4 address of the LAN port to a different IP that is not the same as the LAN port IP of other routers in your home. (Many routers default the LAN port IP to 192.168.1.1. If you do not modify the IP of the OpenWrt, it will easily lead to conflicts and failure to connect to the Internet).

If necessary, it is also recommended to disable the IPv6 allocation length. After the modification is completed, click "Save & Apply", and re-use 192.168.10.1 to access the OpenWrt console.

SIM820x OpenWrt(EN) (3).png
  • In addition, it is recommended to adjust the Firewall setting to connect the OpenWrt terminal and Web management interface through the local area.

Network —> Firewall, change all "reject" to "accept", and click "Save & Apply" after modification, as shown in the picture below:

SIM820x OpenWrt(EN) (4).png
  • And then select System -> Administration, modify the allowed interface for SSH access to "unspecified" (that is, any interface can be accessed by ssh), check the Gateway port, and click "Save & Apply" after the modification is completed.
SIM820X OpenWrt02.png

At this point, you can connect to the OpenWrt web management interface or terminal through the IP address of the LAN port or wan port.

Check the working status of the drive

Connect to the OpenWrt terminal via SSH, and run the following commands to view the qmi driver, USB device, network port registration, and network port status:

dmesg | grep qmi
dmesg | grep ttyUSB 
ls /dev | grep cdc-wdm 
ifconfig wwan0
SIM8200 OpenWrt 7.png

Configure networking

  • Select System -> FileTransfer, select and upload simcom-cm in the simcom-cm directory of the folder:
SIM820x OpenWrt(EN) (6).png

Use the above "File Transfer" to upload, the uploaded program is located in "simcom-cm" under the /tmp/upload/ directory.

Enter the following commands in the terminal:

cp /tmp/upload/simcom-cm /
chmod a+x simcom-cm
./simcom-cm

【Note】: Closing this terminal will cause the networking program to stop, which will cause the network to be disconnected. It is recommended to run in the background.

SIM8200 OpenWrt 9.png
  • At this time, open a new terminal of OpenWrt and enter the command: ifconfig wwan0. You can see that the wwan0 network port has successfully obtained the operator IP and can ping the external network.
SIM8200 OpenWrt 10.png
  • Enter the Web management interface of OpenWrt, click Network —>Interface —>Create a new interface.
SIM820x OpenWrt(EN) (7).png
  • Enter the interface as shown in the picture below and confirm that the interface selection in "Physical Settings" is "wwan0".
SIM820x OpenWrt(EN) (8).png
  • Confirm that the interface selection in "Firewall Settings" is "wan".
SIM820x OpenWrt(EN) (9).png
  • Click "Save & Apply" to complete the network port settings, then return to the interface below, network-interface, you can see that the network port has been correctly identified.
SIM820x OpenWrt(EN) (10).png

Then the other devices can be connected to the OpenWrt wireless "OpenWrt" or through the network cable to connect to OpenWrt's own network port for networking.

5G network speed test

In the speed measurement part, because the Raspberry Pi comes with a Gigabit Ethernet port, and there are few USB network cards above Gigabit, we use the SpeedTest For Python tool to perform speed measurement by the commands. Connect to the terminal of OpenWrt and enter the commands one by one to measure the speed:

## Raspberry Pi OS
sudo apt install speedtest-cli
speedtest      # or use speedtest_cli

or

## OpenWRT
opkg update   
opkg install python3
opkg install python3-pip
pip install speedtest_cli 
speedtest      # or use speedtest_cli

5G HAT Minicom Serial Port Debugging

4G/5G Modules UART Interface Support

SIM8202G-M2, RM500U-CN, and SIM7600G-H-M2 Support UART Interface, Other 4G/5G Modules NOT Support!

For SIM8202G-M2 and SIM8200EA-M2 these two 5G modules, the UART interface is closed by default and needs to be opened through AT commands:

AT+CCUART=1

Raspberry Pi Serial Port Enable

Since the Raspberry Pi serial port is used for terminal debugging by default, if you need to use the serial port, you need to modify the Raspberry Pi settings. Execute the following command to enter the Raspberry Pi configuration:

sudo raspi-config

Select Interfacing Options ->Serial ->NO ->YES to disable serial debugging.
Serial port.png
Open the /boot/config.txt file, and find the following configuration statement to enable the serial port, if not, add it at the end of the file:

enable_uart=1

Restart to take effect:

1. Insert the module into the Raspberry Pi, and turn the S_TX and S_RX of the DIP switch to ON:
Minicom-serial.png
2. Install minicom, minicom is a serial debugging tool for the Linux platform:

sudo apt-get install minicom

3. Open ttyS0 through minicom——ttyS0 is the serial port of Raspberry Pi 3B/3B+/4B, the default baud rate is 115200;

sudo minicom -D /dev/ttyS0

4. For Raspberry Pi 2B/zero, the user serial device number is ttyAMA0; you can use the following command line to confirm, serial0 is the selected serial device number, as shown below:
RM500U-CN 5G HAT 9.png

Working with Jetson Nano

Hardware Connection

Connect the 5G HAT with a double-ended usb3.0 data cable, and connect an external 5V power supply to the Type-C power supply port of the 5G HAT, as shown in the figure:
RM500U-jetson.png
We recommend you use the new jetson-nano-sd-card-image, whose kernel version is higher than 4.9.140-tegra.
If you run with other Linux systems, please download the driver which is located in the SIM8200_OS_Driver\linux folder, and porting it according to the attached document.

Setup software

Open a terminal and run the following command.

sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/0/07/Sim8200_for_jetsonnano.7z
7z x Sim8200_for_jetsonnano.7z -r -o./Sim8200_for_jetsonnano
sudo chmod 777 -R Sim8200_for_jetsonnano
cd Sim8200_for_jetsonnano
sudo ./install.sh

Please do not modify or delete the option,qmi_wwan_simcom, default.script, and install.sh folders, otherwise, the driver cannot be installed normally.
If the driver failed to install, please use the 4.9.140-tegra version and try it again.

Run the command ifconfig -a to check WWAN0 port.
Sim8200 jetsonnano 1.png

Test AT command

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2

SIM8200 RPI 1.png

5G Networking

cd Goonline
make
sudo ./simcom-cm

Check if it generates the DNS.
Sim8200 jetsonnano 2.png

FAQ

Support

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