Start with one of the hardware setups in the section above. A generic setup is shown in Figure 1.
The GUI is strictly for configuring the UART port as a Serial to Network bridge. Open up a web browser and navigate to the IP address of the Smart Radio. From there, navigate to Services → Serial Configuration. A screenshot of the GUI is shown in Figure 2. For mobile applications, we recommend using UDP transport over TCP transport as it is more responsive.
When configuring the serial to network relay using the GUI, the program, socat, is used in the background. For unicast traffic, the relay should operate as either a server which listens on a particular network port for incoming connections, or a client which attempts to connect to a particular IP address and network port. For multicast traffic, the relay can either send, receive, or operate bi-directionally. It will be necessary to open up the firewall at the desired network port, and a link to the firewall page is provided. For multicast traffic, it is also necessary to update the routing table and a link is provided to the static route page. An example static route is shown in Figure 3.
Choose the device /dev/uart0. After making your changes, click Save & Apply. If you are familiar with Socat and want to use your own arguments, then you can input them using the checkbox at the bottom of the page.
The remainder of this section discusses configuration using the CLI.
We recommend using the GUI for serial port configuration, but if you want an advanced configuration, then you may also use the CLI. This guide is not designed to be comprehensive, and if you plan on using the UART port manually, then you will need to have Linux expertise. We will discuss some of the tools which are built into the Smart Radio for you to use, and this section will also be useful as a debugging guide.
You can SSH into the radio by running
It may be necessary to update your PC’s list of known hosts first.
The UART interface is attached to /dev/uart0.
Before attempting to use the UART port manually, ensure that socat is disabled. SSH into the radio and run
This can also be done in the web GUI.
The default UART settings can be changed using the stty program which is installed on the Smart Radio. An example usage is,
which sets the speed to 115,200 baud, 8 data bits, 1 stop bit and no parity.
(Please note that the Helix Smart Radio’s
UART port supports max 115,200 baud).
From the May 2021 firmware release onwards, picocom is installed by default on the Smart Radio. picocom is a terminal access program which can be used for general debugging of the UART port. You can invoke picocom with
You can exit picocom by holding down CTRL, and the hitting a and then x. For a full list of
commands, just type picocom.
A single message can easily be sent on the UART port using echo
or received on the UART port using cat
These programs use the settings applied by stty as defaults.
The program "agetty" can be used to open a serial console over the USB UART port. First access the Smart Radio over SSH, and then run
socat and ser2net are installed on the Smart Radio, however, due to a socat bug, we strongy
recommend that you use the web GUI for their configuration.
Openwrt uses the procd system for service startup, configuration and management [1]. To make a simple script which starts up on boot, and respawns when it closes, you can use the script below as a template.
The START value indicates it’s boot priority with 99 being the lowest (recommended). This template should be copied to the folder /etc/init.d/ and enabled by running
At startup, the script /opt/myscript.sh will run.
You can start, stop, restart, enable or disable the script using the mystartupscript init
script.
[1] Openwrt procd init script parameters, https://openwrt.org/docs/guide-developer/procd-init-scripts, September 2021