1002 RPi0 4G Cat1 (EN):修订间差异
无编辑摘要 |
|||
第144行: | 第144行: | ||
http://www.mcuzone.com/wiki/1002_Zero_4G_Cat1/1002_Zero_4G_Cat1_25.jpg | http://www.mcuzone.com/wiki/1002_Zero_4G_Cat1/1002_Zero_4G_Cat1_25.jpg | ||
==== 3.2.4 | ==== 3.2.4 How to use AT commands ==== | ||
Execute the command in the SSH terminal: | Execute the command in the SSH terminal: | ||
2024年10月21日 (一) 10:25的版本
Keywords
Raspberry Pi Zero, Zero 2W, Cat1 4G LTE, USB2.0, USB Type-C, Expansion board, Nano SIM, RPi-Connect, Remote connection, Driver-free, Plug and play
I. Introduction
The Raspberry Pi Zero CAT1 is a 4G LTE expansion board measuring only 65*30mm in size. It is designed based on the Raspberry Pi Zero series (including the Zero, Zero W(H), and Zero 2W). It utilizes the gold-plated test points on the backside of the Raspberry Pi Zero board for USB and power to enable peripheral expansion. The expansion board comes in two versions: the USB version and the Probe version. The Probe version connects the expansion board to the Zero's USB port via pogo pins. In this case, it is no longer possible to connect USB devices such as keyboard or mouse to the Raspberry Pi Zero's micro USB port. but we can control the device through a remote connection. The USB version (without pogo pins) can be used with the Raspberry Pi 3B, 4B, and 5. The expansion board uses a recessed design, which facilitates installation on top of boards like the Raspberry Pi 3B/4B/5, ensuring it does not affect or minimally affects the external connections of the 40-pin header.
4G Cat1 is a cost-effective module designed for medium-speed IoT applications around 10Mbps. The 10Mbps downlink and 5Mbps uplink speeds can meet the vast majority of networking and transmission needs. The CAT1 expansion board is driver-free and plug-and-play under the official Raspberry Pi operating system.
II. Hardware Spec
1. This expansion board Probe pin version connects to the Raspberry Pi Zero series' gold-plated contact points via four pogo pins. The expansion board is positioned below the Zero and is powered through the Zero's MicroUSB power port. At this point, the Raspberry Pi Zero's own micro USB port, the onboard USB-C port, and the 1.25mm 4-pin interface cannot be used to connect any external devices or power sources.
2. The USB version (without soldering pogo pins) communicates with and powers the development board via the USB port. The USB port is available in two forms: a Type-C port and a 1.25mm 4-pin connector, with either one being selectable for use.
3. Uses a Nano SIM card slot; please refer to the silkscreen on the board or the markings on the SIM card slot for the correct orientation of the SIM card insertion.
4. The 4G antenna uses a first-generation IPEX connector, which can be used with a 4G FPC antenna or a rod antenna.
5. Break out the debugging serial port and the AT main serial port, both at 3.3V voltage level.
6. Two LED indicator lights: The STAT light indicates normal operation of CAT1 when it is lit. The NET light indicates the network status, with 1.8 seconds on and 0.2 seconds off indicating successful network registration, and 1.8 seconds off and 0.2 seconds on indicating that the device has not registered onto the network, suggesting that the SIM card and antenna should be checked.
7. The reverse side reserves positions for the BOOT and reset buttons. If there is a need to upgrade firmware or perform a button reset, you can solder the buttons yourself.
8. Size: 65*30*5.5mm.
9. The M2.5mm mounting holes are perfectly aligned with those on the Raspberry Pi Zero development board. The PCB board has received UL and ROHS certification and has a fire protection rating of 94V-0.
III. Work with Raspberry Pi OS
3.1 USB version
For the USB version, if connecting to a Raspberry Pi Zero series development board, it generally requires the use of an expansion board with a USB interface. So you just need to enable USB Host mode in the config.txt file.
Here, we are assembling the Raspberry Pi Zero 2W using our company's Raspberry Pi Zero Dual 100M-Ethernet and Dual USB Expansion Board, and then connecting the CAT1-USB version.
The CAT1-USB version occupies the right-side Raspberry Pi Zero Dual 100M-Ethernet and Dual USB Expansion Board (as shown in the image below). This USB port cannot be used to connect any external devices; otherwise, the 4G functionality will not work.
After booting the system, execute ifconfig -a
, and you will see eth2, which corresponds to the 4G CAT1 interface; while eth0 and eth1 are the two 100Mbps Ethernet ports on the Raspberry Pi Zero Dual 100M-Ethernet and Dual USB Expansion Board.
3.2 Probe version
3.2.1 Preparation
The Raspberry Pi Zero 2W has only one USB port, which is now occupied by the 4G module, so there are no USB ports available for a keyboard or mouse. Subsequent operations can only be performed through a WiFi or 4G connection. Therefore, when flashing the system, you need to pre-configure it to set up WiFi and enable SSH to proceed further (if you are using a Raspberry Pi Zero W or Zero WH, the usage method is the same).
If you are using the Raspberry Pi Zero, which lacks WiFi functionality, you would need to debug all business logic and set it up to run on startup on another expansion board. If you do not have any subsequent need to connect other USB devices and the 4G Cat1 is only used to provide network access, you can use the Probe version. Otherwise, it is recommended to use the USB version.
Hardware: Please plug the power supply into the USB power port marked "PWR" on the Zero 2W. If you plug it into another USB port or the USB port on the expansion board, it will cause the 4G module to be shielded.
Wiring diagram:
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.)
3.2.2 Flashing system (Setup required for WiFi connection and SSH service)
Open the Imager, select the “Raspberry Pi Device”, “Choose Use Custom”, and “Storge”, then click "NEXT."
Then click "Edit Settings" :
In the pop-up window, under the GENERAL tab, you can set the hostname, username, and password, the default WiFi connection, and the region:
Under the SERVICES tab, please set up to enable the SSH service:
After completing the settings, click "Save," return to the previous page, and then click "Yes":
Click "Yes" in the warning window:
This will start the burning process. After the burning is complete, use this TF card to boot the system. The system will automatically log in with the preset username and password and connect to the preconfigured WiFi (provided the device is within range of the WiFi hotspot).
If the system stop at the Raspberry Pi logo and fails to boot:
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:
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.)
3.2.3 Control via SSH through WiFi
After the system starts, if the WiFi connection is successful, the internal network IP will be displayed below the WiFi icon in the top right corner of the desktop:
You can also obtain the system's internal IP address by checking the router's backend:
Here, we use the MobaXterm for SSH. The download link for MobaXterm is:
https://mobaxterm.mobatek.net/download-home-edition.html
Open the MobaXterm, create a new connection, select SSH, enter the IP address of the Raspberry Pi OS in the "Remote Host", and enter the login username in the "Specify username", as shown in the following figure:
Click "OK," then log in. After logging in, we can perform command-line operations on the Raspberry Pi Zero 2W using MobaXterm:
Now we check the connection status of the 4G module:
lsusb
It can be seen that the 4G module has connected.
Using ifconfig -a
to check the network interfaces, it can be seen that the 4G module is identified as eth0 and has obtained an IP address:
3.2.4 How to use AT commands
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:
Install minicom:
sudo apt-get install minicom
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
:
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.
四、4G的应用(远程控制)
RPi-Connect提供了从任何地方安全接入到树莓派的服务。基于此服务,搭配Zero_Cat1_4G顶针版即可实现在户外没有无线网络的情况下,依旧可以远程访问树莓派操作。注意:要使用此服务必须运行Bookworm及以上系统。同时,只有树莓派5,4或400可以使用屏幕分享。Zero2W只能使用Remote shell。接下来演示如何配置远程连接服务。
4.1 安装DNS服务(仅限2024.07.04及之后的系统版本)
4G CAT1模块是免驱的,在每次开机就可以实现4G自动连接,但是为了不引起DNS服务器冲突,还需要对开机自启动进行如下设置:
安装切换DNS服务器的软件udhcpc:
sudo apt install udhcpc
开启rc-local服务:
sudo sudo systemctl enable --now rc-local
通过下面的命令打开rc.local:
sudo nano /etc/rc.local
在exit 0上面添加你要开机执行的命令,然后保存文件(本示例中eth0代表4G模块,名称以实际为准):
sleep 5 && sudo udhcpc -i eth0 && sleep 5 && sudo udhcpc -i eth0 && sleep 5 && sudo udhcpc -i eth0
sleep命令的作用是延迟多少秒执行之后的命令,因为4G模块获取IP地址需要一定的时间,所以为了防止udhcpc执行失败,需要多执行几次,并且在每一次执行命令之间加上一定的延迟。这样执行的结果,是等系统启动后,大约20秒左右可以使用4G网络。
4.2 申请Raspberry Pi ID
如果已有Raspberry Pi ID请直接登录,如果没有请按下列步骤申请。
打开在https://id.raspberrypi.com/,输入您要使用的邮箱以及密码:
创建账号完成后需要进入邮箱验证:
验证完成后即可使用该id。
4.3 安装远程服务
打开SSH终端,安装Raspberry Pi Connect软件,如果安装时显示已安装则不需另外安装:
sudo apt install rpi-connect
安装完成后,我们在终端输入loginctl enable-linger
确保每次重启后系统自动打开远程服务。
重启系统,在图形界面中,依次选择如下图项目后,确保Raspberry Pi Connect已打开:
然后在树莓派终端输入:
rpi-connect signin
此时显示一个网址,如上图所示,我们在浏览器(建议使用别的电脑,Zero系列因为硬件资源关系,打开浏览器时非常缓慢)中打开这个网址:
点击Sign in,按照提示进行绑定即可,首先需要设置设备名称:
点击Create device and sign in:
这样就完成了绑定,终端中也会有成功的显示:
4.4 使用远程控制
在PC上打开:https://connect.raspberrypi.com/devices
:
刚才添加的Zero 2W设备下面只有”Remote shell“字样,表示此设备只能通过远程命令行界面控制。
点击Connect,弹出远程命令行界面,即可输入命令:
配置完毕后,可以使系统每次启动时都能通过4G上网,并开启Raspberry Pi Connect远程服务,我们就可以在PC上通过远程命令行界面控制设备。
联系我们
电话:13957118045
如本页面有任何疏漏、错误或者侵权,请通过上述途径联系我们,谢谢!
Copyright 2004-2024 野芯科技