Running Polaric Server on Ulari

The “Polaric Server” is mainly a web based service to present live APRS tracking information on maps and where the information is updated in realtime. It is originally targeted for use by radio amateurs in voluntary search and rescue service in Norway. It consists of a web application and a server program (APRS daemon). It runs on e.g. aprs.no as a online service on the internet, but what if we could bring it with us out in the field in a portable computer, possibly with its own LAN, APRS modems and radios, all in a box, ready for use? And how well would it work without always being online with a good connection to the internet?

It is no news that the Raspberry PI is or other small portable computers are suitable for this and that this has been tested in various projects. See for example the Aprs Box by W6ELA. I have done some testing with Raspberry PI, the Cubieboard, etc.. It also works with the Database plugin. It is easy to integrate with Direwolf which is a very good software for APRS, using the sound-interface. The Polaric Server (or Direwolf) could easily be used as a igate as well. I have tested a RPI 4 with a 7Ah batteri and it runs for a day before needing recharge. It can be a hassle to assemble this unit from a PI, soundcards via the USB, radio, setting up keying of the radio, battery, etc. The Raspberry PI for example, will need an external USB soundcard or we may use a TNC. Wouldn’t it be nice if there existed some box complete with everything we need in it: Computer, radio, modem, Wifi LAN, etc?

And guess what, here is something. I have tested the Ulari Duo 2 box from Microsat. It is straightforward to run Polaric Server on it, and it works surprisingly well.

The Ulari Duo 2

Ulari review

According to Mateusz, SQ3PLX of Microsat, ULARI stands for “Ultimate Linux Amateur Radio Interface”. It is intended to be a set of devices which utilize Linux-enabled microprocessor modules to serve in the field of amateur radio and related use.

I have tested the Duo 2 which is based on the NanoPI Duo 2 which is actually a rather small module with a 4-core computer with 512MB RAM. It is mounted on a motherboard with radio, a microcontroller, plugs for ethernet, USB, antenna, etc. along with LEDs for indication. The radio is quite similar to the one used in Arctic Tracker with a small 1 watt VHF module and a PA module with a yield of up to 7 watts. A shielded 7 pole lowpass filter ensures that unwanted harmonics are removed. It has a mechanical relay to switch between RX and TX which makes a distinct clicking sound. A little strange maybe, but I can understand this choice.

Raspbian is a nice Linux distro, but be careful when upgrading the packages. DO NOT upgrade the kernel if you don’t know exactly what you are upgrading to: You risk losing the driver for the network interface. The armbian-config program easily let you prevent the automatic upgrading the kernel (or you can more manually pin it to the version that came with the original image). These challenges with respect to mainainablility are solvable for Linux experts (you can for instance recompile the kernel yourself). It is also easy to get the Wifi up and running using the raspbian-config, either connecting to an AP or acting as its own AP. The Ulari has an antenna mounted outside the box for Wifi that gives it a good range.

A potential drawback of Ulari is in my view the somewhat incomplete documentation, and the dependence of what in practice is closed source software. A image based on Ubuntu/Armbian is provided and it works well with some Ulari specific things already installed. It is easy to get started, but when I try with a more recent Debian based Armbian the sound interface won’t work and I have no clue why. Did I miss something? I had to do some educated guessing and hacking to install the ulari-manager program and its config files to the other distro. It does things like setting some parameters on the radio module and control the blinking of the LED on the front panel. It can detect that Direwolf is running and indicate this with a double LED blinking pattern. Cool. It would have been even more useful if the source code was available, maybe with some explanations. I am not sure if I have a complete understanding of what the (Atmega) micro-controller and the daemon program that controls it is doing. Hint hint.

Getting started

It is a good chance the box comes with a micro-sd card already inserted. If not, the image is available on Ulari webpages. If you can plug the Ulari box into your router using a ethernet cable and the Router provides IP addresses through DHCP, it is definitively the easiest way. Follow the First Run instructions and make sure you can connect the box using SSH. Now, reboot and move to the Direwolf settings. MYCALL is probably the only thing you need to change. Since Polaric Server has an igate, you may check that the igate and digipeater in Direwolf are disabled as probably also any kind of beaconing. You may want to comment out the last 4 lines in Direwolf config. The gpsd program can be removed if you don’t plan to use it. If you want to use the Direwolf tracking or igate instead of Polaric Server you can of course change this later. You may skip the audio volume control and just check that the ulari-manager settings are correct. Now, the radio should be up and running. If the heartbeat LED blinks twice every second it means that Direwolf is up and running.

Now I recommend to run the armbian-config command (in the shell). First, go to the “Personal” submenu and change the hostname to whatever you like, for example your callsign. You may also want to change your timezone or stay with UTC time. Now, go to the “System” submenu and then select “Freeze” (disable Armbian kernel upgrades). Then the background will turn red. As I said earlier, we need to be careful about upgrading kernel. Now, select “Avahi” to turn on mDNS announcements. You may also use the “Firmware” menu selection to upgrade software packages (or just apt update; apt upgrade in the shell). When you now reboot the system, you can use the hostname to connect it (you don’t need to find the IP-address). If you selected “ulari” as the hostname, you use “ulari.local” as the hostname when connecting the box on the LAN.

System settings menu

Wifi setup

The armbian-config menu also let you set up the Wifi network. It can either be set up with an existing access point or you may set the Ulari itself up as an access point. You cannot do both at the same time however. For portable use, it would be useful if we had some script that automatically could try to look for some known access points first and if not found, it could activate its own. Such scripts exist, and with some adaptation it could work. I have also tried RaspAP which is a fancy web-interface – it works on a Raspberry PI but not on a Ulari. At least not without significant PHP hacking.

Installation and basic setup of Polaric Server

Follow the instructions here to install Polaric Server. First polaric-aprsd and then polaric-webapp2. When polaric-aprsd is installed, you may point your browser to http://<hostname>.local:8081/config_menu where (you may also access this from the the main menu in the webapp) and log in with username ‘admin’ and password ‘polaric‘ (you may change the password later). Now you can configure polaric-server. Set your callsign first, then you can go to the radio channel menu choice and select ‘TCPKISS’ type for the channel. Then press update and then select the ‘radio’ channel again in the menu. Now you can configure it to use Direwolf. Set the hostname to localhost and port number to 8001 (as it is set in Direwolf config). The Kiss port number can be 0. Now, check the Activated box, press update and it should connect to Direwolf.

Configure the radio channel for using Direwolf

Now, You should take a look at the aprsIS channel config. You will at least need to provide the APRS passcode. If you want, you may also change the server to e.g. norway.aprs2.net and the port to 14580. In that case you also need to provide a filter and it may be a good idea to restrict the area of interest the region where you expect to operate. If you have configured a connection to APRS-IS before, you know the drill.

Now, you may want to go back to “Server config” to activate the server as an igate. Just check the Activated box and press Update. If you don’t set the paths it will use a default setting. If you just fill inn a digipeater path for igate, it will be used also for messages and objects. The “Own position” menu choice let you configure Polaric Server to work as a position tracker. You may set a static position (using UTM coordinate) or you may use a GPS. If some settings require the restart of the server, it will be indicated.

Server config and IGATE setup

Polaric Webapp

When polaric-webapp2 is installed, you may point your browser to http://<hostname>.local/aprs. It is kind of pre-configured for Norway so you may try to zoom the map there and you will probably see APRS stations and objects on top of the map.

The polaric-webapp2 is the web-browser application with maps. It includes OpenStreetmap and some norwegian map-layers by default. The challenge of operating offline is that maps are fetched from online webservices. Online maps will not work when not connected to the internet. However, the polaric-wepapp2 comes with a map over Norway where tiles are fetched, cached and stored locally when users browse the map. It is also possible to pre-seed map tiles from a certain zoom level. The challenge may still to be sure that you have all the map tiles you will need before taking the box offline.

It is very configurable and it can be used with many map sources, also in other countries than Norway of course. It is beyond the scope of this article to go into the use and configuration of map-layers and caching of map-tiles (using mapcache). It is also beyond the scope of this article to describe all the things this application can do. It is a rather capable APRS client, bot also more: It is a GIS tool.

Database plugin

Polaric Server has a plugin that integrates a PostgreSQL database (with PostGIS extension). It is used for storing and retrieving APRS packets and trails, as well as user-related information like map-layer-information, administration of trackers, etc. The heaviest part with respect to processing and searching is APRS packets and posititons since it mainly represent the stream of data from APRS-IS (or radio) and the amount of data may become large over time. You can configure the system to delete records after a number of days, etc and you can configure it to not store everything.

The database plugin mostly works on Ulari. The most complex query (finding a cloud of points where a digi or igate has heard things), seems to push it over the edge. A computer with only 512MB RAM and a micro-SD card as storage is not optimal for complex databases. In my tests this query does not run reliably, but even if it is disabled, most of the database extension works well and it is useful.

To install the database extension. Install the package (using apt) polaric-db-plugin. Using apt will pull in other packages it depends on. When the packages are installed, run the command: polaric-dbsetup. This will pull in the PostgreSQL server and set up the schema. When all this has finished, restart the whole thing using polaric-restart command. You may (if you need) use the PostgreSQL shell by using the commands (as root):

su - postgres
psql polaric

Concluding remarks

Polaric Server has been around for a decade and is still evolving. It is beyond the scope of a single article here to describe what it can do and how it works. It is mainly a APRS client with GIS capabilities and it is used by hams to support search and rescue services in Norway and possibly some other countries (USA, Germany). We are exploring how to support portable operations where you aren’t always online with a full internet connection, with Polaric Server, APRS, etc. This article shows how to run it on the Microsat Ulari Duo2 box. It works well, and even the SQL database extension could be used to some extent. Feel free to suggest additional information to this article, ideas for additional articles on the subject or to contribute with your own experiences. This is work-in-progress.

73 de LA7ECA, Øyvind