1003 RPi0 4G Cat1-Hub EN

来自Mcuzone Wiki

切换语言为中文

Keywords

Raspberry Pi Zero, Zero 2W, Cat1 4G LTE, USB2.0, USB Type-C, USB HUB, Nano SIM, RPi-Connect, Remote connection

I. Introduction

The Raspberry Pi Zero series (including the Zero, Zero W/H, and Zero 2W) is a highly cost-effective embedded system platform, known for its small size, low power consumption, and acceptable performance, making it suitable for many lightweight application scenarios. Although the Zero series is compact, it reserves a large number of expansion interfaces. Especially on the backside of the board, gold-plated test points for USB and power are brought out. We can use these sets of USB and power test points to expand various types of peripherals.

This expansion board is essentially a USB hub that connects to the Zero's USB port via pogo pins. It expands four USB ports via USB, with one USB port converted to a 4G Cat1 module, and three USB 2.0-A host ports.

4G Cat1 is a high-cost-performance module aimed at medium-speed IoT applications around 10 Mbps. The 10 Mbps downlink and 5 Mbps uplink speeds can satisfy the majority of connectivity and transmission requirements. The CAT1 module is driver-free and automatically recognized in the Raspberry Pi OS, Ubuntu system, and OpenWrt system, making it easy to use.

II. Hardware Spec

1. This expansion board connects to the Raspberry Pi Zero's USB port and power contacts via four pogo pins for both power supply and communication.

2. A USB-C power port is provided, which functions are the same as the power port on the Raspberry Pi Zero itself. You can choose to use either one, but not both simultaneously.

3. The board includes a 4G CAT1 module, with an option for a 4G module that includes GPS functionality. Users in other countries can also select other CAT1 modules that match their frequency bands.

4. Uses a Nano SIM card slot (located on the reverse side). Please refer to the silkscreen on the board for the direction in which the SIM card should be inserted.

5. It uses a first-generation IPEX connector, which can be used with external 4G FPC or rod antennas. If the GPS version is selected, a passive GPS antenna is required, and the antenna must be placed outside the window to achieve positioning.

6. The board features three USB 2.0 Type-C host interfaces, with each USB port capable of supplying 1A of power (Note: the Raspberry Pi Zero's own OTG functionality will no longer be usable, and the Zero's own micro USB port cannot be used to connect any USB devices, otherwise, this expansion board will not function properly).

7. Reserve the debugging serial port and the AT main serial port, both with 3.3V voltage levels.

8. There are three LED indicator lights; one is the power indicator for the expansion board, and another is the power indicator for the 4G module. The NET LED indicates the network status: a 1.8-second on and 0.2-second off cycle indicates successful network registration, while a 1.8-second off and 0.2-second on cycle indicates that the device has not registered with the network, and you should check the SIM card and antenna.

9. The board features positions for the BOOT and reset buttons.

10. Sizes: 66*30mm, with four M2.5 mounting holes, each with a height of 5mm. The board size is fully compatible with the Raspberry Pi Zero series boards.

11. An optional 3D printed base is available to protect the circuit board.

12. The circuit board uses an ENIG (Electroless Nickel Immersion Gold) process, is produced without lead, and the PCB has received UL and RoHS certifications, with a fire protection rating of 94V-0.

1003_Zero_4G_Cat1-Hub_24.jpg

1003_Zero_4G_Cat1-Hub_25.jpg

1003_Zero_4G_Cat1-Hub_26.jpg

III. System flashing

3.1 Overview

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

1. The Raspberry Pi OS used in this document is: 2024-07-04-raspios-bookworm-arm64.img.xz(Raspberry Pi OS with desktop).

(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.)

You can download the Raspberry Pi OS in:

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

2)Ubuntu系统,Ubuntu Server 24.04 LTS,服务器版(树莓派Zero 2W因为性能关系不能用Desktop版),镜像为ubuntu-24.04-preinstalled-server-arm64+raspi.img.xz

Ubuntu系统下载地址:

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

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

(If using the first-generation Raspberry Pi Zero board, which only supports 32-bit systems, there may not be a suitable Ubuntu Server system available.)

3.2 Flash the OS image in TF card

Click here to read the instructions for System flashing

IV. Work with Raspberry Pi OS

☆ 4.1 View hardware devices

4.1.1 Hardware connection

This expansion board features four USB Type-C ports. One of these USB Type-C ports is labeled as PWR on the silkscreen on the back, indicating it is the power input USB Type-C port. The remaining three USB Type-C ports are HOST ports, which can be used to connect USB devices such as keyboards, mice, and USB drives, among other peripherals. Above the 4G module, there are two antenna connectors; one is for the 4G signal antenna, and the other is for the GPS signal antenna. All peripherals are driver-free, meaning they are plug-and-play.

The Raspberry Pi Zero board is fixed above the expansion board using four screws. Please pay attention to the installation direction and ensure that the pogo pins on the expansion board align with the corresponding contacts on the Zero board. Connect the HDMI cable and power supply, and note that the Zero's micro USB port should not be connected to any devices.

4.1.2 View USB devices

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

1003_Zero_4G_Cat1-Hub_01.jpg

The system has detected the USB hub and the 4G module:

Device 002: External USB Hub;

Device 003: 4G module;

Device 004: USB2.0 Type-C 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

4.1.3 View 4G module

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

1003_Zero_4G_Cat1-Hub_02.jpg

You can see that eth0 as the 4G Cat1 (which has automatically connected, with the default IP address in the above example being 192.168.10.2), and wlan0 as the wireless network card that comes with the Zero 2W.

☆ 4.2 Test 4G module

4.2.1 Operations on 4G when the system has not set up WiFi

When the Raspberry Pi OS boots, WiFi is enabled by default, but it is not connected to any access point (meaning no WiFi account and password are set in the system). So when connecting to the internet via the 4G module, we can perform a ping operation:

Ping the IP should correctly display as follows:

1003_Zero_4G_Cat1-Hub_03.jpg

Ping the domain name should correctly display as follows:

3101_Domestic_4G_16.jpg

This indicates that the 4G connection is normal.

Solution for ping domain error:

If you encounter a ping domain error, as shown in the image:

0007_Zero_4G_Cat1_52.jpg

This indicates that the DNS server settings for the 4G module are incorrect. Let's modify the DNS server settings:

First, we need to connect to WiFi:

Click on the network icon in the upper right corner and select the AP you want to connect to:

1003_Zero_4G_Cat1-Hub_28.jpg

Enter the password (if there is one), and then click "Connect":

1003_Zero_4G_Cat1-Hub_29.jpg

After a successful connection, you can obtain the IP address of the router and access the internet normally:

1003_Zero_4G_Cat1-Hub_30.jpg

Install the DNS server switching software udhcpc:

sudo apt install udhcpc

0007_Zero_4G_Cat1_48.jpg

After installation, use the following command to switch the DNS server to the 4G module (in this case, eth0 represents the 4G module; the name may differ depending on the software and hardware platform):

sudo udhcpc -i eth0

1003_Zero_4G_Cat1-Hub_04.jpg

This way, you achieve normal internet browsing via 4G.

The method of switching DNS servers for 4G internet access will stop working after the system is restarted. If you want the DNS server to automatically switch to the 4G module each time the system starts, you can follow these steps:

Open rc-local service:

sudo systemctl enable --now rc-local

Use the following command to open rc.local:

sudo nano /etc/rc.local

Add the command you want to execute at startup above the line exit 0, and then save the file (in this example, eth0 represents the 4G module, but the name should match the actual interface identified on your system):

sleep 5 && sudo udhcpc -i eth0 && sleep 5 && sudo udhcpc -i eth0 && sleep 5 && sudo udhcpc -i eth0

1003_Zero_4G_Cat1-Hub_23.jpg

The sleep command is used to delay the execution of subsequent commands by a certain number of seconds. Since the 4G module needs some time to acquire an IP address, to prevent `udhcpc` from failing, it needs to be executed several times with a delay added between each execution. As a result, the 4G network becomes usable approximately 20 seconds after the system boots up.

4.2.2 The system has already been set up for WiFi connectivity, and the operations for the 4G connection

If your system was previously set up with WiFi, the Raspberry Pi Zero 2W will provide internet access via WiFi when used alone. When you install our expansion board, upon rebooting the system, it will prioritize using the 4G network for internet access. If you want to switch to WiFi, you can follow these steps:

Disable the 4G network connection:

sudo ifconfig eth0 down

1003_Zero_4G_Cat1-Hub_31.jpg

Use udhcpc to switch the DNS server to the WiFi's DNS server.

sudo udhcpc -i wlan0

1003_Zero_4G_Cat1-Hub_32.jpg

If you later want to switch back to browsing the internet using the 4G network, you can run:

sudo ifconfig eth0 up

sudo ifconfig wlan0 down

sudo udhcpc -i eth0

4.2.3 Access the 4G module via SSH over WiFi

If you want to enable SSH using the Raspberry Pi ZERO's WiFi to subsequently perform 4G operations on the Raspberry Pi, you need to set up the SSH service before flashing the system. For the steps, refer to this guide.

☆ 4.3 How to use AT commands and GPS

4.3.1 Open AT serial

Execute the command in the SSH terminal:

ls /dev

You should be able to see three devices named ttyACM0, ttyACM1, and ttyACM2 under the dev directory:

1003_Zero_4G_Cat1-Hub_08.jpg

Install minicom:

sudo apt-get install minicom

0007_Zero_4G_Cat1_13.jpg

Open AT Command serial port by minicom:

sudo minicom -D /dev/ttyACM0

Note: When using a serial port, ensure that after entering this port, you can input and run AT commands without any garbled output or unexpected jumps in the results.

4.3.2 Execute AT commands

The following uses minicom as an example:

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

Use AT+CPIN? to check if the SIM card is properly inserted and recognized;

Use AT+CSQ to check the signal strength; the first value ranges from 0-31, and a value of 25 or above is considered good signal quality;

Use AT+COPS? to check the network registration status; the quotation marks contain the operator code, and the last digit represents the network mode, with 7 indicating 4G.

1003_Zero_4G_Cat1-Hub_09.jpg

4.3.3 GPS Test (only for GPS version)

When using GPS, you need to connect a passive GPS antenna and ensure that the GPS antenna is extended outdoors.

Run minicom and open the ttyACM0 serial port:

sudo minicom -D /dev/ttyACM0

And execute:

AT+CGNSPWR=1 //Open GPS

AT+CGNSAID=31,1,1,1 //Enable location assistance positioning (the command will immediately return OK, and positioning will succeed in about 2-10 seconds based on signal strength).

AT+CGNSURC=1 //Setup automatic reporting of location information

After running successfully, you will be able to see GPS information output from the serial port:1003_Zero_4G_Cat1-Hub_10.jpg

Wait for a moment, and the device will then be able to acquire its location.

1003_Zero_4G_Cat1-Hub_27.jpg

V. Work with Ubuntu system

5.1 Edit the initialization script

After flashing Ubuntu Server to the TF card, please open the config.txt file in the root directory of the system partition on your PC to check the USB initialization script. Ubuntu Server initializes the USB twice, and the first initialization does not configure it into host mode. You need to verify if the position indicated by the red box in the following diagram is fully configured. 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

5.2 Configure the username and password

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

0007_Zero_4G_Cat1_31.jpg

After modifying the password, you will automatically enter the system.

5.3 Configure the network

After the system boots, there is no network available, and setup is required 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 network interface name:

1003_Zero_4G_Cat1-Hub_33.jpg

The second network interface (enx2089846a96ab) is the 4G module.

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

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

Edit the network interface configuration file according to the image below:

1003_Zero_4G_Cat1-Hub_34.jpg

Save and exit, then restart.

After restarting, you can connect to the network. Install the net-tools package for convenience:

sudo apt install net-tools

0007_Zero_4G_Cat1_35.jpg

Run ifconfig -a to see that the 4G module has correctly obtained an IP address:

1003_Zero_4G_Cat1-Hub_35.jpg

5.4 Test AT command

Execute command:

ls /dev

You should be able to see three devices named ttyACM0, ttyACM1, and ttyACM2 under the dev directory:

1003_Zero_4G_Cat1-Hub_36.jpg

Install minicom:

sudo apt-get install minicom

1005_Zero-DETH_DUSB_24.jpg

Open AT Command serial port by minicom:

sudo minicom -D /dev/ttyACM0

Note: When using a serial port, ensure that after entering this port, you can input and run AT commands without any garbled output or unexpected jumps in the results.

The following uses minicom as an example:

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

Use AT+CPIN? to check if the SIM card is properly inserted and recognized;

Use AT+CSQ to check the signal strength; the first value ranges from 0-31, and a value of 25 or above is considered good signal quality;

Use AT+COPS? to check the network registration status; the quotation marks contain the operator code, and the last digit represents the network mode, with 7 indicating 4G.

1005_Zero-DETH_DUSB_25.jpg

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.

六、(应用)Raspberry Pi Connect远程连接树莓派

RPi-Connect提供了从任何地方安全接入到树莓派的服务。基于此服务,搭配Zero_Cat1_4G Cat1-Hu版即可实现在户外没有无线网络的情况下,依旧可以远程访问树莓派操作。注意:要使用此服务必须运行Bookworm及以上系统。同时,只有树莓派5,4或400可以使用屏幕分享。Zero2W只能使用Remote shell。接下来演示如何配置远程连接服务。

6.1 申请Raspberry Pi ID

如果已有Raspberry Pi ID请直接登录,如果没有请按下列步骤申请。

打开在https://id.raspberrypi.com/,输入您要使用的邮箱以及密码:

1003_Zero_4G_Cat1-Hub_12.jpg

创建账号完成后需要进入邮箱验证:

1003_Zero_4G_Cat1-Hub_13.jpg

1003_Zero_4G_Cat1-Hub_14.jpg

验证完成后即可使用该id。

6.2 安装远程服务

打开树莓派终端,安装Raspberry Pi Connect软件,如果安装时显示已安装则不需另外安装:

sudo apt install rpi-connect

安装完成后,我们在终端输入loginctl enable-linger确保每次重启后系统自动打开远程服务。

1003_Zero_4G_Cat1-Hub_15.jpg

重启系统,在图形界面中,依次选择如下图项目后,确保Raspberry Pi Connect已打开:

MPS2280iPoE_08.png

1002_Zero_4G_Cat1_13.jpg

然后在树莓派终端输入:

rpi-connect signin

1003_Zero_4G_Cat1-Hub_16.jpg

此时显示一个网址,如上图所示,我们在浏览器(建议使用别的电脑,Zero系列因为硬件资源关系,打开浏览器时非常缓慢)中打开这个网址:

1003_Zero_4G_Cat1-Hub_17.jpg

点击Sign in,按照提示进行绑定即可,首先需要设置设备名称:

1003_Zero_4G_Cat1-Hub_18.jpg

点击Create device and sign in:

1003_Zero_4G_Cat1-Hub_19.jpg

这样就完成了绑定,终端中也会有成功的显示:

1003_Zero_4G_Cat1-Hub_20.jpg

6.3 使用远程控制

在PC上打开:https://connect.raspberrypi.com/devices

1003_Zero_4G_Cat1-Hub_21.jpg

刚才添加的Zero 2W设备下面只有”Remote shell“字样,表示此设备只能通过远程命令行界面控制。

点击Connect,弹出远程命令行界面,即可输入命令:

1003_Zero_4G_Cat1-Hub_22.jpg

联系我们

4f7e81daf8791971.jpg 79c020da7ad0af9b.jpg 2851e01a0549e6f7.gif 0003_bb.jpg 0005_qq.jpg QQ:8204136

邮件:mcuzone@vip.qq.com

电话:13957118045

如本页面有任何疏漏、错误或者侵权,请通过上述途径联系我们,谢谢!

Copyright 2004-2024 野芯科技