0020 MPU4G(PCIe to USB 4G LTE EN:修订间差异

来自Mcuzone Wiki
无编辑摘要
 
(未显示同一用户的10个中间版本)
第1行: 第1行:
[[0020 MPU4G(PCIe to USB 4G LTE|切换语言为中文]]
== '''Keywords''' ==
== '''Keywords''' ==
Raspberry Pi 5, Raspberry Pi, 4G LTE, PCIe, mini PCIe, AT Commands
Raspberry Pi 5, Raspberry Pi, 4G LTE, PCIe, mini PCIe, AT Commands
第5行: 第7行:
The MPU4G is a 4G expansion board specifically designed for the Raspberry Pi 5. First, expand four USB 2.0 interfaces through the PCIe interface, then connect one of the USB 2.0 signals to the 4G module on the miniPCIe interface. The remaining three USB 2.0 interfaces are brought out in the form of a 1.25mm 4Pin connector. These three interfaces can be used to further expand 1-3 CM4-sized 4G modules. When expanding more than two 4G modules, please pay attention to the power supply. They can also be used to expand our temperature and humidity modules or GPS modules. The 4G modules included with the expansion board are driver-free and do not require dial-up. They are automatically recognized and plug-and-play under the Raspberry Pi official OS/Ubuntu, eliminating the need for additional driver installation. Their target applications include 4G access, multi-4G carrier aggregation, and remote unattended operation.
The MPU4G is a 4G expansion board specifically designed for the Raspberry Pi 5. First, expand four USB 2.0 interfaces through the PCIe interface, then connect one of the USB 2.0 signals to the 4G module on the miniPCIe interface. The remaining three USB 2.0 interfaces are brought out in the form of a 1.25mm 4Pin connector. These three interfaces can be used to further expand 1-3 CM4-sized 4G modules. When expanding more than two 4G modules, please pay attention to the power supply. They can also be used to expand our temperature and humidity modules or GPS modules. The 4G modules included with the expansion board are driver-free and do not require dial-up. They are automatically recognized and plug-and-play under the Raspberry Pi official OS/Ubuntu, eliminating the need for additional driver installation. Their target applications include 4G access, multi-4G carrier aggregation, and remote unattended operation.


The MiniPCIe 4G models are as follows: Domestic solution CAT4 4G and ZTE CAT4 4G, Quectel EC20 Voice GPS Lite version (with call and SMS functions), Qualcomm 4G, and Qualcomm 4G-GPS version. There are also international versions, such as the Qualcomm 4G European version (NL668-EU), Australian version (NL668-EAU), and North American version (NL668-AM), among others.
The MiniPCIe 4G models are as follows: Domestic solution CAT4 4G and ZTE CAT4 4G, Quectel EC20-GPS Voice Lite version (with call and SMS functions), Qualcomm 4G, and Qualcomm 4G-GPS version. There are also international versions, such as the Qualcomm 4G European version (NL668-EU), Australian version (NL668-EAU), and North American version (NL668-AM), among others.


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_87.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_108.jpg


== '''II. Hardware Spec''' ==
== '''II. Hardware Spec''' ==
第48行: 第50行:
!
!
!CAT4
!CAT4
!高通4G/GPS
!Qualcomm 4G/GPS
!ZTE CAT4
!ZTE CAT4
!EC20-GPS简版
!EC20-GPS Voice lite version
|-
|-
|BAND
|BAND
第107行: 第109行:
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_28.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_28.jpg


Under normal conditions, the "4G" LED indicator on the expansion board flashes rapidly."
Under normal conditions, the "4G" LED indicator on the expansion board flashes rapidly.


=== 3.4 Quectel EC20 voice GPS L lite version ===
=== 3.4 Quectel EC20-GPS voice lite version ===
By executing <code>ifconfig -a</code> in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address.
By executing <code>ifconfig -a</code> in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address.


第129行: 第131行:
'''''Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.'''''
'''''Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.'''''


=== 3.6 '''Remote Connection to Raspberry Pi'''('''4G application''') ===
=== 3.6 Remote Connection to Raspberry Pi(4G application) ===
If you want to use 4G for remote access to a Raspberry Pi 5, the official Raspberry Pi OS (Bookworm version) comes with an example application called Raspberry Pi Connect that you can refer to and use. With the Raspberry Pi paired with 4G, and through the official remote control software Raspberry Pi Connect, you can securely access your Raspberry Pi from anywhere in the world. Here, we will demonstrate how to configure the remote connection service.
If you want to use 4G for remote access to a Raspberry Pi 5, the official Raspberry Pi OS (Bookworm version) comes with an example application called Raspberry Pi Connect that you can refer to and use. With the Raspberry Pi paired with 4G, and through the official remote control software Raspberry Pi Connect, you can securely access your Raspberry Pi from anywhere in the world. Here, we will demonstrate how to configure the remote connection service.


第154行: 第156行:
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_39.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_39.jpg


6. After successfully logging in, access <code><nowiki>https://connect.raspberrypi.com/</nowiki></code> in a browser on Windows and log in.
6. After successfully logging in, access https://connect.raspberrypi.com/ in a browser on Windows and log in.


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_40.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_40.jpg
第172行: 第174行:
9. Measured data usage: Under remote desktop, the Raspberry Pi consumes about 2MB of data per minute; under The remote shell is as follows: line interface, the Raspberry Pi consumes about 100KB of data per minute.
9. Measured data usage: Under remote desktop, the Raspberry Pi consumes about 2MB of data per minute; under The remote shell is as follows: line interface, the Raspberry Pi consumes about 100KB of data per minute.


== '''四、Ubuntu OS的操作''' ==
== '''IV. Work with Ubuntu OS''' ==
我们测试的Ubuntu OS的版本为:
Ubuntu OS:


ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz(Desktop版,图形化版本)
ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz(Desktop, GUI version)


ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz(Server版,命令行版本)
ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz(Server, command line version)


Ubuntu OS下载地址:
You can download it in:


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


=== 4.1 Ubuntu Desktop系统 ===
=== 4.1 Ubuntu Desktop OS ===
Ubuntu Desktop系统(图形化版本),终端执行<code>ifconfig -a</code>时,所有的4G模块均识别为enx开头的网卡,可直接使用,免驱免配置。
Ubuntu Desktop OS(GUI version). When executing <code>ifconfig -a</code> in the terminal, all 4G modules are recognized as network interfaces starting with <code>enx</code>, and they can be used directly without the need for drivers or additional configuration.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_44.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_44.jpg


=== 4.2 Ubuntu Server OS ===
=== 4.2 Ubuntu Server OS ===
Ubuntu Server系统(命令行版本)基于树莓派5,默认只开启一路网络,而且关闭wifi功能,所以若要用4G或wifi,则需要开启第二路,第三路网络,且需要手动添加网卡才能使用;在此,我们将演示Ubuntu Sever下将wifi开启,且使用4G的操作步骤:
When the Ubuntu Server OS (command line version) is used on a Raspberry Pi 5, only one network interface is enabled by default, and the Wi-Fi functionality is disabled. So if you want to use 4G or WiFi, you need to enable the second and third network interfaces, and manually add a network card to use them. We will demonstrate the steps to enable Wi-Fi and use 4G on Ubuntu Server.


==== 4.2.1 系统烧写,设置SSH ====
==== 4.2.1 System flashing and setting up SSH ====
烧写系统时建议在树莓派烧录器里面把WiFi和SSH设置都预设置好:
When flashing the system, it is recommended to pre-configure the WiFi and SSH settings in the Raspberry Pi imager.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_35.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_61.jpg


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_36.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_62.jpg


将TF卡插入树莓派,启动系统。第一次启动后会要求登录,用户名和密码均为ubuntu,登录成功后会要求修改密码。
Insert the TF card into the Raspberry Pi and boot up the system. The login username and password are the ones pre-configure; if not pre-configure, both are <code>ubuntu</code>, and you will be prompted to change the password after successful login.


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


修改完毕后就自动进入系统。
After the modifications are completed, it will automatically enter the system.


==== 4.2.2 配置系统网络 ====
==== 4.2.2 Configure system network ====
此处操作以CAT 4G为例。
The operation here is demonstrated using CAT 4G as an example.


'''''系统默认并没有集成ifconfig工具,只有ip命令可用。'''''
'''''Note: The system does not come with 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 network interface name.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_37.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_37.jpg


其中eth0树莓派5自带千兆网口,enx000c29a39b6d为4G模组,wlan0为树莓派自身的无线网卡(本系统烧写时已经预配置了无线热点信息,因此启动后即可使用无线网卡)。
Among them, eth0 is the built-in Gigabit Ethernet port of the Raspberry Pi 5, enx000c29a39b6d is the 4G module, and wlan0 is the Raspberry Pi's own wireless network card (the system has been pre-configured with wireless hotspot information during the initial setup, so the wireless network card can be used immediately after booting).


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


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


按照下图编辑网卡配置文件:
Please edit the network card configuration file according to the image below:


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_34.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_59.jpg


保存退出,然后重启。
Save and exit, then reboot.


重启后即可联网,安装net-tools工具以便于使用:
After rebooting, you can connect to the internet. Install the net-tools package for ease of use:


<code>sudo apt install net-tools</code>
<code>sudo apt install net-tools</code>


安装完毕net-tools工具,即可使用<code>ifconfig -a</code>查看网络状态:
Once the net-tools package is installed, you can use the command <code>ifconfig -a</code> to check the network status.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_47.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_60.jpg


可见此时有线网卡和4G模组均已获取了ip地址。
It is evident that both the wired network card and the 4G module have obtained IP addresses at this point.


我们通过某一网卡ping外网服务器,即可验证该网卡工作是否正常,如我们通过4G模组ping外网IP和网址,结果如下:
By <code>ping</code> an external server through a specific network card, we can verify whether the network card is functioning properly. For example, if we <code>ping</code> an external IP address and website using a 4G module, the results are as follows:"


<code>ping 220.189.255.38 -I enx000c29a39b6d</code>
<code>ping 220.189.255.38 -I enx000c29a39b6d</code>
第243行: 第245行:
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_46.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_46.jpg


== '''五、AT命令操作''' ==
== '''V. AT command operation''' ==


=== 5.1 操作AT命令 ===
=== 5.1 AT command operation ===
此处操作以高通4G模组为例。在树莓派终端中执行命令<code>lsusb</code>,如下图所示:
Taking Qualcomm 4G as an example, execute <code>lsusb</code> in terminal:


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_23.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_23.jpg


本模块的id为05c6 90b6,记录下这个值。(每个模组的ID号不同,以实际查看为准)
Record the ID value of the 4G module: 05c6 90b6 (The ID number for each type of module varies; please refer to the actual details for accurate information.)


使用下列命令打开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>
第260行: 第262行:
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_02.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_02.jpg


执行上述两条命令之后执行:
After executing the above two commands, proceed with:


<code>ls /dev</code>
<code>ls /dev</code>


此时应该能看到dev设备下有ttyUSB0-2三个设备:
At this point, you should be able to see three devices under the dev directory: ttyUSB0, ttyUSB1, and ttyUSB2:


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_03.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_03.jpg


然后通过minicom打开AT命令串口:
Install the serial port software minicom:
 
<code>sudo apt install minicom</code>
 
Then open the AT command serial port using minicom:


<code>sudo minicom -D /dev/ttyUSB0</code>
<code>sudo minicom -D /dev/ttyUSB0</code>
第274行: 第280行:
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_04.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_04.jpg


(注意:使用哪个串口,应以在进入此串口后,可输入运行AT命令,显示不乱码,不乱跳结果为准)
(Note: The choice of which serial port to use should be based on the ability to input and run AT commands after entering this port, ensuring that the display is not garbled and the results do not jump erratically.)


第一次输入AT命令可能没有回显,此时如果输入命令<code>at</code>后回车,有返回OK,就说明工作正常。如果需要查看回显,请键入命令:<code>ate1</code>,然后回车,继续键入其它命令,回车可以看到结果。
The first time you enter an AT command, there may be no echo. If you then input the command <code>at</code> and press Enter, and it returns "OK," it indicates that everything is working properly. If you need to check the echo, please type the command: <code>ate1</code>, then press Enter. After that, you can continue to type other commands and press Enter to see the results.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_05.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_05.jpg


=== 5.2 常用AT命令 ===
=== 5.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) 查看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.
 
7)APN设置
 
普通手机SIM是不需要任何设置,即可直接使用,有些物联网卡需要设置APN才能正常使用,APN的参数一般由运营商提供,以下仅供参考。


移动卡:
7. APN settings:


AT+CPNETAPN=0,"cmnet","",""
The SIM card of a regular mobile phone can be used directly without any configuration. However, some IoT cards require APN settings to function properly, and the APN parameters are usually provided by the carrier.
 
电信卡:
 
AT+CPNETAPN=0,"ctnet","",""


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


如果你需要其它AT命令的操作方法,请自行查看4G模组配套的at命令手册(各个厂家的模块的操作命令不尽相同)。
If you need the operation methods for other AT commands, please refer to the AT command manual provided with the 4G module (the operation commands may vary depending on the manufacturer).


=== 5.3 修改IP地址方法 ===
=== 5.3 Modify the IP address of the 4G module ===
如果出厂的4G IP地址和用户使用的IP地址有冲突,或有修改IP地址的需求,可按照下列步骤进行修改:
If the default 4G IP address assigned at the factory conflicts with the IP address being used by the user, or if there is a need to modify the IP address, you can change the 4G module's IP.


'''CAT4 4G:'''
'''1. CAT4 4G:'''


执行AT命令:
Execute the AT command:


<code>AT+ROUTEIP=<newip></code>
<code>AT+ROUTEIP=<newip></code>


注意,只支持192.168.x.1这样格式的地址,如果设置了<code>AT+ROUTEIP=192.168.3.1</code>,最终获得的IP为192.168.3.100,修改完后需断电重启系统。
Note: only addresses in the format of 192.168.x.1 are supported. If you set <code>AT+ROUTEIP=192.168.3.1</code>, the final IP address obtained will be 192.168.3.100. After making the changes, you need to power off and restart the OS.


查询当前IP:<code>AT+ROUTEIP?</code>,返回两个值,前一个为旧IP,后一个为新IP。
Query current IP: <code>AT+ROUTEIP?</code>, it returns two values, the first one is the old IP, and the second one is the new IP.


测试命令:<code>AT+ROUTEIP=?</code>
Test command: <code>AT+ROUTEIP=?</code>


'''高通 4G模块、ZTE CAT4模块:'''
'''2. Qualcomm 4G, ZTE CAT4 4G:'''


将4G模块的IP改为直接获取公网IP即可,请执行AT命令:
Set the 4G module's IP to directly obtain a public IP. Please execute the AT command:


设置IP为公网:<code>AT+GTIPPASS=1</code>
Set the IP to public: <code>AT+GTIPPASS=1</code>


设置IP为内网:<code>AT+GTIPPASS=0</code>
Set the IP to private: <code>AT+GTIPPASS=0</code>


查询当前IP为公网还是内网:<code>AT+GTIPPASS?</code>
Check whether the current IP is a public or private IP: <code>AT+GTIPPASS?</code>


修改IP完毕后需要断电重启才能生效。
After modifying the IP, a power cycle reboot is required for the changes to take effect.


'''EC20的IP地址不清楚如何修改,如有需要,需要用户自行研究。'''
'''3. We are not know''' '''how to modify the IP address of EC20, If needed, users are required to research it themselves.'''


=== 5.4 GPS的使用 ===
=== 5.4 GPS test ===


==== 5.4.1 高通4G-GPS ====
==== 5.4.1 Qualcomm 4G-GPS ====
若要使用高通4G的GPS功能,需要接GPS无源天线,且确保GPS天线甩出户外。GPS是通过AT命令操作。
To use the GPS function of Qualcomm 4G, you need to connect a GPS passive antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands.


按照章节5.1步骤,开启ttyUSB串口。
Follow the steps in section 5.1 to enable the ttyUSB serial port.


运行minicom,打开ttyUSB0串口:
Run minicom and open the ttyUSB0 serial port.


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


并运行:
And execute:


<code>at+gtgpsepo=1</code> //开启AGPS
<code>at+gtgpsepo=1</code> //Enable AGPS


<code>at+gtgpspower=1</code> //打开GPS
<code>at+gtgpspower=1</code> //Enable GPS


稍等片刻待定位成功,运行:
Please wait a moment for the positioning to succeed, then execute:


<code>at+gtgps?</code> //查看NMEA信息
<code>at+gtgps?</code> //View NMEA messages


就可以看到GPS信息输出:
Then you can see the GPS information output:


http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_70.jpg
http://www.mcuzone.com/wiki/0012_MPUUART_MP4232/0012_MPUUART_MP4232_70.jpg


==== 5.4.2 EC20-GPS语音简版 ====
==== 5.4.2 Quectel EC20-GPS voice lite version ====


===== 5.4.2.1 GPS的操作 =====
===== 5.4.2.1 Operation of GPS =====
使用EC20的GPS,需要接GPS有源天线,且确保GPS天线甩出户外,GPS是通过AT命令操作。
To use the GPS function of EC20, you need to connect a GPS active antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands.


开启ttyUSB串口。然后运行minicom,打开'''ttyUSB3'''串口:
Open '''ttyUSB3''' serial port by minicom:


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


并运行:
and execute:


<code>AT+QGPS=1</code>
<code>AT+QGPS=1</code>
第404行: 第402行:
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_63.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_63.jpg


运行minicom,打开'''ttyUSB1'''串口,即可获取GPS信息:
Open '''ttyUSB1''' serial port by minicom, and you can obtain GPS information:


<code>sudo minicom -D /dev/ttyUSB1</code>
<code>sudo minicom -D /dev/ttyUSB1</code>
第410行: 第408行:
http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_64.jpg
http://www.mcuzone.com/wiki/5002_CM5_Basic/5002_CM5_Basic_64.jpg


如果觉得minicom下看原始的GPS信息不太直观,那么我们可以安装gpsd来提取GPS信息:
If you find the raw GPS data in minicom not very intuitive, we can install gpsd to extract the GPS information:


<code>sudo apt-get install gpsd gpsd-clients</code>
<code>sudo apt-get install gpsd gpsd-clients</code>
第416行: 第414行:
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_65.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_65.jpg


然后配置gpsd软件:
Then configure the gpsd software:


<code>sudo gpsd /dev/ttyUSB1 -N -D 9 -F /var/run/gpsd.sock -S 3333</code>
<code>sudo gpsd /dev/ttyUSB1 -N -D 9 -F /var/run/gpsd.sock -S 3333</code>
第422行: 第420行:
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_66.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_66.jpg


'''''注:3333为监听端口,可自行定义。'''''
'''''Note: 3333 is the listening port, which can be customized as needed.'''''


不要关掉配置终端窗口,另外开一个终端窗口,运行:
Do not close the configuration terminal window, instead, open a new terminal window and execute:


<code>cgps -s localhost:3333</code>
<code>cgps -s localhost:3333</code>
第430行: 第428行:
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_67.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_67.jpg


从输出的界面可以看到时间、经纬度、速度、高度等信息:
From the output interface, information such as time, latitude and longitude, speed, and altitude can be seen.


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_68.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_68.jpg


===== 5.4.2.2 发短信操作 =====
===== 5.4.2.2 Send SMS =====
发短信是使用AT命令操作,这里介绍使用英文字符发送短信的流程。
Sending text messages involves using AT commands. Here, we will introduce the process of sending SMS using English characters.


按照章节5.1步骤,开启ttyUSB串口,然后运行<code>sudo minicom -s</code>,选择“Serial port setup”:
Follow the steps in section 5.1 to enable the ttyUSB serial port. Then execute <code>sudo minicom -s</code>, select "Serial port setup":


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_100.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_100.jpg


按A和F ,修改串口号和流控如下图所示:
Press A and F to modify the serial port number and flow control as shown in the figure below:


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_101.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_101.jpg


修改完毕后按回车返回上一层菜单,选择“Exit”退出:
After making the modifications, press Enter to return to the previous menu, and select "Exit" to quit:


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_102.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_102.jpg


依次执行下列AT命令:
Execute the following AT commands in sequence:


<code>AT+CMGF=1</code> //将短信字符设置为英文
<code>AT+CMGF=1</code> //Set the SMS characters to English


<code>AT+CMGS="13xxxxxxxxx"</code> //设置接收短信的号码
<code>AT+CMGS="13xxxxxxxxx"</code> //Set the number to receive SMS messages


回车后在>后面输入短信内容,然后按Ctrl+Z发送,发送成功会显示“+CMGS 14”:
After pressing Enter, input the SMS content after the ">", then press Ctrl+Z to send. A successful send will display "+CMGS 14":


http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_103.jpg
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_103.jpg
第488行: 第486行:
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_106.jpg-->
http://www.mcuzone.com/wiki/0024_MP4GUSB/0024_MP4GUSB_106.jpg-->


=== 5.5 关于网络策略的一些知识 ===
=== 5.5 Some knowledge about network policies ===
若您需要了解一些网络策略知识,可以参考如下链接:
If you need to learn about some network strategy knowledge, you can refer to the following link:


[[1001 RPi0 4G Cat1-ETH/RS485#3.2.2 网卡优先级的设置|如何设置网卡优先级]]
[[1001 RPi0 4G CAT1-ETH(RS485 OPT#3.2.2 Set network adapter priority|How to set network adapter priority]]


[[1001 RPi0 4G Cat1-ETH/RS485#3.2.3 利用udhcpc指定DNS服务器|利用udhcpc指定DNS服务器]]
[[1001 RPi0 4G CAT1-ETH(RS485 OPT#3.2.3 Using udhcpc to specify DNS servers|Using udhcpc to specify DNS servers]]


== '''六、OpenWrt的操作''' ==
== '''VI. Work with OpenWrt''' ==
我们测试用的OpenWrt系统版本为:openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz
The version of the OpenWrt we use for testing is: openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz


以高通4G模组为例,OpenWrt系统下可配置为一进一出的交换机模式,即4G可作为WAN口,树莓派5自身的网口配置为LAN口,用于连接PC。
Taking the Qualcomm 4G module as an example, in the OpenWrt, it can be configured in a one-in-one-out switch mode. This means the 4G can serve as the WAN port, while the Raspberry Pi 5's own Ethernet port can be configured as the LAN port for connecting to a PC.


=== 6.1 登录操作界面 ===
=== 6.1 Login operation interface ===
将树莓派5连接至PC网口,启动系统,在Windows设置中找到网络和Internet,在以太网中打开连接的网络查看默认网关的IP地址,这个地址就是OpenWrt系统的后台配置页面地址,如图所示,本文测试的地址为192.168.198.1:
Connect the Raspberry Pi 5 to the PC's Ethernet port, start the system, go to Network and Internet settings in Windows, open the connected network in Ethernet, and view the default gateway's IP address. This address is the backend configuration page address for the OpenWrt. As shown in the figure, the address tested in this article is 192.168.198.1:


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


然后打开网页浏览器输入192.168.198.1进入OpenWrt系统。默认用户名为<code>root</code>,默认密码为<code>password</code>
Then open your web browser, enter 192.168.198.1 to access the OpenWrt. 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_19.jpg


登录后进入“系统 - TTYD终端”,使用用户名为<code>root</code>、密码为<code>password</code>进行登录:
After logging in, navigate to "System - TTYD Terminal", and log in using the username <code>root</code> and the password <code>password</code>.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_48.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_48.jpg


输入<code>ifconfig -a</code>,可以看到有标识为usb0的网卡,即为高通4G模组:
By entering <code>ifconfig -a</code>, you can see a network card labeled as usb0, which is the Qualcomm 4G module.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_49.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_49.jpg


若是国产CAT4或ZTE CAT4,系统识别成eth1,若是EC20也是识别成USB0,到时设置接口时,把usb0改成eth1即可。
If it is a CAT4 4G or ZTE CAT4, the system recognizes it as eth1. If it is an EC20, it is also recognized as usb0. When setting up the interface later, simply change usb0 to eth1.


=== 6.2 设置4G为WAN口 ===
=== 6.2 Set the 4G module as the WAN port ===
进入OpenWrt系统后,然后进入“网络 - 接口”,点击“添加新接口”:
After entering the OpenWrt, navigate to "Network - Interfaces" and click "Add new interface".


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_12.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_12.jpg


新接口的设置如下图,其中”usb0“即为4G模块:
The setup of the new interface is as shown in the figure below, where "usb0" represents the 4G module.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_50.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_50.jpg


然后点击”提交“。
Then click "Submit".


在”防火墙设置“中,区域选择”wan“,然后点击”保存&应用“:
In the "Firewall Settings", select the "WAN", then click "Save & Apply".


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_14.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_14.jpg


稍等片刻,我们在”网络 - 接口“中就能看到WAN口已经通过4G模块获得了IP:
Wait a moment, and we will see in the "Network - Interfaces" that the WAN port has already obtained an IP through the 4G module.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_15.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_15.jpg


此时我们在“系统 - TTYD终端”中,执行<code>ifconfig -a</code>,就能看到usb0已成功获取IP地址,ping公网地址也能成功,说明此时可以通过4G模块上网:
Now we click the "System - TTYD Terminal", by executing <code>ifconfig -a</code>, we can see that usb0 has successfully obtained an IP address, and pinging a public address is also successful. This indicates that we can now access the internet via the 4G module.


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_16.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_16.jpg


同时我们可以在与树莓派相连的PC的网卡连接中,看到以太网的连接状态是Internet,表示此时PC也可以通过这个4G模组上网:
Meanwhile, we can observe in the network connection settings of the PC connected to the Raspberry Pi that the Ethernet connection status is labeled as "Internet", indicating that the PC can also access the internet through this 4G module at this time.


http://www.mcuzone.com/wiki/2003_CM4_Tiny_HDMIx2/2003_CM4_Tiny_HDMIx2_21.jpg
http://www.mcuzone.com/wiki/2003_CM4_Tiny_HDMIx2/2003_CM4_Tiny_HDMIx2_21.jpg


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


http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_22.jpg
http://www.mcuzone.com/wiki/0020_MP4GM/0020_MP4GM_22.jpg


'''''注意:4G网络测速受网络信号和测试方法影响,速度请以实际为准。'''''
'''''Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.'''''


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

2025年3月3日 (一) 17:22的最新版本

切换语言为中文

Keywords

Raspberry Pi 5, Raspberry Pi, 4G LTE, PCIe, mini PCIe, AT Commands

I. Introduction

The MPU4G is a 4G expansion board specifically designed for the Raspberry Pi 5. First, expand four USB 2.0 interfaces through the PCIe interface, then connect one of the USB 2.0 signals to the 4G module on the miniPCIe interface. The remaining three USB 2.0 interfaces are brought out in the form of a 1.25mm 4Pin connector. These three interfaces can be used to further expand 1-3 CM4-sized 4G modules. When expanding more than two 4G modules, please pay attention to the power supply. They can also be used to expand our temperature and humidity modules or GPS modules. The 4G modules included with the expansion board are driver-free and do not require dial-up. They are automatically recognized and plug-and-play under the Raspberry Pi official OS/Ubuntu, eliminating the need for additional driver installation. Their target applications include 4G access, multi-4G carrier aggregation, and remote unattended operation.

The MiniPCIe 4G models are as follows: Domestic solution CAT4 4G and ZTE CAT4 4G, Quectel EC20-GPS Voice Lite version (with call and SMS functions), Qualcomm 4G, and Qualcomm 4G-GPS version. There are also international versions, such as the Qualcomm 4G European version (NL668-EU), Australian version (NL668-EAU), and North American version (NL668-AM), among others.

0024_MP4GUSB_108.jpg

II. Hardware Spec

1. One PCIe interface, 0.5mm 16P, used to connect to the Raspberry Pi 5's own PCIe interface, and PCIe expands to 4 USB ports.

2. One Mini PCIe 4G LTE interface.

3. One Nano SIM card slot, single SIM single standby.

4. Triple-channel USB 2.0 interface, 1.25mm-4P, can be used to expand 1-3 channels of 4G.

5. Two LED lights, one serving as the power indicator and the other as the 4G status light.

6. Reserve two 4G SMA antenna interfaces.

7. Reserve two 4G SMA antenna interfaces.

8. Size: 85*56mm. Fully compatible with the Raspberry Pi 5 in terms of size and mounting holes. The board features a grooved design that does not interfere with the GPIO of the Raspberry Pi 5.

9. Aluminum alloy casing(OPT.)

0020_MP4GM_51.jpg

0020_MP4GM_52.jpg

0020_MP4GM_53.jpg

0020_MP4GM_54.jpg

0020_MP4GM_55.jpg

0020_MP4GM_56.jpg

0020_MP4GM_57.jpg

0020_MP4GM_58.jpg

CAT4 Qualcomm 4G/GPS ZTE CAT4 EC20-GPS Voice lite version
BAND LTE FDD:B1/3/5/8

LTE TDD:B34/38/39/40/41

LTE FDD:B1/3/5/8

LTE TDD:B34/38/39/40/41

WCDMA:B1/8

TDSCDMA:B34/39

EVDO/CDMA1X:BC0

GSM/GPRS/EDGE:900/1800MHz(OPT)

LTE FDD:B1/3/5/8

LTE TDD:B34/38/39/40/41

LTE FDD:B1/3/5/8

LTE TDD:B34/38/39/40/41

WCDMA:B1/8

TDSCDMA:B34/39

CDMA:BC0

GSM:900/1800MHz

III. Work with Raspberry Pi OS

Raspberry Pi OS: 2024-07-04-raspios-bookworm-arm64.img.xz

You can download it in:

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

Different 4G models recognize different device models, usually as eth1 or usb0 devices.

3.1 Qualcomm 4G module

By executing ifconfig -a in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address.

0020_MP4GM_24.jpg

Under normal conditions, the "4G" LED indicator on the expansion board will blink slowly, with occasional brief fast flashes in between.

3.2 CAT4 4G module

By executing ifconfig -a in the Raspberry Pi terminal, we can see that the 4G module (eth1) has successfully obtained an IP address.

0020_MP4GM_26.jpg

Under normal conditions, the "4G" LED indicator on the expansion board will blink slowly (the duration of the light being on is longer than the duration of it being off).

3.3 ZTE CAT4 4G module

By executing ifconfig -a in the Raspberry Pi terminal, we can see that the 4G module (eth1) has successfully obtained an IP address.

0020_MP4GM_28.jpg

Under normal conditions, the "4G" LED indicator on the expansion board flashes rapidly.

3.4 Quectel EC20-GPS voice lite version

By executing ifconfig -a in the Raspberry Pi terminal, we can see that the 4G module (usb0) has successfully obtained an IP address.

0020_MP4GM_30.jpg

Under normal conditions, the "4G" LED indicator on the expansion board will blink slowly.

3.5 Internet test

After the 4G module successfully obtains an IP address, we can ping external network addresses, such as:

ping www.mcuzone.com

0020_MP4GM_18.jpg

It is also possible to connect to the external network via a 4G module and access a speed test website to measure the speed, with the results as follows:

0020_MP4GM_20.jpg

Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.

3.6 Remote Connection to Raspberry Pi(4G application)

If you want to use 4G for remote access to a Raspberry Pi 5, the official Raspberry Pi OS (Bookworm version) comes with an example application called Raspberry Pi Connect that you can refer to and use. With the Raspberry Pi paired with 4G, and through the official remote control software Raspberry Pi Connect, you can securely access your Raspberry Pi from anywhere in the world. Here, we will demonstrate how to configure the remote connection service.

The configuration and usage instructions are as follows:

1. Apply for a Raspberry Pi ID at https://id.raspberrypi.com/.

2. Install the Raspberry Pi Connect software in the Raspberry Pi OS (no need to install if it is already installed):

sudo apt install rpi-connect

3. Restart the system, and in the GUI, sequentially select the items as shown in the following image to ensure that Raspberry Pi Connect is turned on:

MPS2280iPoE_08.png

1002_Zero_4G_Cat1_13.jpg

4. In the upper right corner, there will be a Raspberry Pi Connect icon.

0024_MP4GUSB_38.jpg

5. Click on this icon, select "Sign in" and use your previously registered Raspberry Pi ID to log in on the pop-up webpage. Then set the device name.

0024_MP4GUSB_39.jpg

6. After successfully logging in, access https://connect.raspberrypi.com/ in a browser on Windows and log in.

0024_MP4GUSB_40.jpg

7. Click "Connect via" to choose between using Screen sharing or the Remote shell Interface.

0024_MP4GUSB_41.jpg

8. Screen sharing is as follows:

0024_MP4GUSB_73.jpg

The remote command line interface is as follows:

0024_MP4GUSB_43.jpg

9. Measured data usage: Under remote desktop, the Raspberry Pi consumes about 2MB of data per minute; under The remote shell is as follows: line interface, the Raspberry Pi consumes about 100KB of data per minute.

IV. Work with Ubuntu OS

Ubuntu OS:

ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz(Desktop, GUI version)

ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz(Server, command line version)

You can download it in:

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

4.1 Ubuntu Desktop OS

Ubuntu Desktop OS(GUI version). When executing ifconfig -a in the terminal, all 4G modules are recognized as network interfaces starting with enx, and they can be used directly without the need for drivers or additional configuration.

0020_MP4GM_44.jpg

4.2 Ubuntu Server OS

When the Ubuntu Server OS (command line version) is used on a Raspberry Pi 5, only one network interface is enabled by default, and the Wi-Fi functionality is disabled. So if you want to use 4G or WiFi, you need to enable the second and third network interfaces, and manually add a network card to use them. We will demonstrate the steps to enable Wi-Fi and use 4G on Ubuntu Server.

4.2.1 System flashing and setting up SSH

When flashing the system, it is recommended to pre-configure the WiFi and SSH settings in the Raspberry Pi imager.

0020_MP4GM_61.jpg

0020_MP4GM_62.jpg

Insert the TF card into the Raspberry Pi and boot up the system. The login username and password are the ones pre-configure; if not pre-configure, both are ubuntu, and you will be prompted to change the password after successful login.

0007_Zero_4G_Cat1_31.jpg

After the modifications are completed, it will automatically enter the system.

4.2.2 Configure system network

The operation here is demonstrated using CAT 4G as an example.

Note: The system does not come with the ifconfig tool by default, only the ip command is available.

Execute ip addr to view and record the network interface name.

0020_MP4GM_37.jpg

Among them, eth0 is the built-in Gigabit Ethernet port of the Raspberry Pi 5, enx000c29a39b6d is the 4G module, and wlan0 is the Raspberry Pi's own wireless network card (the system has been pre-configured with wireless hotspot information during the initial setup, so the wireless network card can be used immediately after booting).

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

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

Please edit the network card configuration file according to the image below:

0020_MP4GM_59.jpg

Save and exit, then reboot.

After rebooting, you can connect to the internet. Install the net-tools package for ease of use:

sudo apt install net-tools

Once the net-tools package is installed, you can use the command ifconfig -a to check the network status.

0020_MP4GM_60.jpg

It is evident that both the wired network card and the 4G module have obtained IP addresses at this point.

By ping an external server through a specific network card, we can verify whether the network card is functioning properly. For example, if we ping an external IP address and website using a 4G module, the results are as follows:"

ping 220.189.255.38 -I enx000c29a39b6d

ping www.mcuzone.com -I enx000c29a39b6d

0020_MP4GM_46.jpg

V. AT command operation

5.1 AT command operation

Taking Qualcomm 4G as an example, execute lsusb in terminal:

0020_MP4GM_23.jpg

Record the ID value of the 4G module: 05c6 90b6 (The ID number for each type of module varies; please refer to the actual details for accurate information.)

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'

0020_MP4GM_02.jpg

After executing the above two commands, proceed with:

ls /dev

At this point, you should be able to see three devices under the dev directory: ttyUSB0, ttyUSB1, and ttyUSB2:

0020_MP4GM_03.jpg

Install the serial port software minicom:

sudo apt install minicom

Then open the AT command serial port using minicom:

sudo minicom -D /dev/ttyUSB0

0020_MP4GM_04.jpg

(Note: The choice of which serial port to use should be based on the ability to input and run AT commands after entering this port, ensuring that the display is not garbled and the results do not jump erratically.)

The first time you enter an AT command, there may be no echo. If you then input the command at and press Enter, and it returns "OK," it indicates that everything is working properly. If you need to check the echo, please type the command: ate1, then press Enter. After that, you can continue to type other commands and press Enter to see the results.

0020_MP4GM_05.jpg

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

7. APN settings:

The SIM card of a regular mobile phone can be used directly without any configuration. However, some IoT cards require APN settings to function properly, and the APN parameters are usually provided by the carrier.

0007_Zero_4G_Cat1_15.jpg

If you need the operation methods for other AT commands, please refer to the AT command manual provided with the 4G module (the operation commands may vary depending on the manufacturer).

5.3 Modify the IP address of the 4G module

If the default 4G IP address assigned at the factory conflicts with the IP address being used by the user, or if there is a need to modify the IP address, you can change the 4G module's IP.

1. CAT4 4G:

Execute the AT command:

AT+ROUTEIP=<newip>

Note: only addresses in the format of 192.168.x.1 are supported. If you set AT+ROUTEIP=192.168.3.1, the final IP address obtained will be 192.168.3.100. After making the changes, you need to power off and restart the OS.

Query current IP: AT+ROUTEIP?, it returns two values, the first one is the old IP, and the second one is the new IP.

Test command: AT+ROUTEIP=?

2. Qualcomm 4G, ZTE CAT4 4G:

Set the 4G module's IP to directly obtain a public IP. Please execute the AT command:

Set the IP to public: AT+GTIPPASS=1

Set the IP to private: AT+GTIPPASS=0

Check whether the current IP is a public or private IP: AT+GTIPPASS?

After modifying the IP, a power cycle reboot is required for the changes to take effect.

3. We are not know how to modify the IP address of EC20, If needed, users are required to research it themselves.

5.4 GPS test

5.4.1 Qualcomm 4G-GPS

To use the GPS function of Qualcomm 4G, you need to connect a GPS passive antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands.

Follow the steps in section 5.1 to enable the ttyUSB serial port.

Run minicom and open the ttyUSB0 serial port.

sudo minicom -D /dev/ttyUSB0

And execute:

at+gtgpsepo=1 //Enable AGPS

at+gtgpspower=1 //Enable GPS

Please wait a moment for the positioning to succeed, then execute:

at+gtgps? //View NMEA messages

Then you can see the GPS information output:

0012_MPUUART_MP4232_70.jpg

5.4.2 Quectel EC20-GPS voice lite version

5.4.2.1 Operation of GPS

To use the GPS function of EC20, you need to connect a GPS active antenna and ensure that the GPS antenna is extended outdoors. GPS is operated via AT commands.

Open ttyUSB3 serial port by minicom:

sudo minicom -D /dev/ttyUSB3

and execute:

AT+QGPS=1

0024_MP4GUSB_63.jpg

Open ttyUSB1 serial port by minicom, and you can obtain GPS information:

sudo minicom -D /dev/ttyUSB1

5002_CM5_Basic_64.jpg

If you find the raw GPS data in minicom not very intuitive, we can install gpsd to extract the GPS information:

sudo apt-get install gpsd gpsd-clients

0024_MP4GUSB_65.jpg

Then configure the gpsd software:

sudo gpsd /dev/ttyUSB1 -N -D 9 -F /var/run/gpsd.sock -S 3333

0024_MP4GUSB_66.jpg

Note: 3333 is the listening port, which can be customized as needed.

Do not close the configuration terminal window, instead, open a new terminal window and execute:

cgps -s localhost:3333

0024_MP4GUSB_67.jpg

From the output interface, information such as time, latitude and longitude, speed, and altitude can be seen.

0024_MP4GUSB_68.jpg

5.4.2.2 Send SMS

Sending text messages involves using AT commands. Here, we will introduce the process of sending SMS using English characters.

Follow the steps in section 5.1 to enable the ttyUSB serial port. Then execute sudo minicom -s, select "Serial port setup":

0024_MP4GUSB_100.jpg

Press A and F to modify the serial port number and flow control as shown in the figure below:

0024_MP4GUSB_101.jpg

After making the modifications, press Enter to return to the previous menu, and select "Exit" to quit:

0024_MP4GUSB_102.jpg

Execute the following AT commands in sequence:

AT+CMGF=1 //Set the SMS characters to English

AT+CMGS="13xxxxxxxxx" //Set the number to receive SMS messages

After pressing Enter, input the SMS content after the ">", then press Ctrl+Z to send. A successful send will display "+CMGS 14":

0024_MP4GUSB_103.jpg

0024_MP4GUSB_104.jpg

5.5 Some knowledge about network policies

If you need to learn about some network strategy knowledge, you can refer to the following link:

How to set network adapter priority

Using udhcpc to specify DNS servers

VI. Work with OpenWrt

The version of the OpenWrt we use for testing is: openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz

Taking the Qualcomm 4G module as an example, in the OpenWrt, it can be configured in a one-in-one-out switch mode. This means the 4G can serve as the WAN port, while the Raspberry Pi 5's own Ethernet port can be configured as the LAN port for connecting to a PC.

6.1 Login operation interface

Connect the Raspberry Pi 5 to the PC's Ethernet port, start the system, go to Network and Internet settings in Windows, open the connected network in Ethernet, and view the default gateway's IP address. This address is the backend configuration page address for the OpenWrt. As shown in the figure, the address tested in this article is 192.168.198.1:

0007_Zero_4G_Cat1_18.jpg

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

0007_Zero_4G_Cat1_19.jpg

After logging in, navigate to "System - TTYD Terminal", and log in using the username root and the password password.

0020_MP4GM_48.jpg

By entering ifconfig -a, you can see a network card labeled as usb0, which is the Qualcomm 4G module.

0020_MP4GM_49.jpg

If it is a CAT4 4G or ZTE CAT4, the system recognizes it as eth1. If it is an EC20, it is also recognized as usb0. When setting up the interface later, simply change usb0 to eth1.

6.2 Set the 4G module as the WAN port

After entering the OpenWrt, navigate to "Network - Interfaces" and click "Add new interface".

0020_MP4GM_12.jpg

The setup of the new interface is as shown in the figure below, where "usb0" represents the 4G module.

0020_MP4GM_50.jpg

Then click "Submit".

In the "Firewall Settings", select the "WAN", then click "Save & Apply".

0020_MP4GM_14.jpg

Wait a moment, and we will see in the "Network - Interfaces" that the WAN port has already obtained an IP through the 4G module.

0020_MP4GM_15.jpg

Now we click the "System - TTYD Terminal", by executing ifconfig -a, we can see that usb0 has successfully obtained an IP address, and pinging a public address is also successful. This indicates that we can now access the internet via the 4G module.

0020_MP4GM_16.jpg

Meanwhile, we can observe in the network connection settings of the PC connected to the Raspberry Pi that the Ethernet connection status is labeled as "Internet", indicating that the PC can also access the internet through this 4G module at this time.

2003_CM4_Tiny_HDMIx2_21.jpg

Open https://www.speedtest.cn/ on your PC to conduct a speed test. At this point, the traffic is routed through the 4G module, and the test results are as follows:

0020_MP4GM_22.jpg

Note: Network speed tests are affected by the network environment and testing methods. Please refer to the actual speed, as this test is for reference only.

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