Difference between revisions of "Template:SIM862E-M2 5G HAT USER GUIDE"

From Waveshare Wiki
Jump to: navigation, search
m (Text replacement - "https://www.waveshare.com/w/upload/" to "https://files.waveshare.com/upload/")
Line 46: Line 46:
 
<pre>
 
<pre>
 
sudo apt-get install p7zip-full
 
sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/8/89/SIM8200_for_RPI.7z
+
wget https://files.waveshare.com/upload/8/89/SIM8200_for_RPI.7z
 
7z x SIM8200_for_RPI.7z  -r -o./SIM8200_for_RPI
 
7z x SIM8200_for_RPI.7z  -r -o./SIM8200_for_RPI
 
sudo chmod 777 -R SIM8200_for_RPI
 
sudo chmod 777 -R SIM8200_for_RPI
Line 134: Line 134:
  
 
===Program the image===
 
===Program the image===
Download the [https://www.waveshare.com/w/upload/b/b7/Sim820x_for_OpenWrt_Linux-5.4.86.7z RPI OpenWrt system], unzip the system in the Imgs directory, and use the burning tool to burn the system to the SD card.
+
Download the [https://files.waveshare.com/upload/b/b7/Sim820x_for_OpenWrt_Linux-5.4.86.7z RPI OpenWrt system], unzip the system in the Imgs directory, and use the burning tool to burn the system to the SD card.
  
 
===Login & Initial Settings===
 
===Login & Initial Settings===
Line 216: Line 216:
 
<pre>
 
<pre>
 
sudo apt-get install p7zip-full
 
sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/0/07/Sim8200_for_jetsonnano.7z
+
wget https://files.waveshare.com/upload/0/07/Sim8200_for_jetsonnano.7z
 
7z x Sim8200_for_jetsonnano.7z -r -o./Sim8200_for_jetsonnano
 
7z x Sim8200_for_jetsonnano.7z -r -o./Sim8200_for_jetsonnano
 
sudo chmod 777 -R Sim8200_for_jetsonnano
 
sudo chmod 777 -R Sim8200_for_jetsonnano

Revision as of 06:37, 2 September 2023

User Manual

Working With Windows

Direct Installation

Download a driver (Resource->Software->SIM8200 Driver) on your computer and then unzip it.
Enter SIM8200_OS_Driver\Windows directory.
For most hosts, you can enter "1_install" directory and then click "setup.exe" to install.
Sim8200 windows driver1.png
After connecting, a mobile network icon will appear. You can disconnect from other networks and test the mobile network.

Install Driver Manually

For some hosts, the port may not appear even if "1_install" is installed. In this case, you need to use the files in "2_AddManully" to add them manually. The way to use it is to find the unrecognized device in the device manager and right-click to add the driver, as follows:
Power on the G module and turn the switch to ON, the module starts, and the computer will recognize 4 unknown devices (maybe some boards will recognize 5 or 6), only 5 in the picture:
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 for all four/five/six devices:
Sim8200 windows driver1.png
Four COM ports: AT is used for AT command controlling, and Audio is used for dial up. 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.

Manual NDIS Dial-up Internet

If the above 2 steps have been done, Windows cannot access the Internet, you need to manually start the NDIS dial-up.
Open the sim8200 AT port and send the command:

AT$QCRMCALL=1,1+Enter

After dialing is successful, as shown in the figure below, the computer can go online normally.
Sim8200 win sendat1.png
At this time, the NDIS dialing takes effect, and the computer can connect to the network; if it returns No Carrier, it may have dialed up, and you can go online to see it directly.

GPS Positioning

SIM8200EA-M2 is ANT5; SIM8202G-M2 is ANT2; SIM8262E-M2 is ANT3; see the module hardware manual for details

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 #Enter

Sim8200 gps info0.png
Now open the NEMA port, you can get GPS data:
Sim8200 gps info1.png

Working With Raspberry Pi

It is recommended that you use the latest system image (the latest system address) of the Raspberry Pi, and the system's Linux kernel version 5.4. If your kernel is different, it is recommended that you update to the same version as this one. This tutorial is based on the 5.4 kernel, which can minimize errors.
SIM862E-M2 5G HAT USER05.png
SIM862E-M2 5G HAT USER06.png
If you are using other Linux systems, please download the driver under SIM8200_OS_Driver\linux, and transplant it according to the document under it; you can also use the built-in driver of the system for SIM820X RNDIS dial-up internet.

Configuration At The First Time

Please don't type the wrong letter, it's better to copy and paste.

sudo apt-get install p7zip-full
wget https://files.waveshare.com/upload/8/89/SIM8200_for_RPI.7z
7z x SIM8200_for_RPI.7z  -r -o./SIM8200_for_RPI
sudo chmod 777 -R SIM8200_for_RPI
cd SIM8200_for_RPI
sudo ./install.sh

Please do not delete or modify the "option" directory, "qmi_wwan_simcom" directory, "default.script", "install.sh" files, otherwise it will affect the loading of the driver.
If there is an error, please confirm whether the system is "2020-08-20-raspios-buster-armhf", and take a screenshot of the error message so that engineers can help you analyze and solve the problem.
Run "ifconfig -a" to see that "WWAN0" has been generated.
SIM8200 RPI 2.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

After running codes, DNS information is shown in the figure below:
SIM8200 RPI 3.png
After connecting two SIM820X to the Raspberry Pi through USB, two network cards—wwan0 and wwan1 can be recognized. 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.

Live streaming with ffmpeg

If you are using the 2020-08-20-raspios-buster-armhf image, then you don't need to install anything as the system already comes with ffmpeg.
Going straight to the topic, assuming you already have a camera and it's properly connected to the Raspberry Pi, then proceed with the tutorial.

  • The camera must be enabled by running the raspi-config command before using it:
sudo raspi-config
Select Enable Camera, select YES

Rpi Enable Camera.png

  • If it is a camera using the CSI interface, the system cannot find the device node of /dev/video0. A line for bcm2835-v4l2 needs to be added to the /etc/modules file:
sudo nano /etc/modules

add:

bcm2835-v4l2 

Pan-tilt hat addmodules.png
Then after the system starts, the system will load the module name in this file and restart the system:

sudo reboot
ls /dev/video*

The video0 device node is found below.
SIM862E-M2 5G HAT USER GUIDE03.png
Note: If after performing the first steps, please confirm that the operation and instructions are correct.
Suppose you are using Douyu Live now, register your account and enable the host function, open Douyu Live Host Center, and find the live broadcast settings.
SIM862E-M2 5G HAT USER GUIDE04.png
Open video plug flow setting:
SIM862E-M2 5G HAT USER GUIDE05.png
The rtmp address and live code will be obtained, and the Raspberry Pi will execute the command:

ffmpeg -f video4linux2 -s 640x480 -r 25 -i /dev/video0 -c:v h264_omx -f flv "rtmp address/live code"

For example: open a terminal first, runs the 5G network:

cd Goonline
sudo ./simcom-cm

and then open another terminal, run the following command:

ffmpeg -f video4linux2 -s 640x480 -r 25 -i /dev/video0 -c:v h264_omx -f flv "rtmp://sendtc3.douyu.com/live/9188303rTNGmU7CS?wsSecret=ef762877aae120262eaf23c3f60a28bf&wsTime=5f59dbf0&wsSeek=off&wm=0&tw=0&roirecognition=0"

rtmp://sendtc3.douyu.com/live is the address, and the next section is the live code. Enter the room number at this time, you can observe the live broadcast, the delay is about 1-2S.

How To Use OpenWrt

Introduction

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.

Program 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 & Initial Settings

  • After the OpenWrt system is turned on, the Raspberry Pi is equivalent to a router. Therefore, you can 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"). Enter 192.168.1.1 on the webpage, the default username: root, the default password: password, and enter the Web management interface of OpenWrt.
SIM820x OpenWrt(EN) (2).png
  • Set WIFI password: Network -> Wireless -> Modify -> Interface Configuration -> Wireless Security, as shown below:
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 fail 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", 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 driver

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 wireless "OpenWrt" or through the network cable to connect to OpenWrt's own network port for networking.

5G network speed test

In terms of the speed measurement, as 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 test the speed with the command.
Connect to the terminal of the OpenWrt, and enter the command one by one to test:

opkg update
opkg install python3
opkg install python3-pip
pip install speedtest_cli
speedtest or speedtest_cli

Working With Jetson Nano

It is recommended that you use the system image jetson-nano-sd-card-image (updated in October 2020). The Linux kernel version of this system is 4.9.140-tegra. The previous system is 4.4. This tutorial is based on the 4.9 kernels. If there is a difference, please update to the same version as this one, which will minimize the chance of your using it incorrectly.
If you are using other linux systems, please download the driver under SIM8200_OS_Driver\linux and port it according to the documentation under it.

Configuration Required for First Use

  • It's best to copy and paste in case you type the wrong letters:
sudo apt-get install p7zip-full
wget https://files.waveshare.com/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 delete or modify the "options", "qmi_wwan_simcom", "default.script", "install.sh" directory files, otherwise it will affect the loading of the driver.
If there is an error, please confirm whether the system kernel is 4.9.140-tegra, and take a screenshot of the error message so that engineers can help you analyze and solve the problem.
Run "ifconfig -a" to see that WWAN0 has been generated.
Sim8200 jetsonnano 1.png

AT Test Command

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

SIM8200 RPI 1.png

5G Network

cd Goonline
make
sudo ./simcom-cm

You can successfully see that DNS has been generated at the bottom.
Sim8200 jetsonnano 2.png

Others

If you need to use the product on other systems, please download the SIM8200_OS_Driver file, and refer to the SIMCOM official documentation to add the driver.

About the Speed

Due to the differences between actual and laboratory conditions, the 5G speed will not be ideal and stable at 100MBPS. There are the following points:

  • Base station distance, the closer to the 5G base station, the better the signal and the faster the speed.
  • Base station load, the fewer people using it, the faster the speed will be, and the rush hour will be slower.
  • Number of base stations: Due to spectrum relationships, the same amount of 4G coverage requires double the number of 5G base stations.
  • Provider: You need to confirm whether your 5G card is limited in speed, you can periodically ask the provider to reset your network.
  • Indoors is worse than outdoor: building penetration loss, and indoor diffraction loss.
  • PS: The current number of base stations still does not have good coverage, and the speed measurement in different locations is not the same.