Setting up MultiTech LoRaWAN gateway on Ubuntu

As the convener for the Adelaide community of The Things Network, I am frequently setting up Multitech Conduit Gateways. Depending on your PC or notebook hardware you might have some problems with the Exar USB-UART driver on Linux.

Here are the steps to getting this unit setup from an Ubuntu (should work for any other Linux distro) machine.


Should show something like this:

Bus 002 Device 006: ID 04e2:1410 Exar Corp. XR21V1410 USB-UART IC

Download the driver for the Exar site:

cd xr_usb_serial_common_lnx-3.6-and-newer-pak
sudo insmod ./xr_usb_serial_common.ko

Ensure driver is loaded at startup

sudo vim /etc/modules
#Add the following

ls /dev/tty*

should now show another USB port ttyXRUSB0

For the rest you just need to follow the excellent instructions by Jac Kersing who maintains the Multitech TTN installer and documentation here:

Get EUI of your gateway

mts-io-sysfs show lora/eui 2> /dev/null | sed 's/://g'

Microchip LoRaWAN Development Utility on Ubuntu

Having just wasted a few hours on getting this Java software running on Linux I am documenting this for future reference and hopefully saving other LoRa / TTN folks some time.


Install a Java JDK + JavaFX. This should work with the default OpenJDK 8 or 9 which comes as part of the Ubuntu repositories. I ended up installing Oracle JDK 8 as well as I thought the error might be related to OpenJDK.

sudo apt install openjdk-8-jre-headless openjfx

Download & install utility

Download location:
LoRa® Technology Evaluation Kit

cd ~/Downloads/
chmod +x

Fix User Preferences

This step is required for the Utility to run. Unfortunately, this is documented NOWHERE…

Change the following files to include the FilePath entry. The map is empty by default.

  • /home/USERID/.java/.userPrefs/dfu/prefs.xml
  • /home/USERID/.java/.userPrefs/fed/prefs.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<map MAP_XML_VERSION="1.0">
  <entry key="FilePath" value="/home/USERID/"/>

If you chose the default install location you can now start the utility

java -jar ~/Microchip/LoRaSuite/Applications/LoRaDevUtility/LoRaDevUtility.jar

A big thank you goes to The Things Network user JBI – who provided this answer in a TTN forum post.

No thanks to Microchip as their forum and firmware release policy is a bit of a shocker. There are several reports of such problems in the forum with no answers. Unfortunately, this seems to be no exception with electronics manufacturers (Hello Kerlink!).

RaspberryPi Version 3 SOE

Since there is now a supported Raspbian version without GUI and other unneeded add-ons available as Raspbian Lite the need to use other installers (with sometimes some downsides) is now not a necessity anymore. Below is a list of steps I like to perform before using them for any purpose as my Standard Operating Environment.

Download Raspbian Lite

Download link:

Write to SD Card

dd bs=4M if=2016-05-27-raspbian-jessie-lite.img of=/dev/sdb

Boot RPi

Default login details are
UID: pi
PWD: rasbperry

Regional settings

locale-gen en_AU.UTF-8
dpkg-reconfigure locales
ln -sf /usr/share/zoneinfo/Australia/Adelaide /etc/localtime

System update

apt update && apt upgrade
apt install vim

Setup SSH keys

As a security precausion it’s a good idea to disable password authentications
ssh-keygen -t rsa
vim /root/.ssh/authorized_keys
# --> add RSA public key

Setup Wireless LAN

iwlist wlan0 scan
wpa_passphrase SSID WPA_KEY
vim /etc/wpa_supplicant/wpa_supplicant.conf

Copy the resulting hash from the previous command

Example config

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

Rename default user account

The default Raspbian images use the default user ‘pi’ – I prefer to change this user to another account for security purposes and to be in line with other Linux system I use.

Reboot and log in to the RPi as root – you need to run the following commands as root.

usermod -l NEW_USER_ID pi
usermod -m -d /home/NEW_USER_ID NEW_USER_ID
groupmod --new-name NEW_USER_ID pi
mkdir /home/NEW_USER_ID/.ssh/
vim /home/NEW_USER_ID/.ssh/authorized_keys
# --> add RSA public key
# change owner and permissions on key files
chown -R NEW_USER_ID:NEW_USER_ID /home/NEW_USER_ID/.ssh/
chmod 700 /home/NEW_USER_ID/.ssh/
chmod 600 /home/NEW_USER_ID/.ssh/authorized_keys
rm /etc/sudoers.d/010_pi-nopasswd
echo 'NEW_USER_ID ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/010_NEW_USER_ID-nopasswd

If you are using the desktop version not a headless version you want to make sure you don’t boot into the desktop and if you want to change the autologin ensure you update the username there as well.


Configure Raspberry Pi settings

I generally need to enable SPI, change the hostname and others depending on the purpose of the unit.

EDIT [2017-08-21]: With the update of Raspbian to Stretch you now have the firmware updater as part of the Raspbian repos:

sudo rpi-update

This will update the Pi Firmware to the latest version as well – which is worth it if you use it for later cameras and peripheral usage.

EDIT [2017-12-27]: change annoying vim defaults in Debian Stretch onwards. Visual mode.

sudo vim /usr/share/vim/vim80/defaults.vim

Comment out the following lines:
“if has(‘mouse’)
” set mouse=a

RaspberryPi real-world control with REST API

Finally found some time playing with a RaspberryPi and an attached PiFace Interface board to control some garden pumps and potentially an Aquaponics setup in the near future.

PiFace board


Base Raspian (Debian Wheezy) Install (I prefer the clean minimal install via

Configure the base system as per my previous base install.

Install Apache & PHP

sudo apt-get install apache2 php5 php5-dev php5-cli php5-mcrypt curl raspi-config

Ensure mod-rewrite is enabled

sudo a2enmod rewrite

Install PHP SPI Extension

More info:

git clone
cd php_spi
./configure --enable--spi
make test
make install

Install PiFace REST API

cd /var/www/
git clone
cd piface-rest-api
curl -sS | php
php composer.phar install

Thanks to Nate Fanaro for the excellent work on the API.

Make sure SPI is enabled on the RPi


Advanced Options –> A5 SPI –> yes

Install PiFace Modules

sudo apt-get install python3-pifacedigitalio python-pifacedigitalio
sudo usermod -a -G gpio www-data
sudo usermod -a -G spi www-data

For more info visit

Apache2 API Configuration

Enable SPI extension

sudo vim /etc/php5/apache2/php.ini
#add the following extension

Apache VHost config

sudo vim /etc/apache2/sites-available/piface

Paste the following VHost config

<Virtualhost *:80>
DocumentRoot /usr/share/piface-rest-api/public_html
ErrorLog /var/log/apache2/piface_error.log
CustomLog /var/log/apache2/piface_access.log combined
<Directory />
AllowOverride All
Order allow,deny
Allow from all

Enable the newly created VHost

a2ensite piface
service apache2 restart


curl http://HOSTNAME/led/test/

Next up will be some modification for securing access to the PiFace REST API via some sort of API Key or digital certificate as it’s open by default at the moment.

Mobile sensors and the “Internet of Things” in learning

With the Internet of Things slowly becoming mainstream the potential uses of this technology can also be seen in the Education sector. This blogpost is the first installment of a series of posts that highlights practical examples that can be used in teaching and training.

Part 1 – Environmental Noise Monitoring

WideNoise by leeander, on Flickr
Creative Commons Attribution-Noncommercial-No Derivative Works 2.0 Generic License  by  leeander 

Noise pollution has been a serious problem in many large cities all over the world and with the help of common mobile devices (smartphones) this can be easily measured, monitored and compared with a large quantity of samples from other cities/regions.

Some of the skills taught in these projects are:

  • Environmental science
  • Citizen science (collaborative data gathering)
  • Measurement / sensing
  • Data visualisation
  • Data comparison
Here are two very useful pieces of software to undertake this type of project:


With WideNoise users can monitor the noise levels around them using an App downloadable from Android Market or Apple AppStore. It has geo-location capabilities allowing users to also check the online map to see the average sound level of the area around them.

The project has made it’s source code available via an Open Source license allowing further customisation.


A project developed by Sony Computer Science Laboratory Paris & VUB BrusSense group allows a user to measure the level of noise in dB(A) (with a precision a bit lower than a sound level meter), and contribute to collective noise mapping effort by annotating it (tagging, e.g. subjective level of annoyance). This information can be automatically published on this website (3G/GPRS or manual upload on any PC).

These two projects provide an excellent starting point for educators to become involved on the ‘Internet of Things. A copy of this can be seen on my work blog as well.