LoRa Device Developer Guide Orange
LoRa Device Developer Guide Orange
In collaboration with
Credits
This LoRa Device Developer Guide is an initiative by Orange Connected Objects & Partnerships developed in
collaboration with Actility. It provides an overiew of the LoRa ecosystem, wireless network architecture, as well as
guidelines to support the growing community of developers adopting the LoRaWAN specification to connect
devices, sensors and actuators to IoT applications and services.
Nicolas DUCROT
Dominique RAY
Ahmed SAADANI
Olivier HERSENT
Gabor POP
Guillaume REMOND
April 2016
in collaboration with
Table of Content
April 2016
in collaboration with
Glossary of Terms
Term
Definition
ADR
API
Application Key
(AppSKey)
The optional 128-bit key used to encrypt the payload of the messages.
Application Server
(AS) Routing Profile
Connectivity Plan
Device
EUI ID
GUI
LoRa
Long Range
Controller (LRC)
The LPWA core network component implementing the cloud based MAC
layer and acting as a mediation function between connected devices and
Application Servers.
Network Key
(NwkSKey)
The 128-bit key used by the LPWA network to verify the authenticity and
integrity of each message transmitted through the system.
NOC
OSS
SNR
LPWA
TDoA
MAC layer
Medium access control or media access control (MAC) layer is the lower
sublayer of the data link layer (layer 2) of the seven-layer OSI model.
ISM band
MQTT
April 2016
in collaboration with
Introduction to LoRaWAN
According to Machina Research, connected objects will account for more than 25 billion connections by 2025.
Based on the current projection, a large part of these connections will come from fixed and short range
connections such as Wifi, Bluetooth, Zigbee, Z-Wave etc. These technologies are well suited for short range
applications where power consumption and battery life is not a major issue. Cellular connections will originate
from SIM and/or e-SIM enabled devices using 2G/3G/4G network infrastructures and technologies. Current
generations of cellular technologies will need to be completed by cellular evolutions and LPWA (Low Power Wide
Area) technologies to serve many new IoT applications due to the low power consumption requirements by
devices to send and receive relatively low volumes of data.
Beyond cellular evolutions, the new wireless IoT connectivity family named LPWA networks is well suited to
support services and use cases which need long range communication (dozens of km) to reach devices which
must have a low power consumption budget in order to operate several years remotely on a single battery pack.
The trade-off is a low data rate delivered by LPWA network technologies, from 300 bps up to 5 kbps (with 125 kHz
bandwith) in LoRa modulation.
April 2016
in collaboration with
Key use cases for LPWA networks include applications for Smart Cities such as smart parking, intelligent street
lighting, supply chain management with asset tracking & condition monitoring, smart grids with electricity, water
& gas metering, smart agriculture with land condition monitoring or animal tracking and geofencing.
These are just few examples of existing applications. Thanks to the growing awareness of LPWA capabilities and
live network deployments, new market needs and use cases appear continuously.
Several radio technologies co-exist to deploy LPWA networks. Along with the Ultra Narrowband (UNB) protocol,
LoRa and its MAC layer implementation LoRaWAN is the LPWA network solution currently gaining the most
traction to support IoT applications and services.
Based on the LoRa radio modulation technology, invented in 2010 by the French startup Cycleo and then acquired
in 2012 by Semtech (a semiconductor company), a MAC layer has been added to standardize and extend the LoRa
physical communication layer onto internet networks. This MAC layer is called the LoRaWAN (LoRa for Wide Area
Networks) specification. The specification is open sourced and supported by the LoRa Alliance. The LoRaWAN
protocol also includes several key wireless network features such as E2E encryption and security, adaptive data
rate optimisation, quality of service, and other advanced communication applications.
Orange network supports currently the LoRaWAN 1.0 specification. A new version is under specification
(LoRaWAN 1.1) and will be available on Orange network in the future.
April 2016
in collaboration with
LoRaWAN networks are typically laid out as star-of-stars topology in which gateways relay messages between
end-devices and a central core network server. All gateways are connected to the core network server via
standard IP connections while end-devices use single-hop LoRa communication to one or many gateways. All
communication is natively bi-directional, although uplink communication from an end-device to the network
server is expected to be the predominant use case and traffic patern.
A star network architecture provides the best compromise between long range communication, number of
antennas (base stations) and devices battery life.
April 2016
in collaboration with
Communication between end-devices and gateways is spread out on different frequency channels and data rates.
The selection of the optimized data rate is a trade-off between the communication range and the message
duration. Communications using different data rates do not interfere with each other. LoRa supports data rates
ranging from 300 bps to 5 kbps for a 125 kHz bandwith. In order to maximize both the battery life of each device
and the overall capacity available through the system, LoRa network infrastructures use an Adaptive Data Rate
(ADR) scheme to manage the individual data rates and RF output of each connected device.
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 against interference.
In EU 868 ISM band, the end-device has to respect the maximum transmit duty cycle relative to the sub-band
used and local regulations (1% for end-devices).
In the US, the end-device respects the maximum transmit duration (or dwell time) relative to the sub-band used
and local regulations which is 400ms.
Adaptative Data Rate is the procedure by which the network instructs a node to perform a rate adaptation by
using a requested data rate (and a requested TX Power in future LoRaWAN versions). The table below illustrates
the Data Rate as function of the distance and the Spreading Factor (SF). As illustrated, LoRaWAN optimizes the
communication data rate to minimize the airtime and power consumption of devices. Compared to fixed data
rate of LPWA technologies, this optimization can lower average power consumption of a connected object by a
factor of 100.
(with coding rate 4/5 ; bandwidth 125Khz ; Packet Error Rate (PER): 1%)
Fig 5. LoRaWAN protocol Spreading Factors (SF) versus data rate and time-on-air
LoRaWAN uses licence-free spectrum, usually ISM (Industrial, Scientific, Medical) bands to communicate over the
air. In Europe, ETSI regulates the ISM band access on the 868 MHz and 433 MHz bands. The usage of these bands
is submitted to limitations: The output power (EIRP) of the transmitter shall not exceed 14 dBm or 25 mW, and
April 2016
in collaboration with
the duty cycle imposed in Europe by ETSI is limited to 1% (for devices) or 10% (for gateways) depending on the
used sub-band.
Three different classes (A,B,C) of communication profiles are available in LoRa networks between devices and
applications. Each class serves different application needs and has optimised requirements for specific purposes.
The key difference between A, B and C profiles is the trade-off made between latency and power consumption.
April 2016
in collaboration with
Class A devices implement a bi-directional communication profile whereby each end-devices uplink transmission
is followed by two short downlink receive windows. The transmission slot scheduled by the end-device is based
on its own communication needs with a small variation based on a random time basis. This Class A operation is
the lowest power consuming option for applications that only require downlink communication from the server
shortly after the end-device has sent an uplink transmission. Downlink communications from the server at any
other time has to wait until the next scheduled uplink. Class A covers the vast majority of use cases, and is the
most power efficient mode of LoRa.
April 2016
in collaboration with
10
Devices should implement a Class B communication profile when there is a requirement to ensure low latency of
downlink communication, while keeping the power consumption as low as possible. Class B emulates a
continuously receiving device by opening receive windows at fixed time intervals for the purpose of enabling
server-initiated downlink messages.
LoRaWAN Class B option adds a synchronized reception window on the remote device. Class B is achieved by
having the gateway send a beacon on a regular basis to synchronize all the end-point devices in the network. It
allows devices to open a short extra reception window (called ping slot) at a predictable time during a periodic
time slot.
Class B is currently still in experimental status at the LoRa alliance, but most use cases can already be covered by
combination of class A and class C. For example devices requiring periodic rendezvous points to receive
configuration data (e.g. room reservation display) may periodically request time from the LPWA network, then
synchronize their internal clock and periodically open rendezvous windows for downlink messages.
Devices implementing Class C communication profiles are used for applications that have sufficient power
available and thus do not need to minimize reception time windows. This is the case of most actuators (smart
plugs, remote control of powered devices, etc.). Class C devices will listen with RX2 windows parameters as often
as possible. The device listens on RX2 when it is not either (a) sending or (b) receiving on RX1, according to Class A
definition. To do so, it will open a short window on RX2 parameters between the end of the uplink transmission
and the beginning of the RX1 reception window and it will switch to RX2 reception parameters as soon as the RX1
reception window is closed; the RX2 reception window will remain open until the end-device has to send another
message.
April 2016
in collaboration with
11
The LoRaWAN technology has been designed to respond to use cases where a sensor communicates small
amounts of data a few times a day. It is well suited for smart meters, trackers, comfort sensors etc. However, it
is not designed to support applications that require high data rates such as audio or video. However, LoRaWAN
can be used to control other wireless device capabilities; for instance to remotely instruct a camera to begin a
data transmission, and stay in low power mode whenever opening a video stream is not required.
The examples below detail several key applications of LoRaWAN: Smart cities, Factories and Industries, Facility
Management, Healthcare or dedicated networks for specific verticals, e.g. airport management.
April 2016
in collaboration with
12
Facility Management
Healthcare Applications
April 2016
in collaboration with
13
Airport Services
Management
April 2016
in collaboration with
14
Smart Parking
Application
Street Lighting
April 2016
in collaboration with
15
April 2016
in collaboration with
16
Medical wearables
April 2016
in collaboration with
17
April 2016
in collaboration with
18
Waste management
April 2016
in collaboration with
19
The data rate ranges from 300 bps up to 5 kbps (with 125 kHz bandwidth) and 11 kbps (with 250 kHz
bandwidth) allowing for better time-on-air and better battery life
Communication is natively bidirectional and unlimited (with respect to ISM band local regulations)
Native payload encryption
Location without GPS with TDoA
Wide offer in gateways: macro-gateways, indoor gateways, pico-gateways for in-home usage
Able to create public and / or private networks
ADR (Adaptive Data Rate) enables an easily scalable network as base station addition will lower the
average ADR and time-on-air around it, allowing for more end nodes to communicate
Other LPWA technologies such as Weightless-N, Weightless-P from Weightless SIG and RPMA (Random Phase
Multiple Access technology) from Ingenu are also commercially deployed and used to support specific vertical use
cases.
Last but not least, there are several new 3GPP standards such as EC-GSM, LTE-M and NB-IoT that are currently
being specified to enable future 3GPP networks to support the specific requirements and use cases of the fast
growing IoT markets in upcoming years.
April 2016
in collaboration with
20
A LoRaWAN network includes the following key components: the base station or gateway also known as LRR
(Long Range Relay), the LRC (Long Range Controller) i.e. the LoRaWAN network server, and the OSS (Operation
Support System) for provisioning and management of the network system.
Base station (LoRaWAN Gateway)
Macro-gateway and pico-gateway base stations are pre-integrated with the platform to ease LPWA network
rollout and provisioning using common interfaces and APIs.
Macro-gateways are typically used in public network deployments to ensure city or nationwide coverage.
Pico-gateways can be deployed to increase network capacity in dense areas, or to improve Quality of Service
parameters, for example to lower time on air in order to increase the battery lifetime of a specific application (e.g.
smart parking applications), or to ensure coverage of hard-to-reach or isolated sites. Pico-gateway functionality
may also be added to other equipment to allow longer range or neighborhood communication use cases.
April 2016
in collaboration with
21
April 2016
in collaboration with
22
April 2016
in collaboration with
23
Publish &
Subscribe
Persistent
FIFO queue
Message Router
MQTT(S)
LoRa interface
Live Objects
services
-SMS
-E-mail
Security
Bus
Out
Data
Management
Device
Management
HTTPS
Bus
Connectivity
internet
Devices /
things
IoT application
IoT application
Apps
Live Objects offers a set of device and data management tools exposed through APIs and Portals interfaces to
easily monitor the status and data of objects, sensors and actuators. The main purpose of Live Objects is
interconnecting end-devices with IoT applications.
When using Orange LoRa network, all the data generated by your device will be natively stored within Live
Objects Manage platform. As Live Objects is open through web APIs (REST and MQTT), you can easily plug your
IoT application on Live Objects to retrieve your data. Live Objects is also the platform providing all device
management features including device provisioning used for Over The Air Activation.
The current features available on Live Objects are the following:
Connectivity interfaces to collect data, send command or notification from/to IoT devices
Device management (supervision, configuration, firmware, etc)
Message routing between devices and IoT applications
Data storage with advanced search features
April 2016
in collaboration with
24
April 2016
in collaboration with
25
Power
supply
MCU
LoRa
radio
Peripherals / sensors / IO /
Depending on design and production constraints, several options are available to build a LoRa device:
The choice of the target architecture needs to be made based on criteria such as expected production quantities,
RF engineering skills available and the development timeline available to complete the project.
In order to select the optimal architecture, it is preferable to start with a LoRa starter-kit and create a mockup.
April 2016
in collaboration with
26
My Temperature
Sensor
Middleware
LoRaWAN
stack
Power
management
Drivers
USB
UART
SPI
Analog
The driver layer provides the hardware adaptation and implements all the drivers to manage the device
peripherals. It abstracts the hardware as simple functions exposed to the middleware.
The middleware implements the communication protocol libraries (LoRaWAN, 6LowPAN), it implements also
complex drivers like screen, GPS driver.
The application layer contains all functional applications where the device behavior and functionalities are
implemented.
MCU
App
SX127x
LoRa
WAN
LoRa radio
Peripherals / sensors / IO /
In this architecture, the device developer must take responsibility for the entire RF design, including PCB routing
constraints, antenna tuning and emission/immunity issues.
April 2016
in collaboration with
27
The entire LoRaWAN stack here must be managed by the main MCU, and implemented by the device developer
or manufacturer. The software architecture is explained in the chapter 4.5.
LoRa
MCU
App
module
LoRa
WAN
LoRa
radio
Peripherals / sensors / IO /
Compared to the previous architecture, as the MCU is available, the device manufacturer is only responsible for
the integration of the LoRaWAN stack. Depending of the module provider, the LoRaWAN stack may be delivered
as a library.
April 2016
in collaboration with
28
MCU
host
Power
supply
App
LoRa
LoRa
WAN
modem
Peripherals / sensors / IO /
Several manufacturers propose a LoRa modem such as Microchip RN2483, Multitech or also ATIM.
LoRa
Existing Device
LoRa
WAN
modem
App
April 2016
in collaboration with
29
Maturity of the device specifications: feasibility test phase, market test phase or mass production phase
Electronic and RF development skills
Budget for development
Project timeline
Expected quantities and expected market price
Software development resources availability
RF region (ISM band)
The ISM band where the device will be deployed will impact the architecture as the antenna matching and the
antenna itself must be tuned to fit the correct frequency band. The module and modem architecture, which
already includes the RF part, will specify in which band it is available.
In terms of a project timeline, the key tasks to be estimated are:
April 2016
in collaboration with
30
http://www.semtech.com/images/datasheet/AN1200.20SARANT_V1_0_STD.pdf
http://www.ti.com/lit/an/swra161b/swra161b.pdf
http://www.ti.com/lit/an/swra416/swra416.pdf
In order to estimate the lifetime of a battery, 5 major consumption modes must be known:
in collaboration with
31
Once each of these 5 power modes are known, the developer needs to estimate how long the device will stay in
each mode to calculate the average power consumption per hour. It is highly recommended to consider worst
cases in the calculation, for example SF12 for LoRa messages duration.
With this approach it will be possible to estimate the battery capacity due and the expected lifetime of the device.
Semtech provides a tool that can help with fast evaluation of link budgets, time on air and energy consumption of
SX1272 transceiver. It can be downloaded at http://www.semtech.com/wireless-rf/rf-transceivers/sx1272/
Below is an example of power consumption measurement during transmission and reception phases:
RSSI probe
11ms M3
MCU
processing
47mA at
14dBm
10.6mA Rx
current
Rx slot 1
5 symbols
@SF12
Rx slot 2
5 symbols
@SF9
April 2016
in collaboration with
32
Actility provides as well wireless developer kits with or without base station bundles. The picture below is an
example of a ThingPark Wireless developer kit including developer libraries available on the ARM mBed platform.
Website: https://developer.mbed.org/teams/Actility/code/LoRaWAN_actility/
April 2016
in collaboration with
33
The test mode can be activated through a specific command on a dedicated FPort. Then the test mode is able to
check all available MAC commands and open a fast period communication with the server to check all message
type and integrity.
April 2016
in collaboration with
34
payload in SF12 is 51 bytes. In order to maximize the efficiency of communications in all situations (whatever
the radio condition) we recommend using a size of 20 bytes at maximum.
Spreading Factor: Orange recommendation is to use the SF12 by default at device initialization in order to
maximize the efficiency of the communication, even under difficult radio conditions.
Repetition mechanism: we recommend the implementation of a repetition mechanism up to 3 transmissions
to increase significantly the radio performances.
Duty cycle: as the LoRa network is operated over ISM band, it is under regulation with a maximum duty
cycle. The good practice is to develop the application depending on a respectable behavior with the respect
of the duty cycle but not develop the application in order to fit exactly the maximum authorized duty cycle.
The purpose of the duty cycle is to provide a fair use for every transmitter (and not block the frequency for
too long time).
Channel selection: when the device selects the frequency to use among the channels proposed by the
network, we recommend implementing a random selection instead of testing the received channels one by
one following the exact received order.
Mobility: mobile devices need to implement a data rate adaptation algorithm. Unlike for fixed or slow
devices, the network will not provide consistent data rate information to mobile devices. Orange can support
you to select the best algorithm for your object.
JOIN procedure management: in order to increase security level on devices, Orange recommends that
devices generate a JOIN REQUEST regularly to trigger a JOIN ACCEPT message allowing them to regenerate
their network and application session keys.
Confirmed messages: back to the duty cycle issue, as the duty cycle is per emitter, the gateway has also its
maximum duty cycle in emission so each downlink messages (from network to devices) has a cost in the
gateway duty cycle for every device. Please note that the confirmed mode is not available by default for
uplink messages (from devices to network), devices will need to use Unconfirmed mode for uplink messages.
SF adaptation: so as to adapt the SF when no downlink message is received by the device, the
ADR_ACK_LIMIT parameter can be used. The value of this parameters sets the number of uplink messages
(without downlink answers) sent before a downlink message is requested by the device. The ADR_ACK_LIMIT
needs to be set on 64.
Activation-By-Personalization (ABP):
ABP
Who?
What is it?
DevEUI
IEEE
DevAddr
Orange
NwkSKey
Device manufacturer
OR
Orange
AppSKeys
April 2016
in collaboration with
35
Notes:
The unicity of a device in a LoRaWAN network is based on the combination of DevAddr and NwkSKey
It is mandatory to generate a random NwkSKey per device during manufacturing and to not use the same
NwkSKey for every device.
Who?
What is it?
DevEUI
IEEE
AppEUI
IEEE
AppKey
Device manufacturer
The DevEUI or AppEUI is a unique IEEE MAC addresses. Each device manufacturer must purchase an address block
to IEEE. There are 3 available ranges from IEEE:
MAC-L: http://standards.ieee.org/develop/regauth/oui/
MAC-M: http://standards.ieee.org/develop/regauth/oui28/index.html
MAC-S: http://standards.ieee.org/develop/regauth/oui36/index.html
For LoRa modems, the manufacturer should already have a range of addresses and then each modem should be
delivered with its pre-defined DevEUI.
4.11 Certification
Regulatory certification
Each device that is built and sold in the European market must obtain the CE mark, under responsibility of the
manufacturer. CE mark requirements depend on the device type. A LoRa device must be compliant at least with
ETSI EN 3002-220 series. Compliance may be tested by the manufacturer or by an independent laboratory.
April 2016
in collaboration with
36
Depending on product category, other certifications may also be required; for example in automotive or medical
fields. Devices operating in potentially explosive atmosphere must bear a specific ATEX mark. Devices connected
to the electric power lines must comply with directive 2006/95/CE.
During the RF tests that are part of EN 3002-220, the Effective Radiated Power (ERP) of the device is tested. This
measurement takes into account all loss inside the circuit and the antenna, and provides a radiation directivity
measurement for the product.
For most sensors designed for indoor use, an omnidirectional pattern is optimal. For outdoor sensors, directive
antennas with high gain may provide better results, especially in the downlink direction.
Another important RF test, not part of EN 3002-220, is to qualify the sensitivity of the reception path of the
device. LoRa is a high sensitivity technology, and the public network dimensioning assumes that deployed devices
have a radio receiving performance in line with the technology capabilities. Sensitivity testing ensures that the
device will perform as expected in the LoRaWAN public network.
April 2016
in collaboration with
37
Actility certification
Orange certification
Chipset
Recommended
Recommended
Mandatory
Module
If Orange certified
module: not required
Else: recommended
If Orange certified
module: not required
Else: mandatory
RF-MCU
Recommended
Recommended
Mandatory
Modem
Recommended
Recommended
Mandatory
External modem
Recommended
Recommended
Mandatory
April 2016
in collaboration with
38
April 2016
in collaboration with
39
Below are some typical examples of existing devices that may be improved by migrating to LPWA technology.
Does the device application or use case require high data bandwidth?
Does it require real time communication with a smartphone?
Should it be able to connect to Internet without support of a local bridge (smartphone or internet box)?
Would the device use cases be enhanced by lower power consumption or wider connectivity coverage?
With this in mind, it appears that many different types of consumer connected devices could benefit from
LoRaWAN connectivity, for example:
Internet buttons, currently connected with Wi-Fi to a home internet box
Connected smoke detectors, currently using WIFI, connectivity which should be able to stay connected even
when no WIFI network or power supply is available
Remote home gardening sensors usually connected through Bluetooth to a smartphone
Personal key-ring Bluetooth tracker, which works only when they are in range of their smartphone
All type of people, pets or personal assets trackers
As Bluetooth and Wi-Fi operate in 2.4GHz band, wearable devices are often built with a simple chip and small
antenna design. Moving these form factors to LoRaWAN requires fitting a longer antenna in a small footprint, and
April 2016
in collaboration with
40
still keeping good RF performance. This technical challenge can be met fairly easily provided that LoRa antenna
design is integrated into the device architecture at the beginning of the overall product design thinking process.
April 2016
in collaboration with
41
Thank y u