HackSpace – September 2019

(Jacob Rumans) #1

TUTORIAL


Let’s learn LoRa!


TO THE THINGS NETWORK
We’ll use The Things Network as the glue to hold
our sensor together with dashabord (which we’ll
look at in a bit). Navigate to hsmag.cc/BtGluJ and
register an account. Once registered and logged in,
you should see a link for ‘console’ in a drop-down
list when you click your username. Navigate to the
console and you should see two large icons: one
that says applications and one that says gateways.
We are (hopefully) going to rely on you being in
range of a gateway, so we are interested in setting
up an application: click the Application icon.
An application, in terms of The Things Network,
can be thought of as the area to which your devices
or nodes (in this case, your The Things Uno) will
send their data. It is here that the The Things
Network will choose where to send and what to do
with the data it receives. An application can receive
data from multiple nodes or devices and can also
be integrated into other online services that allow
you to do things with the data (for example, send
a text message when a temperature gets too high,
populate a dashboard, send key information to an
online spreadsheet).
For now, we are going to create one simple
application to receive data from our The Things Uno,
which will be the humidity and temperature from our
DHT11 sensor. Click the ‘Add application’ button in
the top right-hand corner and give it an application
name – note that these have to be in lower case
and also have to be unique, so if you try ‘test’ for
example, you will probably find when you try to
add the application, it has already been used. As
instructed in the second section, add some human-
readable text to remind you what this application is;
for example, ‘HackSpace tutorial temperature and
humidity example’.

The last two input boxes should be as we want
them, with ‘Application EUI’ set to ‘EUI issued by
The Things Network’, and ‘Handler registration’ set
to ‘ttn-handler-eu’. Leave these as they are and click
the turquoise ‘Add application’ (Figure 3) button in
the lower right-hand side of the page.
The application should now be created and you
will be pushed on to the Application Overview
page. If you scroll down this page, you should find
a section called ‘Devices’ which will show there are
no registered devices. So let’s add a device, which
will be our The Things Uno, so that our hardware can
connect to this application. On the upper right-hand

side of the devices box, click ‘Register device’.
In the resulting Device Registration page, give the
device a device ID and then copy the ‘Dev EUI’
from the text document we made earlier when we
got the device information off our The Things Uno
via the device info sketch. Leave the App Key field
on this page as it is (set to be generated by The
Things Network) and click the turquoise ‘Register’
button in the lower right-hand corner (Figure 4).
You should now end up on the ‘Device Overview’
page for the device you just registered. There is a lot
of information on this page, including the activation
method (which should be OTAA) and the various
keys that the device has or needs to communicate
with the application. If we scroll down to the

Use The Things
Network website
map to see if you
are close to any
LoRa gateways.

QUICK TIP


Figure 3
Adding an application
to our The Things
Network account
Figure 4
Registering a device
into an application on
The Things Network is
essentially introducing
The Things Network
to our The Things
Uno so that they are
connected and enabled
to communicate with
each other

For now, we are going to
create one simple application
to receive data from our
The Things Uno


Free download pdf