Scaleway Documentationtutorials
actility lorawan operator

Jump toUpdate content

Using Actility as a LoRaWAN© operator for IoT Hub

Reviewed on 10 May 2021Published on 02 July 2020
  • Scaleway
  • IoT
  • Hub
  • LoRaWAN©

LoRaWAN© and Actility Overview

LoRaWAN© is a low-power, low-bandwidth, long-range radio protocol used by many devices to send their data over the air. This protocol is specifically designed for battery powered devices with little to no installation cost.

LoRaWAN© devices broadcast their data to reachable LoRaWAN© gateways, which forward the messages on the LoRaWAN© operator network. The operator de-duplicates the messages from multiple gateways and hand over the message to the “LoRaWAN© application”. In our scenario, the “LoRaWAN© application” is Scaleway IoT Hub.

Actility is a LoRaWAN© operator which can build a public or private LoRaWAN© network.

In this tutorial we are going to:

  • Create a IoT Hub which to receive/send messages from/to LoRaWAN© devices
  • Add a Device to the Hub to prepare the Actility-to-Scaleway connection
  • Set up the Actility backend to use the Device credentials to establish a connection with IoT Hub
  • Add another Device and connect it as a subscribe to receive LoRaWAN© messages

Create an IoT Hub

First, we need a Hub. Its role will be to distribute messages from your LoRaWAN© devices to the intended targets. Please follow this procedure to create an IoT Hub if you don’t have one already. The hub’s name and plan does not matter for this tutorial.

Create an IoT Device

The Actility platform will connect as a MQTT device to exchange data on IoT Hub. This means that we need to add a Device to the IoT Hub. Please follow this procedure to create a device.

Note:
  • The device name is not important for this tutorial.
  • Keep the default Deny Insecure connections setting to provide maximum security.

Once done, copy the Device ID and download the certificate & private key files, you will need them to set up the Actility backend.

Set up the Actility backend

Now IoT Hub is ready to exchange messages with Actility, let’s configure the Actility side:

  1. Go to your Actility Thingpark Enterprise console.

  2. Click Applications > Create and choose MQTT.

  3. Fill in the following parameters (unlisted settings can be anything you like):

    • Hostname: Your IoT Hub Endpoint, followed by MQTTs port (ex: iot.fr-par.scw.cloud:8883).
    • Account prefix: This allows you to set the MQTT topic prefix. Messages will be published with a topic like <prefix>/things/<LoRaWAN device ID>/uplink. Type in my-app here.
    • Protocol: SSL.
    • MQTT Username: Your IoT Hub Device ID.
    • MQTT Password: Leave empty.
    • Certificate: the device certificate file (ex: my-device-crt.pem).
    • Private Key: the device key file (ex: my-device-key.pem).
  4. Click the Save button.

You can check the application is up and running by going to the application page and verifying the Deployment Status box is set to Opened. When it is, your LoRaWAN© network is now connected to your IoT Hub.

Verify the we have done things right

It is time to see messages flowing on IoT Hub:

  • Create another IoT Hub Device, but this time choose the Allow Insecure connections setting. Secured connections are not supported over Web Sockets, which the MQTT Webclient uses.

  • On the Device page, click the MQTT Webclient button. The client will open and automatically connect.

  • Now subscribe to the LoRaWAN© devices messages:

    • Click Add New Topic Subscription in the Subscriptions block
    • Pick any color to identify this subscription
    • Leave QoS 0
    • Use my-app/things/+/uplink as the topic, this will instruct IoT Hub to send you uplink messages from all devices
    • Click subscribe
  • Your subscription now appears in the Subscriptions block and the messages from your LoRa devices will start showing in the Messages block.

Congratulations! Messages are flowing as expected.

Going further

You could leverage the power of IoT Hub to build a dashboard to display your data in a few easy steps:

  • Start a PostgreSQL managed DB instance and create a lora table with the following fields: time (timestamp type) and data (jsonb type)
  • Configure a Database Route to push data in there, see how to. The topic filter should be my-app/things/+/uplink. Your query should look like INSERT INTO lora (time, data) VALUES (NOW(), $PAYLOAD).
  • Start a new Scaleway instance and setup Grafana, get inspiration from this tutorial (steps 1 to 14, don’t enable TimescaleDB option).
  • Add widgets to your dashboard, for a graph your query could look like SELECT time, data->'DevEUI_uplink'->'payload'->'batteryLevel' as batteryLevel FROM lora WHERE $__timeFilter(time).

That’s it! Your LoRaWAN© devices data is now backed by a production-grade dashboard!


Learn more about Scaleway IoT Hub, discover how to add Devices to the hub, check the IoT Hub metrics or get started in a few clicks with the IoT Hub Kickstarts.