Deploying a RAK Gateway With LoRa Basics™ Station With TTN and Balena

RAK’s José Marcelino’s and Balena’s Marc Pous demonstrated deploying RAK’s developer gateways with a new reliable and much secure protocol running on top of Balena’s container technology

Last July, our solutions architect together with Balena showcased a tutorial for provisioning RAK’s developer LPWAN gateways with the newest Packet Forwarder protocol, LoRa Basics™ Station on The Things Network (TTN). This new protocol utilizes JSON format over WebSockets (TCP based), supports TLS encryption and certificates-based authentication between the gateway and the cloud service bringing much-improved security and reliable data transmission. Many LoRaWAN® operators as well as the community are now adopting it as a replacement for the long deprecated de facto standard UDP based protocol.

In the tutorial, Marc and José used the following hardware:

  • Raspberry Pi 4
  • RAK2245 LPWAN Gateway Concentrator Module at Marc’s office in Barcelona, Spain
  • RAK2287 and respective Pi HAT at José’s site in Newcastle upon Tyne, UK
  • microSD card

On the other hand, the software requirements are as follow:

  • A TTN or The Things Industries account
  • A free balenaCloud account.
  • Software to flash an SD card e.g. balenaEtcher
  • Project code (optional only if the CLI method is used)

From a single Balena application and simple writing of a microSD card, Marc and José demonstrated the secure deployment of two devices in two countries automatically, complete with remote access and monitoring.

“BalenaCloud offers several advantages such as its simplicity in deployment, user-friendliness, and remote management of Linux-based gateways from a single dashboard.”

– José Marcelino, Solutions Architect, RAKwireless

With gateways becoming more powerful, demands for added flexibility, security, and edge computing are driving containerization further down the network chain to the LPWAN gateways themselves - this is a trend that RAK is bringing to the IoT market in collaboration with Balena.

If you want to know the full details of the tutorial, you can read it here, but if you want the summarized version, you can also read on.

The tutorial starts with creating an application using the necessary code found in the Basics Station GitHub repository. Simply pressing the “Deploy with balena” button, the service will automatically pull this code to BalenaCloud and create an application.

You can then add a device once your application is generated. José reminds us to be specific in detail so that there won’t be any mismatch in the configuration of your application. When everything’s set and you see a customized balenaOS image of your device and app, you can download the file to your workstation.

Flashing your SD card comes next and you can perform this using the balenaEtcher. Once done, you can connect your SD card into the Raspberry Pi and turn its power on.

Your device will appear online in the dashboard and that would signal the automatic download of the application you created.

At this step, you can connect to TTN by creating an account and registering your gateway. Paste the EUI (from the tag on your device's dashboard in balenaCloud) into the gateway EUI field in The Things Network console. Input all the data – including your frequency plan, which depends on your geographic location.

José noted that this gateway is created with European frequency and you can always change your LoRaWAN region by changing the TC_URI to the correct LNS server depending on your LoRaWAN region.

Apart from connecting to the community TTN service, you can also use LoRa Basics™ Station with The Things Industries (TTI) – the professional side of TTN - this is the new default protocol there. The Things Industries offers a private, supported service for enterprise customers who desire a solution with an SLA.

If necessary, change the TC_URI to the proper WebSockets URI enabled by your organization.

RAK, Balena, and The Things Network are prominent IoT companies in the world and this latest development highlights the benefits of collaboration amongst industry leaders in IoT. We can expect more breakthroughs to occur soon! By offering easy to use, cost-efficient, high-quality hardware, and software, RAK is committed to supporting people from all backgrounds, bringing their own set of skills and reaping the benefits of IoT. The entire RAK team across eight countries works every day to make sure that IoT is accessible to everyone.