1001 RPi0 4G CAT1-ETH(RS485 OPT:修订间差异

来自Mcuzone Wiki
无编辑摘要
 
(未显示2个用户的65个中间版本)
第1行: 第1行:
[[1001 RPi0 4G Cat1-ETH(百兆网络 4G Cat1 USB2.0-A 485版本可选)|切换语言为中文]]
== '''Keywords''' ==
== '''Keywords''' ==
Raspberry Pi, Raspberry Pi Zero, Cat1 4G LTE, USB2.0-A, Ethernet, Expansion Board, USB HUB
Raspberry Pi Zero,Raspberry Pi Zero W,Raspberry Pi Zero WH,Raspberry Pi Zero 2 W, Cat1 4G LTE, USB2.0-A, Ethernet, Expansion Board, USB HUB, RS485, driver-free


== '''Ⅰ、Introduction''' ==
== '''I. Introduction''' ==
The Raspberry Pi Zero series (including Zero, Zero W(H), and Zero 2W) is a highly cost-effective embedded system platform with a compact size, low power consumption, and decent performance, making it suitable for many lightweight application scenarios. The Zero series, despite its compact size, offers many expansion interfaces. The underside of the board features gold-plated test points for USB and power connections. These USB and power test points allow us to connect various types of peripherals for expansion. This expansion board is a USB hub, connecting the expansion board to the USB port of the Zero via pogo pins. It extends four USB ports through the USB connection: one USB port is converted to a 100Mbps wired Ethernet connection, one USB port is connected to a 4G Cat1 module, and two USB2.0-A host interfaces are provided.
The Raspberry Pi Zero series (including Zero, Zero W(H), and Zero 2W) is a low cost-effective embedded system platform with a compact size, low power consumption, and decent performance, making it suitable for many lightweight application scenarios. The Zero series, despite its compact size, offers many expansion interfaces. The underside of the board features gold-plated test points for USB and power connections. These USB and power test points allow us to connect various types of peripherals for expansion.  


4G Cat1 is a cost-effective module designed for medium-speed IoT applications around 10Mbps. The 10Mbps downlink and 5Mbps uplink speeds can meet the vast majority of networking and transmission needs. It supports 4G full network coverage, including China Unicom, China Telecom, and China Mobile networks.
This expansion board is a USB hub, connecting the expansion board to the USB port of the Zero via pogo pins. It extends four USB ports through the USB connection: one USB port is converted to a 100Mbps wired Ethernet connection, one USB port is connected to a 4G Cat1 module, and two USB2.0-A host interfaces are provided. There is also an RS485 version available, which can convert one USB port to an RS485 interface.


== '''Ⅱ、Hardware Resources''' ==
4G Cat1 is a cost-effective module designed for low-speed IoT applications around 10Mbps. The 10Mbps downlink and 5Mbps uplink speeds can meet the vast majority of networking and transmission needs.This module is plug-and-play on Raspberry Pi and Ubuntu OS, automatically recognized as a 4G connection without needing drivers or dial-up configurations, making it convenient for users to develop applications.It have two verison, CAT.1 and CAT.1-EU .
2.1 Use gold-plated pogo pins to connect the Raspberry Pi Zero series, eliminating the need for external cables;


2.2 The two groups of gold-plated pogo pins are used separately for power supply and USB communication.
== '''II. Hardware Spec''' ==
2.1 One USB-C power input, similar to the micro USB PWR on the Raspberry Pi Zero; choose one of the two options.


2.3 The expansion board is equipped with a USB-C power supply interface, which can power the entire system. The Micro USB port on the Zero can also be used for power.
2.2 One 10/100Mbps Ethernet.


2.4 The onboard USB hub expands the Zero's USB into four ports: one port is used for connecting a 4G LTE Cat1 module, two are USB host interfaces, and one is a USB to 10/100Mbps Ethernet adapter.
2.3 One 4G LTE Cat1 module.


2.5 The 4G LTE Cat1 module supports full 4G network coverage, with a downlink speed of up to 10Mbps and an uplink speed of up to 5Mbps.
2.4 One Nano SIM card and one IPEX-1 antenna.


2.6 The 4G LTE Cat1 module is a plug-and-play in most systems, driver-free and does not require manual dialing, usually recognized as the eth1 network card.
2.5 Two USB2.0-A HS.  


2.7 The 4G LTE Cat module uses a Nano-sized SIM card and offers the option of either an SMA antenna or a first-generation IPEX antenna.
2.6 Four LEDs: PWR/MODE/ACT LED


2.8 The expansion board supportsother Pi with USB contacts in the same position, such as the Orange Pi Zero 2W.
2.7 One reset button for 4G module.


2.9 Onboard PWR/MODE/ACT LED.
2.8  '''''The RS485 version with industrial-grade power isolation,''''' it is USB to RS485, so only one USB2.0 on board.


2.10 Onboard reset button for 4G module.
2.9 Aluminum alloy enclosure(OPT).


Note 1: After connecting this expansion board, the Micro USB port on the Zero will no longer be usable.
Note 1: After connecting this expansion board, the Micro USB port on the Zero will no longer be usable.
第32行: 第34行:
Note 2: In some systems, it is necessary to disable the OTG function and set the USB mode to Host mode.
Note 2: In some systems, it is necessary to disable the OTG function and set the USB mode to Host mode.


Note 3: The expansion board supports all versions of the Raspberry Pi Zero, including the Zero, Zero W, Zero WH, and Zero 2W.
Note 3: The board supports all versions of the Raspberry Pi Zero, including the Zero, Zero W, Zero WH, and Zero 2W.
 
Note 4: The board supportsother Pi with USB contacts in the same position, such as the Orange Pi Zero 2W.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_27.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_78.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_28.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_79.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_29.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_80.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_43.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_81.jpg


== '''三、系统烧写''' ==
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_82.jpg
3.1 本文档使用基于树莓派Zero 2W的硬件,镜像为2024-07-04-raspios-bookworm-arm64.img.xz(树莓派OS,Raspberry Pi OS with desktop)。


(若使用树莓派Zero一代系列的板子,只支持32位系统,请注意下载版本。)
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_83.jpg


树莓派OS下载地址:
{| class="wikitable"
|+4G Parameters
!model
!CAT1
!CAT1-EU
|-
| rowspan="2" |Band
|FDD:B1/B3/B5/B8
|FDD:B1/B3/B5/B7/B8/B20/28
|-
|TDD:B34/B38/B39/B40/B41
|TDD:B38/B40/B41
|-
|DATA
| colspan="2" |FDD: Max 10Mbps(DL)/Max 5Mbps(UL)
TDD:Max 8Mbps(DL)/Max 2Mbps(UL)


https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
Max 6Mbps(DL)/Max 4Mbps(UL)
|}
== '''III. Work with Raspberry Pi OS''' ==
We conducted tests based on the Raspberry Pi Zero 2W.


或ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz(Ubuntu系统,Ubuntu Server 24.04 LTS,服务器版,树莓派Zero 2W因为性能关系不能用Desktop版)。
The Raspberry Pi OS:(Raspberry Pi OS with desktop) 2024-07-04-raspios-bookworm-arm64.img.xz.


Ubuntu系统下载地址:
You can download the Raspberry Pi OS in:


https://ubuntu.com/download/raspberry-pi
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit


3.2 系统烧写在SD(TF)卡上,[[0005 MPS2242 2280(单SSD扩展板)#三、系统烧写及设置|点击直达烧写方法说明]]。
(If you are using the Raspberry Pi Zero (1st generation) series boards, they only support 32-bit systems. Please be sure to download the correct version.)


== '''四、树莓派系统下使用演示''' ==
=== 3.1 View hardware devices ===


=== 4.1 查看硬件设备 ===
==== 3.1.1 View USB devices ====
Open the terminal in Raspberry Pi OS and enter the command<code>lsusb</code>, as shown in the image below:


==== 4.1.1 查看USB设备 ====
'''RPi0_RS485CAT1:'''
打开树莓派OS的终端,输入命令<code>lsusb</code>,如下图所示:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_01.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_86.jpg


可以看到系统识别到了USB HUB和4G模组。其中:
'''RPi0_RS485CAT1EU:'''


Device 002:外挂USB Hub;
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_87.jpg


Device 003:4G模组;
'''RPi0_CAT1-ETH/RPi0_CAT1-EU_ETH:'''


Device 004:USB转百兆网卡;
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_88.jpg


Device 005:USB2.0-A接口;
If the system stop at the Raspberry Pi logo and fails to boot:


Device 008:USB2.0-A接口。
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_58.jpg


如果系统没有识别到USB HUB和4G模组请仔细观察顶针是否对准了镀金触点,并请在PC端打开TF卡系统分区根目录下的config.txt检查USB的初始化脚本:
or if after booting, the keyboard, mouse, and 4G module cannot be used, please carefully check whether the pogo pins are aligned with the gold-plated contacts. Additionally, on the PC, open the <code>config.txt</code> file located in the root directory of the TF card to check the USB initialization script.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_41.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_41.jpg


需要确认下图中的两处红框的位置是否都配置成完全,如果没有,请手动添加完整并保存文件:
You need to confirm that the three red-boxed areas in the following image are all configured completely. If not, please manually add the missing parts and save the file:
 
<code># otg_mode=1</code> (It is recommended to comment out as follow)


<code># otg_mode=1</code>
<code>dtoverlay=dwc2,dr_mode=host</code> (These two areas must be ensured to be included.)


<code>dtoverlay=dwc2,dr_mode=host</code>
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_57.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_42.jpg
==== 3.1.2 View network devices ====
The 4G module is automatically recognized in the Raspberry Pi OS, requires no drivers, and is plug-and-play.


==== 4.1.2 查看网络设备 ====
Open the terminal in Raspberry Pi OS and enter the command <code>ifconfig -a</code>, as shown in the image below:
打开树莓派OS的终端,输入命令<code>ifconfig -a</code>,如下图所示:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_24.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_24.jpg


可以看到eth0为USB转以太网,eth1为4G Cat1(上图中IP地址默认为192.168.5.8)。
We can see that eth0 is a USB-to-Ethernet, and eth1 is a 4G Cat1 connection (with the IP address in the image above is 192.168.5.8).


=== 4.2 测试网络设备 ===
=== 3.2 Test network devices ===


==== 4.2.1 ping包测试 ====
==== 3.2.1 ping tests ====
测试的时候有优先级,如果eth0已连接则优先走eth0。如有内外网特殊优先级需要请调整各网络的metric值以及DNS服务器设置。
When testing, there is a priority order: if eth0 is connected, it will be used first. If there are specific requirements for internal and external networks, please adjust the metric values of each network and the DNS server settings.


可以用-I参数指定从哪个网卡开始ping包,如下所示:
Use the -I parameter to specify which network interface to start the ping packet from, as shown below:


<code>ping www.mcuzone.com -I eth0</code>
<code>ping www.mcuzone.com -I eth0</code>
第112行: 第135行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_04.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_04.jpg


优先级可以通过可以执行<code>route</code>命令来查看,哪个网卡的metric值小就从优先从哪个网卡通讯。
Priority can be checked by executing the <code>route</code> command; the network card with the smaller metric value will be preferred for communication.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_05.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_05.jpg


我们也可以通过关闭某个网卡,达到强制指定通过另一个网络进行通讯,如需关闭eth0,可执行下面的命令:
We can also force communication through another network by disabling a specific network card. For example, to disable eth0, you can execute the following command:


<code>sudo ifconfig eth0 down</code>
<code>sudo ifconfig eth0 down</code>


以及通过执行下面的命令来开启eth0:
And enable eth0 by the following command:


<code>sudo ifconfig eth0 up</code>
<code>sudo ifconfig eth0 up</code>


==== 4.2.2 设置网卡优先级 ====
==== 3.2.2 Set network adapter priority ====
如果要设置网卡的优先级,需要修改网卡的metric值,我们首先需要安装ifmetric软件:
To set the priority of network cards, you need to modify the metric value of the network card. First, we need to install the ifmetric software.


<code>sudo apt install ifmetric</code>
<code>sudo apt install ifmetric</code>
第131行: 第154行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_06.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_06.jpg


安装完毕后就可以修改网卡的metric值,如需要将eth0的metric值修改为102,可执行:
After the installation is complete, you can modify the metric value of the network card. If you need to change the metric value of eth0 to 102, you can execute:


<code>sudo ifmetric eth0 102</code>
<code>sudo ifmetric eth0 102</code>


修改完毕后再用<code>route</code>命令查看,我们可以看到eth0的metric值已修改为102:
After making the changes, use the <code>route</code> command to check, and we can see that the metric value of eth0 has been updated to 102:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_07.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_07.jpg


但是这样修改仅仅是临时修改,如果系统重启的话还是会恢复到原样,如果我们需要永久修改eth0的metric值为102,则需通过编辑启动文件rc.local来达到目的。
However, this modification is only temporary; if the system is restarted, it will revert to its original state. To permanently change the metric value of eth0 to 102, you need to edit the startup file to achieve this.


通过下面的命令打开rc.local:
Open rc.local by the following command:


<code>sudo nano /etc/rc.local</code>
<code>sudo nano /etc/rc.local</code>


在exit 0上面添加你要开机执行的命令,如<code>sudo ifmetric eth0 102</code>,然后保存文件,这样就可以实现每次启动系统修改eth0的metric:
Add the command you want to execute at startup above exit 0, such as <code>sudo ifmetric eth0 102</code>, then save the file. You can modify the metric of eth0 every time the system starts by this way.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_08.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_08.jpg
第151行: 第174行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_09.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_09.jpg


修改完metric值后,有可能系统的nameserver(即DNS服务器)还是原来优先级高的网卡的,因为此时默认网卡已改变,就会造成域名无法解析,所以我们还需要修改nameserver。
After modifying the metric values, it is possible that the system's nameserver (i.e., DNS server) is still using the previous higher-priority network card's nameserver. Since the default network card has now changed, this can lead to domain name resolution issues. So we also need to update the nameserver.


通过下面的命令打开resolv.conf文件:
Open resolv.conf by the following command:


<code>sudo nano /etc/resolv.conf</code>
<code>sudo nano /etc/resolv.conf</code>
第161行: 第184行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_17.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_17.jpg


查看此时的nameserver是否正确,如果不正确,请将其改为目前优先级高的网卡的nameserver或者一些通用的nameserver地址(如114.114.114.114等)。
Check if the current nameserver is correct. If it is not, please change it to the nameserver of the network card with higher priority or to some common nameserver addresses (such as 8.8.8.8, etc.).


==== 4.2.3 利用udhcpc指定DNS服务器 ====
==== 3.2.3 Using udhcpc to specify DNS servers ====
上一节我们讲了通过修改nameserver来指定DNS服务器,其实我们也可以通过使用udhcpc来完成该任务。
In the previous section, we discussed specifying DNS servers by modifying the nameserver. In fact, we can also achieve this by using udhcpc.


首先需要安装udhcpc软件:
Install the udhcpc software:


<code>sudo apt install udhcpc</code>
<code>sudo apt install udhcpc</code>
第172行: 第195行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_48.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_48.jpg


本节我们测试的例子中,eth0为USB转以太网,usb0为4G Cat1(即相当于前文的eth1),如果我们需要使用USB转以太网(eth0)的网络DNS,请使用下面的命令:
In this section, in the example we are testing, eth0 is a USB-to-Ethernet adapter, and usb0 is a 4G Cat1 (which corresponds to eth1 in the previous section). If we need to use the network DNS of the USB-to-Ethernet adapter (eth0), please use the following command:


<code>sudo udhcpc -i eth0</code>
<code>sudo udhcpc -i eth0</code>
第178行: 第201行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_49.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_49.jpg


如果我们需要使用4G Cat1(usb0)的网络DNS,请使用下面的命令:
If we need to use the network DNS of the 4G Cat1 (usb0), please use the following command:


<code>sudo udhcpc -i usb0</code>
<code>sudo udhcpc -i usb0</code>
第184行: 第207行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_50.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_50.jpg


==== 4.2.4 udhcpc应用场景举例 ====
==== 3.2.4 Examples of how to use udhcpc ====
例1:百兆网口接Internet,4G Cat1正常联网。
Example 1: The 100Mbps Ethernet port is connected to the Internet, and the 4G Cat1 is connected normally. In this case, if we ping a certain domain name, it will succeed:
 
这时我们ping某个域名,是可以成功的:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_51.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_51.jpg


此时拔了百兆网口的网线,就无法ping成功了:
At this point, unplugging the 100M network port cable will make the ping fail:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_52.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_52.jpg


执行<code>sudo udhcpc -i usb0</code>,将DNS服务器切换到4G Cat1上,就可以正常ping了:
Run <code>sudo udhcpc -i usb0</code> and switch the DNS server to 4G Cat1, then you should be able to ping normally:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_53.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_53.jpg


例2:百兆网口接内网(不连通Internet),4G Cat1正常联网。
Example 2: The 100Mbps Ethernet port is connected to the internal network (not connected to the Internet), 4G Cat1 is connected normally. In this case, if we ping a certain domain name, it will failed:
 
这时我们ping某个域名,无法ping成功:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_54.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_54.jpg


执行<code>sudo udhcpc -i usb0</code>,将DNS服务器切换到4G Cat1上,就可以正常ping了,同时还可以通过IP地址正常访问内网设备:
Execute <code>sudo udhcpc -i usb0</code>, switch the DNS server to the 4G Cat1, and then you should be able to ping normally, and access internal network devices via the IP addresses:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_55.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_55.jpg


==== 4.2.5 iperf3测速 ====
==== 3.2.5 Test speed by iperf3 ====
Windows版iperf3下载:
You can download iperf3 (Windows version) in:


http://www.mcuzone.com/down/Software.asp?ID=10000634
http://www.mcuzone.com/down/Software.asp?ID=10000634


Linux下iperf3安装:
Install iperf3 (Linux version) by using the following command:


<code>sudo apt-get install iperf3</code>
<code>sudo apt-get install iperf3</code>


百兆以太网测速结果,client模式70Mbps左右,server模式90Mbps左右:
100M Ethernet speed test results: It is about 70Mbps in client mode and it is about 90Mbps in server mode:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_10.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_10.jpg
第224行: 第243行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_11.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_11.jpg


'''''注意:USB转百兆有线受Zero 2W性能和USB Hub以及4G Cat1带宽占用影响并不能跑满,请知悉。'''''
'''''Note: The USB to 100M Ethernet adapter may not reach full speed due to the performance limitations of the Zero 2W, the USB hub, and the bandwidth usage of the 4G Cat1.'''''
 
4G CAT1 speed test results:
 
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_66.jpg


4G CAT1的测速结果如下:
'''''Note: Network speed tests are affected by network conditions and testing methods. The actual speed may vary; this test is for reference only.'''''


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_46.jpg
=== 3.3 AT Command for 4G Cat1 Module ===
 
==== 3.3.1 Open AT Command serial port ====
To operate 4G Cat1 Module using AT commands on a Raspberry Pi, you first need to open the AT command serial port. The method to open it is as follows:


== '''五、树莓派系统下4G Cat1模组的AT命令演示''' ==
Input the following command: <code>lsusb</code>, to open ttyUSB serial port:
=== 5.1 打开AT命令串口方法 ===
在树莓派下要对4G进行AT命令操作,首先要打开AT命令串口,打开方法如下:


==== 5.1.1 打开ttyUSB串口 ====
If you use '''RPi0_RS485CAT1''':
输入命令<code>lsusb</code>,如下图所示:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_23.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_23.jpg


记下4G模块的ID值:1782 4e00
Record the ID value of the 4G module: 1782 4e00


使用下列命令打开ttyUSB串口,其中echo后面的值就是上面记录的ID值:
Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:


<code>sudo modprobe option</code>
<code>sudo modprobe option</code>
第249行: 第272行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_12.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_12.jpg


执行以上两条命令后系统应该会多出ttyUSB0-2三个设备。
If you use '''RPi0_RS485CAT1EU, RPi0_CAT1-ETH, RPi0_CAT1-EU_ETH''':


==== 5.1.2 用串口工具打开 ====
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_68.jpg
下载minicom工具:
 
Record the ID value of the 4G module: 19d1 0001
 
Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:
 
<code>sudo modprobe option</code>
 
<code>sudo sh -c 'echo 19d1 0001 > /sys/bus/usb-serial/drivers/option1/new_id'</code>
 
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_69.jpg
 
After execution is complete, the system should have three additional devices: ttyUSB0, ttyUSB1, and ttyUSB2.
 
Then Open serial port by serial port tool.
 
Install minicom:


<code>sudo apt-get install minicom</code>
<code>sudo apt-get install minicom</code>
第258行: 第296行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_13.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_13.jpg


通过minicom打开AT命令串口:
Open AT Command serial port by minicom:


<code>sudo minicom -D /dev/ttyUSB0</code>
<code>sudo minicom -D /dev/ttyUSB0</code>


Or


<code>sudo minicom -D /dev/ttyUSB1</code>
<code>sudo minicom -D /dev/ttyUSB1</code>
第268行: 第306行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_14.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_14.jpg


然后直接键入AT命令,回车可以看到结果,如果需要查看回显,请键入命令:<code>ate1</code>
Then directly type the AT command and press Enter to see the result. If you need to view the echo, please type the command: <code>ate1.</code>


注意:4G模组型号可能会变更,但流程一样,只需要用lsusb查看实际的USB ID并在后续命令中将USB ID替换为实际值即可。另外,有部分4G Cat1模组的芯片组ID已经被内核加入支持列表,这类Cat1模组无需添加USB ID即可自动识别为ttyAMAx。
Note: The model of the 4G module may change, but the process remains the same. You only need to use <code>lsusb</code> to check the actual USB ID and replace it with the actual value in subsequent commands. Additionally, some 4G Cat1 modules's chipset IDs have already been included in the kernel's supported list, so these Cat1 modules can be automatically recognized as ttyAMAx without the need to add a USB ID.


=== 5.2 常用AT命令 ===
==== 3.3.2 Common AT commands ====
1) 检查SIM卡是否识别到:
1) Check if the SIM card is detected:


<code>at+cpin?</code>
<code>at+cpin?</code>


返回ready表示卡已识别,返回error要检查硬件
Return ready to indicate the card has been recognized, if return error, you need to check the hardware.


2) 检查天线信号质量:
2) Check antenna signal quality:


<code>at+csq</code>
<code>at+csq</code>


返回值在26-31表示信号OK,信号满格31;返回值在20-25表示信号勉勉强强;返回值在20以下表示信号比较糟糕或者天线没接
Return values between 26 and 31 indicate a good signal, with 31 representing a full signal strength; return values between 20 and 25 indicate a barely acceptable signal; return values below 20 indicate a poor signal or that the antenna might not be connected.


3) 检查注网情况:
3) Check network registration status:


<code>at+cops?</code>
<code>at+cops?</code>


正常应该返回运营商代码和7,7代表4G
Normally, it should return the network supporter's code: 7, where 7 represents 4G.


注意,以上命令只有<code>at+csq</code>不要加问号,另外两条命令需要加问号。
Note: The above command <code>at+csq</code> should not include a question mark, while the other two commands require a question mark.


4) 查看SIM卡的IMEI码:
4) View the SIM card's IMEI code:


<code>at+cgsn</code>
<code>at+cgsn</code>


5) 重启4G模块(有时候如果重插SIM卡,热插拔不一定管用,可以用这个reset命令来复位模块):
5) Reset 4G module (Sometimes, if you reinsert the SIM card, hot swapping may not work; in such cases, you can use this reset command to reset the module.):


<code>at+reset</code>
<code>at+reset</code>


6) 关闭射频:
6) Disable radio frequency:


<code>at+cfun=0</code>
<code>at+cfun=0</code>


开启射频:
Enable radio frequency:


<code>at+cfun=1</code>
<code>at+cfun=1</code>


上述两条命令成对使用,可以在不重启4G模组的情况下让模组重新注网。
The two commands mentioned above can be used in pairs to allow the module to re-register with the network without restarting the 4G module.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_15.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_15.jpg


== '''六、Ubuntu系统下使用演示''' ==
=== 3.4 RS485 serial test ===
If you are using '''''the RS485 version''''', it has one fewer USB2.0-A host interface, which is replaced by an RS485 interface.
 
First, you need to install the serial port software CuteCom; the installation command is:
 
<code>sudo apt install cutecom</code>
 
After installation, click on the Raspberry Pi icon in the top left corner of the desktop, and under "System Tools," there will be a shortcut to CuteCom:
 
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_01.jpg
 
If there are permission issues during use, please open the Raspberry Pi OS terminal and enter:
 
<code>sudo cutecom</code>
 
to run the CuteCom.
 
This expansion board comes with a 4G module, which occupies three serial ports ttyUSB0-2. Therefore, the serial port number for the RS485 serial port is shifted to ttyUSB3.
 
Plug a USB to RS485 converter into the PC and connect it to the RS485 port on the expansion board. Open the serial port software on each end for transmission and reception. The result is as follows:
 
Raspberry Pi OS:
 
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_61.jpg
 
Windows:
 
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_62.jpg
 
Through practical testing, the baud rate can reach up to 2.06M (based on the criterion that transmitted data does not become garbled).


=== 6.1 编辑初始化脚本 ===
== '''IV. Work with Ubuntu OS''' ==
Ubuntu Server烧写完毕后,请在PC端打开TF卡系统分区根目录下的config.txt检查USB的初始化脚本,Ubuntu Server对USB初始化了两遍,前面一遍没有配置成host模式,需要确认下图中的两处红框的位置是否都配置成完全,如果没有,请手动添加完整:
The hardware in this document is based on the Raspberry Pi Zero 2W.
 
Ubuntu system: Ubuntu Server 24.04 LTS. (The Raspberry Pi Zero 2W cannot use the Desktop version due to performance limitations.)
 
The image is: ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz
 
You can download the Ubuntu system in:
 
https://ubuntu.com/download/raspberry-pi
 
=== 4.1 Edit the initialization script ===
After flashing Ubuntu Server, please open the <code>config.txt</code> file located in the root directory of the system partition on the TF card on your PC to check the initialization script for USB. Ubuntu Server initializes the USB twice, but the first initialization does not configure it in host mode. Please verify that the area highlighted in red in the following image is configured properly. If it is not, please manually add the complete configuration:


<code>dtoverlay=dwc2,dr_mode=host</code>
<code>dtoverlay=dwc2,dr_mode=host</code>
第322行: 第400行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_32.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_32.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_30.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_75.jpg


=== 6.2 配置用户名和密码 ===
=== 4.2 Configure username and password ===
将TF卡插入Zero 2W,启动系统。第一次启动后会要求登录,用户名和密码均为ubuntu,登录成功后会要求修改密码。
Insert the TF card into Zero 2W and boot up the system. Upon the first startup, you will be prompted to log in; both the username and password are "ubuntu." After logging in successfully, you will be asked to change the password.


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_31.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_31.jpg


修改完毕后就自动进入系统。
Once the password is changed, you will automatically enter the system.


=== 6.3 配置网络 ===
=== 4.3 Configure network ===
系统启动后并无网络可用,需要进行后续设置后才能使用。
After system startup, there is no network available, and further configuration is needed before it can be used.


'''''注意,系统默认并没有集成ifconfig工具,只有ip命令可用。'''''
'''''Note: the system does not integrate the ifconfig tool by default; only the ip command is available.'''''


执行<code>ip addr</code>查看并记录下网卡名称:
Execute <code>ip addr</code> to view and record the name of the network interface card:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_33.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_33.jpg


其中2号网卡(enx00e0996df1cd)为USB转百兆网卡,3号网卡(enxac4bb3b9ebe5)为4G模组。
The second network interface card (enx00e0996df1cd) is a USB-to-100Mbps Ethernet adapter, and the third network interface card (enxac4bb3b9ebe5) is the 4G module.


然后运行下面的命令,打开网卡配置文件:
Then run the following command to open the network interface card configuration file:


<code>sudo nano /etc/netplan/50-cloud-init.yaml</code>
<code>sudo nano /etc/netplan/50-cloud-init.yaml</code>


按照下图编辑网卡配置文件:
Edit the network interface card configuration file according to the diagram below:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_34.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_34.jpg


保存退出,然后重启。
Save and exit, then reset the system.


重启后即可联网,安装net-tools工具以便于使用:
After rebooting, you can connect to the network. Install the <code>net-tools</code> to facilitate usage:


<code>sudo apt install net-tools</code>
<code>sudo apt install net-tools</code>
第358行: 第436行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_35.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_35.jpg


=== 6.4 网络及4G模组测试 ===
=== 4.4 Test network and 4G module ===
执行命令<code>ifconfig -a</code>,查看网卡信息:
Run the command <code>ifconfig -a</code> to view the information of network:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_36.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_36.jpg


可见第一块网卡为USB转百兆网卡,第二块网卡为4G模组。
The first network interface card is a USB-to-100Mbps Ethernet adapter, and the second network interface card is the 4G module.


通过使用-I参数,在ping包时加上网卡名称,可指定哪块网卡进行ping包。通过这两块网卡对腾讯的网站的ping包测试可知,第二块网卡即4G模组支持ipv6:
By using the -I parameter, you can specify the network interface name when sending ping packets, thus determining which interface to use for the ping. Through ping tests to Tencent's website using these two network interfaces, we can know that the second network interface (4G module) supports IPv6:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_37.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_37.jpg


=== 6.5 AT命令交互测试 ===
=== 4.5 AT command interaction test ===
安装minicom工具:
Install minicom:


<code>sudo apt-get install minicom</code>
<code>sudo apt-get install minicom</code>
第376行: 第454行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_38.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_38.jpg


然后和树莓派OS一样,通过minicom打开AT命令串口:
Open AT Command serial port by minicom:


<code>sudo minicom -D /dev/ttyUSB0</code>
<code>sudo minicom -D /dev/ttyUSB0</code>


Or


<code>sudo minicom -D /dev/ttyUSB1</code>
<code>sudo minicom -D /dev/ttyUSB1</code>
第386行: 第464行:
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_39.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_39.jpg


即可使用常见AT命令进行交互:
Now you can use common AT commands for interaction:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_40.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_40.jpg


== '''七、OpenWrt系统操作演示''' ==
=== 4.6 RS485 serial test ===
This expansion board comes with a 4G module, which occupies three serial ports ttyUSB0-2. Therefore, the serial port number for the RS485 serial port is shifted to ttyUSB3.


=== 7.1 概述 ===
Plug a USB to RS485 converter into the PC and connect it to the RS485 port on the expansion board. Open the serial port software on each end for transmission and reception. We use minicom on Ubuntu system:
此扩展板搭配树莓派Zero 2W,在OpenWrt系统下可配置为一进一出的交换机模式,扩展板上的4G可作为WAN口(直接4G上网),网口配置为LAN口,用于连接PC。


=== 7.2 准备工作 ===
<code>sudo minicom -D /dev/ttyUSB3</code>
本文使用的OpenWrt系统为:openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz


烧写OpenWrt系统并上电启动后,我们通过树莓派自带网口连接网线至PC网口,待PC的网卡与树莓派的网口连接成功后,我们在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:
Through practical testing, the baud rate can reach up to 2.00M (based on the criterion that transmitted data does not become garbled).


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_18.jpg
Ubuntu system:


然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为root,默认密码为password。
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_63.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_19.jpg
Windows:


=== 7.3 设置OpenWrt系统 ===
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_64.jpg
进入OpenWrt系统后,如前所述,用网线把树莓派的网口和PC的网口直连,等PC的网卡获取了IP地址后,即可让PC直接通过4G模块上网(无需设置)。


=== 7.4 测试4G模块网速 ===
== '''V. Work with OpenWrt''' ==
在PC端打开<nowiki/>https://www.speedtest.cn/<nowiki/>进行测速,此时流量走的是4G模块,测试结果如下:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_46.jpg
=== 5.1 Overview ===
This expansion board, when paired with the Raspberry Pi Zero 2W running OpenWrt, can be configured as a one-in-one-out switch mode. The 4G module on the expansion board can serve as the WAN port (for direct 4G internet access), while the Ethernet port is configured as the LAN port for connecting to a PC.


'''''注意:4G网络测速受网络信号和测试方法影响,速度请以实际为准。'''''
=== 5.2 Preparation ===
The OpenWrt which be used in this document is: openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz


=== 7.5 挂载U盘及文件操作 ===
After flashing the OpenWrt system and powering it up, we connect an Ethernet cable from the Raspberry Pi's built-in Ethernet port to the PC's Ethernet port. Once the connection between the PC's network card and the Raspberry Pi's Ethernet port is successful, we find Network and Internet settings in Windows, then open the connected network under Ethernet to view the default gateway IP address. This address is the backend configuration page address for the OpenWrt system. As shown in the figure, the address for this test is 192.168.198.1:
将U盘插入USB口,则在“系统 - 磁盘管理”中直接可以看到该U盘的信息及挂载情况:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_20.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_18.jpg


在“系统 - 挂载点”中可以看到各个挂载点的情况,也可以在此页面对其进行配置。
Then open a web browser and enter 192.168.198.1 to access the OpenWrt system. The default username is <code>root</code>, and the default password is <code>password</code>.


在“网络存储 - 文件助手”中,可以对系统中的文件进行操作。
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_19.jpg


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_21.jpg
=== 5.3 Configure the OpenWrt system ===
After entering the OpenWrt system, connect the Raspberry Pi's Ethernet port directly to the PC's Ethernet port using an Ethernet cable. Once the PC's network card has acquired an IP address, the PC can directly access the internet through the 4G module (no additional settings required).


=== 7.6 TTYD终端 ===
=== 5.4 Test the network speed of 4G module ===
OpenWrt系统自带一个网页版的TTYD终端,可在“系统 - TTYD终端”中打开。默认用户名为root,默认密码为password,因为是使用root账号登录,登录后即有root权限。
On the PC, open https://www.speedtest.cn/ to perform a speed test. At this point, the traffic goes through the 4G module, and the test results are as follows:


http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_22.jpg
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_46.jpg


<!--=== 7.7 无线网卡的使用 ===
'''''Note: The speed of 4G network testing is influenced by network signal strength and the testing method, so actual speeds may vary.'''''
此扩展板自带一个无线网卡,但本OpenWrt系统因为驱动原因默认不开启,所以暂时处于不可用状态,如果需要使用,则需手动开启。


默认状态下,“网络”里面没有无线网卡的相关设置:
=== 5.5 Mounting USB drive and file operations ===
When you insert a USB drive into a USB port, you can directly see the information and mounting status of the USB drive in "System - Disk Management":


44
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_20.jpg


7.7.1 安装驱动
In the "System - Mount Points" section, you can see the status of all mount points and can configure them on this page.


驱动下载地址:
In the "Network Storage - File Assistant" section, you can perform operations on files within the system.


http://www.mcuzone.com/wiki/1001_Zero_4G_Cat1/brcmfmac43430b0-sdio.raspberrypi,model-zero-2-w.zip
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_21.jpg


下载完毕后将其解压到U盘,本文所解压的目录为U盘下的op文件夹,将U盘插到扩展板上,我们可以在“网络存储 - 文件助手”中看到这些文件,挂载目录为/mnt/sda/op/
=== 5.6 TTYD terminal ===
The OpenWrt system comes with a web-based TTYD terminal, which can be accessed in the "System - TTYD Terminal" section. The default username is <code>root</code>, and the default password is <code>password</code>. Since you log in with the root account, you will have root privileges upon logging in.


45
http://www.mcuzone.com/wiki/0007_Zero_4G_Cat1/0007_Zero_4G_Cat1_22.jpg
 
打开TTYD终端并登录,执行下列命令:
 
<code>cd /mnt/sda/op/</code>
 
<code>cp *.* /lib/firmware/brcm/</code>
 
47


然后重启系统。
== '''VI. Expansion board selection guide''' ==
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_65.jpg


7.7.2 配置无线网卡-->
{{Contact_Us_icon}}


{{联系我们_图标}}
[http://wiki.mcuzone.com/index.php?title=1001_RPi0_4G_Cat1-ETH(100M_ETH_4G_Cat1_USB2.0-A_RS485_version_optional) T]

2025年3月5日 (三) 12:02的最新版本

切换语言为中文

Keywords

Raspberry Pi Zero,Raspberry Pi Zero W,Raspberry Pi Zero WH,Raspberry Pi Zero 2 W, Cat1 4G LTE, USB2.0-A, Ethernet, Expansion Board, USB HUB, RS485, driver-free

I. Introduction

The Raspberry Pi Zero series (including Zero, Zero W(H), and Zero 2W) is a low cost-effective embedded system platform with a compact size, low power consumption, and decent performance, making it suitable for many lightweight application scenarios. The Zero series, despite its compact size, offers many expansion interfaces. The underside of the board features gold-plated test points for USB and power connections. These USB and power test points allow us to connect various types of peripherals for expansion.

This expansion board is a USB hub, connecting the expansion board to the USB port of the Zero via pogo pins. It extends four USB ports through the USB connection: one USB port is converted to a 100Mbps wired Ethernet connection, one USB port is connected to a 4G Cat1 module, and two USB2.0-A host interfaces are provided. There is also an RS485 version available, which can convert one USB port to an RS485 interface.

4G Cat1 is a cost-effective module designed for low-speed IoT applications around 10Mbps. The 10Mbps downlink and 5Mbps uplink speeds can meet the vast majority of networking and transmission needs.This module is plug-and-play on Raspberry Pi and Ubuntu OS, automatically recognized as a 4G connection without needing drivers or dial-up configurations, making it convenient for users to develop applications.It have two verison, CAT.1 and CAT.1-EU .

II. Hardware Spec

2.1 One USB-C power input, similar to the micro USB PWR on the Raspberry Pi Zero; choose one of the two options.

2.2 One 10/100Mbps Ethernet.

2.3 One 4G LTE Cat1 module.

2.4 One Nano SIM card and one IPEX-1 antenna.

2.5 Two USB2.0-A HS.

2.6 Four LEDs: PWR/MODE/ACT LED

2.7 One reset button for 4G module.

2.8 The RS485 version with industrial-grade power isolation, it is USB to RS485, so only one USB2.0 on board.

2.9 Aluminum alloy enclosure(OPT).

Note 1: After connecting this expansion board, the Micro USB port on the Zero will no longer be usable.

Note 2: In some systems, it is necessary to disable the OTG function and set the USB mode to Host mode.

Note 3: The board supports all versions of the Raspberry Pi Zero, including the Zero, Zero W, Zero WH, and Zero 2W.

Note 4: The board supportsother Pi with USB contacts in the same position, such as the Orange Pi Zero 2W.

0007_Zero_4G_Cat1_78.jpg

0007_Zero_4G_Cat1_79.jpg

0007_Zero_4G_Cat1_80.jpg

0007_Zero_4G_Cat1_81.jpg

0007_Zero_4G_Cat1_82.jpg

0007_Zero_4G_Cat1_83.jpg

4G Parameters
model CAT1 CAT1-EU
Band FDD:B1/B3/B5/B8 FDD:B1/B3/B5/B7/B8/B20/28
TDD:B34/B38/B39/B40/B41 TDD:B38/B40/B41
DATA FDD: Max 10Mbps(DL)/Max 5Mbps(UL)

TDD:Max 8Mbps(DL)/Max 2Mbps(UL)

Max 6Mbps(DL)/Max 4Mbps(UL)

III. Work with Raspberry Pi OS

We conducted tests based on the Raspberry Pi Zero 2W.

The Raspberry Pi OS:(Raspberry Pi OS with desktop) 2024-07-04-raspios-bookworm-arm64.img.xz.

You can download the Raspberry Pi OS in:

https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit

(If you are using the Raspberry Pi Zero (1st generation) series boards, they only support 32-bit systems. Please be sure to download the correct version.)

3.1 View hardware devices

3.1.1 View USB devices

Open the terminal in Raspberry Pi OS and enter the commandlsusb, as shown in the image below:

RPi0_RS485CAT1:

0007_Zero_4G_Cat1_86.jpg

RPi0_RS485CAT1EU:

0007_Zero_4G_Cat1_87.jpg

RPi0_CAT1-ETH/RPi0_CAT1-EU_ETH:

0007_Zero_4G_Cat1_88.jpg

If the system stop at the Raspberry Pi logo and fails to boot:

0007_Zero_4G_Cat1_58.jpg

or if after booting, the keyboard, mouse, and 4G module cannot be used, please carefully check whether the pogo pins are aligned with the gold-plated contacts. Additionally, on the PC, open the config.txt file located in the root directory of the TF card to check the USB initialization script.

0007_Zero_4G_Cat1_41.jpg

You need to confirm that the three red-boxed areas in the following image are all configured completely. If not, please manually add the missing parts and save the file:

# otg_mode=1 (It is recommended to comment out as follow)

dtoverlay=dwc2,dr_mode=host (These two areas must be ensured to be included.)

0007_Zero_4G_Cat1_57.jpg

3.1.2 View network devices

The 4G module is automatically recognized in the Raspberry Pi OS, requires no drivers, and is plug-and-play.

Open the terminal in Raspberry Pi OS and enter the command ifconfig -a, as shown in the image below:

0007_Zero_4G_Cat1_24.jpg

We can see that eth0 is a USB-to-Ethernet, and eth1 is a 4G Cat1 connection (with the IP address in the image above is 192.168.5.8).

3.2 Test network devices

3.2.1 ping tests

When testing, there is a priority order: if eth0 is connected, it will be used first. If there are specific requirements for internal and external networks, please adjust the metric values of each network and the DNS server settings.

Use the -I parameter to specify which network interface to start the ping packet from, as shown below:

ping www.mcuzone.com -I eth0

ping www.mcuzone.com -I eth1

0007_Zero_4G_Cat1_04.jpg

Priority can be checked by executing the route command; the network card with the smaller metric value will be preferred for communication.

0007_Zero_4G_Cat1_05.jpg

We can also force communication through another network by disabling a specific network card. For example, to disable eth0, you can execute the following command:

sudo ifconfig eth0 down

And enable eth0 by the following command:

sudo ifconfig eth0 up

3.2.2 Set network adapter priority

To set the priority of network cards, you need to modify the metric value of the network card. First, we need to install the ifmetric software.

sudo apt install ifmetric

0007_Zero_4G_Cat1_06.jpg

After the installation is complete, you can modify the metric value of the network card. If you need to change the metric value of eth0 to 102, you can execute:

sudo ifmetric eth0 102

After making the changes, use the route command to check, and we can see that the metric value of eth0 has been updated to 102:

0007_Zero_4G_Cat1_07.jpg

However, this modification is only temporary; if the system is restarted, it will revert to its original state. To permanently change the metric value of eth0 to 102, you need to edit the startup file to achieve this.

Open rc.local by the following command:

sudo nano /etc/rc.local

Add the command you want to execute at startup above exit 0, such as sudo ifmetric eth0 102, then save the file. You can modify the metric of eth0 every time the system starts by this way.

0007_Zero_4G_Cat1_08.jpg

0007_Zero_4G_Cat1_09.jpg

After modifying the metric values, it is possible that the system's nameserver (i.e., DNS server) is still using the previous higher-priority network card's nameserver. Since the default network card has now changed, this can lead to domain name resolution issues. So we also need to update the nameserver.

Open resolv.conf by the following command:

sudo nano /etc/resolv.conf

0007_Zero_4G_Cat1_16.jpg

0007_Zero_4G_Cat1_17.jpg

Check if the current nameserver is correct. If it is not, please change it to the nameserver of the network card with higher priority or to some common nameserver addresses (such as 8.8.8.8, etc.).

3.2.3 Using udhcpc to specify DNS servers

In the previous section, we discussed specifying DNS servers by modifying the nameserver. In fact, we can also achieve this by using udhcpc.

Install the udhcpc software:

sudo apt install udhcpc

0007_Zero_4G_Cat1_48.jpg

In this section, in the example we are testing, eth0 is a USB-to-Ethernet adapter, and usb0 is a 4G Cat1 (which corresponds to eth1 in the previous section). If we need to use the network DNS of the USB-to-Ethernet adapter (eth0), please use the following command:

sudo udhcpc -i eth0

0007_Zero_4G_Cat1_49.jpg

If we need to use the network DNS of the 4G Cat1 (usb0), please use the following command:

sudo udhcpc -i usb0

0007_Zero_4G_Cat1_50.jpg

3.2.4 Examples of how to use udhcpc

Example 1: The 100Mbps Ethernet port is connected to the Internet, and the 4G Cat1 is connected normally. In this case, if we ping a certain domain name, it will succeed:

0007_Zero_4G_Cat1_51.jpg

At this point, unplugging the 100M network port cable will make the ping fail:

0007_Zero_4G_Cat1_52.jpg

Run sudo udhcpc -i usb0 and switch the DNS server to 4G Cat1, then you should be able to ping normally:

0007_Zero_4G_Cat1_53.jpg

Example 2: The 100Mbps Ethernet port is connected to the internal network (not connected to the Internet), 4G Cat1 is connected normally. In this case, if we ping a certain domain name, it will failed:

0007_Zero_4G_Cat1_54.jpg

Execute sudo udhcpc -i usb0, switch the DNS server to the 4G Cat1, and then you should be able to ping normally, and access internal network devices via the IP addresses:

0007_Zero_4G_Cat1_55.jpg

3.2.5 Test speed by iperf3

You can download iperf3 (Windows version) in:

http://www.mcuzone.com/down/Software.asp?ID=10000634

Install iperf3 (Linux version) by using the following command:

sudo apt-get install iperf3

100M Ethernet speed test results: It is about 70Mbps in client mode and it is about 90Mbps in server mode:

0007_Zero_4G_Cat1_10.jpg

0007_Zero_4G_Cat1_11.jpg

Note: The USB to 100M Ethernet adapter may not reach full speed due to the performance limitations of the Zero 2W, the USB hub, and the bandwidth usage of the 4G Cat1.

4G CAT1 speed test results:

0007_Zero_4G_Cat1_66.jpg

Note: Network speed tests are affected by network conditions and testing methods. The actual speed may vary; this test is for reference only.

3.3 AT Command for 4G Cat1 Module

3.3.1 Open AT Command serial port

To operate 4G Cat1 Module using AT commands on a Raspberry Pi, you first need to open the AT command serial port. The method to open it is as follows:

Input the following command: lsusb, to open ttyUSB serial port:

If you use RPi0_RS485CAT1:

0007_Zero_4G_Cat1_23.jpg

Record the ID value of the 4G module: 1782 4e00

Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:

sudo modprobe option

sudo sh -c 'echo 1782 4e00 > /sys/bus/usb-serial/drivers/option1/new_id'

0007_Zero_4G_Cat1_12.jpg

If you use RPi0_RS485CAT1EU, RPi0_CAT1-ETH, RPi0_CAT1-EU_ETH:

0007_Zero_4G_Cat1_68.jpg

Record the ID value of the 4G module: 19d1 0001

Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:

sudo modprobe option

sudo sh -c 'echo 19d1 0001 > /sys/bus/usb-serial/drivers/option1/new_id'

0007_Zero_4G_Cat1_69.jpg

After execution is complete, the system should have three additional devices: ttyUSB0, ttyUSB1, and ttyUSB2.

Then Open serial port by serial port tool.

Install minicom:

sudo apt-get install minicom

0007_Zero_4G_Cat1_13.jpg

Open AT Command serial port by minicom:

sudo minicom -D /dev/ttyUSB0

Or

sudo minicom -D /dev/ttyUSB1

0007_Zero_4G_Cat1_14.jpg

Then directly type the AT command and press Enter to see the result. If you need to view the echo, please type the command: ate1.

Note: The model of the 4G module may change, but the process remains the same. You only need to use lsusb to check the actual USB ID and replace it with the actual value in subsequent commands. Additionally, some 4G Cat1 modules's chipset IDs have already been included in the kernel's supported list, so these Cat1 modules can be automatically recognized as ttyAMAx without the need to add a USB ID.

3.3.2 Common AT commands

1) Check if the SIM card is detected:

at+cpin?

Return ready to indicate the card has been recognized, if return error, you need to check the hardware.

2) Check antenna signal quality:

at+csq

Return values between 26 and 31 indicate a good signal, with 31 representing a full signal strength; return values between 20 and 25 indicate a barely acceptable signal; return values below 20 indicate a poor signal or that the antenna might not be connected.

3) Check network registration status:

at+cops?

Normally, it should return the network supporter's code: 7, where 7 represents 4G.

Note: The above command at+csq should not include a question mark, while the other two commands require a question mark.

4) View the SIM card's IMEI code:

at+cgsn

5) Reset 4G module (Sometimes, if you reinsert the SIM card, hot swapping may not work; in such cases, you can use this reset command to reset the module.):

at+reset

6) Disable radio frequency:

at+cfun=0

Enable radio frequency:

at+cfun=1

The two commands mentioned above can be used in pairs to allow the module to re-register with the network without restarting the 4G module.

0007_Zero_4G_Cat1_15.jpg

3.4 RS485 serial test

If you are using the RS485 version, it has one fewer USB2.0-A host interface, which is replaced by an RS485 interface.

First, you need to install the serial port software CuteCom; the installation command is:

sudo apt install cutecom

After installation, click on the Raspberry Pi icon in the top left corner of the desktop, and under "System Tools," there will be a shortcut to CuteCom:

0012_MPUUART_MP4232_01.jpg

If there are permission issues during use, please open the Raspberry Pi OS terminal and enter:

sudo cutecom

to run the CuteCom.

This expansion board comes with a 4G module, which occupies three serial ports ttyUSB0-2. Therefore, the serial port number for the RS485 serial port is shifted to ttyUSB3.

Plug a USB to RS485 converter into the PC and connect it to the RS485 port on the expansion board. Open the serial port software on each end for transmission and reception. The result is as follows:

Raspberry Pi OS:

0007_Zero_4G_Cat1_61.jpg

Windows:

0007_Zero_4G_Cat1_62.jpg

Through practical testing, the baud rate can reach up to 2.06M (based on the criterion that transmitted data does not become garbled).

IV. Work with Ubuntu OS

The hardware in this document is based on the Raspberry Pi Zero 2W.

Ubuntu system: Ubuntu Server 24.04 LTS. (The Raspberry Pi Zero 2W cannot use the Desktop version due to performance limitations.)

The image is: ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz

You can download the Ubuntu system in:

https://ubuntu.com/download/raspberry-pi

4.1 Edit the initialization script

After flashing Ubuntu Server, please open the config.txt file located in the root directory of the system partition on the TF card on your PC to check the initialization script for USB. Ubuntu Server initializes the USB twice, but the first initialization does not configure it in host mode. Please verify that the area highlighted in red in the following image is configured properly. If it is not, please manually add the complete configuration:

dtoverlay=dwc2,dr_mode=host

0007_Zero_4G_Cat1_32.jpg

0007_Zero_4G_Cat1_75.jpg

4.2 Configure username and password

Insert the TF card into Zero 2W and boot up the system. Upon the first startup, you will be prompted to log in; both the username and password are "ubuntu." After logging in successfully, you will be asked to change the password.

0007_Zero_4G_Cat1_31.jpg

Once the password is changed, you will automatically enter the system.

4.3 Configure network

After system startup, there is no network available, and further configuration is needed before it can be used.

Note: the system does not integrate the ifconfig tool by default; only the ip command is available.

Execute ip addr to view and record the name of the network interface card:

0007_Zero_4G_Cat1_33.jpg

The second network interface card (enx00e0996df1cd) is a USB-to-100Mbps Ethernet adapter, and the third network interface card (enxac4bb3b9ebe5) is the 4G module.

Then run the following command to open the network interface card configuration file:

sudo nano /etc/netplan/50-cloud-init.yaml

Edit the network interface card configuration file according to the diagram below:

0007_Zero_4G_Cat1_34.jpg

Save and exit, then reset the system.

After rebooting, you can connect to the network. Install the net-tools to facilitate usage:

sudo apt install net-tools

0007_Zero_4G_Cat1_35.jpg

4.4 Test network and 4G module

Run the command ifconfig -a to view the information of network:

0007_Zero_4G_Cat1_36.jpg

The first network interface card is a USB-to-100Mbps Ethernet adapter, and the second network interface card is the 4G module.

By using the -I parameter, you can specify the network interface name when sending ping packets, thus determining which interface to use for the ping. Through ping tests to Tencent's website using these two network interfaces, we can know that the second network interface (4G module) supports IPv6:

0007_Zero_4G_Cat1_37.jpg

4.5 AT command interaction test

Install minicom:

sudo apt-get install minicom

0007_Zero_4G_Cat1_38.jpg

Open AT Command serial port by minicom:

sudo minicom -D /dev/ttyUSB0

Or

sudo minicom -D /dev/ttyUSB1

0007_Zero_4G_Cat1_39.jpg

Now you can use common AT commands for interaction:

0007_Zero_4G_Cat1_40.jpg

4.6 RS485 serial test

This expansion board comes with a 4G module, which occupies three serial ports ttyUSB0-2. Therefore, the serial port number for the RS485 serial port is shifted to ttyUSB3.

Plug a USB to RS485 converter into the PC and connect it to the RS485 port on the expansion board. Open the serial port software on each end for transmission and reception. We use minicom on Ubuntu system:

sudo minicom -D /dev/ttyUSB3

Through practical testing, the baud rate can reach up to 2.00M (based on the criterion that transmitted data does not become garbled).

Ubuntu system:

0007_Zero_4G_Cat1_63.jpg

Windows:

0007_Zero_4G_Cat1_64.jpg

V. Work with OpenWrt

5.1 Overview

This expansion board, when paired with the Raspberry Pi Zero 2W running OpenWrt, can be configured as a one-in-one-out switch mode. The 4G module on the expansion board can serve as the WAN port (for direct 4G internet access), while the Ethernet port is configured as the LAN port for connecting to a PC.

5.2 Preparation

The OpenWrt which be used in this document is: openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz

After flashing the OpenWrt system and powering it up, we connect an Ethernet cable from the Raspberry Pi's built-in Ethernet port to the PC's Ethernet port. Once the connection between the PC's network card and the Raspberry Pi's Ethernet port is successful, we find Network and Internet settings in Windows, then open the connected network under Ethernet to view the default gateway IP address. This address is the backend configuration page address for the OpenWrt system. As shown in the figure, the address for this test is 192.168.198.1:

0007_Zero_4G_Cat1_18.jpg

Then open a web browser and enter 192.168.198.1 to access the OpenWrt system. The default username is root, and the default password is password.

0007_Zero_4G_Cat1_19.jpg

5.3 Configure the OpenWrt system

After entering the OpenWrt system, connect the Raspberry Pi's Ethernet port directly to the PC's Ethernet port using an Ethernet cable. Once the PC's network card has acquired an IP address, the PC can directly access the internet through the 4G module (no additional settings required).

5.4 Test the network speed of 4G module

On the PC, open https://www.speedtest.cn/ to perform a speed test. At this point, the traffic goes through the 4G module, and the test results are as follows:

0007_Zero_4G_Cat1_46.jpg

Note: The speed of 4G network testing is influenced by network signal strength and the testing method, so actual speeds may vary.

5.5 Mounting USB drive and file operations

When you insert a USB drive into a USB port, you can directly see the information and mounting status of the USB drive in "System - Disk Management":

0007_Zero_4G_Cat1_20.jpg

In the "System - Mount Points" section, you can see the status of all mount points and can configure them on this page.

In the "Network Storage - File Assistant" section, you can perform operations on files within the system.

0007_Zero_4G_Cat1_21.jpg

5.6 TTYD terminal

The OpenWrt system comes with a web-based TTYD terminal, which can be accessed in the "System - TTYD Terminal" section. The default username is root, and the default password is password. Since you log in with the root account, you will have root privileges upon logging in.

0007_Zero_4G_Cat1_22.jpg

VI. Expansion board selection guide

1006_RPi0_4G_MiniPCIe_65.jpg

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2025 Wildchip

T