About Leo Gaggl

ict business owner specialising in mobile learning systems. interests: sustainability, internet of things, ict for development, open innovation, agriculture

Connecting your LoPy to The Things Network in Australia

These notes are to assist Australian IoT enthusiasts to get started in connecting a LoPy to The Things Network as it is unfortunately (not yet) straight forward to make them work with the current AU-915 TTN Channel plans. As the initiator of the local Adelaide Community of The Things Network I have been experimenting with a number of devices to connect sensors to #TTNADL. One of my personal favourites is the Pycom LoPy as a nice middle-ground between capabilities and technical complexity.

The Things Network Adelaide

However I ran into a problem where the LoPy would not get a signal back from the TTN network when joining over OTAA even though the TTN Console (http://console.thethingsnetwork.org/) the device showed as connected. With some friendly help from Jose Marcelino at the Pycom Forum this turned out to be an issue with the 915MHz frequency regions. Since there is no actual a standard governing which of the channels are used by TTN gateways, what is outlined here is what is implemented by most TTN communities down under (I know that at least ADL, BNE, SYD and WOL adhere to those). This is the typical Sub-band 2 (Channel 8-15) implementation of AU ISM 915 with TTN Gateways.

This channel plan is also implemented by the install script for the MultiTech Conduit Gateways which are currently the most common gateways installed across Australia (see https://github.com/TheThingsNetwork/gateway-conf/blob/master/AU-global_conf.json)

Channel# Direction Frequency MHz Bandwidth kHz Data rate
8 up 916.8 125 DR0 – DR3
9 up 917.0 125 DR0 – DR3
10 up 917.2 125 DR0 – DR3
11 up 917.4 125 DR0 – DR3
12 up 917.6 125 DR0 – DR3
13 up 917.7 125 DR0 – DR3
14 up 918.0 125 DR0 – DR3
15 up 918.2 125 DR0 – DR3
65 up 917.5 500 DR4
0 down 923.3 500 DR8 – DR13
1 down 923.9 500 DR8 – DR13
2 down 924.5 500 DR8 – DR13
3 down 925.1 500 DR8 – DR13
4 down 925.7 500 DR8 – DR13
5 down 926.3 500 DR8 – DR13
6 down 926.9 500 DR8 – DR13
7 down 927.5 500 DR8 – DR13

To set the LoPy unit up it needs to have the set frequency plan removed and the region specific frequency plan loaded (even though they were bought as 915Mhz units). I have created some quick Python code to set up the LoPy with the above channel structure as the default settings for those devices do not work. Note that you have to remove the default channel settings and add the correct ones before you can successfully register and send data.

Below is my adaptation of the LoPy LoraWAN example to work with TTN in Australia. Please note that the LoPy Lora class only accepts DR values from 1-7. Suggestions more than welcome.

Hope this helps other LoPy owners in Australia to connect to The Things Network. And if you are in Adelaide why don’t you come along to our OpenData and IoT Meetup ? Let’s build this thing together.

Using DNSMadeEasy as Dynamic DNS provider on Synology Diskstations

Since Synology (despite requests) still has not added DNS Made Easy as a listed provider (despite listing some really obscure services – go figure!) here is the steps to add a custom provider.

DNS Made Easy Setup

Create a new A-Record

  1. Set the name
  2. Set the IP (initial – any valid IP)
  3. Tick the “Dynamic DNS” tickbox
  4. Enter your chosen Dynamic DNS Password
  5. Save the new record

When saving the record you will see a “Dynamic DNS ID” – note down this number. This will become the hostname on the Synology setup.

Synology Setup

Click “Customize” to add a new DDNS provider

Query URL

Click “Add” to add a new DDNS service

  1. Service Provider: *DNSMADEEASY
  2. Hostname: Dynamic DNS ID from DNS Made Easy
  3. Username/Email: your DNS Made Easy email
  4. Password/Key: your chosen DNSMadeEasy DDNS password

Once you save the new DDNS provider you should see the status to go “Normal” in a green color. This means the update was successful. You should now be able to PING the DNS record or if you log in to DNS Made Easy the IP address should have changed to the external IP of your DiskStation.

Getting Fujitsu ScanSnap S1300i to work on Ubuntu 16.04LTS

ScanSnap 1300i

Upgrade or install SANE backends

Since the version of SANE in the Ubuntu 16.04LTS repos is not working for this scanner you either need to install from sources (see this blog) or from this PPA.
sudo add-apt-repository ppa:rolfbensch/sane-git
sudo apt update
sudo apt install sane-backends tesseract-ocr gscan2pdf


Add yourself to the ‘scanner’ group to be able to use the scanner.

sudo usermod -a -G scanner USERNAME

Checking SANE

Check for the libsane version (needs to be at least libsane.so.1.0.26 not libsane.so.1.0.25 which is in the Ubuntu repos)

sudo ldconfig -v | grep libsane

This should show something like: libsane.so.1 -> libsane.so.1.0.26

Add udev rules for the scanner

sudo vim /etc/udev/rules.d/79-scanner.rules
#add the following
Fujitsu ScanSnap S1300i
ATTRS{idVendor}=="04c5", ATTRS{idProduct}=="128d", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

Get the firmware for the FUJITSU ScanSnap S1300i

sudo mkdir /usr/share/sane/epjitsu
cd /usr/share/sane/epjitsu
sudo wget https://github.com/ckunte/scansnap-firmware/raw/master/1300i_0D12.nal


scanimage -L

>> device `epjitsu:libusb:002:027′ is a FUJITSU ScanSnap S1300i scanner

You can now use gscan2pdf to scan, clean and OCR from the ScanSnap S1300i.

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: https://www.raspberrypi.org/downloads/raspbian/

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

Configure Raspberry Pi settings

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

Giving Opera another spin – ad-blocking as a core feature

I haven’t been using Opera for quite a while as I didn’t really have a need for a third browser lately (Firefox & Chrome being the main ones). However I came across this article today mentioning that Opera has integrated ad-blocking as a core feature rather than a plugin to manage.

If there were no bloated ads, some top websites would load up to 90% faster.

Today, we wanted to share with you a native ad-blocking technology in our Developer channel for Opera for computers. “Native” means unmatched speed vs extensions, since the blocking happens at the web engine level.

We are the first major browser vendor to integrate an ad-blocking feature, but this development should be a no surprise to anyone given the rising popularity of ad-blocking software and even Apple allowing it on its platform.

Install procedure (Ubuntu 15.10)

sudo add-apt-repository 'deb https://deb.opera.com/opera-stable/ stable non-free'
wget -qO- https://deb.opera.com/archive.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install opera-stable

Original: http://www.opera.com/blogs/desktop/2016/03/native-ad-blocking-feature-opera-for-computers/

Install Hugo on Ubuntu to generate static websites

Whilst there is a .DEB installer to download from the GoHugo sites I get all matter of warnings that the package is of bad quality and I am not comfortable to run these kinds of installers.

Hugo Logo

I rather install from sources in this case which is very straight forward since the main dependencies (largely GO) are in the Ubuntu main repositories.

Install dependencies

sudo apt-get install golang git mercurial python-pygments

Create environment variables

vim ~/.bashrc
#add the following 3 lines
export GOROOT=/usr/lib/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Update Bash Environment Variables without logging out.

source ~/.bashrc

Install Hugo

go get -u -v github.com/spf13/hugo

Start using Hugo

#create new site
hugo new sitename /path/to/sitename
#change directory to site
cd /path/to/sitename
#create content page
hugo new about.md
#edit content page
vim content/about.md

Good bye Android ? Hello Ubuntu ! Not yet unfortunately …

As a long-term Ubuntu user I am extremely interested in what Canonical and the Ubuntu community are doing on the mobile front. Their convergence strategy (I am testing Snappy Core on IoT devices as well) seems very well thought through and once the the Meizu MX4 phone was released I got myself an invite and ordered a unit. It took a while to ship and then also had to make it’s way down under as Meizu only ship to Europe (and Asia I believe).

Meizu MX4 Ubuntu

Having played with Ubuntu on the phone a while ago on an old Nexus 4 as well as a Nexus 7 unit it was a much more pleasant initial experience and I was really hoping to make this my day-to-day phone. After the initial excitement and a few days of use (including with my main SIM card) however it is clear that we’re not at this stage yet. I am quite prepared to forego some conveniences I got used to on CyanogenMod (Android) over the years, but at this stage there are just too many things not working consistently. On the surface most of the critical components are there, but there is just too many bugs and inconsistencies in heavy usage left to make this a solid experience unfortunately. The single button hardware also doesn’t seem to work with the UI as in a lot of places you are searching for a back button and there ain’t one. And to my surprise the browser feels pretty horrible and lacks a lot of functionality. If the browser would work solidly a lot of the missing apps would be bearable. But this coupled with lack of stability prevent me from taking the plunge I was hoping to make and ‘de-google’ a little more….

It might work if you use your phone for voice calls and occasionally browsing. But as a very heavy user relying on the phone for work the overall stability is some way off.

The Great

  • A phone where you don’t have to jump through unreasonable hoops to get under the hood
  • Refreshingly different & pleasant UI
  • Very developer friendly
  • Terminal – it just works …
  • All Linux CLI programs (armhf) at your fingertips

The Good

  • All pre-installed crap-ware such as Ebay & Amazon apps easy to remove (would be nice not to have them – but they need to make some money)
  • Phone functions are solid and good voice quality
  • Camera on the MX4 is pretty decent
  • Familiar to Ubuntu users
  • Great selection of Reddit clients & German IPTV apps ;-)

The Bad

  • The inbuilt browser is very under-cooked – missing basic functionality plus not very intuitive rendering
  • Sharing between apps not working well – plus lack of apps that support intents – something extremely useful that Android really shines at
  • Calendaring
  • UI still seems sluggish for the computing power available on MX4

The Ugly

  • Stability – lots of apps (web-apps) refuse to display randomly
  • Home screen lock-ups with no other options than reboot
  • Many of the apps that are available are of very questionable quality – mostly websites with wrapper

I will keep a very close eye on what’s happening with the next releases (OTA6 release is due in 5 weeks) and in the meantime will help out with testing & debugging. I have been really pleasantly surprised by the responsiveness of the developers (for example the missing WIFI Hotspot functionality – it will be available next release and the devs sent me an invite to the pre-release after asking a question on Reddit). I don’t want this to be seen as dismissal of Ubuntu on phones. Just some realism as I feel selling this phone as a ‘finished’ product by Meizu is a mistake that could damage the overall aim. I still hope to settle there eventually. The community is working very hard and it’s just a question of time…

Views ‘under the hood’ of Ubuntu Phone

Here are some initial notes on how to get “under the hood” access to the Ubuntu phone.

Enable Developer mode

System Settings –> About this phone –> Developer Mode

Ubuntu Phone - Developer Mode

Install tools on the desktop / notbook device

sudo apt-get install phablet-tools

Connect via SSH

vim .android/adb_usb.ini
#add the following line to allow adb access to device

sudo vim /etc/udev/rules.d/51-android.rules
#Meizu MX4
SUBSYSTEM=="usb", ATTR{idVendor}=="2a45", ATTR{idProduct}=="0c02", MODE="0664" OWNER=""


Important note: the phone needs to be unlocked for this (and other phablet-tools commands) to work. If the phone is locked you will get a series of adb error messages.

Change Ubuntu Touch Channel

adb shell
sudo system-image-cli --switch ubuntu-touch/rc-proposed/meizu.en

More info on channels here: https://developer.ubuntu.com/en/start/ubuntu-for-devices/image-channels/

Make filesystem writable

DISCLAIMER: Proceed with caution ! You can do some serious damage if you don’t know what you are doing. But on the other hand you have the whole power of apt-get install available to install armhf packages that might be useful.

phablet-config writable-image

Disable writable mode

sudo rm /userdata/.writable_image


Taking screenshots is something I commonly like to do for documentation purposes.

Via commandline


Via phone

Hold volume up and volume down until you hear the picture sound and see the screenshot flash.

In both cases your screenshot will be saved in /home/phablet/Pictures/Screenshots and you can view them using the gallery app or download via USB.


Currently there is no way to change you ringtones in the UI and I fully agree that the focus should be on much more important functions. But I got used to my ringtone and don’t respond to others anymore.

sudo cp /home/phablet/Downloads/ringtones/GoodBadUgly.ogg /usr/share/sounds/ubuntu/ringtones/

Note: the sudo password for the “phablet” user is the same as you set for your screen-lock.

ChromeOS – removing SSH known_hosts from Chromebook

One of the things that is not implemented in the Secure Shell Chrome extension is the ability to remove know_host fingerprints which alert you if the fingerprint for a specific IP address has changed.

However there are times when you upgrade a systems and this need to be done.

Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /.ssh/known_hosts:7
ECDSA host key for xxxxxxxxxxxxx.yyy.au has changed and you have requested strict checking.
Host key verification failed.
NaCl plugin exited with status code 255.
(R)econnect, (C)hoose another connection, or E(x)it?

Here is how to remove a known host fingerprint (from known_hosts) on a Chromebook.

You can find the index of the offending host entry reported by ssh if the connection fails (see above: “Offending ECDSA key in /.ssh/known_hosts:7”). Then you can open the JavaScript console (CTRL +Shift +J) and type the following into the console.

Replace INDEX with the number obviously.

To clear all the known hosts:

OpenVPN – fix issues with DNS server assignment (Synology NAS)

Synology NAS systems are great VPN servers for a home or small office. However if you want to connect to the VPN and route all your traffic through the VPN and be able to browse the internet there are a few things you need to change on the Synology server.

Theoretically you should be able to set these options on the client, but I have not managed to get this to work with Synology and judging by the amount of forum threads a lot of other people had the same problem. If somebody has a better way to fix this I would love to know. I don’t like to manually change these config files as I assume they will be overwritten when making changes to the web-interface.

vi /usr/syno/etc/packages/VPNCenter/openvpn/openvpn.conf

add the following lines.

push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS"
push "dhcp-option DNS"

Please note that the DNS option are Google’s public DNS servers as an example, you probably want to use your ISP’s (the one hosting the Synology server that is) DNS IP’s instead.

Please note that this was tested with Synology DSM version 5.2 only and Ubuntu & Android as the main client OS. Please leave comment for other combinations.

Finding Notebook Hardware for Ubuntu – 2015 Edition

Unfortunately it is still much harder than necessary to find notebook hardware to use with Ubuntu (or other Linux variants). This blog is full of past experiences (some of them quite time-consuming) on finding notebook hardware that will work without too much fiddling. This short note is to document my recent research on that front to help others who want to do the same (as there doesn’t seem to be a lot of good current info around).

There are some vendors that do ship with Ubuntu, however they are generally all based in the US and their pre-sales communications are pretty horrible (I am talking to you ZaReason – still waiting for reply email as well as tweet). Then there is Purism Librem, but unfortunately they have still not shipped their 15″ version and I need a tool now. The jury on this is still out and I don’t really have the time to be a guinea-pig. Maybe next time (as I like what they are doing) …

There was one option from one of the top-tier manufacturers (Dell XPS 13 – Developer Edition) which ships with Ubuntu. But as – per usual – NOT in Australia. However there was a lot of conflicting evidence I found that the Windows Version had some issues with current Ubuntu versions (Dell ship 14.04 LTS – which makes sense from their point).

I ended up buying the Lenovo X1 (3rd Generation) and after the install of Ubuntu I have to say this is the first notebook I just had to plug in the Ubuntu USB (Version 15.04 Vivid Vervet 64bit) and install and everything just worked. No fighting with UEFI firmware, no function keys not working and no issues with sound or other drivers. To be fair – there is one thing I noted (which is irrelevant to me) – the fingerprint reader does need some additional driver installed & configured.

It was also the first notebook I didn’t even bother booting up and create a repair disk first. There is no way I would ever restore something to Windows 8 – however if you are not sure that you will stick with Ubuntu – that’s probably not advisable.

Thank you Lenovo for developing a very decent piece of hardware that just works with Ubuntu ! However I would like to note that the recent Superfish debacle http://support.lenovo.com/us/en/product_security/superfish really left a sour taste and nearly made me take Lenovo off the evaluation list.

Some conversations that might be useful: