Taxonomy Icon

IoT

Setting up the hardware platform for long-range IoT systems that use LoRaWAN networking

Get the code

Summary

Learn how to set up the hardware platform that takes advantage of LoRaWAN networking provided by The Things Network. In this pattern, you learn how to wirelessly join multiple resource-constrained devices as a network using LoRaWAN networking, collect data for an IoT project at the physical or network layer, and then publish that data to the Watson IoT Platform.

Overview

LoRaWAN is a wireless network protocol designed for the Internet of Things, which has a long range (up to 10km in optimal conditions) and requires a minimal amount of battery power from the devices that use it to communicate with each other. This longer range allows for the deployment of larger scale projects, such as smart parking structures, agricultural monitoring, tracking weather conditions, asset tracking, and so on.

Each LoRa network consists of a “gateway”, and one or more “nodes”. This network uses a star-based topology, in which each node communicates directly with the gateway. Data can be sent and received through each gateway/node connection. As data is received by the gateway, the gateway can then convert the data to a readable format and send it up to an IoT platform for further processing.

When you have completed this pattern, you understand how to:

  • Assemble a Raspberry Pi with additional hardware to serve as a LoRaWAN gateway
  • Determine which sensors are best for their IoT or smart city setup
  • Configure a microcontroller with LoRaWAN support. In this case, the microcontroller is a piece of hardware responsible for harvesting data from connected sensors, and wirelessly transmitting the collected data to the gateway via LoRa packets. In this pattern, I use the Adafruit LoRa “feather” as the microcontroller, but you can use alternative boards, such as the Arduino Uno or the MakerFocus LoRa board.
  • Forward LoRaWan packets from the gateway to the Watson IoT Platform
  • Visualize data in Watson IoT Platform (or a React web application)
  • Persist sensor data in a database
  • Feed data into analytical or predictive algorithms

Flow

Architecture diagram for environment tracking system that uses LoRaWAN networking

  1. LoRaWAN end nodes power on, sample values from sensors, and send data to Gateway. This process is repeated at a interval set by the user

  2. Gateway receives LoRa packets, and forwards packets up to “The Things Network” (TTN)

  3. TTN processes LoRa packets and confirms packets came from an authenticated device

  4. Gateway receives JSON object containing LoRa payload from to TTN MQTT broker

  5. Gateway decodes LoRa payload (base64 to integer/plaintext) and publishes an updated JSON object to Watson IoT platform

  6. Watson IoT platform receives JSON, updates dashboard and persists sensor values in a Cloudant Database

Instructions

Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README file.