Il WL-R220L 4G OpenWrt is an M2M (Machine to Machine) industrial cellular router that can run on the 4G / 3G cellular network to provide reliable, secure, high-speed wireless connectivity with supported I / O and VPNs. It is a powerful and programmable industrial device with high performance and rugged enclosure designed for remote management, telemetry, condition monitoring, CCTV, ATMs, vending machines and other M2M applications.
OpenWrt is a Linux distribution for routers; offers a built-in software package manager that allows you to install the package from a software repository. The router is configured using a web interface (LuCI). Customers can customize the device to suit their needs.
Router update with OpenWrt 23.05.0-rc2 r23228
To update the router to the OpenWrt version 23.05.0-rc2 r23228 it is necessary to run the firmware download, from the web menu interface System->Backup/Flash firmware you can select the file *.bin with firmware.
The page with the firmware information will be displayed by pressing the key Proceed, the firmware is installed.
Manual configuration
Once the firmware has been upgraded, the LTE interface must be reinstalled, from the menu Network->Interfaces remove any LTE interface then present with the key Add new interface you can insert a new LTE interface.
Enter any APN and PIN of the SIM card used. After having set and accepted all the settings, reboot the router.
From the menu Firewall Settings you can put the interface in the desired zone, I recommend to put it in WAN.
Configuration with archive file
A configuration file is provided with the firmware LTE default config.tar.gz from the menu System->Backup/Flash firmware you can execute the command Perform reset to return the router to the factory reset condition then with the command Upload archive it is possible to select the configuration file to configure the router to default with LTE interface installed.
References to the different models
The information reported refers to the 2nd series (SN starting with 2120R), Mediatek OpenWrt 23.05.0-rc2 r23228 chip
For information regarding the 2nd series (SN starting with 2120R) Mediatek OpenWRT18.06.9 chip see application note.
For information regarding the 1st series (SN starting with 1120R) Atheros chips see application note.
How to configure the router
Insert SIM 2 (Router off), to start better that the SIM has no PIN, possibly insert it into a phone and delete the PIN. Turn on the router that has the default address 192.168.1.1 and the active DHCP server, by connecting via ethernet (LAN port) with a PC, typing the IP address (192.168.1.1) from the browser, you will be redirected to the login page. The default login credentials are user "root" no password. On the page Status->Overview information about the software version is shown.
It is also possible to connect via SSH or via RS232 serial port, the router implements the BusyBox interface, a simple tool which allows you to manage all the most useful commands and tools in the Unix world. For a list of possible commands, refer to the OpenWrt documentation available on the Internet.
Reconfigure the router to default
- With the router off, press the button Reset on the front.
- Turn on the router.
- Wait for about 10 seconds then release the button Reset.
- Wait for the router to start which will configure itself with an IP address of 192.168.1.1 and an active DHCP server, it is now possible to access via browser.
It is also possible to restore it to default from the page System->Backup/Flash Firmware by pressing the button Perform reset.
From SSH or serial connection you can run the command jffs2reset, which will delete and reformat the entire jffs2 partition, creating it again.
umount /overlay && jffs2reset && reboot now
Diagnostic system commands and utilities
System commands that can be sent both from serial port and from SSH connection.
The command is used to verify active processes ps, matching the command grep (Global Regular Expression Print) you can define a search filter in the results.
ps | grep zerotier 2263 root 13804 S /usr/bin/zerotier-one /var/lib/zerotier-one_sample_config
To display the ports listening by the system, use the command.
netstat -tulpn | grep LISTEN tcp 0 0 192.168.1.1:63500 0.0.0.0:* LISTEN 2234/zerotier-one tcp 0 0 192.168.1.1:53 0.0.0.0:* LISTEN 3132/dnsmasq tcp 0 0 :::1000 :::* LISTEN 3666/ser2net
Diagnostic modem AT commands and utilities
AT commands management
The router for the connection uses a Quectel EC25 cellular engine, the engine can be managed with the AT commands (AT commands manual) that can be sent both from the serial port and from the SSH connection, to send the commands the package is used chat which is already installed by default (Application note). The syntax of the command is:
chat -t 3 -e '' '<AT command>' OK >> /dev/ttyUSB3 < /dev/ttyUSB3
View extended error codes
For more information on error codes, it is possible to enable the management of extended error codes with the command:
chat -t 3 -e '' 'AT+CMEE=2' OK >> /dev/ttyUSB3 < /dev/ttyUSB3
Verify SIM
To check the presence of the SIM use the command reported below. If SIM inserted, it is returned: +CPIN: READY. If SIM not inserted or in error, it is returned: +CME ERROR:
chat -t 3 -e '' 'AT+CPIN?' OK >> /dev/ttyUSB3 < /dev/ttyUSB3
Check signal
To check the signal reception level, use the command reported below (The command returns the signal level even without a SIM inserted).
chat -t 3 -e '' 'AT+CSQ' OK >> /dev/ttyUSB3 < /dev/ttyUSB3
A message of the type: +CSQ: aa,bb is returned
- aa: Indication of the received signal strength (RSSI) and has a value from 0 (-113 dBm and below) to 31 (-51 dBm and above), 99 if the signal is not detectable.
- bb: Channel bit error rate. It can only be detected during a call, in other cases it has a value of 0 or 99 depending on the SIM card. If the error rate can be measured, its value is between 0 and 7.
RSSI | Gain | Signal strength | Description |
---|---|---|---|
> 24 | > = -70 dBm | Excellent | Strong signal with maximum data speeds |
13 ~ 24 | -70dBm to -85dBm | Good | Strong signal with good data speeds |
7 ~ 12 | -86dBm to -100dBm | Fair | Fair but useful, fast and reliable data speeds may be achieved, but marginal data with drop-outs is possible |
2 ~ 6 | <-100 dBm | Poor | Performance will drop drastically |
<2 | -110 dBm | no signal | no signal |
Check connection type
To check the type of data network connection, use the command below. The last number represents the type of connection.
0: GSM, 2: UTRAN, 3: GSM W / EGPRS, 4: UTRAN W / HSDPA, 5: UTRAN W / HSUPA, 6: UTRAN W / HSDPA and HSUPA, 7: E-UTRAN, 100: CDMA
chat -t 3 -e '' 'AT+COPS?' OK >> /dev/ttyUSB3 < /dev/ttyUSB3 La risposta è del tipo: +COPS: 0,0,"FASTWEB",7
IP address assigned by the operator
To find the IP address assigned by the manager, use the command below:
chat -t 3 -e '' 'AT+CGPADDR' OK >> /dev/ttyUSB3 < /dev/ttyUSB3 La risposta è del tipo: +CGPADDR: 1,"10.89.81.39"
Firmware upgrade
OpenWRT is a specific Linux distribution for embedded devices, there are always new versions available. To be able to use the new versions it is necessary to upgrade the firmware, the operation is simply performed from the menu System->Backup/Flash Firmware.
Application installation
The advantage of using OpenWRT is that it has a huge library of executable programs (today they are more than 6000). Package management can be done simply from the web page, from the menu Software you can manage installed packages by upgrading or uninstalling them, or installing new packages.
Run the command Update lists which connects to the repository and updates all the packages that can be installed on the router. Now you can select the desired software and install it.
Of course, like all Linux systems, software maintenance is also possible from the command line by accessing from the SSH console. The command:
- opkg update Update from available application repositories.
- opkg install packagename Performs installation of a software package (Application).
- opkg remove packagename Uninstalls a software package (Application).
Ser2net installation for receiving/sending SMS messages
By installing the application ser2net it is possible to manage the router with the classic AT commands (See application note) thus being able to receive and send SMS messages, (ser2net – Man Page). Now you can run the program by typing the command:
ser2net -C <TCP port>:<state>:<timeout>:<device>:<options>
The -C option indicates that the parameters are given inline to the command.
- TCP port: Indicates the TCP port to listen to.
- state: It can be raw, rawlp, telnet or off.
- timeout: Time (in seconds) before port is disconnected if there is no activity, value zero disables this feature.
- device: Name of the device to connect to.
- options: Device configuration options.
To allow you to manage the AT commands on the modem we will have to define the command:
ser2net -C 1000:telnet:100:/dev/ttyUSB2:115200,8DATABITS,NONE,1STOPBIT,-XONXOFF
With this command we will activate a telnet server on port 1000, by connecting to the server all the commands we send will be redirected to the modem and vice versa. To automatically run the program at startup you need to write to the file /etc/rc.local the command:
sleep 60 ser2net -C 1000:telnet:100:/dev/ttyUSB2:115200,8DATABITS,NONE,1STOPBIT,-XONXOFF
With the FB ModemCore it is possible to manage the reception and sending of SMS directly from our programmable systems.
ZeroTier installation for accessing the router from the Internet
As seen in this article ZeroTier interconnects geographically dispersed devices via the Internet, allowing access to them with their own IP address as if they were virtually connected to their own ethernet network. ZeroTier is already installed with the firmware update, possibly it is possible to install it from the menu System->Software.
To configure ZeroTier edit the file /etc/config/zerotier enabling the service and defining the network ID.
config zerotier 'sample_config' option enabled '1' list join 'xxxxxxxxxxxxxxxx'
Once the network ID has been defined, it is necessary to restart the service with the command /etc/init.d/zerotier restart. Perform the configuration from the menu Network->Interfaces, it is also necessary to define in Firewall Settings the zone to which the interface belongs.
Now you can check from the portal ZeroTier via the network dashboard the successful connection by detecting the IP assigned to the device.