FSP0015 – LoRaWAN – Facility Science Podcast #15

By | August 6, 2019

Notes for FSP0015 – LoRaWAN
LoRa = Long Range, low power communication technology.
  • This is a proprietary technology owned by Semtech.
  • Physical layer (see #1) communication mechanism uses a spread-spectrum modulation technique to communicate over a very long range (up to 15km (>9 miles) in rural areas and with good penetration on urban areas and buildings) using very low power.
  • Low power consumption enables long-lasting battery-operated devices (a commonly cited figure is up to 10 years battery life)
  • Tradeoff of long range and low power is relatively low data rate.
  • Uses ISM (Industrial, Scientific, Medical) band radio frequencies. These are unlicensed radio frequencies which means you can transmit signals without a license.
  • Example of LPWAN technology (low power wide-area network). An LPWAN is a type of wireless network that enables long range communication at a low bit rate at low power.
  • This is a technology that enables the IoT (Internet of Things).
Compare to other types of wireless networks
  • WiFi – limited range, poor indoor penetration, high power consumption, but high data rate and uses unlicensed spectrum.
  • Cellular – long range, high data rate, but high power consumption and uses licensed spectrum (that’s carefully managed) which effectively means network access is expensive.
  • LoRa (and other LPWAN technologies) fill the gap for low power long range (with the low data rate tradeoff)
  • We like to have all 3 of these category options for out IoT implementations.
LoRa is a physical layer which means it’s only a way to communicate, not really a way to make a functioning network. We need another technology for that.
  • implements media access control and network layer.
  • open protocol defined and maintenance by the LoRa Alliance (https://www.lora-alliance.org/)
  • Quoting from the LoraWAN 1.0.3 Specification :
    • “This document describes the LoRaWAN network protocol which is optimized for battery-powered end-devices that may be either mobile or mounted at a fixed location.”
    • “LoRaWAN networks are typically laid out in a star-of-stars topology in which gateways relay messages between end-devices and a central network server at the backend. Gateways are connected to the network server via standard IP connections while end-devices use single-hop LoRa or FSK communication to one or many gateways. All communication is generally bi-directional, although uplink communication from an end-device to the network server is expected to be the predominant traffic.”
    • “Communication between end-devices and gateways is spread out on different frequency channels and data rates. The selection of data rate is a trade-off between communication range and message duration, communications with different data rates do not interfere with each other. LoRa data rates range from 0.3 kbps to 50 kbps. To maximize both battery life of the end-devices and overall network capacity, the LoRa network infrastructure can manage the data rate and RF output for each end-device by means of an adaptive data rate (ADR) scheme.”
    • “End devices may transmit on any channel available at any time, using any available data rate, as long as the following rules are respected:”
      • “The end-device changes channel in a pseudo-random fashion for every transmission. The resulting frequency diversity makes the system more robust to interferences.”
      • “The end-device respects the maximum transmit duty cycle relative to the sub-band used and local regulations.”
      • “The end-device respects the maximum transmit duration (dwell time) relative to the sub-band used and local regulations.”
      • “Note: Maximum transmit duty cycle and dwell time per sub-band are region specific and are defined in the LoRaWAN regional phyLayer definition document.”
Parts of a LoRaWAN network are end device (or node or mote), gateway, network server, application
  • End Device – end devices are the sensors or actuators or whatever other devices we want to be able to communicate with using the long range low power LoRa radio communication mechanism. Also called motes or nodes.
    • End devices are often battery powered, but they don’t have to be.
    • End devices broadcast data using the on the designated LoRa frequencies. LoRa uses radio frequency bands designated for ISM use. The exact frequencies designated for this vary from region to region around the world and the way in which the frequencies can be used also varies. The LoRa Alliance publishes official regional specifications called “Regional Parameters.”
    • End devices have a 64 bit unique identifier that is assigned by the manufacturer of the LoRa chip.
    • When a device joins a LoRaWAN network, it also receives a 32 bit address that identifies the device on the network. This address is used to actually identify the device on the network. The address can be assigned to the device automatically by the network (this is called OTAA – Over The Air Activation). The device user can also acquire the address from the network and manually configure the device (this is called ABP – Activation by Personalization).
    • LoRaWAN differentiates between uplink messages and downlink messages.
      • An uplink message is a message sent by the end device to the gateway. This is something like “The temperature here is whatever” or “the switch I am monitoring just did the thing” or something like that. As I mentioned before, an end device can transmit an uplink message at any time as long as it observes the rules regarding channel selection and also the duty cycle and transmit duration regulations for the region they are in.
      • A downlink message is a message from a gateway to an end device. This can be either an administration or management command from the network (changing channel settings or checking connectivity) or a command or request from an application (toggle your connected switch or change your setpoint). Since the LoRaWAN concept expects most messages to be uplink messages, end devices are only expected to be listening for downlink messages during certain receive windows. The receive windows are specified in the 3 different device classes.
    • A device can be Class A, Class B, or Class C
      • Class A device opens 2 receive windows at specified times after it sends an uplink message. The two windows are at 1 second and 2 seconds after the uplink message is sent. The server can communicate with the device during one of these receive windows. After the end of the second receive window, the device stops listening for downlink messages. Since operating the radio receiver requires energy, these minimal receive windows allow the devices to last longer before their batteries need to be changed.
      • Class B device does the same thing as a class A device with respect to opening two receive windows after sending an uplink message. Class B device also periodically open other receive windows not associated with an uplink. The timing for the receive windows is synchronized by timing beacons sent from the gateways. The Class B devices use the timing reference provided by the beacons to know when they should open their extra receive windows (these are called “ping slots”).
      • Class C device has its receive window open at all times except when transmitting. The enables relatively fast communication from the application to the device. The downside is that a Class C device uses much more power than a Class A device which would require more frequent battery changes, larger batteries, or connection to infrastructure power.
  • Gateway – a gateway is a device that communicates with the end devices using the LoRa radio communication and also communicates with the network server typically over standard IP connections (corporate network or Internet via Ethernet or WiFi or Cellular).
    • Uplink messages from end devices are picked up by any gateways in range and forwarded to the central server. Since radio is inherently a broadcast communication medium, it is possible that multiple gateways could receive the same message from an end device. LoRaWAN includes a mechanism to deduplicate these multiply-received messages.
    • When the network server wants to send a downlink message to an end device, the server sends that message to a gateway which then forwards the message to the end device. The protocol includes the required mechanisms to identify the gateway that can most likely reach the end device.
    • Like end devices, each gateway has a unique ID that identifies i ton the network.
    • Because of the long range of LoRa and the careful management of communication bandwidth, a single LoRaWAN gateway can potentially serve thousands of end devices spread over a very large area (10s of square miles or km).
  • Network Server – manages the network of gateways and end devices and provides a mechanism for applications to interact with devices and device data.
    • Knows about all the devices connected to the network, and provides the mechanism for devices to join the network (by giving out addresses and network parameters and whatever else the end devices and gateways might need to operate on the network).
    • Receives all uplink messages from all end devices (these are forwarded to the network server by the gateways) and keeps track of their status.
    • Initiates all downlink messages and identifies the gateway through which to forward a downlink message.
    • Provides access to applications that want to make use of data from the end devices through appropriate APIs.
  • Application
    • An application is anything that uses data from end devices.
    • For a private, single purpose network or single user network, the application(s) might be tightly integrated with the network server.
    • For a more general use network with potentially multiple users, there may be many applications each of which only use data from a subset of the connected end devices.
    • Applications could monitor for alarm conditions, record trends, track the location of assets, or whatever makes else makes sense for the data provided by the end devices.
    • Like the end devices and gateways, each application has an ID that uniquely identifies it to the network server.
Star of Stars topology (In case this wasn’t already clear)
  • Center of the star is the central network server. Data from all end devices is directed toward the central network server.
  • The “arms” (rays, beams?) of the central star are the links to the gateways.
  • The gateways are centers of their own stars.
  • The star beams of the gateways are the LoRa channels connecting to the end devices.
  • LoRaWAN has security built in.
  • LoRaWAN security uses 2 separate security layers.
  • One layer protects the network and the other layer protects application data
  • LoRaWAN security protects against the normal types of things you want in a network security scheme:
    • provides authentication to end devices, gateways, and servers know who they are talking to
    • provides for data secrecy and data integrity
    • protects against replay of messages.
  • A network can be set up so that the network operator can’t see into application data and the application users can’t read network management messages or access date in other user’s applications.
  • While it remains to be seen how robust the security architecture actually is, the fact that LoRaWAN has security built in from the start is a good thing.
  • I did find a paper called Security Vulnerabilities in LoRaWAN, but I haven’t had a chance to read it yet (link in the notes).
Benefits and Drawbacks (quick summary)
  • Benefits
    • long range communication and good penetration inside buildings.
    • low power consumption.
    • relatively inexpensive per end device both in terms of capital expenditure and operational cost.
    • geolocation by triangulation (without GPS) (I didn’t mention this before. I believe this is provided by the LoRa physical layer)
  • Drawbacks
    • low data rate – can’t communicate a lot of data quickly
    • high latency – Can only communicate with most devices during short receive windows
Network Options
  • Build your own
  • Hire a commercial network
  • Use a public network (the things network)
Examples use cases
  • Monitoring temperature/humidity/occupancy, status of trash cans, restroom consumables, workstation use, etc,  in a large building or campus – relatively low cost of LoRaWAN implementation can make monitoring many points economically feasible where it might not be for more expensive technologies.
  • Tracking livestock or wild animals.
  • Tracking utilization/availability of public or private parking spaces.
  • Smart electric and water meters
  • basically any widely-distributed IoT application