1006 RPi0 4G MiniPCIe(Expand 4G Module via MiniPCIe):修订间差异

来自Mcuzone Wiki
(创建页面,内容为“== '''关键词''' == 树莓派、 Raspberry Pi Zero、Cat1 4G LTE、USB2.0-A、以太网、扩展板、SSH == '''一、简介''' == Zero系列小巧且预留了非常多的扩展接口,特别是板子反面引出了USB和电源的镀金测试点,我们可以借助这两组USB和电源测试点进行多种类型的外设扩展。本扩展板实际就是一个USB HUB集线器,通过顶针将扩展板和Zero的USB口连接起来,通过USB扩展四路USB…”)
 
 
(未显示同一用户的11个中间版本)
第1行: 第1行:
== '''关键词''' ==
[[1006 RPi0 4G MiniPCIe(MiniPCIe扩展4G模组)|切换语言为中文]]
树莓派、 Raspberry Pi Zero、Cat1 4G LTE、USB2.0-A、以太网、扩展板、SSH


== '''一、简介''' ==
== '''Keywords''' ==
Zero系列小巧且预留了非常多的扩展接口,特别是板子反面引出了USB和电源的镀金测试点,我们可以借助这两组USB和电源测试点进行多种类型的外设扩展。本扩展板实际就是一个USB HUB集线器,通过顶针将扩展板和Zero的USB口连接起来,通过USB扩展四路USB口,其中一路USB转百兆有线以太网,一路USB连接MiniPCIe 4G Cat4模组,以及两路USB2.0-A主机接口。
Raspberry Pi, Raspberry Pi Zero, Cat1 4G LTE, USB2.0-A, Ethernet, Expansion Board, SSH


4G LTE模组是针对中速物联网应用的高性价比模组,可以满足绝大多数联网和传输需求;4G LTE模组支持4G全网通,支持多个型号。
== '''I. Introduction''' ==
The Zero series is compact and 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 MiniPCIe 4G Cat1 module, and two USB2.0-A host interfaces are provided.


== '''二、硬件资源''' ==
The 4G LTE module is a high-cost-performance module aimed at medium-speed IoT applications, capable of meeting the majority of connectivity and transmission needs. The 4G LTE module supports Qualcomm 4G/GPS, NL668-EU/EAU/AM, GoTone EG25-G.
2.1 创新性采用镀金顶针和树莓派Zero系列进行连接,免去外接线缆;


2.2 两组镀金顶针分别用于供电和USB通讯;
== '''II. Hardware Spec''' ==
2.1 Use gold-plated pogo pins to connect the Raspberry Pi Zero series, eliminating the need for external cables;


2.3 扩展板具备USB-C供电接口,可通过此接口给整个系统供电,也可以用Zero上的MicroUSB口供电(供电二选一使用);
2.2 The two groups of gold-plated pogo pins are used separately for power supply and USB communication.


2.4 板载USB Hub,将Zero的USB扩展为四路,一路用于连接MiniPCIe 4G Cat4模组,两路USB主机接口,一路USB转10/100Mbps以太网;
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.5 4G LTE模组支持4G全网通,支持多个型号;
2.4 The onboard USB hub expands the Zero's USB into four ports: one port is used for connecting a MiniPCIe 4G LTE Cat1 module, one is a USB to 10/100Mbps Ethernet adapter, and two are USB host interfaces.


2.6 4G LTE模组在绝大多数系统下可即插即用免驱免拨号,通常识别为eth1网卡;
2.5 The 4G LTE module supports Qualcomm 4G/GPS, NL668-EU/EAU/AM, GoTone EG25-G.


2.7 4G LTE模组采用Nano尺寸SIM卡,可选SMA天线或者IPEX一代天线;
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.8 可支持具有相同位置USB触点的国产派,如香橙派Zero 2W;
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.9 板载PWR/MODE/ACT LED指示灯;
2.8 The expansion board supports other Pi with USB contacts in the same position, such as the Orange Pi Zero 2W.


2.10 板载4G复位按键;
2.9 Onboard PWR/MODE/ACT LED.


2.11 可选配铝合金外壳。
2.10 Onboard reset button for 4G module;


注意1:连接了此扩展板后Zero上的MicroUSB将不可使用。
2.11 An optional aluminum alloy enclosure is available.


注意2:部分系统下需要禁用OTG功能并将USB模式设置为Host模式。
Note 1: After connecting this expansion board, the Micro USB port on the Zero will no longer be usable.


注意3:支持树莓派Zero所有版本,包括Zero、Zero W、Zero WH和Zero 2W。
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.


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_25.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_25.jpg


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_26.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_27.jpg


== '''三、系统烧写及设置''' ==
== '''III. Work with Raspberry Pi OS''' ==
This document uses the Raspberry Pi OS and OpenWrt system for testing.


=== 3.1 概述 ===
The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz
本文档采用树莓派OS和OpenWrt系统进行测试。


树莓派OS的版本为2024-07-04-raspios-bookworm-arm64.img.xz,树莓派OS下载地址:
You can download the Raspberry Pi OS in:


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


(若使用树莓派Zero一代系列的板子,只支持32位系统,请注意下载版本。)
(If using the first-generation Raspberry Pi Zero board, which only supports 32-bit systems, please pay attention to the version you download.)
 
OpenWrt系统的版本为:openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz
 
=== 3.2 从TF卡启动 ===
 
==== 3.2.1 使用树莓派镜像烧录器烧写 ====
首先在Windows端安装树莓派镜像烧录器,下载地址:https://www.raspberrypi.com/software/
 
安装完毕后将TF卡插入读卡器,读卡器插入PC的USB口,然后打开软件:
 
Raspberry Pi Device:选择Raspberry Pi Zero 2 W;
 
请选择需要写入的操作系统:选择Raspberry Pi OS(64-bit),为从树莓派官网下载系统镜像烧写(需联网);选择Use Custom,则需要自行选择硬盘上已经下载的系统镜像(无需联网);
 
储存卡:选择所需烧入的TF卡(即插在PC的USB接口的卡);
 
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_01.jpg
 
选择完毕后按“NEXT”,建议点击“编辑设置”,将一些参数预设置进烧写软件(比如系统用户名和密码,WiFi连接参数、是否要开启SSH服务等),之后在系统启动时就不必再次设置,便于使用。
 
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_02.jpg
 
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_03.jpg
 
'''注意:建议把SSH选上,后面要用:'''
 
http://www.mcuzone.com/wiki/2005_CM4_NAS/2005_CM4_NAS_49.jpg
 
需要使用预设置的按“是”,不需要使用预设置的按“不”,进入下一页,点击“是”,就开始烧写及验证完整性,烧写完毕后按提示取下卡即可。
 
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_04.jpg


==== 3.2.2 使用balenaEtcher烧写 ====
The version of the OpenWrt is: openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz
首先在Windows端安装balenaEtcher,下载地址:https://etcher.balena.io/#download-etcher


将TF卡插入读卡器,读卡器插入PC的USB口,然后打开软件:
=== 3.1 View hardware devices ===


从文件烧录:选择预先下载的树莓派OS或者其它操作系统镜像;
==== 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:
选择目标磁盘:选择所需烧入的TF卡(即插在PC的USB接口的卡);
 
然后点击“现在烧录!”,就开始烧录了,等待烧录完毕即可。
 
http://www.mcuzone.com/wiki/0005_MPS2242_2280/0005_MPS2242_2280_05.jpg
 
==== 3.2.3 启动系统 ====
将TF卡从读卡器中取下,塞进Zero核心板的TF卡卡槽,上电后即可进入系统。
 
== '''四、树莓派系统下使用演示''' ==
 
=== 4.1 查看硬件设备 ===
 
==== 4.1.1 查看USB设备 ====
打开树莓派OS的终端,输入命令lsusb,如下图所示:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_01.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_01.jpg


Device 002:外挂USB Hub;
Device 002:External USB Hub;


Device 003:USB转百兆网卡;
Device 003:USB to 100Mbps Ethernet adapter;


Device 004:USB2.0-A接口;
Device 004:USB2.0-A Interface;


Device 005:4G模组;
Device 005:4G module;


Device 006:USB2.0-A接口;
Device 006:USB2.0-A Interface;


如果系统卡在树莓派logo处无法启动:
If the system stop at the Raspberry Pi logo and fails to boot:


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


或者启动后键盘鼠标及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>(建议按此注释掉)
<code># otg_mode=1</code> (It is recommended to comment out as follow)


<code>dtoverlay=dwc2,dr_mode=host</code>(两处必须确保加上)
<code>dtoverlay=dwc2,dr_mode=host</code> (These two areas must be ensured to be included.)


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_57.jpg


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


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_02.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_02.jpg


可以看到eth0为USB转以太网,usb0为4G Cat4模组(上图中IP地址为10.17.34.16),wlan0为无线网卡(已连接,IP地址为192.168.8.71)
We can see that eth0 is a USB-to-Ethernet adapter, and usb0 is a 4G Cat4 connection (with the IP address in the image above is 10.17.34.16), and wlan0 is the wireless network interface  (with the IP address in the image above is 192.168.8.71).


=== 4.2 通过SSH连接系统 ===
=== 3.2 Connect to the system via SSH ===
为了操作方便,建议使用PC端的SSH软件连接系统并进行终端操作,我们使用与树莓派的无线网卡的IP地址在同一网段内的PC,通过MobaXterm进行连接:
For convenience, it is recommended to use SSH software on the PC to connect to the system and perform terminal operations. We use a PC within the same IP subnet as the Raspberry Pi's wireless network card and connect through MobaXterm:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_03.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_03.jpg


连接后,大部分操作都可以通过PC端的MobaXterm进行,使得整套硬件系统可以脱离显示器运作。以下测试操作将通过MobaXterm在PC端进行演示。
After connecting, most operations can be performed using MobaXterm on the PC side, allowing the entire hardware system to operate without a monitor. The following test operations will be demonstrated using MobaXterm on the PC side.


=== 4.3 测试网络设备 ===
=== 3.3 Test network devices ===


==== 4.3.1 ping包测试 ====
==== 3.3.1 ping tests ====
测试的时候有优先级,如有内外网特殊优先级需要请调整各网络的metric值以及DNS服务器设置。
When testing, there is a priority order. If there are specific requirements for internal and external networks, please adjust the metric values of each network and the DNS server settings.


现在系统已连接WiFi和4G,可以用-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 wlan0</code>
<code>ping www.mcuzone.com -I wlan0</code>
第160行: 第115行:
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_04.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_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/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_05.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_05.jpg


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


<code>sudo ifconfig usb0 down</code>
<code>sudo ifconfig usb0 down</code>


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


<code>sudo ifconfig usb0 up</code>
<code>sudo ifconfig usb0 up</code>


==== 4.3.2 网卡优先级相关设置 ====
==== 3.3.2 Set network adapter priority ====
有关网卡优先级的相关设置,请参阅以下链接:
For related settings regarding network card priority, please refer to the following link:


[[1001 RPi0 4G Cat1-ETH(百兆网络 4G Cat1 USB2.0-A 485版本可选)#4.2.2 网卡优先级的设置|1. 网卡优先级的设置]]
[[1001 RPi0 4G Cat1-ETH(100M ETH 4G Cat1 USB2.0-A RS485 version optional)#4.2.2 Set network adapter priority|1. Set network adapter priority]]


[[1001 RPi0 4G Cat1-ETH(百兆网络 4G Cat1 USB2.0-A 485版本可选)#4.2.3 利用udhcpc指定DNS服务器|2. 利用udhcpc指定DNS服务器]]
[[1001 RPi0 4G Cat1-ETH(100M ETH 4G Cat1 USB2.0-A RS485 version optional)#4.2.3 Using udhcpc to specify DNS servers|2. Using udhcpc to specify DNS servers]]


[[1001 RPi0 4G Cat1-ETH(百兆网络 4G Cat1 USB2.0-A 485版本可选)#4.2.4 udhcpc应用场景举例|3. udhcpc应用场景举例]]
[[1001 RPi0 4G Cat1-ETH(100M ETH 4G Cat1 USB2.0-A RS485 version optional)#4.2.4 Examples of how to use udhcpc|3. Examples of how to use udhcpc]]


==== 4.3.3 iperf3测速 ====
==== 3.3.3 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>


百兆以太网测速结果:
100M Ethernet speed test results:


client模式92.3Mbps左右:
It is about 92.3Mbps in client mode:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_06.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_06.jpg


server模式94.8Mbps左右:
It is about 94.8Mbps in server mode:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_07.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_07.jpg


'''''注意:USB转百兆有线受Zero 2W性能和USB Hub以及4G Cat4模组带宽占用影响并不能跑满,请知悉。'''''
'''''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 Cat4.'''''
 
=== 4.4 树莓派系统下4G Cat4模组的AT命令演示 ===


==== 4.4.1 打开AT命令串口方法 ====
=== 3.4 AT Command for 4G Cat4 Module on Raspberry Pi OS ===
在树莓派系统下对4G进行AT命令操作,需要打开AT命令串口,打开方法如下:


首先打开ttyUSB串口:
==== 3.4.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:


输入命令<code>lsusb</code>,如下图所示:
To open ttyUSB serial port, input the following command: <code>lsusb</code>:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_08.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_08.jpg


记下4G模块的ID值:05c6 90b6
Record the ID value of the 4G module: 05c6 90b6


使用下列命令打开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>
第223行: 第176行:
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_09.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_09.jpg


执行以上两条命令后系统应该会多出ttyUSB0-2三个设备,输入<code>ls /dev</code>可以查看:
After execution is complete, the system should have three additional devices: ttyUSB0, ttyUSB1, and ttyUSB2. Input <code>ls /dev</code> to view:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_10.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_10.jpg


然后用串口工具打开特定串口:
Then Open serial port by serial port tool.


安装minicom工具:
Install minicom:


<code>sudo apt-get install minicom</code>
<code>sudo apt-get install minicom</code>
第235行: 第188行:
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_11.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_11.jpg


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


<code>sudo minicom -D /dev/ttyUSB0</code>
<code>sudo minicom -D /dev/ttyUSB0</code>
第241行: 第194行:
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_12.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_12.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>:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_13.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_13.jpg


==== 4.4.2 常用AT命令 ====
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.
1) 检查SIM卡是否识别到:
 
==== 3.4.2 Common AT commands ====
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) 查看4G模块的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.
 
== '''IV. Work with OpenWrt System''' ==


== '''五、OpenWrt系统操作演示''' ==
=== 4.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.1 概述 ===
=== 4.2 Preparation ===
此扩展板搭配树莓派Zero 2W,在OpenWrt系统下可配置为一进一出的交换机模式,扩展板上的4G可作为WAN口(直接4G上网),网口配置为LAN口,用于连接PC。
The OpenWrt which be used in this document is: openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz


=== 5.2 准备工作 ===
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:
烧写OpenWrt系统并上电启动后,我们通过树莓派自带网口连接网线至PC网口,待PC的网卡与树莓派的网口连接成功后,我们在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_14.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_14.jpg


然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为<code>root</code>,默认密码为<code>password:</code>
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/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_15.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_15.jpg


=== 5.3 设置高通4G LTE模组 ===
=== 4.3 Set up the Qualcomm 4G LTE module ===
登录OpenWrt系统后,点击“Network - Interface”,然后点击“ADD NEW INTERFACE...”:
After logging into the OpenWrt system, click on "Network - Interfaces," and then click on "ADD NEW INTERFACE...".


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_16.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_16.jpg


按照下图进行设置,Name of the new interface为WAN,Protocol of the new interface选择DHCP client,Cover the following interface选择usb0,然后点击“SUBMIT”按钮:
Set it up according to the following picture: set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "usb0" for "Cover the following interface," and then click the "SUBMIT" button:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_17.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_17.jpg


在Firewall Setting中选择WAN口后点击“SAVE & APPLY”按钮:
In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_18.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_18.jpg


回到“Network - Interface”,稍等片刻,就可以看见新建的WAN接口获取了IP地址,这样PC就可以通过4G LTE模组上网了:
Go back to "Network - Interfaces", wait a moment, and you will see the newly created WAN interface has obtained an IP address. This way, the PC can access the internet through the 4G LTE module:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_19.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_19.jpg


在PC端打开<nowiki/>https://www.speedtest.cn/<nowiki/>进行测速,此时流量走的是4G模块,测试结果如下:
Open https://www.speedtest.cn/ on the PC to test speed. At this point, the PC can access the internet through the 4G LTE module, and the test results are as follows:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_20.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_20.jpg


=== 5.4 设置国产4G CAT4模组 ===
=== 4.4 Set up the CAT4 4G(SOC from CHINA) module ===
登录OpenWrt系统后,点击“Network - Interface”,然后点击“ADD NEW INTERFACE...”:
After logging into the OpenWrt system, click on "Network - Interfaces," and then click on "ADD NEW INTERFACE...".


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_16.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_16.jpg


按照下图进行设置,Name of the new interface为WAN,Protocol of the new interface选择DHCP client,Cover the following interface选择eth1,然后点击“SUBMIT”按钮:
Set it up according to the following picture: set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "eth1" for "Cover the following interface," and then click the "SUBMIT" button:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_21.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_21.jpg


在Firewall Setting中选择WAN口后点击“SAVE & APPLY”按钮:
In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_18.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_18.jpg


回到“Network - Interface”,稍等片刻,就可以看见新建的WAN接口获取了IP地址,这样PC就可以通过4G LTE模组上网了:
Go back to "Network - Interfaces", wait a moment, and you will see the newly created WAN interface has obtained an IP address. This way, the PC can access the internet through the 4G LTE module:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_22.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_22.jpg


在PC端打开<nowiki/>https://www.speedtest.cn/<nowiki/>进行测速,此时流量走的是4G模块,测试结果如下:
Open https://www.speedtest.cn/ on the PC to test speed. At this point, the PC can access the internet through the 4G LTE module, and the test results are as follows:


http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_23.jpg
http://www.mcuzone.com/wiki/1006_RPi0_4G_MiniPCIe/1006_RPi0_4G_MiniPCIe_23.jpg


{{联系我们_图标}}
{{Contact_Us_icon}}

2024年11月15日 (五) 10:20的最新版本

切换语言为中文

Keywords

Raspberry Pi, Raspberry Pi Zero, Cat1 4G LTE, USB2.0-A, Ethernet, Expansion Board, SSH

I. Introduction

The Zero series is compact and 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 MiniPCIe 4G Cat1 module, and two USB2.0-A host interfaces are provided.

The 4G LTE module is a high-cost-performance module aimed at medium-speed IoT applications, capable of meeting the majority of connectivity and transmission needs. The 4G LTE module supports Qualcomm 4G/GPS, NL668-EU/EAU/AM, GoTone EG25-G.

II. Hardware Spec

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.

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.4 The onboard USB hub expands the Zero's USB into four ports: one port is used for connecting a MiniPCIe 4G LTE Cat1 module, one is a USB to 10/100Mbps Ethernet adapter, and two are USB host interfaces.

2.5 The 4G LTE module supports Qualcomm 4G/GPS, NL668-EU/EAU/AM, GoTone EG25-G.

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.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.8 The expansion board supports other Pi with USB contacts in the same position, such as the Orange Pi Zero 2W.

2.9 Onboard PWR/MODE/ACT LED.

2.10 Onboard reset button for 4G module;

2.11 An optional aluminum alloy enclosure is available.

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 expansion board supports all versions of the Raspberry Pi Zero, including the Zero, Zero W, Zero WH, and Zero 2W.

1006_RPi0_4G_MiniPCIe_25.jpg

1006_RPi0_4G_MiniPCIe_27.jpg

III. Work with Raspberry Pi OS

This document uses the Raspberry Pi OS and OpenWrt system for testing.

The version of the Raspberry Pi OS is: 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 using the first-generation Raspberry Pi Zero board, which only supports 32-bit systems, please pay attention to the version you download.)

The version of the OpenWrt is: openwrt-bcm27xx-bcm2709-rpi-2-squashfs-sysupgrade-linux-6.1.98-20240723.img.gz

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:

1006_RPi0_4G_MiniPCIe_01.jpg

Device 002:External USB Hub;

Device 003:USB to 100Mbps Ethernet adapter;

Device 004:USB2.0-A Interface;

Device 005:4G module;

Device 006:USB2.0-A Interface;

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

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

1006_RPi0_4G_MiniPCIe_02.jpg

We can see that eth0 is a USB-to-Ethernet adapter, and usb0 is a 4G Cat4 connection (with the IP address in the image above is 10.17.34.16), and wlan0 is the wireless network interface (with the IP address in the image above is 192.168.8.71).

3.2 Connect to the system via SSH

For convenience, it is recommended to use SSH software on the PC to connect to the system and perform terminal operations. We use a PC within the same IP subnet as the Raspberry Pi's wireless network card and connect through MobaXterm:

1006_RPi0_4G_MiniPCIe_03.jpg

After connecting, most operations can be performed using MobaXterm on the PC side, allowing the entire hardware system to operate without a monitor. The following test operations will be demonstrated using MobaXterm on the PC side.

3.3 Test network devices

3.3.1 ping tests

When testing, there is a priority order. 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 wlan0

ping www.mcuzone.com -I usb0

1006_RPi0_4G_MiniPCIe_04.jpg

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

1006_RPi0_4G_MiniPCIe_05.jpg

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

sudo ifconfig usb0 down

And enable usb0 by the following command:

sudo ifconfig usb0 up

3.3.2 Set network adapter priority

For related settings regarding network card priority, please refer to the following link:

1. Set network adapter priority

2. Using udhcpc to specify DNS servers

3. Examples of how to use udhcpc

3.3.3 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 92.3Mbps in client mode:

1006_RPi0_4G_MiniPCIe_06.jpg

It is about 94.8Mbps in server mode:

1006_RPi0_4G_MiniPCIe_07.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 Cat4.

3.4 AT Command for 4G Cat4 Module on Raspberry Pi OS

3.4.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:

To open ttyUSB serial port, input the following command: lsusb:

1006_RPi0_4G_MiniPCIe_08.jpg

Record the ID value of the 4G module: 05c6 90b6

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 05c6 90b6 > /sys/bus/usb-serial/drivers/option1/new_id'

1006_RPi0_4G_MiniPCIe_09.jpg

After execution is complete, the system should have three additional devices: ttyUSB0, ttyUSB1, and ttyUSB2. Input ls /dev to view:

1006_RPi0_4G_MiniPCIe_10.jpg

Then Open serial port by serial port tool.

Install minicom:

sudo apt-get install minicom

1006_RPi0_4G_MiniPCIe_11.jpg

Open AT Command serial port by minicom:

sudo minicom -D /dev/ttyUSB0

1006_RPi0_4G_MiniPCIe_12.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

1006_RPi0_4G_MiniPCIe_13.jpg

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.4.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.

IV. Work with OpenWrt System

4.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.

4.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:

1006_RPi0_4G_MiniPCIe_14.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:

1006_RPi0_4G_MiniPCIe_15.jpg

4.3 Set up the Qualcomm 4G LTE module

After logging into the OpenWrt system, click on "Network - Interfaces," and then click on "ADD NEW INTERFACE...".

1006_RPi0_4G_MiniPCIe_16.jpg

Set it up according to the following picture: set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "usb0" for "Cover the following interface," and then click the "SUBMIT" button:

1006_RPi0_4G_MiniPCIe_17.jpg

In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:

1006_RPi0_4G_MiniPCIe_18.jpg

Go back to "Network - Interfaces", wait a moment, and you will see the newly created WAN interface has obtained an IP address. This way, the PC can access the internet through the 4G LTE module:

1006_RPi0_4G_MiniPCIe_19.jpg

Open https://www.speedtest.cn/ on the PC to test speed. At this point, the PC can access the internet through the 4G LTE module, and the test results are as follows:

1006_RPi0_4G_MiniPCIe_20.jpg

4.4 Set up the CAT4 4G(SOC from CHINA) module

After logging into the OpenWrt system, click on "Network - Interfaces," and then click on "ADD NEW INTERFACE...".

1006_RPi0_4G_MiniPCIe_16.jpg

Set it up according to the following picture: set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "eth1" for "Cover the following interface," and then click the "SUBMIT" button:

1006_RPi0_4G_MiniPCIe_21.jpg

In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:

1006_RPi0_4G_MiniPCIe_18.jpg

Go back to "Network - Interfaces", wait a moment, and you will see the newly created WAN interface has obtained an IP address. This way, the PC can access the internet through the 4G LTE module:

1006_RPi0_4G_MiniPCIe_22.jpg

Open https://www.speedtest.cn/ on the PC to test speed. At this point, the PC can access the internet through the 4G LTE module, and the test results are as follows:

1006_RPi0_4G_MiniPCIe_23.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-2024 Wildchip