FORGE
Next, we need to install some libraries we are
going to use in this tutorial. We’ll install two of
them using the Arduino IDE libraries manager, and
download and manually install one from the internet.
Open the Arduino IDE and then click Tools > Manage
libraries (Figure 2). The first library we are going
to install is called ‘The Things Network’, so type
that into the ‘filter your search’ bar at the top of
the library manager. You should find a library whose
description begins ‘The Things Network by Johan
Stokking, Ludo Teirlinck...’ – select this library and
click Install. Repeat the above process, searching for
‘cayenne LPP’ to install a library called ‘CayenneLPP
by Electronic Cats’. Finally, to install the third library,
we need to download it from hsmag.cc/pEDXUY.
Click the large green ‘Clone or download’ button
and then click the Download ZIP option. Once
downloaded in the Arduino IDE, click Sketch >
Include Library > Add .ZIP Library, and then navigate
to where you downloaded the zip file, and select it.
We are going to work with The Things Uno, which
is essentially an Arduino-shaped board that has
the LoRa communications chip built into it
”
”
Figure 2
Using the
Arduino IDE
library manager
to install the
libraries we need
for our project
GOING LOCAL
The next job is to upload an example sketch from
The Things Network library we just installed. Click
File > Examples > TheThingsNetwork > Device
info in the sketch that is open – we need to make
one small change before we can use this sketch.
The Things Uno frequency for Europe is 868MHz,
so we need to replace some text. Edit the sketch
so that the ‘REPLACE_ME’ is replaced with ‘TTN_
FP_EU868’. Readers in other regions will need
to replace it with the example that matches the
frequency available in your region – it can be found
on a sticker on the reverse of your The Things Uno.
Double-check your board is still connected and
set to Arduino Leonardo, and the port is correct.
Verify and upload the device info sketch to your The
Things Uno. Once uploaded, you need to open the
serial monitor in the Arduino IDE, this can either be
opened by clicking the Magnifying Glass icon at the
top right-hand side of the screen or clicking Tools
> Serial monitor. In the serial monitor after a few
seconds, you should see some details appear that
are unique to your The Things Uno – copy and paste
these details into a text document somewhere on
your computer for later use.
We’ve now got the hardware set up and
configured, it’s time to take a look at the networking
side of things. This is what gives us some where to
send our data to.
PUBLIC NETWORK
The Things Network is a community-hosted network
that consists of gateways connected to the internet.
LoRaWAN devices, in our case a The Things Uno,
can be received by any gateway, and their data
packets are then forwarded to an account registered
by the device owner on The Things Network website.
The website application can be set up to integrate
or forward those pieces of information to other
systems, allowing the user to create a visual web
dashboard, a phone application, an SMS alert, an
email, or other options triggered or populated by
the data from the device or devices in the field. The
Things Network website has a map of gateways –
check and see if you have one locally that you may
be able to connect to.
YOU’LL NEED
The Things
Uno
DHT11 or DHT22
temperature and
humidity sensor
Some
breadboard
connector wires
Micro USB
cable
Access to a LoRa
gateway (see
tutorial for details)