Intro – The essential information

Asian setup – LoRaWAN 1.0 using AS923 AS1 (920-923 MHz)

  • There is a channel standard called AU915 but this is inferior to the newer AS923 and should be avoided. The major issue with AU915 that it has a parameter that segments the channels and devices and gateways can use an incompatible parameter – so prior coordination is need to make sure devices and gateways that both support AU915 are in fact using the same parameter and are compatible.
  • AS923 is a common standard to many Asian countries, but note that LoRaWAN is typically different in each country due the available radio spectrum

Gateways are 8 channel (they must be at least 3 channel) to be LoRaWAN

  • In AUS there are 3 different LoRa ISM bands
  • 433 MHz
  • 915 – 928 MHz
  • 2.4 GHz

LoRa devices use radio chips that support specific frequencies ranges

TIP - check the product and find out the LoRa chipset using in it to look up the datasheet so you get a 915-928 MHz one and don’t accidently buy a device with a European 868 MHz chipset

We will focus only on 920-923 MHz devices in the workshop as these have the longest range and lowest power and is what the LoRaTAS infrastructure supports.

LoRaWAN Architecture



LoRa gateway hardware out in the wild

LoRaTAS gateways are public and all the gateways are at least 8 channel

TIP - some single channel “gateways” have become available.  These cannot be used for LoRaWAN.  A device that is setup to communicate with them will not work or roam on the LoRaTAS LoRaWAN.  E.g. the new Jaycar LoRa gateway is correctly named, as it is not a LoRaWAN gateway.


What you are building in the workshop

In this workshop, you will be building a LoRaWAN temperature sensor.  The components have been prepared to avoid the need for soldering them in the workshop.

TIP - the sensors and components will all need to be returned at the end of the workshop – please don’t blow then up.

  • What the sensor will do when finished
  • Automatically connect to a LoRaTAS gateway when it is within range
  • Measure the temperature at a regular, and configurable interval
  • Send the measurements over LoRa through the network servers and into the Sensor Cloud (the Sense-T Data Platform)

What you will get to see in the workshop

  • One possible option for LoRa hardware to get started with LoRa devices
  • The steps to registering a LoRa device
  • How the device joins and sends data
  • The mechanism available for applications to access the data send by devices
  • How easy it is to get your first working end-to-end LoRa application started


Step 1.  Get familiar with the device

We have chosen to use the Adafruit Feather M0 RFM95 LoRa Radio 900 MHz for the workshop. It is not the only option and there is no “best” LoRa device but this has some useful features on board (pun intended).

Some details about it from Adafruit

“At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0 processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new Arduino Zero. This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and 32K of RAM (16x as much)! This chip comes with built in USB so it has USB-to-Serial program & debug capability built in with no need for an FTDI-like chip.

To make it easy to use for portable projects, we added a connector for any of our 3.7V Lithium polymer batteries and built in battery charging. You don't need a battery, it will run just fine straight from the micro USB connector. But, if you do have a battery, you can take it on the go, then plug in the USB to recharge. The Feather will automatically switch over to USB power when its available. We also tied the battery thru a divider to an analog pin, so you can measure and monitor the battery voltage to detect when you need a recharge.”

 This LoRa board is an Ardunio compatible board, so the programming will be familiar to people who have Arduino experience.

This LoRa board is an Ardunio compatible board, so the programming will be familiar to people who have Arduino experience.


Step 2 – Install and setup the Arduino programming environment on your laptop

Download and install the Arduino IDE.  Get it from

After it is installed open the IDE.  We need to add board information, so open File-> Preferences, then in the Additional Board Manager URLs add the following for adafruit


Now Save the preferences by clicking OK

Install the base support for M0 processors

1. We want to install support in the IDE for SAMD board details, so open Tools-> Board-> Board Manager

2. In the board Manger find the Arduino SAMD Boards (32bits ARM Cortex-M0+), click it and then install the latest version


Install the support for the Adafruit feather (NOTE: this is a second install in the board manager)

3. Now a install a SECOND config in the board.  This second one is needed to support the specifics of the actual Adafruit board config for the Feather M0

4. In the Board Manager find the Adafruit SAMD Boards by Adafruit.  Choose it and install the latest version


TIP – Check that you just installed two configurations in the board manager

Finally, connect the feather on with a USB cable.  In the IDE choose Tools-> Board and from the list choose Adafruit Feather M0

TIP – the board option for Feather M0 is probably right down at the bottom of the board type list which may require scrolling down to see it

If you are using Windows

You need drivers (honestly, change to use Linux or OSX for hardware, but anyway it is what it is). Install the drivers from

Follow the instructions and complete the installation

Now choose Tools-> Port and there should be one that says something like “Adafruit Feather M0”

You are now connected to the Feather and can start programming it.

Step 3.  Run a simple example to test everything is working


Often the best application to started with on a new piece of hardware is a simple program to make an LED blink. It confirms the connection between you and the hardware are ok and you can easily see the results.

You could type in the code, but this is a LoRa workshop and not an Arduino workshop and the Arduino IDE comes with lots of example code, so we will use one of those aptly named “Blink”.  Open File-> Examples-> 01.Basics-> Blink

In the new code window that opens there is a tick icon at the top left, click that to compile. Then if there are no errors click the arrow icon next to it to load the program onto the Feather.  A moment after it loads you should see the red LED pulse on and off in a slow regular 1 second beat.  If that all worked we will get into firing up the temperature sensor on the Feather.


Step 4. Connecting a temperature sensor and reading it over USB

We chose to use a temperature sensor with a OneWire interface.  There are a few neat features of the OneWire interface, firstly it only uses a few wires, and because each OneWire sensor has a unique id it is a bus that allows a chain of sensors to be connected to the same pins. 

The first part is to connect the sensor.  It requires a pullup resistor and the connections to be made as shown below


The Dallas DS18B20+ temperature sensor requires two libraries to be installed. The first is DallasTemperature by Burton et al, and the second is OneWire by Studt et al.

Get the code file tutorial2_dalas-emp.ino from the workshop files

To add a library, go to the sketch menu, then “Include Library” and select “Manage Libraries…”.


Use the search bar at the top of the window and type in Dallas in the search.  Chose the DallasTemperature by Burton et al and install it


Now do the same for the OneWire by Studt et al.


You can now compile the and upload to the Feather M0. Now open Tools-> Serial Monitor and the new window will be output coming from the Feather.  If the temperature sensor is working the output should look something like this with a value every second


(The antenna length for a frequency of 923MHz signal should be 81.2mm long. However, the PCB trace from the module’s amplifier to the hole (via) in the PCB has a length of roughly 5mm, and with the wire required to pass through the via, the wire cut length should be around 78mm

Step 5. Reporting the temperature over LoRa Radio

Modifying the board

TIP - Leave the existing connections as is. 

We have already attached a wire antenna (approx. 78mm long for AS923[1]) on your board. 

You need to add timing connections from the LoRa module to the microcontroller as shown below



Creating a The Things Network Account

1.      Go to in your favourite web browser.

2.      Enter details and register


3.      Go to your email and press the activation link. A new window will open in your browser.

4.      From the new page, go to the console.


5.      Now click the big applications button.


6.      An application is a group of devices used for a common purpose. In this case the common purpose is to measure temperature. If you were developing your own application you might create one, but we aren’t going to do that for the workshop

7.      Please tell the workshop coordinator your ThingsNetwork username and you will be added into our common application for the workshop.

The list will be empty until we add you as a contributor on the workshop application

8.      Once you have been added to the workshop  application you must add your device. Click on “register device”.


9.      Give your device a name, we suggest using a name with the device type and your group number in it so it is easier to identify it during the workshop, eg. feather_device10. You can have the Device EUI made for you by clicking the button next to the field. Then click register.


10.  A device will now have been created

11.  Take note the page for your device with the Device EUI, Application EUIs are and the App Key. You will need to come back to this when we put new code onto the device.


Use a new sketch for the LoRawan code

1.      Get the library from the workshop files

2.      In the Arduino IDE for to Sketch-> Include Library-> Add .Zip Library…   and choose the zip file.  The IDE will put the files in the right place and the library will be available

3.      Get the code file tnn-otaa-temp.ino from the workshop files

4.      Go to the device page on the things network.  The LMIC library needs the values in a particular format so use the interface in to change the format as shown in the screenshot below


TIP - Use the buttons with the two arrows to change the format of the fields

 The  button changes to the { 0x00 } format

The  button toggles the lsb and msb order


5.      Update the code file with the values and compile and upload it to your device



Step 7 Run code to pull the values off the back of the LoRaWAN infrustrucutre


See the packets coming through from the device

To get the packets off the infrastructure we will use an MQTT client. There are a few options and in the next step we will use code to do this and process the packets of data.

First, we will see the packets at the gateway, device and then the raw stream off the application backend of the LoRaWAN servers

1.      Make sure you code and device have the changes from the steps above. Upload the Arduino sketch and open the serial monitor

2.      Your workshop coordinator may put the gateway data on the screen so that you can also see what is happening on the gateway (you don’t need that and normally would not get access to that but seeing it is a good way to understand what is happening.

3.      Also go to your device on the things network and click the tab -> Data.  That will show a list of events from your device.  Once the gateway has received your device’s transmissions and forwarded them to the backend they will be listed in this tab

4.      TIP – only data received while you are watching is shown, TTN doesn’t store the data


Use MQTT to subscribe to the events and data

1.      There are a couple of options for mqtt tools – install one
mosquito is a widely used commandline tool
mqttbox (either Chrome extension or stand alone) is a graphical user interface

2.      Configure a connection and subscribe

Username:                  loratas_workshop   //the application name

Password:                   application key        //copy this application page

Protcol:                       mqtt/tcp


Subscribe to the following mqtt topics

1.      The join events come through the following topic

loratas_workshop/devices/{put your device id here}/events/activations

2.      The data comes through the following topic

loratas_workshop/devices/{put your device id here}/up


TIP – To subscribe to all devices use “+” as the device

            i.e. loratas_workshop/devices/+/events/activations


TIP – an example command line call for mosquito

            $>  mosquitto_sub -h -t 'loratas_workshop/devices/+/events/activations' -u 'loratas_workshop' -P ‘ttn-account-v2.eV5DeYqGIbK1PXdxpoaWp_B_sBgs3pFFC9YJtLb2zmM'


Setup a place to put the data


In the workshop we are going to put the data in the Sense-T Data Platform


1.      Go to

2.      Click login in the top right, then Create an Account

3.      Signup with a valid email and then login for the first time

4.      Now let the workshop coordinator know the email you used, they will now invite your into the loratas_workshop group on the platform.  Once you accept the invite email  you will be able to register you device so that the data can be sent to the platform.

5.      We need to put a place to store the temperature and battery voltage that we will send to the platform over LoRaWAN.  You will create two datastreams, so this will be a similar part you do twice. So to start

a.       Use to the menu +New -> Datastream

b.      Fill in the id with your device id, then the device EUI and description of the

Id: YOUR_deviceid_temp

Type: Scalar

Org: LoRaTAS

Group: LoRaTAS workshop

Ignore location

Sampling period: 1 minute

Reporting period: 1 minute

Observed property: type in “air temp” and hit search.  Choose “air temperature” from the list

Units: type in “degree” and hit search.  Choose “Degree Celsius”

Interpolation: Continuous

c.       Save that datastream and use to the menu again, +New -> Datastream

d.      Create a datastream to store battery voltage of your device

Id: YOUR_deviceid_voltage

Type: Scalar

Org: LoRaTAS

Group: LoRaTAS workshop

Ignore location

Sampling period: 1 minute

Reporting period: 1 minute

Observed property: type in “battery” and hit search.  Choose “battery voltage” from the list

Units: type in “volt” and hit search.  Choose “Volt”

Interpolation: Continuous

e.      Save that datastream


6.      Now get your authentication

a.       In the Sense-T Data Platform on the left hand menu open API -> API Docs

b.      In the new page type in your email and password in the header line and click Explore

c.       Now click “Operations” in the page, and expand the first item GET /

d.      In the panel under the command is a “try it now” button, click it. 

e.      If all goes well you will get a result, but we only want the Auth, so find the line Curl, and in that line the Authorisation value, in the example below is has been changed to all “x”.  Copy that part from the Curl and keep a copy of it for the next stage

"Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"


Now we need to run code to get the data, process it as new data arrives and put it somewhere


Option 1 – Python on your computer (cheap, but stops when your computer or internet do)


1.      Install python 3.6 (or 2.7 if you know you need to be compatible for older apps)

2.      Install paho-mqtt and requests with pip the python package manager

a.       pip install paho-mqtt

b.      pip install requests

3.      Get the file and edit the credentials to match your device

4.      Run it

a.       $> python


Option 2 – Python in the cloud (so it runs while your computer sleeps)


There are a range of python hosting options.  AWS is free for small instance, but tricky to setup.  An option that is easy but will cost $5 per month is PythonAnywhere and it can be free for education so we will show that here.


·         For PythonAnywhere signup and login

·         Upgrade your account to paid (expect around $5 /month)

·         Get the file and edit the settings for your device

·         Upload the file to PythonAnywhere

·         Open a bash console in PythonAnywhere

$> mkvirtualenv loraenv --python=python3.6

$> pip install paho-mqtt

$> pip install requests

$> python



TIP - By now all the IDs, etc are probably second nature, but in the python script the TTN values match the MQTT settings you have already used.  The Platform settings are for the datastreams you created on the platform and the authorisation is what you kept a record of after running a “try now” on the platform API


View the data

With everything working you can now go to the Data Platform and view your two datastreams on a chart. 


1.      Go to Data-> Datastreams and open the list.

2.      Type in the device ID or the start of the EUI on the filter at the top of the ID column (that is why we asked you to add the EUI the the ID)

3.      When your streams are in the filtered list click Add to Chart on the right for each of them.  When you have the Chart button will appear in the header on the page (and show 2 as the number of streams.)  Now click on that Chart button in the header and your data will load as a time series.

4.      To zoom in on the data click on Latest 24 hours below the chart. 


TIP – you can also select part of the timeline and top view of the chart will zoom to your selection. 


5.      Hit the refresh button on your browser to get the latest data and view the chart worm along. 


TIP – as the sensor is measuring temperature try a few locations or heat the sensor with your finger and then refresh the chart to see the change


You have now completed the end-to-end workshop


If you get to here early there are a few options to do more


1.      Change the sensor to one measuring temperature and humidity

2.      Team up with another group and chain two temperature sensors together and send both values

3.      Alternative LoRa device hardware – mDot and LoPy

4.      Add a data logger

5.      Add a GPS

6.      Add an RGB display to show what the device is doing



Please feel free to contact me for deeper questions and keep in touch


Dr Paul Neumeyer

0418 400 656