Hometutorials
actility lorawan operator

Jump toUpdate content

Using Actility as a LoRaWAN© operator for IoT Hub

Reviewed on 28 February 2022Published on 02 July 2020
  • Iot-Hub
  • LoRaWAN©
  • Loriot

LoRaWAN© is a low-power, low-bandwidth, long-range radio protocol used by many devices to send data wirelessly. 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 an IoT Hub 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
Requirements:

Setting up the Actility backend

  1. Go to the 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 the MQTT port (ex: iot.fr-par.scw.cloud:8883).
    • Account prefix: Enter my-app. This allows you to set the MQTT topic prefix. The messages will be published with under a topic such as the following: <prefix>/things/<LoRaWAN device ID>/uplink.
    • Protocol: SSL.
    • MQTT Username: Your IoT Hub device ID.
    • MQTT Password: Leave this field empty.
    • Certificate: The device certificate file (ex: my-device-crt.pem).
    • Private Key: The device key file (ex: my-device-key.pem).
  4. Click Save.

  5. Verify if the Deployment Status is set to Opened in the application page to make sure the application is running.

Your LoRaWAN© network is now connected to your IoT Hub.

Subscribe to the LoRaWAN© devices messages

To ensure messages are being properly sent, we will create a new device that will subscribe to the LoRaWAN© devices messages.

  1. 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.

  2. Click MQTT Webclient on the device page. The client will open and connect automatically.

  3. 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 the 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 appear in the Messages block.

Setting up a dashboard

You can go further and leverage the power of IoT Hub to build a dashboard and display your data in a few easy steps:

  1. Create a Managed Database Instance for PostgreSQL and a lora table with the following fields: time (timestamp type) and data (jsonb type).

  2. Configure a Database route to push data into. Set the topic filter as: my-app/things/+/uplink. Your query will look like such:

    INSERT INTO lora (time, data) VALUES (NOW(), $PAYLOAD)
  3. Create an Instance and set up Grafana (You can follow steps 1 to 14 of the tutorial. Do not enable the TimescaleDB option).

  4. Add widgets to your dashboard.

  5. Try creating a graph by running the following query:

    SELECT time, data->'DevEUI_uplink'->'payload'->'batteryLevel' as batteryLevel FROM lora WHERE $__timeFilter(time)
    ```

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.