4002 R2S Plus 4G EN
Keywords
FriendlyElec, NanoPi R2S Plus, RK3328, Dual Gigabit Ethernet, Soft Router, 4G TLE, FriendlyWrt, OpenWrt, OpenMediaVault, Debian, Ubuntu
I. Introduction to 4G Modules
This 4G module is a 4G LTE product we designed based on the FriendlyElec Nano Pi R2S Plus. The CM4 4G mini module is paired with a specially designed 4G carrier board, and the 3D-printed base has been redesigned to replace the base of the R2S Plus enclosure, integrating the 4G antenna internally. If Wi-Fi is not needed, the 4G antenna can also be placed externally, as the R2S Plus development board already has two pre-reserved antenna holes.
The 4G module is a USB device connected to the USB port of the R2S Plus. Therefore, by combining the 4G module and WiFi with the R2S Plus, it can function as a portable 4G soft router, sharing a WiFi hotspot, making it more suitable for high-speed, high-performance networking applications in space-constrained environments.
Building upon the FriendlyWrt, we performed secondary compilation by integrating 4G drivers to ensure the new firmware supports automatic 4G module detection.
II. Work with FriendlyWrt
Some versions of the FriendlyWrt do not support 4G modules. Based on the FriendlyWrt, we have made secondary compilations and added 4G module drivers, so the firmware we provide supports 4G modules.
Our OS firmware package version: friendlywrt_23.05_20240823_rk3328_arm64_sd.img.gz
Use the 4G module as a WAN port in the FriendlyWrt. Connect the LAN port of the R2S Plus to the PC's Ethernet port, power it on, and once the connection is established, open 192.168.2.1 in the PC's browser to access the OS backend page (default username: root
, password: password
).
2.1 4G modules test
Start the OS, go to '"Services - Terminal", log in to the terminal. The default username is root
, and the password is password
.
Execute ip addr
, and the result is as follows. You can see that the CAT4 4G module is recognized as eth2
:
If it is a Qualcomm 4G module, it will be recognized as usb0
:
Then, configure 4G as the WAN. The steps are as follows:
Go to "Network - Interfaces", and click "Add New Interface".
Please configure as shown in the figure (the "Name" can be customized), select "eth2" (CAT4 4G module) or "usb0" (Qualcomm 4G module) for the device, then click "Create Interface":
Click on "Firewall Settings", in the "Create / Assign firewall-zone" section, select "wan", and then click "Save":
It automatically returns to the "Interfaces" page, then click "Save and Apply":
Wait for a moment, and we can see that the 4G module has obtained an IP address:
Back in the terminal, execute ifconfig eth2
(If it is Qualcomm 4G, execute ifconfig usb0
) to check the network parameters of the 4G module:
A successful ping to the domain indicates that the 4G module is now able to browse the internet normally:
4G Module internet speed test:
Note: Network speed testing is affected by the network environment and the testing method. The speed provided here is for reference only, please refer to the actual speed for accurate information.
2.2 Testing the built-in WiFi module as a wireless hotspot
If your device is equipped with the optional M.2 WiFi module (RTL8822CS WiFi), it can operate in AP mode (as a wireless hotspot), allowing other devices to connect to the internet wirelessly.
For setup details, visit FriendlyELEC's site:
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R2S_Plus/zh
After setup, we can see that the hotspot is now active, and mobile devices can then connect to it.
Since the 4G internet connection was already set up in the previous section, the 4G module now serves as the WAN, while the wireless hotspot acts as the LAN. Once a mobile device connects to it, it can access the internet via the 4G network through the wireless hotspot.
Connect the mobile phone to a wireless hotspot to perform an internet speed test using the website https://www.speedtest.cn/.
Note: Network speed testing is affected by the network environment and the testing method. The speed provided here is for reference only, please refer to the actual speed for accurate information.
2.3 More functions
III. Work with Ubuntu OS
3.1 4G modules test
Flash the Ubuntu OS (command-line only, no desktop) onto a TF card.
The version of the Friendly's Ubuntu OS we tested: rk3328-sd-ubuntu-noble-core-6.1-arm64-20241112.img.gz
Connect the LAN port of the R2S Plus to the upstream router, then connect the PC to the same upstream router. After the OS boots up, check the IP address of the R2S Plus through the router's admin panel. In this document, the address obtained by the OS is: 192.168.8.65. Download and install the terminal software MobaXterm on your PC. MobaXterm download address:
https://mobaxterm.mobatek.net/download-home-edition.html
Use MobaXterm software to connect to the OS via SSH (username: root
, password: fa
):
▶With CAT4 4G configured, execute ip addr
to view the network parameters as follows:
2: eth0 is the WAN port of the R2S Plus, and it has no IP address because no network cable is connected.
3: eth1 is the 4G module and has successfully obtained an IP address.
4: wlan0 is the R2S Plus's built-in WiFi adapter, not connected to any hotspot.
6: eth2 is the LAN port of the R2S Plus, connected to the upstream router and has successfully obtained an IP address.
▶Paired with Qualcomm 4G, Qualcomm 4G is recognized as USB0, and the execution result is as follows:
Then execute the route
command to view the routing table. If eth1 (CAT4 4G) is listed first, it means the internet connection is through the 4G module.
Qualcomm 4G: If usb0 is listed first, then internet connection is through the 4G module.
Currently, pinging both the IP and the domain name is successful, confirming that the 4G module is working correctly.
3.2 Modification of Network Priority
The Friendly's Ubuntu OS of the R2S Plus defaults to prioritizing 4G network for internet access. If you want to prioritize wired network instead, you can run the command:
sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1
Explanation of these two commands (separated by '&&'):
sudo ip route del default
: Remove the default route from the routing table.
sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1
: Add the gateway of the wired network as a new default route (ensure to use the actual gateway address).
After completing the execution, execute the route
command to view the routing table. The current default route is the gateway of the wired network (Using the CAT4 4G module as an example, eth2 is listed first):
This way, the network will default to using the wired connection. If you need to switch back to defaulting to the 4G network, please restart the OS.
Or you can excute this command:
sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.6.1
The default gateway for the CAT4 4G module is 192.168.6.1, please refer to the actual configuration.
Note: After a reboot, the routing table resets. To ensure the network continues to use the wired/wireless connection as the default route post-restart, you'll need to execute sudo ip route del default && sudo route add -net default netmask 0.0.0.0 gw 192.168.8.1
again.
4.1 AT command operation
The operation methods for the Ubuntu OS and FriendlyWrt are basically the same. For FriendlyWrt, after booting the OS, you need to go to "Services - Terminal" to log in to the terminal.
Ubuntu OS requires installing usbutils first, while FriendlyWrt does not need to install it:
apt install usbutils
Taking the CAT4 4G module as an example (the operation method for Qualcomm 4G modules is similar), use lsusb
to check the USB devices, and the red box indicates the 4G module:
Record the ID value of the 4G module: 1286 4e3d
Use the following command to open the ttyUSB serial port, where the value after echo is the ID recorded above:
modprobe option
sh -c 'echo 1286 4e3d > /sys/bus/usb-serial/drivers/option1/new_id'
After executing the above two commands, proceed with:
ls /dev
Now, you should see three devices (ttyUSB0-2) under the dev directory.
Install minicom:
apt install minicom
Then open the AT command serial port using minicom (The FriendlyWrt recompiled by Mcuzone already has minicom built-in.):
minicom -D /dev/ttyUSB1
(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.
Common AT commands:
1. View echo:
ate1
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 see the inputs.
2. 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.
3. 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.
4. 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.
5. View the SIM card's IMEI code:
at+cgsn
6. 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
7. 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.
4.2 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. You can make the changes by following steps:
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=?
Qualcomm 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.
V. Summary
We only introduce the usage and operations for 4G module based on NanoPi R2S Plus, without covering the operations and software system specific to the NanoPi R2S Plus development board itself. For information about the NanoPi R2S Plus boards, please visit the FriendlyElec's website:
https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R2S_Plus
Contact Us
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