5G/4G Raspberry 4B openWrt Sample Tutorial

From Waveshare Wiki
Jump to: navigation, search

Overview

This tutorial will introduce how to use Raspberry Pi 4B equipped with SIM8202G-M2 HAT module to realize the function of sharing the mobile network with wifi. If you add a UPS as a power source, you can get a portable and portable wireless router. 4G or 5G mobile network anytime, anywhere shared.

Working principle

  • Soft routing refers to a routing solution formed by using a desktop computer or a server and other equipment with software. It mainly relies on software settings to achieve the function of a router; OpenWrt is a very popular member of the soft routing system. It is a The highly modular and highly automated embedded Linux system has powerful network components and scalability, and is often used in industrial control equipment, routers and other equipment; after the Raspberry Pi is programmed with the OpenWrt soft routing system, the Raspberry Pi itself is It is equivalent to a wireless WIFI router.
  • Remote NDIS (RNDIS) is a bus-independent class specification for Ethernet (802.3) network devices over dynamic Plug and Play (PnP) buses such as USB, 1394, Bluetooth, and InfiniBand. Remote NDIS defines a bus-independent message protocol between a host computer and a remote NDIS device through abstract control and data channels. The implementation of RNDIS based on USB is actually TCP/IP over USB, which is to run TCP/IP on the USB device, making the USB device look like a network card. The advantage of using this protocol is that it has high versatility. In Windows system, it can directly identify and use the external network module by loading the built-in RNDIS driver. Similarly, in the OpenWrt soft routing system, the interface can also be set to DHCP client mode. Connect to the network directly through the module.

Preparations

Hardware Preparation

  • Raspberry Pi, 4g/5g communication expansion module (here takes RM8202G as an example) and its accessories package, SD card, two 5V3A DC power adapters, SIM card that supports and has opened 5G/4G service

Program soft routing mirror

  • Download the compiled OpenWrt image file and unzip it;
  • Use the burning software to burn the image file in the prepared sd card.

Install the expansion board

  • Insert the communication module into the M2 interface of the base plate at an oblique direction, and fix the tail with screws after pressing down;
  • Connect the antenna port on the communication module to the antenna port on the base plate using an IPEX adapter cable, and screw in the four paddle antennas respectively.
  • Use the accessory package USB-A male to A male cable or adapter to connect the Raspberry Pi to the expansion module with the communication module installed (try to connect the Raspberry Pi USB3.0 interface).

Installation renderings

Configure the RNDIS dial-up mode

  • Connect the module to the Raspberry PI or Jetson Nano via USB port, then execute the command to see if ttyUSB2 can be detected normally, if possible, open the port via minicom:
ls /dev/ttyUSB*
sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
  • SIM82XX sends the following command through minicom and waits for the module to restart
at+cusbcfg=usbid,1e0e,9011
  • RM5XXX sends the following command through minicom and waits for the module to restart
AT+QCFG="usbnet",3
AT+QNETDEVCTL,3,1 = 2
AT+CFUN = 1, 1

Configuration usage

Connect and configure Raspberry Pi OpenWrt system WIFI

  • After burning the OpenWrt system, insert the SD card into the Raspberry Pi motherboard, the default network port IP is: 192.168.1.1, and the default is 5G WIFI router.
  • You can search through the mobile phone WIFI, find the WIFI open hotspot whose default name is "OpenWrt", and then connect
  • Open the browser, enter: 192.168.1.1, the default username: root, the default password: password, and then you can enter the router management interface.
  • Insert the sim card into the card slot of the communication module, turn the switch to the position of the external power supply ((EXT PWR)), and the module will turn on after the external power supply is connected;
  • Add new interface: Network -> Interfaces -> Add New Interface

OpenWrt SIM8202G 1.png

  • Create new interface: name of new interface - SIM8202G; protocol of new interface - DHCP client; include the following interfaces - ethernet adapter: "usb0"; submit

OpenWrt SIM8202G 2.png

  • Configuration interface: Firewall settings - wan; save & apply

OpenWrt SIM8202G 3.png

  • Wireless configuration: Network -> Wireless -> Modify -> Interface Configuration -> Basic Settings -> Check SIM8202G in Network; Save & Apply

OpenWrt SIM8202G 4.pngOpenWrt SIM8202G 5.png

Module Configuration