You are on page 1of 15

Journal of Ambient Intelligence and Humanized Computing (2020) 11:945–959

https://doi.org/10.1007/s12652-019-01207-3

ORIGINAL RESEARCH

Multi‑hop LoRaWAN uplink extension: specification and prototype


implementation
José Dias1,2 · António Grilo1,2

Received: 15 August 2018 / Accepted: 28 November 2018 / Published online: 2 February 2019
© Springer-Verlag GmbH Germany, part of Springer Nature 2019

Abstract
The coverage of a LoRaWAN network in a city is greatly hampered by the harsh propagation environment. Sensors are
sometimes placed under the ground or in places with strong electromagnetic attenuation. Also, for users who have a contract
with a network operator, installing another gateway to improve coverage of blind spots is not an option. In other cases, there
is no or very weak connectivity (e.g. basements). In the present work, we design and implement a multi-hop uplink solution
compatible with the LoRaWAN specification, which can act as an extension to already deployed gateways. End nodes trans-
mit data messages to intermediate nodes, which relay them to gateways by choosing routes based on a simplified version of
destination-sequenced distance vector routing. The routing protocol was successfully implemented and was assessed using
a linear and bottleneck topology, where the packet reception rate (PRR) and throughput were measured. A carrier activity
detection mechanism is also proposed. This paper presents the protocol specification and detailed description of a prototype
implementation, as well as experimental performance results. On the bottleneck topology, it was observed that the PRR
of each node did not significantly vary. On the linear topology, we observed that the throughput and PRR did not decrease
considerably with the increase of hops. A listen-before talk multiple access mechanism is also proposed, which significantly
reduces the probability of collision.

Keywords LoRa · LoRaWAN · Multi-hop · Routing

1 Introduction all channels and are permanently connected to the Internet.


Its density can be reduced through the use of simple relay
A low power wide area network (LPWAN) is characterized nodes in a multi-hop scheme. Urban environments are likely
by long range, low power consumption, low cost and low to have dark spots, with weak or no coverage at all. In these
throughput. End nodes transmit data, such as sensor read- scenarios, a multi-hop communication scheme is a simple,
ings, usually using radio links to gateways, which relay it to effective and cheap solution to improve coverage. Also,
an Application Server in the cloud. There are several ena- when a network user does not own the network infrastruc-
bling technologies for LPWANs, which differ in power con- ture, deploying additional gateways is not an option. Multi-
sumption, range, throughput, quality of service, scalability hop allows data to be collected from remote locations, such
and cost. LoRaWAN is one such technology operating in the as villages or rural areas with no accessible gateways, and
license-free sub-Ghz spectrum. Gateways are complex and where it is not economically viable to deploy and maintain a
costly to maintain. They need to simultaneously listen in gateway. In addition, if a gateway fails, a multi-hop protocol
could mitigate the network failure, as the messages would be
forwarded by relay nodes to the nearest available gateway.
* António Grilo In the specific case of LoRaWAN, Adelantado et al. (2017)
antonio.grilo@inesc‑id.pt suggests that research should be done regarding a multi-hop
José Dias approach, which would also allow to decrease the transmit
jose254@gmail.com power of end devices.
1 LoRaWAN is a long-range wireless communication tech-
Instituto Superior Técnico - Universidade de Lisboa, Av.
Rovisco Pais 1, 1049‑001 Lisbon, Portugal nology intended for battery powered applications, where
2 the battery lifetime and energy consumption is important.
INESC-ID, Rua Alves Redol, 9, 1000‑029 Lisbon, Portugal

13
Vol.:(0123456789)
946 J. Dias, A. Grilo

It is currently considered very promising for the support of 2 Related work


Internet of Things (IoT) applications, namely for those that
entail private small-scale installations. LoRaWAN employs This section presents related work concerning perfor-
the LoRa modulation, where each data bit is modulated as mance evaluation of LoRaWAN, as well as LoRaWAN
a sequence of chirps, which are signals whose frequency multi-hop schemes and Wireless Sensor Network (WSN)
increases or decreases over time, covering the complete fre- routing protocols.
quency range of the channel. The spreading factor (SF) sets
the duration of the chirps. Higher SFs increase resistance to
natural interference, noise and jamming but decreases avail- 2.1 LoRaWAN performance studies
able bandwidth for data. To improve robustness to errors,
LoRaWAN adds redundancy by employing coding to per- In Petajajarvi et al. (2015), two sets of empirical measure-
form forward error detection and correction. The measure of ments were conducted on land and on water to evaluate the
redundancy is the coding rate (CR), defined as the portion range in line of sight and in a specific urban environment.
of the bit stream that corresponds to effective data bits. The In Gregora et al. (2016), the packet loss and attenuation
structure of a LoRaWAN packet also comprises a preamble of a LoRa signal was studied in the presence of reinforced
for synchronization of the receiver. concrete. In Haxhibeqiri et al. (2017), simulations using
LoRaWAN also specifies network protocols for the data different combinations of frequency channels and spread-
link layer and above. Typically, a LoRaWAN network con- ing factors were used to observe how the throughput and
sists of a single hop star topology, in which gateways relay the Packet Error Rate (PER) vary with an increase in the
messages between the end-devices and a Network Server. number of nodes around a single gateway. In Sanchez-
An end-device can reach one or more gateways using the Iborra et al. (2018), an experimental performance evalua-
LoRa or frequency shift keying (FSK) modulation. Gateways tion of LoRaWAN in urban, suburban and rural scenarios
are connected to the Internet via WiFi, 3G or Ethernet in is presented, considering both dynamic and static condi-
order to deliver the data to the Network Server through IP tions. From these studies, it becomes clear that, in real
(LoRa Alliance 2017). Different end-devices and gateways environments, LoRaWAN deployments are likely to ben-
can coexist in the same geographical area by isolating com- efit from the use of relay nodes, either to extend coverage
munications in frequency and also in virtual channels within or as a means to overcome dark spots.
the same frequency channel. This is possible due to chirp LoRa modulation is referred to have non destructive
spread spectrum, since transmissions with different SFs are concurrent transmissions when using the same physical
orthogonal. (frequency) and virtual (SF) channel. To address this
This paper presents the specification, detailed imple- topic, Bor et al. (2016) set up an experiment with two
mentation and evaluation of a multi-hop routing protocol LoRa transceivers configured with a power difference of 1
intended to extend the range of LoRaWAN installations, dB to differentiate a strong from a weak transmitter. Other
while interoperating with standard LoRaWAN gateways. parameters were the following: SF = 12 , BW = 125 kHz ,
The proposed routing protocol makes use of the LoRaWAN CR = 4∕5 , payload was set to 10 bytes and the preamble
beacon, delivering LoRaWAN packets from end nodes to to 12.25 symbols, which resulted in an airtime of 991 ms.
gateways through a minimum number of hops. A prototype The experiment consisted on varying the offset time of
was developed in order to evaluate the proposed mechanisms the strong transmitter relative to the weak transmitter. The
under relevant scenarios. This paper extends the initial pro- results are described below for a packet with 60.25 symbols:
posal in Dias and Grilo (2018), including a more compre-
hensive description of the software implementation, as well • Both strong and weak transmissions were received
as an evaluation of the proposed carrier activity detection successfully when the strong transmission takes place
(CAD) mechanism. more than 57 symbols before than the weak transmis-
This paper is organized as follows: Sect. 2 provides an sion. In this case, the three last symbols of the strong
analysis of the most recent LoRa literature; Sect. 3 describes transmission overlap the 3 first symbols of the pream-
the implemented communication protocol and mechanisms, ble of the weak transmission.
as well as the prototype implementation; Sect. 4 contains • The strong transmission is received if it initiates less
the assessment of the implemented solution; finally, Sect. 5 than 57 symbols earlier but not more than 3 symbols
concludes the paper. after the weak transmission. Within those intervals the
weak transmission is not decoded.
• If the strong node initiates the transmission 3 symbols
after the weak node, neither of the two is received up to

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 947

57 symbols. After that value, the strongest transmission an experiment to address the interference between LoRa
is received but the weak transmission continues not concurrent transmissions. The objective of our multi-hop
to be received. This case corresponds to the overlap- extension is different from that of LoRaBlink, since we
ping of the strong transmission with the CRC of the aim at keeping compatibility with standard LoRaWAN
weak transmission in the end of the packet. The weak gateways, thus guaranteeing that the relaying functions
transmission only starts to be received again when the are completely transparent to the latter.
strong transmission initiates approximately when the
weak transmission has ended, which corresponds to
more than 60 symbols given the packet length. 2.3 WSN routing protocols

The experiment was repeated with both transmitters Routing is the process of finding and selecting a path for
configured with the same power and, in this case, either messages from a source to a destination. If multiple paths
one is perceived as the strongest with similar results. The are available, an algorithm is responsible for the selection
authors conclude that one of two concurrent transmissions is process, which takes into consideration one or several met-
received with very high probability if the offset between the rics to choose the links and nodes that will form the route
two transmissions is not greater than 3 symbols, otherwise to the destination.
there is a collision. These results point to the need of a CAD In most WSN applications, the sensor nodes are assumed
mechanism in high density LoRaWAN deployments. to have energy limitations, usually relying on small capac-
ity bateries that provide autonomous operation during a
2.2 LoRaWAN multi‑hop extensions limited lifetime, with the latter being sometimes extended
based on energy scavenging techniques. As such, one of the
Although there are proposals for multi-hop operation of main challenges of WSN routing protocols is to build routes
other LPAWAN technologies, such as in Vázquez et al. between sources and sinks in an energy-efficient way. A huge
(2017), this section shall focus on multi-hop extensions panoply of routing protocols has been proposed for WSNs.
specific to LoRaWAN. The reader can find an extensive survey by Zungeru et al.
In de Velde (2017), the author analyzed the impact of (2012). This section addresses only the two most relevant
introducing a forwarder node between an end device and routing protocols that have inspired the proposed LoRaWAN
a gateway. As the forwarder aims to reduce the power con- multi-hop solution: routing protocol for low-power and lossy
sumption on end-nodes, the work mainly focused on an networks (RPL) and destination-sequenced distance vector
energy analysis. (DSDV).
LoRaBlink is a multi-hop protocol for LoRa transceiv- RPL is a proactive distance vector routing protocol speci-
ers proposed by Bor et al. (2016) to address multi-hop fied by the Internet Engineering Task Force (IETF) (Winter
under low density and low traffic volume of the network. et al. 2012), being designed and optimized for use in IoT
It combines Medium Access Control (MAC) and routing, applications (Djamaa et al. 2017). The protocol does not rely
using beacons for time synchronization and in order to on a priori knowledge of the network topology. Instead, RPL
communicate the distance in number of hops to the gate- utilizes control messages that are propagated in a distrib-
way or sink. The first beacon is transmitted by the sink uted way in the WSN, which contain the rank of the sender
and then there is a flooding process in which each node relative to the root node. The rank is a result of an Objec-
propagates to its neighbors the number of hops it is away tive Function (OF) that minimizes a certain metric such as
from the sink. As a time synchronization mechanism, a energy, hop count, Expected Transmission Count (ETX) or
beacon indicates the start of an epoch. An epoch is con- other. The topology consists on a Directed Acyclic Graph
stituted by N slots, in which the first NB are beacon slots (DAG) in which its root has no outgoing edges. The latter
used to transmit hop distance beacons and ND are data may be constituted by several Destination Oriented Directed
slots. NB establishes the maximum number of hops. For Acyclic Graphs (DODAGs) in which every node has the
instance, if a node received a beacon with a hop count of same destination. A DODAG corresponds to an instance of
4, it received it in the 4th slot and will convey (if this is RPL and there is an instance for each different destination.
the lowest value to date) its own hop count of 5 in the 5th The following control messages are used to form and main-
slot. When a message with data is sent, all the neighbor tain the network topology:
nodes check its origin in terms of hop distance and, if
they are closer to the sink, they relay the message. Several • DIO: Advertise an existent DODAG and its informa-
transmissions may arrive at the gateway through different tion to neighbor nodes. Content includes the rank of the
relaying paths, which introduces redundancy and therefore broadcasting node, the OF, DODAG-ID, etc. This mes-
unnecessary power consumption. The authors also set up sage is sent downwards from the root.

13
948 J. Dias, A. Grilo

• DIS: Request information about existent DODAGs to harvesting—an energy analysis to assess its effectiveness
nearby nodes if no DIO message was received yet. This outside this assumption is left for future work. On the other
message is sent upwards towards the root. hand, LNs are assumed to be energy constrained nodes and
• DAO: Request to join the advertised DODAG in a previ- do not take part in the multi-hop routing. Such an heterog-
ous DIO message and send self identification within the enous architecture involving energy constrained leaf nodes
network. and energy harvesting relay nodes is also proposed in Abdul-
• DAO-ACK: Response to the previous solicitation. Qawy and Srinivasulu (2018).
As the described protocol is implemented on top of a
The formation of a DODAG starts at the destination, LoRaWAN packet layer, it benefits from some of its fea-
which is considered the root node. The root advertises a tures, e.g., end-to-end security and interoperability with
DIO packet announcing the DODAG to its neighbors. Each LoRaWAN gateways. Regarding the existence of duplicates,
neighbor then computes its own rank based on the rank it only the LNs transmit in broadcast, which means that this is
received from the root node and on the cost to reach the root. the only source of duplicates. However, LoRaBlink imple-
These nodes may then join the existent DODAG by issuing a mented bidirectional communication, whereas in the present
DAO packet which will be acknowledged back with a DAO- work only uplink traffic is considered.
ACK. Each of the root neighbors will advertise the DIO with
their own rank to their neighbors. Those neighbors will then 3.1 Overview
advertise to their neighbors, and so on.
Although RPL is still regarded as a relevant proto- The implemented protocol is a simplified version of DSDV.
col in the context of the Internet of Things, link capacity DSDV was originally designed for mobile nodes. Conse-
constraints prevent it from being used in a LoRaWAN set- quently, some simplifications were needed in order to opti-
ting without extensive adaptation. On the other hand, it mize it for operation in a LoRaWAN network. Firstly, as RNs
was found that DSDV could be more easily adapted to a are assumed to be static, there is no pointer for information
LoRaWAN setting due to its simplicity. regarding the stability of a certain route as in the original
DSDV is a proactive distance vector protocol proposed by DSDV. As fluctuations are not expected in a LoRaWAN net-
Perkins and Bhagwat (1994) for Mobile Ad Hoc Networks. work, routes are considered stable when they are advertised.
However, adaptations of this protocol were employed in Secondly, there is synchronization between nodes (contrary
WSNs. In DSDV, each node in the network stores a rout- to DSDV), which is set by a gateway.
ing table, which contains the destinations reachable by that An example of the protocol operation is depicted in
node, the metric associated with a certain path, the next node Fig. 1. Once routes are established, data transmission can
in that path and other fields. DSDV considers full dumps take place. LNs construct a LoRaWAN packet and append
and incremental packets as routing advertisement messages a routing overhead to forward the packet within the multi-
based on the information they carry. A full dump contains hop extension. When the packet is received by a gateway
all the entries in the routing table and should be sent sporadi- neighbor, the overhead is dropped and only the LoRaWAN
cally, whereas an incremental packet only contains infor- part is sent. A representation is given in the second sequence
mation that changed since the last full dump packet. One of arrows with origin in LN1. The packet will appear in the
important property of DSDV is that its routes are loop-free Application Server as being sent by the node that originated
(see Perkins and Bhagwat 1994). it. End-to-end encryption is employed like in a standard sin-
gle hop LoRaWAN network.
A gateway sends its LoRaWAN beacon periodically, most
3 LoRaWAN multi‑hop uplink extension commonly, each 128 s. RN1, in dark orange, is close to the
gateway and will receive the beacon, update its routing table
This section provides a description of a protocol which and transmit a full dump as soon as possible. RNs that did
allows typical LoRaWAN end nodes, named Leaf Nodes not receive the beacon, in light orange, receive the full dump
(LN), which are not in range of a gateway, to have their from a neighbor RN (e.g., RN1), update their routing table
messages delivered to the latter through more than a sin- and transmit their full dump. LN1, in green, transmits data
gle hop. LNs transmit data to intermediate nodes, named periodically. The data packet comprises a LoRaWAN part
Routing Nodes (RNs), until the data reaches a LoRaWAN and a routing header until it reaches RN1, which contains
gateway. Each RN runs an instance of the routing protocol, a gateway in its routing table. RN1 removes the header and
exchanging routing information packets with neighbor RNs forwards only the LoRaWAN part so that the packet is cor-
to find routes in order to forward packets from LNs to gate- rectly interpreted by the gateway.
ways. We assume RNs are not energy constrained, being Each RN stores a routing table containing a list of des-
connected to the mains power network or relying on energy tinations, the metric to reach each destination, the next

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 949

Fig. 1  Timing diagram of the implemented multi-hop solution. Different colors represent different types of nodes: gateway (blue), RN (orange)
and LN (green). (Color figure online)

hop in the path, the sequence number issued by the des- 3.2 Packet structure
tination and a time stamp to detect stale entries. Since
there is only uplink traffic in the current implementation, The packets exchanged within the multi-hop extension may
a destination corresponds to a gateway, and only the gate- be of two types: full dumps containing routing information or
way with the lowest number of hops (metric) is stored. data packets containing application data. Nodes exchange full
Nevertheless, the protocol is prepared to support other dumps in order to form routes, with each node storing only
destinations such as RNs or LNs, which allows downlink the next hop node along the path, together with its distance to
traffic in future work to be delivered from a gateway to a given destination, as in a typical distance-vector protocol.
a RN or LN along the correct path. When full dumps Sequence numbers issued by each destination are also included
are received, the information is compared with the stored as they ensure loop freedom. The full dump packet structure is
routing table, which is updated when there are new des- represented in Fig. 2. The sender is identified in the Source ID
tinations, better metrics for the same sequence number field, which can only contain an ID from one of the receiving
or newer sequence numbers. RNs can be divided in those node’s neighbors. When a destination is added to the routing
that are gateway neighbors and those that are not. Gate- table of the receiving node, the Source ID field is added as
way neighbors schedule a short reception window right the next hop to reach that destination. The number of entries
after receiving a beacon, in which the channel parameters is included for the receiving node to know how to parse the
are changed to those used by the gateway to transmit the entries. Each entry contains the ID of a destination, its distance
beacon. Other RNs also schedule the next instant from metric and the sequence number generated by that destination.
which they expected the first full dump of the next beacon The list of routing entries represents a short version of the rout-
period, after which a RN should send its own full dump. ing table of the sender node.
An LN sends a data packet with the structure of Fig. 3. The
Unicast ID field identifies the next hop node, i.e., to whom the
packet shall be forwarded to. This ensures packets will only
travel to one path towards their destination when reaching an

Fig. 2  Packet structure of a


full dump containing routing
information with field lengths
in bytes

13
950 J. Dias, A. Grilo

Fig. 3  Structure of a application data packet within the multi-hop network with field lengths in bytes

RN. When an LN transmits a packet, this field is assigned a 3.3.1 Threads


broadcast value. The Destination ID generally corresponds to
the ID of the gateway, i.e. 0. The remaining part, LoRaWAN, Figure 4 represents a high level flowchart of the program
contains the data payload and the other fields defined in the running on RNs. The figure is divided in zones to better
LoRaWAN specification (LoRa Alliance 2017) . Activation visualize which part performs each task. Grey boxes rep-
by Personalization (ABP), in which a node is flashed with the resent wait system calls, which stop the execution of the
session security keys, must be used since the current imple- current thread and wait for other threads or an Interrupt
mentation does not support downlink multi-hop transmission. Service Routine (ISR) to execute before continuing. In this
particular case, the other threads or an ISR may send a sig-
3.3 Protocol implementation nal or place a new mail in the mailbox, after which the cur-
rent thread will then continue its execution. In subsequent
In this section, the protocol is described from the point flowcharts from other components, the boxes that send
of view of an RN. The explanation follows a top down a signal or put a mail in the mail box have a background
approach, starting with how the algorithm components were color associated with the thread which they send the sig-
divided and which data structures were used, further provid- nal to. Boxes with double lines, such as “Parse received
ing more details regarding each component.

Fig. 4  Top level flowchart of the program running on RNs. (Color figure online)

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 951

packet” and “Transmit packet”, are represented in greater not received within that interval and a timeout occurs, the
detail on separated flowcharts. Beacon Thread enters the beacon reception mode again.
There exist three threads running in parallel: Since the receiving time on startup is so long, other pack-
ets in the same beacon frequency and spreading factor may
• Beacon Thread: manages the beacon receiving window be received. If a non-beacon packet is received during that
when the RN is a gateway neighbor. It controls a timer time, or if a CRC error is detected, the consequence will be
which fires an interrupt when it times out, indicating the the same until reaching the maximum number of attempts.
start of the receiving window, and configures the channel Beyond this maximum number of attempts, the node is
parameters for the beacon reception. considered not a gateway neighbor and will only listen for
• Transmission Thread: manages all transmissions, includ- full dumps and data packets. During normal operation,
ing full dumps and data packets, and waits to transmit if a beacon reception timeout occurs, the next scheduled
the next packet by calculating its air-time according to reception window will be longer to account for the previ-
the duty cycle limitations. Packets to be transmitted are ous timeout (which is equal to the time duration of the
taken from a mail box, which receives them either from reception window) and will be started earlier. When a RN
the Beacon Thread (full dump) or from the Data Recep- fails the reception of a beacon up to the defined limit, the
tion Thread (data packet). RN stops being considered a gateway neighbor, and the
• Data Reception Thread: Processes all received packets gateway is removed from the RN’s routing table.
which are not beacons from gateways, including full
dumps and data packets. Note that the box associated
with the task of parsing the received packet is common 3.3.2 Interrupts
both to the Beacon Thread and to the Data Reception
Thread. Interrupts are signals to the processing unit indicating an
event that requires immediate attention. Interrupt Service
When powered up, a RN will set its channel parameters Routines (ISR) are subsequently run with higher prior-
to allow beacon reception, waiting in reception mode for ity over threads. In the present implementation, interrupts
a time interval equal to the beacon period. If a beacon is may have two separate origins, as represented in Fig. 5:

Fig. 5  Flowchart of the interrupts. (Color figure online)

13
952 J. Dias, A. Grilo

• LoRa radio transceiver, indicating a successful or timed- The type is now checked to contain an ‘R’. Next, the
out transmission or reception, or a packet received with packet is iterated to extract the several advertised des-
errors, i.e., CRC failed. tinations, their distance metrics and sequence numbers,
• An MCU timer that timed out. There are two timers run- which are compared with the existing routing table. A
ning permanently with an ISR associated: one to notify destination is added to the table if it does not exist, or
that the beacon window should start, in case the RN is updated if, for the same sequence number, the distance
a gateway neighbor, or, in case it is not, to reset a flag is lower, or if the sequencer number is greater. When-
which indicates if the full dump was already sent dur- ever there is an insertion or update in the routing table,
ing the current beacon period. The other timer, indicated the row containing that destination is timestamped in the
as Backoff Timeout, is used to avoid collisions during a field Install Time, which is used to detect expired entries
transmission and is explained later in Sect. 3.3.5. before sending a full dump. Additionally, if one of the
advertised destinations has an odd sequence number that
The ISRs mainly result in a signal being sent to a thread, is higher than the one in the routing table, that represents
whose color is associated with the box background color. All a destination that is now unreachable. Consequently, it is
interrupts are configured with the same priority. Each ISR updated and removed from the table as soon as the next
contains as few steps as possible, in order not to cause delay full dump is transmitted.
between processing of events. A state variable is assigned • Application data packet. If the packet contains applica-
a value, which represents the type of interrupt that identi- tion data, the field type should contain an ‘M’ character.
fies the event within the transceivers’ different interrupts. According to Fig. 3, the two IDs are extracted. Firstly,
Despite being very unlikely, if a transceiver’s interrupt the Unicast ID is compared with the Unicast ID of the
occurs while the MCU is inside a Timer ISR, the second RN that received it. If there is a match, the RN iterates
interrupt will wait for the first ISR to finish its execution. over its routing table to look for the destination specified
in Destination ID field. If the destination is found,the
3.3.3 Parsing of received packet node checks the next hop field indicated in the rout-
ing table. If the next node in the the path is a gateway,
When a packet is received, it is verified to be one of the the three bytes of overhead must be eliminated. If the
following possible packets: a full dump, a data packet or a next hop is not a gateway, the packet’s Unicast ID field
beacon. The flow of actions is represented in Fig. 6. This is updated to the value of the next hop indicated in the
routine runs both in the Beacon Thread and on the Data routing table. In both cases, which are highlighted in a
Reception Thread. In either case, it is called after an inter- pink colored area, the resulting modified packet is put in
rupt signals either thread and after confirming that the state the mailbox for the Transmission Thread to transmit it.
variable indicates a packet received with correct CRC.
The four different areas in Fig. 6 represent the mentioned 3.3.4 Full dump
three different cases of reception, plus the common set of
operations for routing data packets. The different cases are Full dumps are transmitted right after receiving a beacon or
explained below. the first full dump within a beacon period. The routing table
is iterated and all entries are put in a full dump packet to be
• Beacon from a gateway. The parameters contained in broadcasted to neighbors. The respective flowchart can be
a full dump, namely the destination, sequence number seen in Fig. 7. While iterating, the algorithm first checks if
and distance metric are extracted from a normal beacon the current entry is stale by comparing its Install Time with
packet specified in LoRaWAN. The identification of the the current value of a timer. If the difference is greater than
beacon is performed by comparing the first three bytes, a number c of beacon periods, the entry is considered stale.
which correspond to the NetworkID field of the beacon. If the entry is stale, the sequence number is incremented
If there is a match with the expected result, the destina- to indicate an unreachable destination, the row is added to
tion is set to 0, the distance to 1 and the sequence number the current full dump packet and then removed from the
is extracted from the two least significant bytes of the table. If the sequence number is even, that destination was
time field. This corresponds to an absolute maximum of received as unreachable from a full dump packet in the pre-
65535 in the sequence number field. As the timestamp is vious beacon period. As such, it was not transmitted yet and
taken from a GPS module in each gateway, the synchro- was maintained in the routing table to be transmitted in the
nization is ensured and all nodes distancing 1 hop from next beacon period. A destination in this condition is added
a gateway will advertise the same sequence number. to the packet and removed from the routing table. If all des-
• Full dump. The sender’s ID and and type of packet are tinations have been read, the packet is put in the mailbox for
extracted from the expected fields according to Fig. 2. the Transmission Thread to transmit it.

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 953

Fig. 6  Medium level flowchart of a reception. (Color figure online)

3.3.5 Packet transmission an exponential backoff, i.e. wait a random amount of time


until checking the medium again and doubling the upper
Every transmission is accomplished by the Transmis- bound of the waiting time when preambles are consecutively
sion Thread. This subroutine is represented in Fig. 8 detected. The minimum waiting time, a, should correspond
and corresponds to the box entitled “Transmit packet” in to the air-time of one packet. The maximum, b, should be the
Fig. 4. It starts with a CAD on the medium to detect a minimum time plus the random number. The upper bound
valid LoRaWAN preamble. If a preamble is not detected, of such random number doubles due to an increment of the
it assumes the medium is free and transmits. On the other number of bits used for its representation. When it finally
hand, if a preamble is detected, the transmitter will follow transmits, the upper bound is reset.

13
954 J. Dias, A. Grilo

Fig. 7  Flowchart of the con-


struction of a full dump packet

3.4 Design choices to the gateway in a random channel in the set {868.1,


868.3, 868.5} MHz.
We enumerate below the design choices taken during the • Downlink is not supported in the current proposal of
development phase. this extension. If we consider that the RNs are subject
to duty cycle constraints, it becomes evident that shar-
• RNs transmit in one of the frequency channels between ing resources between uplink and downlink turns it dif-
868.0 MHz and 868.6 MHz (allowed to a maximum ficult to guarantee downlink packet delivery to LNs at
of 1% duty cycle). The frequency in which the nodes specific time instants unless they are put in continuous
exchange the full dumps and the application data mes- reception.
sages is constant and should be defined when RNs are • The beacons are issued with a constant period. We
flashed. If a RN is a gateway’s neighbor, it transmits initially thought of implementing an exponential bea-
con timer similar to RPL, due to the static profile of a
LoRaWAN network. The advantage would be the reduc-
tion of overhead and consequently higher data throughput
with the consequence of faulty nodes being detected and
advertised with a higher delay. The drawback was that the
gateway’s packet forwarder had to have its beacon timer
modified from a constant to a dynamic period, which
does not correspond to the LoRaWAN specification and
counters the notion of extension. Another solution for
the beacon was to make it a downlink packet sent from
the application server as an alternative to avoid modify-
ing the gateway. However, there are two main drawbacks
related with such option. Firstly, independent multi-hop
networks would need separate downlink messages, which
negatively affects the available downlink throughput to
single hop nodes. Furthermore, there is no guarantee of
message delivery within a certain time. As such, an RN
at range of more than one gateway could receive the same
sequence number at different instants, which could origi-
Fig. 8  Flowchart of the transmission of a packet with collision avoid- nate fluctuations on routes and unnecessary advertise-
ance using carrier activity detection ments.

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 955

4 Performance evaluation 16, 32, 64, 128} ms. Each interval setting was tested with
2000 transmissions from each transmitter. The transmitted
The routing protocol and CAD mechanism described previ- packets had a payload of 20 bytes, with explicit header,
ously were implemented and tested in a prototype system. CR = 4∕5, BW = 250 kHz and a programmed preamble of
The hardware employed to implement each system compo- 8 symbols. The resulting air time is ToA ≈ 28.29 ms.
nent was the following: Comparing the packet ToA with the testing intervals,
the following is observed:
• Leaf Nodes and Relay Nodes: we used the HopeRF
RFM95 868Mhz RF transceiver module connected to a • For 8 ms and 16 ms, collisions are certain;
STM32L432KC Nucleo board for RNs and an Arduino • For 32 ms, collisions are highly probable;
Pro Mini for LNs. • For 64 ms and 128 ms, collisions are less probable.
• Gateway: The LoRa concentrator is the iC880A-SPI
board manufactured by IMST, which was assembled to a The time between transmission cycles, 1 s, needs to
Raspberry Pi 3 running a packet forwarder TTN (2017b). include a minimum number of backoff times in case of
A GPS was also added to obtain a time reference. The consecutive carrier detections. Since the same code runs
used antenna was a 12 𝜆 dipole with 2 dBi gain. on both transmitters and they start at the same time, syn-
• Network Server: The Things Network (TTN) — a crowd- chronization is expected to be kept. The PRR for the
sourced and open source LoRaWAN network with an experiments with CAD (triangles) and without CAD (cir-
incorporated Network Server — TTN (2017a) was used. cles) is represented in Fig. 9. As expected, in the experi-
• Application Server: Node-Red integration from TTN ment without CAD, the PRR decreases as the time interval
was used to store data from tests for later analysis since becomes shorter, due to an increase in the probability of
TTN dashboard does not store data persistently — TTN collisions. Moreover, when shortening the interval, the
(2017a). distance between points for the same intervals, with and
without CAD, is higher. The results also show that the
The current section presents the experimental results Packet Reception Rate (PRR) stays approximately con-
obtained with the developed prototype. stant at 27% for intervals where collisions are highly likely
LoRaWAN and other technologies that operate in the and certain. For intervals where collisions are probable or
unlicensed spectrum have duty cycle regulations that limit certain, the CAD greatly increases the number of received
the maximum data rate available per node. This upper limit packets when compared with the case where no CAD was
is much lower than the maximum data rate imposed by the used. The obtained results are presented in Table 1.
modulation and coding employed. In a multi-hop network Another experiment was conducted in order to assess
where nodes with the same restrictions forward packets from the capture effect between two signals received with dif-
other nodes, it is critical to identify what is possible when ferent power levels. In Bor et al. (2016), two transmitters
designing under such restrictions. Equation (1) was used with different transmit power were used. In the present
to calculate the Time on Air (ToA) throughout the current experiment, nodes were configured with the same trans-
section. The complete form of this equation can be found in mit power but were placed at two different distances from
the LoRaWAN specification (Semtech 2015). the receiver, which leads to a weak transmission (more
distant from the receiver) and a strong transmission (less
ToA = Tpreamble + Tpacket distant from the receiver). It was observed that, for inter-
= Tsymbol (Lpreamble + LPHDR + LPHDR_CRC (1) vals where collisions are almost certain, for the case with-
+ LPHDR_CRC + LPHY_payload + LPHY_CRC ) out CAD, there is a concentration of RSSI in the higher
(less negative, around − 37 dBm) values. This indicates
that only the strongest transmission is received, which cor-
4.1 CAD for collision avoidance (CA) responds to the capture effect. When CAD is used, the
distribution of RSSI flattens and distributes both around
Two experiments were conducted to evaluate if CAD can
− 37 dBm (strong transmission) and − 53 dBm (weak
be used to successfully avoid collisions. The first experi-
transmission) for the 8 ms interval, which is due to the fact
ment is used as reference and comprises one transmitter
that the transmissions begin to alternate. When the weak
without CAD and one receiver. The second experiment
transmitter is transmitting, the strong transmission will
comprises two transmitters with CAD and one receiver. In
detect it and wait, allowing the weak transmission to be
the CAD experiment, two synchronized transmitters trans-
received and demodulated correctly. This means that the
mit randomly within a given interval of time. The time
fairness of medium access increases with CAD.
intervals were varied from 8 to 128 ms within the set {8,

13
956 J. Dias, A. Grilo

Fig. 9  PRR for the different transmit time intervals tested

Table 1  PRR in percentage for situations with and without CAD for 4.2.1 Single hop: LoRaWAN benchmark
different intervals and 2000 transmitted packets
Time interval (ms) PRR without CAD (%) PRR (with For this first experiment, we assessed the performance of
CAD) (%) one node reaching a gateway through single hop such as
in a typical LoRaWAN network. The maximum theoretical
8 27.1 79.6
throughput is limited by the technology, by the duty cycle
16 26.0 84.3
and by the LoRaWAN overhead. The packet time on air is
32 26.8 90.1
ToAref = 33.41 ms. If we consider the duty cycle limitation,
64 53.4 94.8
we get the maximum theoretical throughput of 35.92 bit/s for
128 71.6 96.8
a 15 byte data packet. The resulting experimental through-
put, calculated based on the time between the arrival of the
first and the last packet, 𝛥t , and on the total number of pack-
4.2 LoRaWAN multi‑hop uplink extension ets received N, resulted in Eq. 2. The obtained PRR was
99.4% for 500 transmitted packets, which is higher than the
The PRR and throughput were the metrics used in the value provided in the datasheet (99%).
performance assessment. In each of the following experi-
L×8×N 15 × 8 × 497
ments, we logged each transmission in each RN and also Thref = = ≈ 35.39 bit∕s. (2)
𝛥t 1685
on the Application Server. In each RN, a counter for the
number of received packets from each LN was maintained The small difference between the two comes from the loss
and, in the Application Server, each received packet, con- of three packets, which is not considered in the theoretical
taining the packet counter, node identification, time and equation. This result is used as a reference for the tests that
other parameters, was stored in a CSV file with a Node- follow.
Red script. A total length of 31 bytes was chosen: 15 bytes
of application data, 3 bytes of routing overhead and 13
bytes of LoRaWAN overhead (similar in size to a Sig- 4.2.2 Two hops without routing protocol
fox frame). The rest of the configured parameters were
f = 250 kHz , CR = 4∕5 , a programmable preamble of 8 The second experiment consisted on evaluating the through-
symbols and the use of explicit header. On all experiments, put and PRR when one node forwards LoRaWAN packets
a total of 500 packets were transmitted. from the LN to the gateway. The LN will send LoRaWAN
packets without multi-hop extension overhead, which will be

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 957

received by the forwarder and retransmitted to the gateway. denominator of Eq. (2) without increasing the numerator,
The forwarder solely transmits what it receives. which only takes into consideration the application pay-
The resulting throughput [calculated according to Eq. load. The second reason may be the packet loss, since the
(2)], and the PRR, both assessed at the Application Server, RN is not only receiving data packets from the LN but also
were 34.73 bit/s and 97.6%, respectively. These values are switching frequency at a period of 128 s to receive the bea-
slightly worse than for single hop. The datasheet lists a PRR con. During this interval, the RN cannot receive packets
of 99% for the used radio module, which indicates that more originated by the LN. Moreover, full dumps have priority
losses are expected with the introduction of each extra hop. over data packets and, if the queue is full, a packet must be
dropped in order to transmit the full dump every 128 s. How-
4.2.3 Linear topology ever, as shown in Table 2, the PRR was not lower than the
case with the simple forwarder and thus we assume that the
In this subsection, we analyze the routing protocol over- difference between the two is inside the confidence interval.
head and the impact of increasing the number of hops, in Regarding the results with different numbers of RNs, we
a linear topology, from two hops to five hops. In each test, found that the PRR at the Application Server decreases on
the number of RNs between the gateway and the LN5 was average 2.2% and the throughput 2.3% with each extra hop.
increased by one.
The first experiment was similar to that of the previous 4.2.4 Bottleneck topology
subsection, with the difference that the forwarder node had
the routing protocol implemented, constituting an RN. In The bottleneck topology is constituted by a RN within
this case, the forwarder node waits for a beacon and sends the range of the gateway and a set of K neighbor LNs (see
its full dump. Also, each packet originated from the LN to Fig. 10). This case is particularly important when duty cycle
the RN has three bytes appended to the LoRaWAN packet. restrictions are imposed by spectrum regulations, since an
Hence, the throughput and PRR are expected to decrease. RN is under the same restrictions as the other nodes. Unless
The subsequent experiments consisted on increasing the every LN only transmits one packet every ToA × 100 × K
number of RNs between the LN and the gateway, one by seconds, the RN will experience congestion.
one. RNs that were in the middle were configured to only We have set up an experiment comprising three LNs
fire the reception interrupt if a routing packet came from and one RN, in which we maintained the same packet
an adjacent RN neighbor or, in case of a data packet, if the parameters but configured each LN to transmit every
Unicast ID field contained their ID. For the RN adjacent to ToA × 100 × 3 = 10.79 s, where the packet air time is
the LN, the previous Unicast ID condition was changed to
the Broadcast ID. In this way, we are sure that the path taken
by a data packet passes through all the nodes.
We first let the topology be constructed by switching the
nodes on and waiting for the first beacon to be received. The
first beacon will trigger the series of full dumps within the
multi-hop topology. The obtained results for the PRR are
presented in Table 2, and the throughput, again calculated
from Eq. (2), is presented in Table 2.
We observe that, from the simple forwarder scenario to
the RN with implemented protocol, the throughput decreases
6.5%. This may have two reasons. The first comes from the
fact that the three bytes of overhead appended to the packet
by the LN increase the packet air time, also increasing the Fig. 10  Bottleneck topology with one RN and K LNs

Table 2  PRR and throughput RNs App. server (%) RN1 (%) RN2 RN3 RN4 Through-
for four experiments with a put
linear topology with different (bit/s)
number of RNs
1 98.2 99.4 – – – 32.48
2 94.8 95.0 96.8% – – 31.36
3 93.4 94.2 96.2% 96.8% – 30.87
4 91.6 94.2 94.4% 96.2% 98.0% 30.26

13
958 J. Dias, A. Grilo

Table 3  PRR and throughput Application server RN1


for the experiment with a
bottleneck topology composed LN1 LN2 LN3 LN1 LN2 LN3
by three LNs and one RN
Individual PRR 87.2% 87.6% 88.6% 92.8% 93.6% 94.4%
Combined PRR 88.7% 93.6%
Throughput 29.56 (bit/s) –

ToA = 35.97 ms. Also, the transmit power was decreased applications, in which uplink packets contain mostly sen-
to the minimum (0 dB). All LNs were configured to be in sor readings. Moreover, for non-critical applications, a PRR
reception mode when started. Upon reception of the first slightly below 90% may still be acceptable. We conclude that
packet (the full dump from the RN), each LN started a peri- a LoRaWAN multi-hop uplink extension is feasible even
odic timer, all at the same time, in order to be synchronized with the duty cycle restriction of the 868 MHz band. This
with the other two LNs. Each transmission occured in a solution provides an extended communication range at the
random interval within the first 6.4 s of each interval of cost of a reduction in the throughput and PRR, which ben-
10 s. The obtained results for the PRR and throughput are efits applications with sporadic traffic, and in which the loss
presented in Table 3. of a few packets is not critical.
The obtained throughput at the Application Server for the Some aspects were left to be addressed in future work:
ensemble of three nodes is lower for the bottleneck topology
than for the linear topology with one RN. The difference • Characterize the bottleneck topology for an increased
may be explained by the difference in the PRR, which is also number of LNs;
lower. The difference of 9.5% in the PRR may be explained • The RNs were assumed to be powered by an external
by concurrent transmissions from the LNs colliding at the power source. An analysis on the energy consumption
RN. When observing the independent PRRs for each of the on these nodes may possibly extend the application’s sce-
three LNs, we observe that the differences are at most 1.4%, narios to remote areas where an AC plug is not present;
which is not considered significant. Also, the packets from • Downlink capability should be added to allow multi-hop
either of the LNs may arrive at the RN while the RN is acknowledgments, node configuration, as well as control-
transmitting either a full dump, where there is no difference ling actuators;
with the linear topology, or an application data packet. Note • Integrate a transmit power control (TPC) mechanism;
that, in the linear topology, this was unlikely to occur given • Consider metrics other than the number of hops to estab-
that there was no randomness associated with the transmis- lish multi-hop routes.
sions of the LN. Hence, when a packet is received by a RN,
it is quickly processed and forwarded when the waiting time
due to the duty cycle for the previous packet has already Acknowledgements This work was partially supported by Portuguese
national funds through Fundação para a Ciência e a Tecnologia (FCT)
elapsed. As the RN removes the routing overhead, this wait- with reference UID/CEC/50021/2013.
ing time is lower for the RN than for the LN and thus, when
the RN is forwarding the packet from the LN, the same LN
is waiting to transmit the next packet. This stability is only References
compromised when a beacon is received and a full dump
must be sent. Abdul-Qawy A, Srinivasulu T (2018) Sees: a scalable and energy-
efficient scheme for green iot-based heterogeneous wireless nodes.
J Ambient Intell Humaniz Comput. https:​ //doi.org/10.1007/s1265​
2-018-0758-7
5 Conclusions Adelantado F, Vilajosana X, Tuset-Peiro P, Martinez B, Melia-Segui
J, Watteyne T (2017) Understanding the limits of lorawan.
This paper proposed an uplink multi-hop extension to IEEE Commun Mag 55(9):34–40. https ​ : //doi.org/10.1109/
LoRaWAN, which is fully compatible with standard MCOM.2017.16006​13
Bor M, Vidler J, Roedig U (2016) LoRa for the internet of things. Junc-
LoRaWAN gateways. Multi-hop routes are established tion Publishing, Dublin, pp 361–366
using an adaptation of the DSDV routing protocol. The de Velde BV (2017) Multi-hop lorawan: including a forwarding node.
proposed scheme was assessed using the PRR and through- https​://texus​.me/files​/Paper​%20Mul​ti-hop%20LoR​aWAN.pdf.
put as performance metrics, being tested in linear and bot- Accessed 18 Jan 2019
Dias J, Grilo A (2018) Lorawan multi-hop uplink extension. In: The
tleneck topologies. The overall results show that such a 9th international conference on ambient systems, networks and
multi-hop extension to LoRaWAN is feasible. The obtained technologies (ANT 2018), ScienceDirect, vol 130, pp 424–431.
values for throughput are satisfactory for most of the IoT https​://doi.org/10.1016/j.procs​.2018.04.063. https​://www.scien​

13
Multi‑hop LoRaWAN uplink extension: specification and prototype implementation 959

cedir​ect.com/scien​ce/artic​le/pii/S1877​05091​83042​16. Accessed TTN (2017a) The things network (TTN). http://www.theth​ingsn​etwor​


18 Jan 2019 k.org. Accessed 18 Jan 2019
Djamaa B, Yachir A, Richardson M (2017) Hybrid coap-based resource TTN (2017b) The things network (TTN) Zurich Github repository.
discovery for the internet of things. J Ambient Intell Humaniz http://githu​b.com/ttn-zh/ic880​a-gatew​ay/wiki. Accessed 18 Jan
Comput. https​://doi.org/10.1007/s1265​2-017-0450-3 2019
Gregora L, Vojtech L, Neruda M (2016) Indoor signal propagation Vázquez T, Noz SBM, Bellalta B, Be A (2017) Hare: supporting effi-
of LoRa technology. In: 2016 17th international conference on cient uplink multi-hop communications in self-organizing lpwans.
mechatronics—mechatronika (ME), pp 1–4 Sensors. https​://doi.org/10.3390/s1801​0115
Haxhibeqiri J, Van den Abeele F, Moerman I, Hoebeke J (2017) Lora Winter T, Thubert P, Brandt A, Hui J, Kelsey R, Levis P, Pister K,
scalability: a simulation model based on interference measure- Struik R, Vasseur J, Alexander R (2012) RPL: IPv6 routing pro-
ments. Sensors 17(6):1193. https​://doi.org/10.3390/s1706​1193 tocol for low-power and lossy networks. https​://doi.org/10.17487​
LoRa Alliance (2017) LoRaWAN 1.1 Specification. LoRa Alliance /RFC65​50. http://www.rfc-edito​r.org/info/rfc65​50. Accessed 18
Perkins CE, Bhagwat P (1994) Highly dynamic destination-sequenced Jan 2019
distance-vector routing (DSDV) for mobile computers. SIG- Zungeru AM, Ang LM, Seng KP (2012) Classical and swarm intel-
COMM Comput Commun Rev 24(4):234–244 ligence based routing protocols for wireless sensor networks: a
Petajajarvi J, Mikhaylov K, Roivainen A, Hanninen T, Pettissalo M survey and comparison. J Netw Comput Appl 35(5):1508–1536.
(2015) On the coverage of LPWANs: range evaluation and chan- https​://doi.org/10.1016/j.jnca.2012.03.004
nel attenuation model for LoRa technology. In: 2015 14th inter-
national conference on ITS telecommunications (ITST), pp 55–59 Publisher’s Note Springer Nature remains neutral with regard to
Sanchez-Iborra R, Sanchez-Gomez J, Ballesta-Vias J, Cano MD, jurisdictional claims in published maps and institutional affiliations.
Skarmeta A (2018) Performance evaluation of lora considering
scenario conditions. Sensors. https​://doi.org/10.3390/s1803​0772
Semtech (2015) SX1276/77/78/79—137 MHz to 1020 MHz low power
long range transceiver. Semtech Corporation. http://www.semte​
ch.com/image​s/datas​heet/sx127​6.pdf, datasheet. Accessed 18 Jan
2019

13

You might also like