More Efficient Iot Communication Through Lora Network With Lora@Fiit and Stiot Protocols

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

More efficient IoT communication through LoRa

network with LoRa@FIIT and STIOT protocols


Ondrej Perešíni, Tibor Krajčovič
Slovak University of Technology in Bratislava
Faculty of Informatics and Information Technologies
Ilkovičova 2, 842 16 Bratislava, Slovakia
ondrej.peresini@stuba.sk, tibor.krajcovic@stuba.sk

Abstract—This paper describes a concept of Internet of Things standard also depended on the actual use case. The offer of
using Low-power Wide Area network based on LoRa wireless existing protocols is quite large, but there is also a possibility
technology, LoRa@FIIT link layer protocol and STIOT network of defining the custom one which will be more suitable for
protocol. LoRa technology is proprietary owned by Semtech and specific use cases. In the following chapters we will describe
the most common implementation relies on open source
proposed protocols for link layer and network layer
LoRaWAN network protocol. This protocol is robust and
versatile however it has a quite high overhead and therefore connectivity.
devices with limited duty cycle can transmit useful data only a
fraction of associated time. Therefore we decided to propose a
II. AN OVERVIEW OF THE LORA NETWORK
more efficient LoRa@FIIT link layer protocol and versatile In simple terms, Lora represents a physical layer in OSI
STIOT network protocol for devices with highly limited model. It specifies how data is sent over the air. In our proposal
resources. a LoRa transmission serves as a first (physical) layer of our
3-layer concept. Second layer can be handled by LoRa carrier
Index Terms—IoT, LoRa, network server, LPWA
protocols like LoRaWAN or the proposed LoRa@FIIT. These
protocols facilitate the communication between end device and
I. INTRODUCTION LoRa Gateway. Third network layer is responsible for
Nowadays, we are able to see massive increase of using a delivering IP packets between LoRa Gateways and Network
concept called Internet of Things. This concept represents a server which is responsible for network, admission and
complex system of many various devices connected to the performance control of the whole LoRa wireless domain.
network and internet via any possible technology in order to A specific hardware is needed for receiving LoRa
build more sophisticated and complex system which is transmission from end devices which must be in the range of
adaptable to the environment in real time. This model of the end devices signal. Devices with hardware supported listening
system brings extensive usage of sensor devices called nodes and transmission of LoRa signal are named gateways. Their
which collect specific data for calculations, representations or main goal is to receive LoRa communication, process it and
they serve as triggers for specific events of some part of the encapsulate it to more standard IP communication. Multiple
system. The nodes are connected to gateways in a star topology gateways, which belong to the one network, may cover wide
and gateways mediate communication to a server. To improve area and they need to be coordinated by the network server. All
comfort in usage, the nodes are mostly connected via wireless gateways send all their data to the main server, so the data is
technology and there are a lot of ways to make it work. For processed in one place.
example, we are able to monitor parking slots availability in Gateways and the network server can facilitate various
the city, build smart lighting which is weather adaptive, make standards and protocols for mutual communication.
soil moisture measurements to know how much water does the LoRa@FIIT or LoRaWAN does not specify the protocol to be
area need and much more [1] Gartner, Inc. expects that there used for this communication. Therefore, we propose our
will be 20.8 billion connected devices by 2020 [2]. multipurpose protocol STIOT for this communication and
There are many different ways how to achieve benefits of describe the use of STIOT with layer 2 protocol LoRa@FIIT.
IoT concept. One of the most important decisions is to choose We also describe differences between existing solutions like
and build the physical layer of the network properly, which MQTT and specify the advantages and common use cases for
structure heavily depends on the use case. Currently there are STIOT. The first decision for implementing STIOT was to
many possibilities to choose from. Good examples are specify the separation of work between server and gateways.
Bluetooth, various mobile networks and low-power wide area The main purpose of a gateway is to bridge the communication
networks (LPWAN) like LoRa wireless technology [3]. between server and end devices by processing and re-
Since the goal is to build a robust smart system, sending encapsulating it between layer 2 and layer 3 protocols. In
raw data is considered too few usage of abilities. Other contrast to LoRaWAN our proposed gateways serve two more
decision, which mostly users make, is to choose convenient purposes, calculating their own duty cycles and informing the
server about it with the key duty_c. Gateways also decrypt when there is no need to send any data for a longer period of
LoRa@FIIT messages and send decrypted data over more time in uplink direction, but the amount of information about
secure TLS connection which is achieved by using extra actual life status of a node is not sufficient.
messages KEYS, KEYR and KEYA. 3) Emergency message
Sometimes a network topology change may occur and
III. LORA@FIIT SPECIFICATION actual network configuration settings may be inadequate or the
LORA@FIIT is a proposed link layer communication communication is interrupted because of some reason. This
protocol for LoRa network which has a unique modulation situation may be detected by non-received acknowledgment on
format. By default, radio chips using LoRa modulation provide the side of a node. For this case the protocol defines emergency
simple packet structure composed of preamble, header, CRC, message which is transmitted using different network settings
payload and CRC of payload. There is an option to choose (f.e. transmission power, spreading factor, frequency, e.g.). The
implicit mode without header and CRC. We have created a programmer decides maximum number of retransmissions
protocol which specifies the inner structure of payload, its before sending an emergency message. If any gateway receives
contents and block distribution in packets. The integrity of the emergency message, then the gateway generates more
received packet is checked by CRC and the integrity of powerful network configuration settings for that node and
payload by the payload CRC. The header carries information sends it a command to reconfigure communication parameters
about the length of payload in bytes, the information about the using the new settings.
forward error correction code rate and the presence of an 4) Register message
optional 16-bit CRC for the payload. Some parts of payload are The process of registration of a node to a certain gateway
encrypted using the XXTEA algorithm. begins with sending a register message to the gateway which
also initiates authentication attempt. Register authentication is
A. Message types
based on a Diffie-Hellman key exchange. The uplink register
LoRa@FIIT protocol is prepared to distinguish between message contains a Diffie-Hellman key A. The answer to this
four basic message types according to its content: message is a downlink register message which provides a
• Data message Diffie-Hellman key B. After this exchange, both devices
• Hello message generate their common secret shared key which is used for
• Emergency message payload encryption using symmetric XXTEA algorithm. Each
• Register message device generates its own code to communicate with gateway.
Sending a message from node to gateway is considered as The downlink register message contains network configuration
an uplink message. Any message with the opposite direction is settings and may include application data.
called downlink message. Each message contains the data type
B. Packet Structures
which informs what type of message is transmitted with
direction included, its acknowledgment requirements and The four types of messages may be sent in prepared
a lock of device’s id to identify the certain node. All messages packets. The protocol defines two packet structures for the
are padded to the block size of 32 bits (for encryption with uplink direction and two packets structured for the downlink
XXTEA which has a 32-bit block size and minimum size of 64 direction.
bits). Acknowledgement messages, like data messages, are
simple. However, they come without the payload. Uplink register message structure:
1) Data message
The data message is reserved for a sending data, either for
an application data or for a network data. Apart from the
general blocks, uplink data message is equipped with blocks Downlink register message structure:
carrying information about the length of the payload, the
sequence number of the message, message integrity code and
the main content in application payload block. Downlink data
message is enriched with network data having a specified size Uplink data, hello or emergency message:
in network data length. The block carrying network data type is
meant to inform the node about what kind of network data is
in the following blocks - the number of elements followed by Downlink data or emergency message structure:
the field values or one value. The user is able to alter the code
rate, frequencies, power, spreading factor, emergency
frequency and frequency of sending a hello message. All these
network configuration settings may be changed using the
network data. Fig. 1. LORA@FIIT packet structure
2) Hello message
The user is able to take advantage of sending a special Figure 1 overviews all needed packet structures. The white
“hello” message. This message has been created for the cases, blocks represent unencrypted parts and the blocks which are
filled with black color represent encrypted part of packets. p LoRaWAN. It is very beneficial to send the short messages
Padding may be added to the end of any packet. The register with a minimal user data payload to save a duty cycle.
messages need their own packet structure because of a Security is extremely important for any network.
demand on sending a Diffie-Hellman code A and B. The other LoRa@FIIT provides encryption for all transmitted data except
messages are composed of the common packet structures. of "Device id" block, "type" block and "Diffie–Hellman key"
Description of all packet structures is presented in the Table I. block in register messages which does not need to be
encrypted. An XXTEA algorithm is used for data encryption
TABLE I. PURPOSE OF THE BLOCKS which allows us to send shorter messages with less padding
Key name Description
compared to LoRaWAN (32-64b vs. 128b). LoRaWAN uses
DEV_ID The unique id of a node AES-128 encryption and therefore sending a short message
TYPE The set of bits that distinguishes four types of messages
requires a lot of padding. LoRa@FIIT padding costs less duty
cycle and it allows us to send messages more often, with fewer
DH_A The code that is used for Diffie-Hellman key exchange
hardware resources (RAM, etc.), therefore it saves battery
DH_B The code that is used for Diffie-Hellman key exchange
lifetime and manufacturing costs.
N_LEN The length of network data block
There are some more battery optimizations during receiving
N_DATA The network data
process where end device opens receive window only when
A_LEN The length of application data block
needed (acknowledgment is requested) and not every time the
A_DATA The application data end device transmits as in a case of LoRaWAN protocol.
SEQ The sequence number of message LoRa@FIIT distinguishes three types of acknowledgments.
MIC The message integrity code First type is Non-ACK and it does not require
acknowledgment. Second type is optional-ACK which does not
A block structure Type distinguishes between specified require direct acknowledgment. An end device opens a receive
message types and the requirement for an acknowledgment. window to receive configuration data from a server after the
message has been sent. The third type of acknowledgment is
TABLE II. TYPE BLOCK VARIATIONS ACK. This message requires acknowledgment from the server
0. 1. 2. 3. 4. 5. 6. 7.
to verify that the message was delivered correctly. If no
Message type, bit
Uplink register 0 0 0 RFU 1 1 F
acknowledgment is received, then the sending process is
repeated few times. In case of multiple unsuccessful sending
Downlink register 1 0 0 RFU 1 1 F
attempts, user payload could be sent via Emergency message
Uplink data 0 0 1 RFU X X F
with maximum transmission output power and different
Downlink data 1 0 1 RFU X X F
network settings for higher delivery probability. We can save
Uplink hello 0 1 0 RFU X 1 F
battery lifetime and duty cycle thanks to adjustable ACK. All
Uplink emergency 0 1 1 RFU 1 1 F of these benefits help to achieve an optimal functionality,
coverage and battery life. Also LoRa@FIIT does not create any
The three most significant bits distinguish between message useless background noise.
types and bits 5 and 6 contain information about the Each end-device has to be activated to participate in a
requirement of acknowledgment. The “RFF” represents bits LoRa@FIIT network. Network activation of LoRaWAN
reserved for the future use and “X” means optional. devices can be achieved in two ways, either over the air by join
Acknowledgment is determined as following: procedure or with activation by personalization (APB).
• 00 - no acknowledgment Activation in LoRa@FIIT is performed only over the air
• 01 - optional acknowledgment (OTAA), using the "Register" messages. Due to the
• 11 - mandatory acknowledgment LoRa@FIIT limitation to single network key it is not easily
All other options are reserved for the future use. possible to achieve roaming. To partially overcome this issue,
the message contains "DEV_ID" block which provides up to
C. Comparison of LoRa@FIIT with other link protocols 24 bits of end device IDs, that allows to connect up to 16 777
Main reason to design LoRa@FIIT is to revamp the 216 end devices in one LoRa@FIIT network segment.
shortcomings of LoRaWAN [4]. LoRaWAN protocol has a
few extra features like Roaming ability and port numbers IV. STIOT SPECIFICATION
which are not mandatory in LoRa@FIIT because standard use STIOT is a TCP-based protocol designed to transfer data
cases do not require them. However, LoRa@FIIT can be between the network server and gateways in LoRa networks.
further extended via RFU fields. Its name is an acronym for Secured TCP for IOT.
The main reason for the LoRa@FIIT is to decrease the The main design priority was to make the protocol secure
amount of useless overhead of LoRaWAN. Whilst the and reliable. We decided to use TLS (SSL) for end to end
LoRaWAN uplink message with 1B user payload has a total encryption and server authentication via public certificate. SSL
size of 29B, the LoRa@FIIT message uses only 12B. This relies on TCP for the transport layer of his secured data [5].
helps to maintain extremely efficient communication which TCP uses many techniques like acknowledgments, sequences,
uses only 42% of a duty cycle and battery compared to keep-alives for reliable communication [6].
The second decision was to use some kind of key-value transmission. Then this PARAM objects are converted to
data format. Based on our analysis we have chosen JSON, as it meaningful layer 2 message on the gateway.
is human readable and well supported. Extra messages KEYR, KEYA and KEYS are added to
One of key features of STIOT is its flexibility. We have synchronize specific values with server and gateways. Key
focused on making it adaptable and usable for other layer 2 dev_id is the only predefined key which is used for getting and
(LoRa carrier) protocols. We defined general form of messages updating data at a shared database table on the server. In a case
where every message has its predefined keys and array of of LoRa@FIIT, we use these messages to sync session keys
values. STIOT specifies 10 types of messages, which can be (key) and sequence counters (seq) between gateways and
separated into 3 groups (GATEWAY_SETUP, server. Gateway uses KEYR message for requesting shared
DEVICE_REGISTRATION, DEVICE_TRANSMISSION). information. With KEYA message server answers to KEYR
Messages can be altered by adding more keys specific for used request. KEYS message serves to update shared information.
layer 2 protocol. In our case, we also added some keys to make All extra messages are described in section D in more details.
LoRa@FIIT work better with STIOT.
C. DEVICE_TRANSMISSION messages
A. GATEWAY_SETUP messages The main group DEVICE_TRANSMISSION contains just
First group GATEWAY_SETUP contains 2 messages 2 messages RXL and TXL. RXL message contains data from
SETR and SETA. The main purpose is to start communication end device and its transmission parameters (RSSI, SNR, etc.).
between server and gateway. In case of LoRa@FIIT protocol data is decrypted from
The gateway first sends SETR message which contains LoRa@FIIT and striped down to just application data.
information about the STIOT version and the protocol used for Complete structure of TXL messages is presented in Table III.
layer 2 LPWAN transport. The key values for these parameters TXL messages are very similar to REGA messages, both
are ver and lora_stand that are consisting of 2 strings contain application data, network data and additional fields of
representing name and version. Gateway also sends its dev_id and power which are presented in Table IV. In a case of
hardware capabilities in these keys: m_chan, channels, TXL messages, we do not need a pre-shared key anymore.
sup_freqs, sup_sfs, sup_crs, sup_bands and max_power.
If the key id received from the gateway is correct than TABLE III. RXL MESSAGE
server responds with SETA message. In this message a server Key name Value type Description
is sending an array of one or many objects PARAM containing time Integer Timestamp of reception
parameters for receiving LoRa transmission. They are dev_id String End device id
accessible by the following keys: cr for code rate, freqs for
rssi Integer Signal strength
frequencies, band for bands, sf for spreading factor and power
snr Integer Signal noise ratio
for transmission power.
data String Base64 string of data
B. DEVICE_REGISTRATION messages conf_need* Boolean End device needs reconfiguration
Next group DEVICE_REGISTRATION is intended for dutty_c* Integer Count of messages of 1 byte
online registration of end devices. The main messages are ack* String Type of acknowledgment
REGR and REGA. When gateway accepts end device request seq* Integer Sequence number
for registration, it will send REGR message containing *LoRa@FIIT specific key
identification of the sender (dev_id) and layer 2 message
reception parameters like signal strength (rssi), signal noise TABLE IV. REGA/TXL MESSAGE
ratio (snr), bandwidth (band), code rate (cr), spreading factor
Key name Value type Description
(sf) and time of reception (time). For further explanation,
dev_id String End device id
values in brackets represent key names in REGR message. In a
power Integer Transmit power
case of using STIOT with the LoRa@FIIT, the gateway will
app_data String Base64 string of data
send extra information for duty cycle calculation (duty_c).
net_data Array of PARAM Array of objects containing
If received information from REGR message is correct, the
objects network settings
server answers with REGA message. This message contains sh_key* String Shared key for generating
information about transmission power (power) and end device session key
id (dev_id). In a case of LoRa@FIIT, we added one key sh_key *LoRa@FIIT and REGA specific key

for sending a pre-shared key to the gateway. The message also The last message is an ERROR message which does not
contains first configuration or useful data destined for the end belong to any of previous groups. If there is a problem, this
device piggybacked in app_data string key and net_data key. message will be used to describe the problem with id number
We separated data into application data (app_data) and represented by error key name. For more verbose information,
network data (net_data). Application data is just raw data error_desc key for description was added.
encoded to string with Base64 coding. A different approach
D. STIOT communication
was taken with network data which is sent like an array of
PARAM objects containing various parameters for LoRa GATEWAY_SETUP messages are the initial messages
sent between server and gateways. Gateway initiates
a communication with the server by connecting to its domain DEVICE_REGISTRATION messages are sent when end
name. Before any data is sent, communication is secured via device wants to register to a server. Gateway accepts layer 2
TLS (SSL) by authenticating server with its TLS certificate. message for registration and converts it to REGR message. If
The gateway does not need to authenticate itself with TLS the end device is known to a server, it will accept the request
compatible certificate, however the server can authenticate and it will send the REGA message for the gateway. Gateway
gateway by id in SETR message. After server received correct can create answer message for end device afterwards.
SETR message, server will respond with SETA message to When LoRa@FIIT protocol is in use, the gateway will
finish gateways setup process. finish the end device registration by updating session key and
After this exchange of messages, the TSL (SSL) connection sequence number in server database with KEYS message.
will be opened. Gateway needs to send keep-alive messages The gateway, which does not have the most recent session
periodically to keep the communication open. The key and sequence number for the end device, can request this
communication is closed only if a network problem occurs. In information from server with KEYR message. If the request is
this case, gateway tries to connect with the server. An example correct, server will send KEYA message. Good example of
of this communication is pictured in Figure 2. device registration and key request is in Figure 3.
DEVICE_TRANSMISSION messages can be described as
simple request and answer messages. The difference is that a
server does not respond to gateway if server has no data for end
device. In case of problematic message both server and
gateway can respond to accepted message with error message.

E. STIOT support for layer 2


In this part, we want to summarize everything needed to
add a layer 2 protocol compatibility to STIOT. At first, you
need to specify protocol names and version. At startup every
gateway sends a SETR message which contains following
information. If your protocol needs extra keys, you must
specify in which messages these keys are used.
It is mandatory to specify at least one type of object
PARAM which will be used for gateway setup. If you want to
use network data, you must also specify the type of PARAM
object which will be transformed on a gateway to your layer 2
message.

Fig. 2. Start of communication F. Comparison of STIOT with other network protocols


STIOT protocol can be assigned to machine to machine
group of protocols. Other protocols included in this group are
MQTT, CoAp, OMA_LWM2M and some more.
The basic M2M LoRa protocol is available at Semtech
example code on GitHub. It is a simple UDP based server
client protocol for LoRaWAN using JSON for its data
structure. Our STIOT protocol also uses JSON for its data
structure but messages are more complex. STIOT is also
created to support more than one layer 2 protocol (for example
for both LoRa@FIIT and LoRaWAN). Finally, STIOT uses
more reliable and secure TLS connection.
MQTT is open source standard with specification available
on oasis web pages [7]. It is used in open source LoRaWAN
server available on GitHub. MQTT is a modern TCP based
protocol with payload encryption. This protocol supports
publish/subscribe messaging model. Application like an open
source Mosquitto can be used to realize publish/subscribe
model. STIOT is just a simple server client communication
protocol which does not need message broker. STIOT is
suitable mainly for LoRa networks, while MQTT is more
generic protocol.
Fig. 3. Registration of end device
V. NETWORK SERVER FOR TRANSMISSION CONTROL optional acknowledgments. Besides that, LoRa@FIIT provides
LoRa transmission does not need any network control mandatory acknowledgments which can be used to guarantee
server to be able to transfer raw data, however all network message delivery. In a case when end device will not receive
parameters would be static and not optimal for all different acknowledgement due to signal loss, it will start emergency
devices and scenarios. The main reason to use network server transmission on a maximal power settings. LoRa@FIIT does
is to control communication parameters based on current not offer roaming between several LoRa@FIIT networks, but it
network state and to handle end devices’ messages. It can uses XXTEA algorithm which allows minimalization of
directly control several transmission parameters like spreading unnecessary padding and can send short messages while
factor (SF), communication channel, coding rate (CR), guaranteeing security for user data. We recommend a usage of
bandwidth (BW) and transmission power. Only through static end devices to eliminate signal loss and to ensure the best
controlling these parameters can LoRa network maintain power consumption. However, the network server is
maximum throughput with minimal power consumption. A responsible for the network configuration of end devices and
good example would be lowering spreading factor and sets up their transmission parameters in a way that every device
transmission power in a case of good signal reception which can maintain minimal transmission power required for reliable
would result in a lower mutual radio interferences and power communication.
consumption. Network server must constantly calculate several The main use case for STIOT protocol is to carry messages
network parameters and send updates to end devices that will between end devices and network server reliably and securely.
apply new communication settings during next transmission. Proposed protocol specification can be used in a
There are several open-source network servers for communication between a server and a gateway. STIOT
LoRaWAN like Brocaar [8] or The Things Network [9] protocol can carry several different layer 2 protocols like
however they are either not compatible with LoRa@FIIT or LoRaWAN and LoRa@FIIT and therefore it is suitable for
they are too simple and unable to control transmission several different use cases of commercial and academic
parameters. Therefore we decided to implement a new network networks. Future development can include additional features
server for both protocols LoRaWAN and LoRa@FIIT which like storing valuable messages from end devices to local
would communicate with gateways through STIOT protocol. memory of gateways which would serve as a backup in a case
To control transmission parameters, we proposed several of temporary network failure.
threshold levels at which the network server lowers or ACKNOWLEDGMENT
increases transmission parameters. Calculations are based on
received signal strength (RSSI), signal to noise ratio (SNR), The authors would like to thank for financial contribution
and other parameters like remaining duty cycle and type of from the STU Grant scheme for Support of Young
acknowledgment. Duty cycle on the gateways is strictly limited Researchers.
and therefore it is crucial to change those parameters only
REFERENCES
when needed. Using LoRa@FIIT without network server
would decrease protocol overhead to 42% compared to [1] Morgan, J.: A Simple Explanation Of ‘The Internet Of Things’.
Online available at:
LoRaWAN. Additional control of transmission parameters via
http://www.forbes.com/sites/jacobmorgan/2014/05/13/simple-
network server could result in a decrease of spreading factor explanation-internet-things-that-anyone-can-
from SF12 to SF7 which provides 8 times faster transmission understand/#68cd72246828
rate and less time in radio transmission will result in a better [2] GARTNER: Gartner Says 6.4 Billion Connected “Things” Will
battery life. In a case of good reception the network server may Be in Use in 2016, Up 30 Percent From 2015. Online available
further decrease transmission power from 14 dBm up to 5 at: http://www.gartner.com/newsroom/id/3165317
dBm. All of those changes combined may result in a more than [3] VANGELISTA, L., ZANELLA, A., ZORZI, M.: Long-Range
99% of power reduction for data transmission and are handled IoT Technologies: The Dawn of LoRa™. Online available at:
at the background without the need of user intervention. http://link.springer.com/10.1007/978-3-319-27072-2_7
Another purpose of the network server is to select correct [4] Sornin, N., Luis, M., Eirich, T., Kramp, T., Hersent, O.:
gateway for sending a response to end device because at a LoRaWAN™ Specification. ©2015 LoRa™ Alliance, (2015)
given moment several gateways are able to reach out a specific [5] INTERNET ENGINEERING TASK FORCE (IETF).: RFC
device. Network server must choose transmission gateway 5246: The Transport Layer Security (TLS) Protocol Version
wisely not to deplete duty cycle at any of them. Additional 1.2. Online available at: https://tools.ietf.org/html/rfc5246
purpose of a network server is to collect and process all [6] INTERNET ENGINEERING TASK FORCE (IETF).: RFC 793:
received data and provide API interface for applications. Transmission Control Protocol. Online available at:
https://tools.ietf.org/html/rfc768
VI. CONCLUSION [7] OASIS.: MQTT Version 3.1.1 Plus Errata 01. Online available
In this paper we have described specifications of at: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html
LoRa@FIIT protocol which is designed for a large number of [8] Brocaar.: Lora network server. Online available at:
end devices and industrial use cases like processes monitoring. https://github.com/brocaar/loraserver
It can save battery lifetime and duty cycle, leveraging the low [9] TTN: The Things Network. Online available at:
data transfer and planned opening of receive windows via https://www.thethingsnetwork.org/

You might also like