My apologies to my regular Dutch readers, given the nature of the topic I am going to do this post in English also. I promise to return to the regular Dutch posts.
When I wrote about connecting the Marvin board to the LoRaWAN network in the previous post, my conclusion was: wow, great, KPN truly does offer easy access to LoRaWAN and it even has coverage in my hometown whereas The Things Network (TTN) has a far from complete coverage in the Netherlands. (Yes, I know, I can add my own gateway, but before I’m going to spend a lot of money on something like this, I would like to play with it first).
Downside of KPN was/is the costs involved in using it beyond the 71 (72?) day trial period. So I wanted to try to connect the Marvin to The Things Network. For that I first needed something that could act as a gateway. I do have a LoPy, but had been unable to get that setup as a gateway. Luckily I also had a Dragino Lora Shield that I had ordered via AliExpress for $19.- a while back. I hadn’t had the time to try and get it to work as a single channel gateway, but now I did. I used the easy to follow instructions available on mobilefish.com. In my case I used an old Raspberry Pi 1 since it does not have to do too much anyway and I am only going to use it for testing purposes.
Within 10 minutes I had my first gateway online. Thanks Robert!
Next step was getting the Marvin to connect to TTN. I am really new to everything LoRaWAN related, but have some Arduino experience, so a .ino file does not scare me. I took a look at the Arduino script that I used for the temperature / humidity measurements (side note: a working version of the script for KPN is available on github). I could not find too much that looked KPN specific.
The only thing that I had to set for KPN were the set_nwkskey, set_appskey and set_devaddr variables. So next I had a look around in the devices section of the console at TTN. And what do you know? If you select Activation by Personalisation (ABP) as the authentication method, then TTN provides you with just those three keys. Would it really be that easy? Yes! 🙂