Setting up The Things Node to help you get dressed in the morning
A beginners experience of utilising LoRaWan and The Things Network to monitor outside temperature.
I live on a hill in West Yorkshire. It can get cold and just recently it has been really cold... The workshop where I spend a lot of my time working for AB Open can also get very cold, so I’ve become a bit obsessed with the weather and the temperature in particular. Getting dressed in the morning I need to decide how many layers I’m putting on, so a quick way to check the outside temperature would be really useful.
I’ve got the usual weather apps on my ‘phone and I’d looked at the different weather stations on offer at varying prices, but decided I didn’t want yet another screen in the house (particularly as they mostly seemed to be nasty beige plastic things). So what I wanted was something that would work with my laptop and/or phone and would provide an interesting experience for an inveterate “tinkerer”.
The Things Network
I had spent some time at work recently setting up some environmental sensors connected to The Things Network and decided something along those lines would be a good solution. After some research I decided that The Things Node (135-9784) would provide a suitable “off the shelf” sensor; it is weather proof, which is essential as it was going to live outside, and would provide more than enough data for my needs.
Setting up The Things Node
Once I got my hands on the node I needed to set it up. It is based on a Sparkfun Pro Micro Arduino board, so I installed the Arduino IDE following these guidelines – including the useful bit at the end that tells you what to do if you get an “Error opening serial port ...”. I then added the additional board manager URL for the Sparkfun AVR boards and The Things Network and Node libraries following the instructions.
I initially had some trouble getting the Node to connect to a computer running Ubuntu, but it worked fine on a Windows machine and so I went ahead and used that to complete the next task, which was to interrogate the Node and get its DeviceEUI – a unique address hard-coded into the Node’s LoRa module. This is needed to register the device on the Things Network.
I took the back off the Node by removing the 2 phillips screws to reveal its battery compartment and a Micro-USB socket. I connected the Node to the PC, opened Arduino IDE, double checked that I had the “Sparkfun Pro Micro Board” with the “ATMega32U4 (3.3v, 8 MHz) processor selected in the Tools menu, then opened the DeviceInfo Sketch from TheThingsNode library, edited it to replace “REPLACE_ME” with “TTN_FP_EU868” to give the correct Frequency Plan for Europe and uploaded it to the Node.
I then hit the Serial Monitor button on Arduino IDE and copied and pasted the details it displayed into text document so I’d have it for reference later.
The next step was to set up my own Application on The Things Network. I already had an account and so I logged in, navigated to the Console, clicked on the big Applications button and followed the “add application” procedure.
I then needed to register my Node. I clicked on the Devices link in my newly created Application, followed the “register device” link and filled out the 2 necessary fields giving my Node its own Device ID and entering the Device EUI that I’d obtained earlier, clicked on the “Register” button and that was it.
Creating a simple Android App
I then started wondering if I could make it even clearer and more accessible, and after some research decided I needed to add an Integration. To quote the very helpful The Things Network website,“ Platform Integrations are full integrations with external IoT platforms to synchronize the device registry and uplink and downlink data, so you don’t need to write code or use The Things Network Console.”
I decided to go with the Cayenne Integration as there was lots of support and help out there for a beginner and it had a nice Android App I could put on my ‘phone.
Again the Things Network website provided really clear instructions. I uploaded the CayenneLPP Sketch from the TheThingsNode library to my Node, remembering to set the Payload Format to Cayenne - and then I had quick access to the outside temperature with one tap on my phone.
I also used Cayenne’s Trigger function to send me a text if the temperature dropped below zero.
Installing a Gateway at Home
When I got my Node home and put it outside I found it could not reach the nearest existing gateways, so I needed to install a gateway and decided upon The Things Network Gateway (135-9783) . This proved easy enough, following the instructions on the web page given in the paperwork that came with the Gateway.
Once this was set up the sensor was able to join the network and send data up to The Things Network and on to Cayenne.
This was the first time I’d done anything Arduino related and my first go at setting up my own Internet of Things device, but thanks to the instructions and explanations provided by The Things Network, I found it all relatively straightforward. As a self-confessed tinkerer, I’m already thinking what else I can do with both the Arduino and the IoT.