• No results found

Lora technology in wireless sensor networks

N/A
N/A
Protected

Academic year: 2021

Share "Lora technology in wireless sensor networks"

Copied!
44
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

0 | P a g e

LORA TECHNOLOGY IN WIRELESS SENSOR NETWORKS

By Karlis Mendzins

GRADUATION REPORT

Submitted to

Hanze University of Applied Science Groningen

In partial fulfilment of the requirements for the degree of

Full Honours Bachelor Advanced Sensor Applications

(2)

ABSTRACT

LORA TECHNOLOGY IN WIRELESS SENSOR NETWORKS By

Karlis Mendzins

Wireless sensor networks are getting more and more attention because of the spreading acknowledgement of the Internet of Things for industrial solutions and households. It is estimated that over 50 billion devices will be connected to Internet by year 2020. Most of these devices will be part of IoT and/or M2M systems. Wireless sensor networks (WSNs) are attracting growing attention for their availability and low cost. Until recently their range was limited to a few hundred meters in line-of-sight situations. In 2013 LoRa technology was introduced, which surpassed those few hundred meters and transmitted signal over 15 km range, while being low-power. This article describes possible PHY and MAC layer implementation of LoRa technology for a typical real-life WSN by comparing supporting microcontrollers and evaluating existing MAC layers for WSNs. It can be concluded that LoRa technology is suited for any microcontroller with SPI peripheral and is arguably the most befitting solution for a low-power long-range WSN solutions.

Keywords: wireless sensor network, LoRa technology, Media Access Control, PHY layer, low-power WLAN, Internet of Things, machine-to-machine communication.

(3)

DECLARATION

I hereby certify that this report constitutes my own product, that where the language of others is set forth, quotation marks so indicate, and that appropriate credit is given where I have used the language, ideas, expressions or writings of another.

I declare that the report describes original work that has not previously been presented for the award of any other degree of any institution.

Signed,

(4)

ACKNOWLEDGEMENTS

Author wishes to thank I. Bukovskis and B.D. Williams for a splendid supervision, D. Liepkalns and G. Paškevičs for technical advisory.

(5)
(6)

Table of Contents

LIST OF TABLES ... 6 LIST OF FIGURES ... 7 I. RATIONALE ... 8 Introduction ... 8 Current situation ... 8 Desired situation ... 9

Desired situation of this project ... 9

Terms, definitions, and abbreviations ... 9

II. SITUATIONAL AND THEORETICAL ANALYSIS ... 13

IoT and M2M systems ... 13

Bluetooth LE ... 13

Wi-Fi ... 13

ZigBee WSN ... 14

LoRa technology ... 14

SAF Tehnika WSN ... 15

III. CONCEPTUAL MODEL ... 16

SAF Tehnika needs ... 16

Characteristics of LoRa technology ... 16

IV. RESEARCH DESIGN ... 18

PHY layer ... 18

Setup of PHY layer ... 18

List of materials ... 19

Transceiver setup ... 19

Comparing LoRaWAN and SAF Tehnika WSN ... 21

V. RESEARCH RESULTS ... 22

Connecting SX1272 to ARM microprocessor ... 22

Putting transceiver to different modes via SPI ... 22

Comparison of real transmitting time versus transmitting time predicted by LoRa calculator ... 23

Comparison of ARM microprocessor versus TI microprocessor ... 24

Comparison of LoRaWAN, and SAF Tehnika WSN MAC layers ... 24

Comparison of different encryption types ... 25

(7)

VII. RECOMMENDATIONS ... 27 REFERENCES CITED ... 29 Appendix ... 33

(8)
(9)

6 | P a g e

LIST OF TABLES

Table 1 Overlook of possible modes for SX1272 over SPI communication ... 22 Table 2 Transmitting time. Predicted vs. Real ... 24 Table 3 Comparison between ARM M0+, MSP430, and MSP432 current consumption ... 24 Table 4 Comparison of LoRaWAN and SAF Tehnika wireless sensor network MAC layers in scale from 1 to 10, where 10 is the best result ... 24 Table 5 Comparison of AES, XXTEA, and RC4 encryption methods ... 25

(10)

7 | P a g e

LIST OF FIGURES

Figure 1 Visualization of LoRa transceiver (SX1272) in combination with ARM microprocessor

(STM32F4-Discovery) ... 18

Figure 2 SX1272 with STM32F4, with logic analyzer ... 20

Figure 3 Example of acquiring SX1272 state displayed with Saleae Logic 1.1.34 Beta software ... 20

Figure 5 Working SPI example ... 22

Figure 4 Example of results displayed with Saleae Logic 1.1.34 Beta ... 22

Figure 6 On the left side - spectrum analyzer showing no signal over center frequency of 865.00 MHz. On the right side - spectrum analyzer showing signal over center frequency of 865.00 MHz ... 23

(11)

8 | P a g e

I.

RATIONALE

Introduction

By 2020 there are expected to be 22 billion devices connected to the Internet [1] according to IHS Technology research [2]. This number would explode even further if Machine-to-Machine (M2M) systems, such as smart grids, networked security cameras, and climate monitoring devices, would be included. Some experts are estimating this number to be as high as 50 billion devices [3]. Hence, an enormous data traffic will be present, which will require efficient ways of organizing it. Unorganized data traffic presents many problems. It would, for instance, lead to the introduction of a huge amount of “junkies”, which would mostly disturb the traffic. Some of these “junkies” are devices meant to forward their received messages, resulting in the fact that a message is sent more than once till it reaches its destiny. The organizational part to eliminate unnecessary actions is partially done in Media Access Control layer (MAC).

Current situation

In 2013 Semtech [4] introduced a new radio frequency (RF) platform called LoRa [5]. LoRa enables long-range and low-power connectivity to Internet of Things (IoT) [6]. By doing so Semtech has claimed that there is no more need for multiple repeaters to achieve wide coverage. Hence, it simplifies the design of a system and lowers its total costs of deployment. Until the introduction of LoRa, the maximum coverage in a suburban environment by a similar device was up to 2 km. Using the LoRa technology, Semtech’s SX127x 2-way wireless communication systems [7] achieves a range of more than 15 km in a suburban environment and up to 5 km in a dense urban environment (operating under EU, US, Chinese, and Japanese regulatory limits). LoRA is a spread spectrum modulation scheme that uses wideband linear frequency modulated pulses. The frequency increases or decreases over a certain amount of time to encode information. LoRa modulation increases receiver’s sensitivity and creates a high tolerance to frequency misalignment between the receiver and transmitter, according to documents on Semtech's website [7].

SAF Tehnika [8] is a designer, producer, and distributor of digital Microwave Data transmission equipment. SAF Tehnika products provide wireless backhaul solutions for digital voice and data transmission to mobile and fixed network operators, data service providers, governments and private companies. SAF Tehnika also provides a wide range of customized microwave solutions for various applications, such as broadcasting and Low latency networks.

Since LoRa has been introduced only recently, most existing RF IoT systems have a range of up to 2 km. The same applies to SAF Tehnika. When building communication systems that have to communicate over a large area (more than 5 km) or in an urban environment, such as IoT or machine-to-machine (M2M) [9], a number of repeaters or other means of connection are necessary to deliver data. For the purpose of testing LoRa capabilities, SAF Tehnika has created a test protocol. Currently 100 devices utilizing LoRa technology are connected to a base station. These devices are placed throughout a manufacturing building, where SAF Tehnika is located. Next to these 100 devices 5 other networks using the same technology and protocol are running simultaneously to monitor possible errors.

The drawbacks of the current system are that there is still a need to optimize the protocol as errors are occurring more often than desired. In addition, the power consumption per device is not satisfactory.

(12)

9 | P a g e

Desired situation

The main desired situation from SAF Tehnika’s perspective is to have a long range wireless sensor network. This network is initially intended to measure physical parameters (such as, temperature and humidity) of a building and outside environment and would consist of several stand-alone transceivers or sub-systems.

These transceivers in combination with others from its kind would transmit data readings from hundreds of sensors placed in an area that could cover a multi-apartment house. Main features of such a transceiver would be:

• Safety (data is encoded using a standardized protocol);

• Low-power requirements (is able to work on 2 AAA type batteries) to run for a number of years; • Long-range (minimum being 1 km in urban areas);

• Endurance against various physical conditions (temperature variations from -40 to +50 degrees Celsius, humidity variations up to 90%).

There is a growing trend for these kinds of systems as more and more people acknowledge their usefulness. This system is expected to be one of the most sold systems by SAF Tehnika and to become a good example to follow when building a long-range low-power WSNs.

Desired situation of this project

The desired situation of this project is to find proof of LoRa technology being suitable to aid in reaching SAF Tehnika main desired situation criteria. The proposed approach is based on effectiveness of both PHY and MAC layers. The project is focused in answering the following central research question:

How can theoretical parameters of LoRa technology be effectively implemented in a typical real-life situation in order to create a wireless sensor network?

The central research question can be dissected into the following sub-questions: • What is LoRa technology and why is it important?

• What are the main functional aspects of LoRa technology? o What are the potential benefits of LoRa technology? o What are the drawbacks of LoRa technology?

• What Media Access Controls utilizing LoRa technology are already known? • Is LoRa technology suitable for SAF Tehnika requirements of the desired system? • Is already available MAC solution suitable for SAF Tehnika’s WSN?

Terms, definitions, and abbreviations

Adaptive Frequency Agility – AFA is a technique used by radio transmitters to avoid transmission in

channels that are already occupied

Bandwidth – the difference between the upper and lower frequencies in a continuous set of

(13)

10 | P a g e

CAD – Channel Activity Detection is a technique to detect presence or absence of signals in the

channel

CDMA - Code Division Multiple Access is a digital technique that spreads digitized version of analogue

signal out over a wider bandwidth at a lower power level

Coordinator – a ZigBee coordinator is responsible for forming the network. After forming is done, it

acts as a router

CRC – error detecting code to detect accidental changes to raw data

Energy efficiency – comparable measurement, which states how much energy is being used and

wasted

End device – a destination device in a networked system Ethernet – a network for locally accessible devices

FDMA - Frequency Division Multiple Access is a channel access method used in multiple-access

protocols as a channelization protocol. FDMA gives users an individual allocation of one or several frequency bands, or channels

FIFO – First In, First Out. A method of organizing and manipulating data buffer, where the first entry

is processed first

Frequency domain – analysis of mathematical functions or signals with respect to frequency, rather

than time

Heterogeneity – the quality of being diverse

Internet of Things – a network in which objects, animals or people are provided with unique

identifiers and the ability to transfer data inside the network without requiring to-human or human-to-computer interaction. IoT is a convergence of wireless technologies, micro-electromechanical systems and the Internet

Junkies – [in this context] an object which provides no meaningful information to the system, but at

the same time occupies bandwidth, space, energy, or other means in the system

Listen Before Talk – LBT. A technique used in radio communications whereby a radio transmitters

first sense its radio environment before it starts a transmission

MAC layer – Media Access Control layer of the system or sub-system

Microcontroller – a down-sized computer on a single integrated circuit containing a processor core,

memory, and programmable input/output peripherals

(14)

11 | P a g e M2M - technology that enables networked devices to exchange information and perform actions

without the manual assistance of humans

PAMA – Pulse-address Multiple Access is a channel access method that enables the ability of a

communicator to receive signals from several terminals simultaneously and to amplify, translate, and relay the signals back to those terminals, based on the addressing of each station by an assignment of a unique combination of time and frequency slots

Payload – actual data to be transmitted

PHY layer – physical layer of the system or sub-system

Privacy and security – aspect concerning defence mechanisms of data being transmitted

Repeater - an electronic device that receives a signal and retransmits it at a higher level or higher

power, or onto the other side of an obstruction, so that the signal can cover longer distances

Responsiveness – in this case, a networks ability to choose the best solution in order to establish

optimal communication

Robustness – defence mechanism against errors in communication

Router – a router is responsible for routing services to network devices. They can also send and

receive messages themselves

RF – radio frequency

Scalability – the ability to adapt to increased demands

SDMA – Space Division Multiple Access is a physical technique that divides frequency users in space

so that there is no interference between them allowing multiple users to use the same frequency

Self-configuration and adaption – organizational part for optimal network configuration Sensor – a device that gathers meaningful data (temperature, humidity, flow, sounds, etc.) Sensor network – a set of sensors monitored at a central facility

Sensor node – a self-contained device that gathers data, processes it, and communicates it to a

control unit

Smart grid – electrical grid that uses analogue or digital information and communications technology

to gather and act on information in an automated fashion to improve the efficiency, reliability, economics, and sustainability of the production and distribution of electricity

SPI – Serial Peripheral Interface is a synchronous serial communication interface specification used

(15)

12 | P a g e

Spread spectrum - method by which a signal generated with a particular bandwidth is deliberately

spread in the frequency domain, resulting in a signal with a wider bandwidth

Systematic design – design of a system working in a step-by-step manner

TDMA - Time Division Multiple Access a digital technique that divides a single channel or band into

time slots. Each time slot is used to transmit one byte or another digital segment of each signal in sequential serial data format

WPAN – wireless personal area network WSN – wireless sensor network

(16)

13 | P a g e

II.

SITUATIONAL AND THEORETICAL ANALYSIS

This chapter summarizes background information and studies relevant to the project. The definition, applicability, and merit of IoT and M2M systems are presented and some available solutions for WSNs are briefly described. Next to that a brief description of development around LoRa technology and a SAF Tehnika proof of concept are noted.

IoT and M2M systems

IoT (Internet of Things or Internet of Everything) [6] and M2M (machine-to-machine) [9] both were designed for the purpose to connect automated devices without user interface with end points for interaction, but that is the only common feature they share. M2M systems focus on point to point solutions, e.g., allows machines of the same type, typically computing sensors that perform specific tasks, to communicate or relay information as needed over simple protocols. IoT systems focus on interacting with all sorts of objects/devices around via Internet or Ethernet, e.g., changing settings of a thermostat at home via an application on a smartphone while user is at work. M2M and IoT are not the same, but they can intersect with one another.

One of the most popular IoT examples is Smart Grid. A Smart Grid is a modernized electrical grid, which uses such information as consumer’s habits and behaviours to improve the efficiency, reliability, and economics of the production and distribution of electricity. This system involves multiple sensor type communication in a network type system for a single purpose. A typical example of M2M system is a telecom system, e.g., connecting a phone to another phone in order to ensure a conversation between two personas. Human interaction is irregular and requires a big amount of data, for example – watching a movie clip on YouTube, while IoT and M2M systems are considered just the opposite. The communication within IoT and M2M systems exists on regular bases and it is relatively small. In comparison, an IoT or M2M system depending on its setup could send a 10 byte message once in an hour, while Skype requires at least 0.1 Mbps (12500 bytes per second) for voice calls and YouTube video watching minimal requirement is 0.5 Mbps.

Bluetooth LE

Bluetooth is a set of specifications for common short range wireless applications. They are written, tested, and maintained by the Bluetooth SIG [10]. Bluetooth LE is part of Bluetooth 4.0. Bluetooth nowadays is used in mobile phones, wireless controllers, headsets and speakers, PCs, M2M applications, etc. Traditional Bluetooth is connection oriented, meaning, a link is maintained, even if there is no data flowing. Bluetooth LE (BLE or Bluetooth low energy) was introduced in 2006 by Nokia [11]. In comparison to old standard Bluetooth 3.0 it is meant for IoT. Transmitting data once every minute could lead to over 40 years of battery life if only BT LE transactions are considered. It offers a range of up to 150 m and is designed for sending chunks of data.

Wi-Fi

A Wi-Fi WSN uses Wi-Fi channels for their functionalities. High frequencies of this system allow for fast data communications, for example 1024 bytes could be transmitted in as little as 160 microseconds. However, the frequencies used by Wi-Fi are getting more and more occupied by more people using Wi-Fi for their houses, offices or even travelling and the time taken to prepare to transmit the data is a significant

(17)

14 | P a g e

energy drain. Redphine’s RS91110-N-11-31 [12] is a good example on using IPv6 framework. It is said that it can last battery powered for 3 years and offers a range of up to 300 m.

ZigBee

ZigBee is a popular low data rate wireless network protocol. It is a long term leader in two-way communication for WPANs with low data rate and has emerged as a dominant standard for wireless sensor networks. Arguably ZigBee protocol for WSNs is thought through to suit any given situation. A low-power ZigBee module has a range of up to 4 km [13]. One major drawback of ZigBee WSNs is that they use ISM bands [14], which are widely used and therefore might have a big interference from other devices. ZigBee works well in a home and light industrial environment, but fails in a heavily automated industrial environment. The direct sequence spread spectrum BPSK modulation can be easily jammed in a heavy RF environment.

In comparison to Bluetooth both ZigBee and WiFi collaborate with IEEE for PHY and MAC layer specifications.

LoRa technology

There are several MAC protocol and control mechanism possibilities (FDMA [15], TDMA [16], CDMA [17], SDMA [18], and PAMA [19]) for a developer/designer to take into account once dealing with Ethernet. Each of these possibilities offers their benefits and drawbacks. Hence, mostly a combination of them is preferred to ensure data communication e.g. CDMA with TDMA as in GSM technology. LoRa technology has its own patented modulation technique to insure signals robustness over long range [20].

There is an alliance of companies called “LoRa Alliance” [21]. This alliance was made for the purpose of collaboration to drive the global success of the LoRa protocol, by sharing their knowledge and experience to guarantee interoperability between operators in one open global standard. This alliance includes IBM, MicroChip, Cisco, Semtech, Bouygues Telecom, Singtel, KPN, Swisscom, Actility, Fastnet and Belgacom, among others.

LoRaWAN separates three device classes [21]:

• Class A: Bi-directional end-devices. These devices allow for bi-directional communications whereby each end-device's uplink transmission is followed by two short downlink receive windows.

• Class B: Bi-directional end-devices with scheduled receive slots. In addition to the Class A random receive windows, Class B devices open extra receive windows at scheduled times. • Class C: Bi-directional end-devices with maximal receive slots. These devices have nearly

continuously open receive windows, only closed when transmitting.

At the time of writing this article, the aforementioned standard is not finished – only Class A and Class C devices have a publicly available standard. There is nothing known about Class B devices. Contact was made with the alliance to get more information about the LoRaMAC protocol, but the only response was that more information is going to be available soon.

Since LoRa uses unlicensed frequencies (868 MHz in EU), it is necessary to meet the standards. EU standard for 865.0-868.0 MHz frequencies [22] is that a spectrum access cannot be exceed 1% of an hour or

(18)

15 | P a g e

Listen Before Talk [23] in combination with Adaptive Frequency Agility [24] should be performed with power limit of 25 mW e.r.p.

Jaakko Ala-Paavola, an employee of Espotel, provider of R&D services for embedded systems development [25], performed LoRa RF link length and performance test in production facilities to detect the limits of different frequencies of this radio technology [26]. His research concluded that LoRa does outperform its competitors (such as, ZigBee [27]) in RF technology by far, but it did not reach all the promises in datasheet from Semtech [28].

LoRa technology’s top speed is 2.7 kbps, hence, it is obvious that for human interaction LoRa technology is not suitable, while for IoT and M2M systems it is fitting. With a growing amount of devices used in IoT and M2M systems LoRa technology is of significance for aforementioned reasons.

SAF Tehnika WSN

SAF Tehnika is aiming to be one of the first to introduce a stable and simple IoT network protocol utilizing LoRa to provide a continuous data flow with low power requirements. Previous research was done within SAF Tehnika to make a simple wireless network. This network consisted of 60 LoRa transmitting devices (using a Semtech’s SX1272 transceiver [29] in combination with Texas Instruments MSP430 microcontroller [30]) and one base station. To test the endurance of this network 5 similar networks in parallel to it were introduced. A detailed description is available in Appendix E.

The positive outcomes of this proof-of-concept network were:

• It proved that it is possible to establish a wireless sensor network using LoRa technology; • The communication distance (depending on the surroundings) is close to promised by Semtech. The negative outcomes of this proof-of-concept network were:

• There were no security features, e.g., encryption, AFA, nor lost communication response, hence neighbouring messages were still received and processed;

• Amount of lost packages was up to 0.4%, which for some possible applications is not good enough;

(19)

16 | P a g e

III.

CONCEPTUAL MODEL

This chapter explores in more detail which factors describe the SAF Tehnika WSN needs regarding LoRa technology and potential characteristics of LoRa technology.

SAF Tehnika needs

In order to satisfy SAF Tehnika needs LoRa technology is to meet two criteria: 1) Range;

2) Power consumption.

Range needs to be at least 1 km in urban environment. Power consumption needs to be such that it would be possible to deploy a standalone battery powered device, which would work for at least 2 years. SAF Tehnika intends to create a WSN in which a sensor node transmits 8 bytes of data once every 10 minutes.

Another aspect that sometimes is overlooked is the component ability to pair with other components. It is essential that a transceiver works well with a MCU. There is an important factor that SAF Tehnika WSN does not possess – data encryption. This would prevent threating other system’s messages as its own and would add extra safety measurements if data is meant to be private.

Characteristics of LoRa technology

The benefits of LoRa technology are: • It offers a long range coverage; • It has low power requirements; • High sensitivity;

• Relatively small.

Many tests have been performed that demonstrate that LoRa technology can reach a range of 15 km or more in a line-of-sight situation [26], [31], [32], [33]. As described by LoRa calculator, the SX1272 transceiver using the most consuming settings in SAF Tehnika WSN would have a 1453 days (almost 4 years) of battery (3.3V, 1000mAh) life, if only LoRa transactions are considered, or 18349 days (50 years) of battery life on least consuming settings [Appendix A]. Guiding from SX1272 transceivers datasheet [29], the sensitivity of SX1272 transceiver is 164 dBm. The SX1272 transceiver chip is 6.00 x 6.00 x 1.00 mm big.

The drawbacks of LoRa technology are:

• Not all packages reach destination under ideal circumstances; • The protocol for LoRa technology is still under development; • LoRa technology does not support other technologies; • It uses unlicensed bands.

SAF Tehnika performed package delivery test as described in [34] and it resulted in 99.8% delivery rating. Class A and Class C devices have their protocol to some extend standardized by IBM, but Class B devices are not yet documented for others to join the protocol. Since LoRa technology uses its own unique modulation technique, it is not able to be used by previously installed systems. Using unlicensed bands could lead to a

(20)

17 | P a g e

higher possibility that a band in use being already occupied by other systems and therefore having an interference with them, though Semtech promises co-channel interference robustness [29].

(21)

18 | P a g e

IV.

RESEARCH DESIGN

This chapter describes the design of tests performed in order to test if LoRa technology can be used in PHY layer for SAF Tehnika needs and description of aspects the LoRaWAN was compared with SAF Tehnika WSN to describe potential improvements for SAF Tehnika WSN.

PHY layer

Setup of PHY layer

The setup used for this research consists of STMicroelectronics [35] STM32F4-Discovery board [36] with Semtech’s SX1272 transceiver. The choice to use STM32F4 was based on the fact that it has an ARM [37] microprocessor. In comparison, previous design for SAF Tehnika WSN was using TI MSP430. Once it was proven that SX1272 transceiver could be paired with an ARM microprocessor, a comparison of power requirements between best suited ARM microprocessor (M0+) and TI microprocessors (MSP430 and MSP432) was made.

Since SX1272 transceiver has SPI feature enabled as main communication protocol with it, it is a straight forward operation to communicate with the transceiver. There are several features that need to be adjusted in the transceiver to make it work as required. These features are namely:

• Centre radio frequency; • Spreading factor; • Bandwidth; • Coding rate; • Payload length; • Preamble length; • Transmit power; • Operation mode; • CRC;

(22)

19 | P a g e

• Receive timeout.

The centre radio frequency defines the frequency in which the transceiver transmits/receives signals and is set depending on network configurations. It can be configured with ±5 Hz precision, but it’s meant for unlicensed bands within the EU and US. The spreading factor makes the signal to be transmitted more robust. There are seven different options available for the developer to pick from (from 26 to 212)1. However there

are precautions that must be taken into account when using spreading factor of 26, 211, and 212 as described

in [29]. The bandwidth affects the speed of transmission and indirectly quality. While using SX1272 transceiver there are three options: 125 kHz, 250 kHz, and 500 kHz. The coding rate is part of forward error correction. It adds redundant bits after every single, second, third, etc. bit. There is an option to choose from coding rate from 4/5 to 4/8. The payload is the actual message to be transmitted and the developer can adjust the length of it per every transmission. The preamble is the introductory part of the message. In LoRa technology it is used for receivers to understand that a message is going to follow. Making it longer would allow the message to be detected more easily, but it would consume more power, since the transmitter would have to transmit a longer message. The options are to adjust preamble to 4.25+n (n being the choice of the developer) symbols long. The transmit power is adjustable up till 20 dBm. There are nine operation modes available. One of which sets the transceiver to LoRa or FSK mode. The CRC is an error detecting code to detect accidental changes to raw data. The receive timeout is a time variable, which sets the time interval for the receiver to wait for a valid signal.

The SX1272 transceiver offers CAD. It lasts for 3 symbols and promises a reliability of 99.9% [38] of detecting if a channel is occupied. This is a supplementary function in case when LBT + AFA are needed.

List of materials

• STM32F4-Discovery board; • SX1272 transceiver board; • Saleae logic analyser;

• PC running IAR Embedded Workbench 6.3 (or higher) and Saleae Logic 1.1.34 Beta (or higher) software;

• Spectrum analyser Adantest R3131A [39];

• Already existing (proof-of-concept) LoRa network.

Transceiver setup

STM32F4-Discovery board was connected to a PC to ensure that both power supply and correct software is provided. Both STM32F4 and SX1272 were connected accordingly for SPI communication

(23)

20 | P a g e

[Appendix B] on a breadboard. In order to monitor the communication in between both parts annexed to these pins was a logic analyser. [Figure 2]

Different transceiver modes were tested to ensure the communication is successful throughout each phase. An example is shown in Figure 3. In addition, time spent in each mode, where it might vary, was measured. This was done to calculate current consumption.

The results were displayed in Saleae Logic 1.1.34 Beta software as showed in Figure 3. The transceiver modes were tested till satisfactory response was received. If the response was not satisfactory, physical connections and/or software were checked and errors were fixed.

When satisfactory response was received, then further procedures take place: 1. Testing transmitting operation:

a. Attaching transceivers antenna to spectrum analyser; b. Setting the transceiver to LoRa mode;

c. Writing data to FIFO;

d. Setting transceiver to transmit mode; e. Monitoring spectrum analyser;

f. Waiting for the operation to complete; g. Setting transceiver to sleep mode; 2. Testing receiving operation:

a. Setting the transceiver to LoRa mode; b. Setting the transceiver to read mode; c. Waiting for a package received; d. Analysing package;

Figure 2 SX1272 with STM32F4, with logic analyzer

(24)

21 | P a g e

e. Setting the transceiver to sleep mode.

Transmitting time was measured to compare the information available by LoRa calculator [40]. The time consumed per transmission was measured with logic analyser. The top row in Figure 3 shows that time is marked. Because of the small imprecision that occurs during signal transmission it is accounted that the error is ±1 ms per measurement. Since per one test time is measured twice, the test error is double the amount, e.g., ±2 ms.

Comparing LoRaWAN and SAF Tehnika WSN

The LoRaWAN is based upon IEEE 802.15.4 standard protocol, which specifies PHY and MAC layers, while the SAF Tehnika WSN is made for a single purpose – creating a simple WSN to monitor physical parameters. Since the PHY layer for both is LoRa technology only MAC layers were evaluated from these aspects: • Energy efficiency; • Responsiveness; • Robustness; • Self-configuration; • Heterogeneity; • Systematic design; • Privacy and security.

Each factor was weighted in order to conclude the best solution for a WSN, which task is to measure simple physical properties of a closed building, such as temperature and humidity measurements in a multi-apartment house.

SAF Tehnika WSN does not possess any encryption methods. Hence, three popular encryption types for small data amounts were compared, namely, AES [41], XXTEA [42], and RC4 [43].

(25)

22 | P a g e

V.

RESEARCH RESULTS

This chapter presents the results obtained. Firstly, results obtained from connecting a SX1272 transceiver to an ARM microprocessor; followed by a comparison of practical usage of SX1272 and promised parameters and a comparison between best suited ARM microprocessor for IoT and TI low-power microprocessors. Secondly, LoRaWAN and SAF Tehnika MAC layer solutions and were compared to distinguish the best suited option for a simple WSN. Thirdly, a comparison of AES, XXTEA, and RC4 encryption methods was made.

Connecting SX1272 to ARM microprocessor

SX1272 has dedicated four pins for SPI communication. Same applies for STMicroelectronics [Appendix B]. However, there was no response from the transceiver after a throughout correct setup [Figure 5]. After analysing the output from the logic analyser, it was clear that there is no waiting for response – no clock is given for the transceiver’s response signal. Hence, SPI protocol was made manually to ensure data communication [Figure 4]. A detailed description is available in Appendix D.

Putting transceiver to different modes via SPI

Mode Success? Comments

LoRa/FSK Yes Only possible when previous mode is sleep mode

Sleep Yes

Standby Yes

Transmit Yes

Receive continuous Yes Need to clear flags after timeout

Receive single Yes Goes to standby mode after received message or timeout interrupt

Frequency synthesis TX Yes Frequency synthesis RX Yes

CAD Yes

Table 1 Overlook of possible modes for SX1272 over SPI communication

Figure 5 Example of results displayed with Saleae Logic 1.1.34 Beta

(26)

23 | P a g e

Transmit and receive modes were tested especially. Both were working accordingly as described in the datasheet [29]. When transmit mode was tested the output of SX1272 transceiver was connected to spectrum analyser to monitor if a message is actually being sent [Figure 6]. If a message was not noticed, then an inspection of physical setup and code was performed to indicate the mistake and fix it.

Comparison of real transmitting time versus transmitting time predicted by

LoRa calculator

The following test was performed with these parameters as constant: • Preamble length = 6;

• Frequency = 865 MHz; • Coding rate = 4/8.

SF (2SF) BW (kHz) Payload length (bytes) Predicted transmitting time (ms) Real time* (ms)

7 125 8 43.26 43.2 7 125 9 43.26 43.4 7 125 10 43.26 43.3 7 125 15 59.65 59.7 7 125 20 67.84 67.8 7 250 8 21.63 21.7 7 250 9 21.63 21.7 7 250 10 21.63 21.7 7 250 15 29.82 29.8 7 250 20 33.95 34.0 7 500 8 10.82 10.8 7 500 9 10.82 10.8 7 500 10 10.82 10.9 7 500 15 14.91 14.9 7 500 20 16.96 17.0 8 125 8 70.14 70.3 9 125 8 140.29 140.5

Figure 6 On the left side spectrum analyzer showing no signal over center frequency of 865.00 MHz. On the right side -spectrum analyzer showing signal over center frequency of 865.00 MHz

(27)

24 | P a g e

10 125 8 280.58 280.6

11** 125 8 561.15 561.2

* Average of ten consecutive tests **Optimizer is turned on

Table 2 Transmitting time. Predicted vs. Real

Comparison of ARM microprocessor versus TI microprocessor

Available information on ARM website hints that their best microprocessor for IoT is M0+. It has the lowest power consumption, but still possesses features as 16-bit processing, which is sufficient for most IoT devices. A comparison was done by “the deltas blog” author abarrilado [44]. It shows that ARM’s M0+ is less power consuming at “run” mode, while consuming more in “sleep” mode. Error! Reference source not found. describes M0+ microcontroller, best suited ARM microcontroller for IoT devices, MSP430 microcontroller, which is used in current SAF Tehnika WSN, and MSP432 microcontroller, which is newest of TI’s low-power microcontrollers, current consumption.

ARM M0+ MSP430 MSP432

Vdd Range 1.8 – 3.6 V 1.8 – 3.6 V 1.6 – 3.7 V

Current consumption in RUN mode, full speed

3.3 mA 4.5 mA 4.6 mA

Current consumption in RUN mode, degraded speed

1.4 mA @ 12 MHz

0.33 mA @ 1 MHz 90 µA @ 128 kHz

Current consumption, lower

consumption with functioning interrupts

Deep-sleep, 170 µA Low-Power mode 3, 0.5 µA Low-Power mode 3, 850 nA

Current consumption, lower

consumption requiring reset

Power-down mode, 1.2 µA Low-Power mode 4, 0.1 µA Low-Power mode 4, 25 nA

Table 3 Comparison between ARM M0+, MSP430, and MSP432 current consumption

Comparison of LoRaWAN, and SAF Tehnika WSN MAC layers

LoRaWAN SAF Tehnika WSN

Energy efficiency 7 8

Responsiveness 8 4

Robustness 9 5

Self-configuration and adaption 8 6

Scalability 9 9

Heterogeneity 10 10

Systematic design 8 8

Privacy and security 9 9

Table 4 Comparison of LoRaWAN and SAF Tehnika wireless sensor network MAC layers in scale from 1 to 10, where 10 is the best result

SAF Tehnika is aiming for the best energy efficient MAC layer while providing certain privacy and security measures. SAF Tehnika WSN’s sensor nodes sleep for most of the time, while LoRaWan Class A devices perform similarly. The difference is in the fact that SAF Tehnika WSN’s sensor node does not expect an ACK message in return, while LoRaWAN end-device does. It is relatively simple to add a new device to LoRaWAN network, but in SAF Tehnika WSN it is done while sacrificing 1/3 of the network for the registration period. A detailed comparison is available in Appendix C.

(28)

25 | P a g e

Comparison of different encryption types

AES XXTEA RC4

Key size 128, 192, or 256

bits 128 bits 40 – 2048 bits

Block size

128 bits 64 + 32*n bits Not applicable

Rounds

10, 12, or 14 52+6*(n+2) 1

Operations to

recover key 2126.1 259 Not applicable

Known attacks

There are no known successful

attacks on AES-256, but other AES have been broken down by super-computers.

Has been broken in academic terms.

In 2015 several cryptologic agencies claim to break RC4. Such companies as

Microsoft and Mozilla recommends to not to use RC4 whenever possible. Ease of

implementation Medium Easy Very difficult

Table 5 Comparison of AES, XXTEA, and RC4 encryption methods

XXTEA is the simplest to implement and has several security measures for a developer to implement it uniquely, while AES is second easiest to implement and offers greater security, but presents higher demands from the system in form of memory requirements in comparison to XXTEA. RC4 is a continuous stream encryption service and, hence, possess certain complications, like, it is not viable for a message stream, which is not continuous.

(29)

26 | P a g e

VI.

CONCLUSIONS

This research article set out to evaluate LoRa technology’s theoretical parameters effective implementation strongly suggests that LoRa technology can be effectively implemented in a typical real-life situation in order to create a long-range low-power WSN.

LoRa technology offers a range of 15 km in line-of-sight scenario, while offering small power consumption (10 mA in RX mode). At the same time it possess >160 dB link budget and tolerance to in-channel burst interference. LoRa technology brings a great improvement for IoT and M2M network range without sacrificing power or integrity. A regular range for a wireless sensor node was up to 2 km in line-of-sight scenario, but with LoRa technology it can reach 15 km or up to 5 km in urban area. However, the maximum speed of 2.7 kbps means that it is not suited for human interactions. However, even under perfect circumstances only 99.8% of messages successfully reached destination and a protocol for it is not fully finished. The “LoRa Alliance” is driving the success of the LoRa protocol called LoRaWAN, by sharing their knowledge and experience to guarantee interoperability between operators in one open global standard. LoRaWAN separates three device classes:

• Class A: Bi-directional end-devices. These devices allow for bi-directional communications whereby each end-device's uplink transmission is followed by two short downlink receive windows.

• Class B: Bi-directional end-devices with scheduled receive slots. In addition to the Class A random receive windows, Class B devices open extra receive windows at scheduled times.

• Class C: Bi-directional end-devices with maximal receive slots. These devices have nearly continuously open receive windows, only closed when transmitting.

Only Class A and Class C devices have a publicly available standard. There is nothing known about Class B devices. Nevertheless Actility already is selling its WSN project called ThingPark, which implements all classes.

Since LoRa technology offers a great range and power consumption that both exceed the requirements from SAF Tehnika WSN, LoRa technology is suitable for SAF Tehnika needs for its WSN.

(30)

27 | P a g e

VII.

RECOMMENDATIONS

During the testing of communication between STM32F4-Discovery board and SX1272 it was discovered that ST’s offered SPI communication protocol is incomplete, resulting in an unsuccessful communication between both peripherals. Instead a self-made SPI communication protocol was made, that was working and demonstrated that SX1272 transceiver can be coupled with an ARM microprocessor. Consequently SX1272 can work with any microprocessor as long as it can handle SPI communication. Hence, it is recommended that with STM32F4-Discovery board a self-made SPI protocol is used.

When choosing between microcontrollers offered by ARM and microcontrollers offered by TI one must pay attention to the purpose of the system and power consumption differences. If the system is meant to be in RUN mode for most of the time if not all time, then ARM M0+ microprocessor is more suitable, but, if the system is meant to be in SLEEP mode for most of the time, then TI MSP430 is favourable. Even less power is consumed by MSP432 than MSP430 while in SLEEP mode. Hence, for a system alike SAF Tehnika WSN, in which a sensor node is for few milliseconds in RUN mode, but several minutes in SLEEP mode, involving MSP430 microcontroller is optimal, but could be replaced by MSP432, if power consumption appears to not satisfy system requirements. To design the system one can address the Semtech datasheet and/or LoRa calculator software for power consumption rates of the SX1272. The tests performed to measure the accuracy of time displayed by calculator prove that time per transmission is indicated correctly.

As described in Table 4 Comparison of LoRaWAN and SAF Tehnika wireless sensor network MAC layers in scale from 1 to 10, where 10 is the best resultTable 4 it is clear that SAF Tehnika WSN could upgrade “self-configuration and adaption”, “robustness”, and “responsiveness” properties to compete with LoRaWAN. A possible solution would be to adapt 802.15.4 standard on which LoRaWAN is based. By all means, but energy efficiency, the LoRaWAN is more developed than SAF Tehnika WSN. LoRaWAN is suited to handle potentially unlimited amount a devices in the network, but SAF Tehnika sacrifices some safety features to improve energy efficiency. If SAF Tehnika is willing to partake in the global protocol-to-be, it has to seriously adjust its WSN. Starting from message structure and ending with self-configuration.

To ensure message safety and privacy an encryption is often used. RC4 encryption algorithm is not recommended because of its late security breaches and complexity involving its implementation. AES is not recommended for simple WSN, because it uses continuous byte stream, which is not suitable for systems sending a few bytes per period of 10 minutes. If it is chosen to use XXTEA encryption algorithm, there is a need to pay special attention in choosing a unique key and variation of rounds in order to secure the data. As mentioned in Table 5, the XXTEA algorithm’s key can be recovered with 259 operations, but in order for it to

happen messages intercept must be consecutive and the result is displayed with the minimal amount of security on victim’s side. XXTEA is recommended if encryption is needed for a simple WSN needs. To implement XXTEA one must take into account that the algorithm requires 8+4*n bytes of data to be encrypted. For example, if the data to be encrypted is 7 bytes long, there is a need to add one (or five, or nine, etc.) byte(s) to comply with requirements.

When designing PHY layer for WSN, the designer must be careful to choose the best suitable operating frequency. Depending on the location of usage there are different standards to comply with, for example, EU standard for 868 MHz frequency is that the spectrum access cannot exceed 1% of a full period or LBT + AFA must be implemented. Another important factor, when designing PHY layer, is the

(31)

28 | P a g e

microprocessor. This is a hot topic currently in IoT field and more and more companies are racing to offer best solution - Samsung recently released their ARTIK microprocessors for IoT and TI introduced MSP432. Both of them promise lower current consumption than TI MSP430. It would be best to test both of those for the sake of lower power consumption resulting in longer battery life.

(32)

29 | P a g e

REFERENCES CITED

[ 1]

A. Jeffries, “Phones, TVs, Cars Leading the Way to 22 Billion Internet-Connected Things,”

Wearable World Inc, 17 Aug 2010. [Online]. Available:

http://readwrite.com/2010/08/17/22_billion_phones_tvs_cars_on_internet_of_things. [Accessed 20 May 2015].

[ 2]

IHS Inc, “About us,” [Online]. Available: https://technology.ihs.com/AboutUs. [Accessed 20 May 2015].

[ 3]

P. N. Howard, “Sketching out the Internet of Things trendline,” The Brookings Institution, Washington, 2015.

[ 4]

Semtech Corporation, “Company,” [Online]. Available:

http://www.semtech.com/company/. [Accessed 20 May 2015]. [

5]

Link Labs, “What is LoRa?,” [Online]. Available: http://www.link-labs.com/what-is-lora/. [Accessed 20 May 2015].

[ 6]

TechTarget, “Internet of Things (IoT),” [Online]. Available: http://whatis.techtarget.com/definition/Internet-of-Things. [Accessed 20 May 2015].

[ 7]

Semtech Corporation, “LoRa™ Product Family,” [Online]. Available: http://www.semtech.com/wireless-rf/lora.html. [Accessed 20 May 2015].

[ 8]

SAF Tehnika, “About us,” [Online]. Available: https://www.saftehnika.com/en/about. [Accessed 20 May 2015].

[ 9]

TechTarget, “machine-to-machine (M2M),” [Online]. Available:

http://whatis.techtarget.com/definition/machine-to-machine-M2M. [Accessed 20 May 2015]. [

10]

Bluetooth SIG, Inc, “About Us,” 2015. [Online]. Available:

http://www.bluetooth.com/Pages/about-bluetooth-sig.aspx. [Accessed 15 June 2015]. [

11]

E. Grabianowski, “Is Wibree going to rival Bluetooth?,” HowStuffWorks, 1 December 2006. [Online]. Available: http://www.howstuffworks.com/wibree.htm. [Accessed 15 June 2015]. [

12]

Redpine Signals, Inc, “RS-9110-N-11-24 Self Contained 802.11 b/g/n Module with Networking Stack,” Redpine Signals, Inc, San Jose, 2012.

[ 13]

(33)

30 | P a g e

[ 14]

International Telecommunication Union, “Industrial, scientific and medical (ISM) applications (of radio frequency energy),” International Telecommunication Union, 2009.

[ 15]

M. Rouse, “FDMA (frequency division multiple access) definition,” TechTarget, [Online]. Available: http://searchmobilecomputing.techtarget.com/definition/FDMA. [Accessed 20 May 2015].

[ 16]

M. Rouse, “TDMA (time division multiple access) definition,” TechTarget, [Online]. Available: http://searchnetworking.techtarget.com/definition/TDMA. [Accessed 20 May 2015]. [

17]

M. Rouse, “CDMA (Code-Division Multiple Access),” TechTarget, [Online]. Available: http://searchtelecom.techtarget.com/definition/CDMA. [Accessed 20 May 2015].

[ 18]

M. Rouse, “spatial division multiple access (SDMA) definition,” TechTarget`, [Online]. Available: http://searchnetworking.techtarget.com/definition/spatial-division-multiple-access. [Accessed 20 May 2015].

[ 19]

World Public Library, “Pulse-address multiple access,” [Online]. Available: http://netlibrary.net/kiosk/Article.aspx?Title=Pulse-address_multiple_access. [Accessed 20 May 2015].

[ 20]

Semtech Corporation, “Recommended SX1272 settings for EU868 LoRaMAC network operation,” Semtech Corporation, 2014.

[ 21]

LoRa Alliance, “LoRa Alliance,” 2015. [Online]. Available: http://lora-alliance.org/. [Accessed 21 May 2015].

[ 22]

THE COMMISSION OF THE EUROPEAN COMMUNITIES, “COMMISSION DECISION of 23 May 2008 amending Decision 2006/771/EC on harmonisation of the radio spectrum for use by short-range devices (notified under document number C(2008) 1937) (2008/432/EC),” Official

Journal of the European Union, no. 151, pp. 49-54, 2008.

[ 23]

Telecom ABC, “LBT,” [Online]. Available: http://www.telecomabc.com/l/lbt.html. [Accessed 21 May 2015].

[ 24]

Telecom ABC, “AFA,” [Online]. Available: http://www.telecomabc.com/a/afa.html. [Accessed 21 May 2015].

[ 25]

Espotel Oy, “Company,” [Online]. Available: http://www.espotel.com/company. [Accessed 20 June 2015].

[ 26]

J. Ala-Paavola, “Real-life performance of the LoRa radio,” 3 Feb 2015. [Online]. Available: http://embeddedexperience.blogspot.com/2015/02/real-life-performance-of-lora-radio.html. [Accessed 21 May 2015].

(34)

31 | P a g e

[ 27]

ZigBee Alliance, “What is ZigBee,” [Online]. Available: http://www.zigbee.org/what-is-zigbee/. [Accessed 22 May 2015].

[ 28]

Semtech Corporation, “SX1276/77/78/79 - 137 MHz to 1020 MHz Low Power Long Range

Transceiver,” November 2014. [Online]. Available:

http://www.semtech.com/images/datasheet/sx1276.pdf. [Accessed 21 May 2015]. [

29]

Semtech Corporation, “SX1272/73 - 860 MHz to 1020 MHz Low Power Long Range Transceiver,” Semtech Corporation, 2014.

[ 30]

Texas Instruments Incorporated, “Who we are,” Texas Instruments Incorporated, [Online]. Available: http://www.ti.com/corp/docs/company/who_we_are.html. [Accessed 25 May 2015].

[ 31]

Libelium Comunicaciones Distribuidas S.L., “Waspmote LoRa 868MHz 915MHz SX1272 Networking Guide,” Libelium Comunicaciones Distribuidas S.L., 2014.

[ 32]

A. Burello, “LoRa: a disruptive wireless long range technology,” Future, RF & Wireless Solutions.

[ 33]

F. C. Bearsch, “I was looking for a better radio range.. Found XRange,” DIY Drones, 23 January 2014. [Online]. Available: http://diydrones.com/profiles/blogs/i-was-looking-to-get-better-radio-range-found-xrange. [Accessed 20 Juna 2015].

[ 34]

Semtech Corporation, “SX1272 Development Kit,” Semtech Corporation, 2013.

[ 35]

STMicroelectronics, “Who We Are,” STMicroelectronics, [Online]. Available: http://www.st.com/web/en/about_st/st_company_overview.html. [Accessed 25 May 2015]. [

36]

STMicroelectronics, “Discovery kit for STM32F407/417 line,” STMicroelectronics, 2014.

[ 37]

ARM Ltd, “About,” [Online]. Available: http://www.arm.com/about/index.php. [Accessed 25 May 2015].

[ 38]

Actility, “ThingPark Wireless PHY and MAC layer specifications,” 27 12 2013. [Online]. Available:

http://cocoon.actility.com/system/files/wireless/ThingPark_Wireless%20PHY_and_MAC_layer_s pecifications_v1.pdf. [Accessed 21 May 2015].

[ 39]

(35)

32 | P a g e

[ 40]

Semtech Corporation, “LoRa Calculator: fast evaluation of link budget, time on air and energy consumption,” Semtech Corporation, 2014.

[ 41]

National Institute of Standards and Technology, “Announcing the ADVANCED ENCRYPTION STANDARD (AES),” Federal Information Processing Standards Publications, vol. I, pp. 1-51, 2001.

[ 42]

E. Yarrkov, “Cryptanalysis of XXTEA,” 2010.

[ 43]

QuinStreet Inc, “RC4/RC5/RC6,” [Online]. Available:

http://www.webopedia.com/TERM/R/RC4_RC5_RC6.html. [Accessed 29 May 2015]. [

44]

abarrilado, “ARM Cortex-M0+ vs. MSP430 (or are M0+-based devices really 16-bit MCU replacements?),” the delta blog, 13 March 2013. [Online]. Available: http://deltas.blog.com/2013/03/13/arm-cortex-m0-vs-msp430-or-are-m0-based-devices-really-16-bit-mcu-replacements-2/. [Accessed 29 May 2015].

[ 45]

Actility, “About,” [Online]. Available: http://www.actility.com/en/our-vision. [Accessed 21 May 2015].

[ 46]

Saleae, “Logic Analyzer (SKU:DFR0178),” 22 March 2012. [Online]. Available: http://www.dfrobot.com/wiki/index.php?title=Logic_Analyzer_(SKU:DFR0178). [Accessed 25 May 2015].

[ 47]

IEEE Standart 802.15.04, “Part 15.4: Low-Rate Wireless Personal Area Networks (LR-WPANs),” IEEE-SA, 2011.

[ 48]

C. B. Zach Shelby, 6LoWPAN: The Wireless Embedded Internet, Wiley, 2009.

[ 49]

R. Faludi, Building Wireless Sensor Network, Sebascropol: O’Reilly Media, Inc, 2010.

[ 50]

Digi International Inc, “XBee® 865/868LP RF Modules,” Digi International Inc, Minnetonka, 2012.

[ 51]

Ookla, “What speeds do I need for Skype, Netflix, video games, etc.?,” 24 January 2012. [Online]. Available: https://support.speedtest.net/hc/en-us/articles/203845210-What-speeds-do-I-need-for-Skype-Netflix-video-games-etc-. [Accessed 14 June 2015].

[ 52]

IEEE Standarts Association, “IEEE Standard for local and metropolitan area networks - Part 15.4: Low-Rate Wireless Personal Area Networks (LR-WPANs),” IEEE, New York, 2011.

(36)

33 | P a g e

[ 53]

Texas Instruments, “Overview for Low-power Microcontrollers,” [Online]. Available:

(37)

34 | P a g e

Appendix

Appendix A

Comparison of SX1272 transceivers most and least power consuming settings

Description Most power consuming Least power consuming

Frequency 865 MHz

Spreading factor 12 6

Bandwidth 500 kHz 125 kHz

Payload 8 bytes

Error coding rate 4/8 4/5

Mode Periodic transmitter

Header mode On Off

Low data rate optimization On Off

CRC On Off

Programmed preamble 6

Transmit power 17 dBm

Duty cycle 600000 ms

Estimated battery life 1287.72 days 18349.92 days

Appendix B

SPI pins Pin STM32F4-Discovery (SPI1) SX1272 Clock PA5 13 MISO PA6 12 MOSI PA7 11

Slave Select PE7 10

Appendix C

Comparison of LoRaWAN, and SAF Tehnika WSN MAC layers

Energy efficiency

LoRaWAN There are three types of nodes: Class A, Class B, and Class C. A class nodes wake up from sleep mode after a certain amount of time and transmit a message, then it listens for an acknowledgment about one second after each transmission. B class nodes wake up after a certain amount of time, wait for the receiver side to send them a message, and, once it is received, start transmission. C class nodes periodically listen to their

(38)

35 | P a g e

channel. The node synchronizes its listening slots to beacon transmitted by the gateways and can be “pinged” during them. Class C nodes are meant for applications where real time control may be necessary. Gateways and base stations never sleep and periodically transmit a beacon signal.

SAF Tehnika There are two types of devices: sensor node and base station. Sensor node for most of the time is in deep sleep mode and wakes up to transmit data. The transmission’s energy mode can be adapted to costumers needs. After each transmission the node goes back to deep sleep mode. Base station never sleeps and continuously listens for incoming messages.

Responsiveness LoRaWAN Depending on the network settings the end node responds differently to the environment. At both possible network settings CAD is performed. If frequency hopping is allowed and CAD returns a negative result, then the transmitting party changes its frequency pseudo randomly and repeats the procedure. Even during the transmission it changes frequency to ensure that other devices can use the same frequency for a longer period of time. If frequency hopping is not allowed and CAD returns negative, then the device delays transmission for a random period of time and repeats the procedure. Depending on the received beacon signal strength the end device changes its settings so that the transmitted message would be received with as little energy usage as possible.

SAF Tehnika Before each transmission the device performs CAD. If it is a success, then the transmission begins. Otherwise the device delays transmission for a random delay time, but no longer than 3 seconds, and repeats the process. If the CAD after three tries is negative, the device doesn’t transmit till next transmission time.

Robustness LoRaWAN Acknowledgment system and forward error correction implanted. The ability to change settings of the end device depending on signal strength from received beacon strength adds extra robustness.

SAF Tehnika Only forward error correction implemented, but is presented twice – once for the whole message as implemented from LoRa technology and secondly in the message itself to test integrity.

Self-configuration and adaption

LoRaWAN ThingPark network protocol makes end devices to measure signal strength of beacon to adjust their transmitting settings. No other adaptions to the situation are given.

SAF Tehnika The sensor node performs CAD function before each transmission. If it returns that the channel is occupied, then the node shifts its schedule accordingly.

Scalability LoRaWAN It is not specified how big the ThingPark network can be.

SAF Tehnika SAF Tehnika network restrictions are depending on its setting. For example, if the period is 10 minutes, then the maximum amount of devices connected to base station is 299.

Heterogeneity LoRaWAN Consists of coordinator, router, and end device. There’s no information on the amount of coordinators, routers and end devices.

SAF Tehnika SAF Tehnika network consists of only a coordinator and end devices.

Systematic design

LoRaWAN The first to set is the coordinator or base station. Base listens to several frequencies in parallel for a network that allows frequency hopping or a single frequency for a single band network. There are two options to add

(39)

36 | P a g e

a device to the network: over the air and manually. Once a device is added to network it knows its transmission time slot and time when to expect a beacon. End device/sensor node transmits its message on given time slot or when “pinged”.

SAF Tehnika The first to be set is base station. The base station all the time listens to two predetermined bands – each for separate transmitting settings. A device is added to the network with over the air function. End device/sensor node at the power up tries to connect to the network. If base station gives the permission, the node is added to the network. If the node doesn’t receive the permission, it either continuous to wait for it or continuous to transmit with previously acquired permission. Node transmits message once every period. Transmitting settings can be changed to suit user’s needs.

Privacy and security

LoRaWAN This matter is not described in available information.

SAF Tehnika SAF Tehnika adds encryption to every message sent. Such that changing a single bit in a message corresponds to at least half of the message to be changed. Encryption key is base-unique and is given to end devices during complex connection process.

Appendix D

SPI communication protocol

Code bellow is written in C language and is prepared for STM32F4-discovery board.

uint32_t multiplier; uint8_t delay = 0x07; void CSSHigh(); void CSSLow();

void clockDown(uint8_t bit); void clockUp(uint8_t bit); void Delay_Init(void) {

RCC_ClocksTypeDef RCC_Clocks;

/* Get system clocks */

RCC_GetClocksFreq(&RCC_Clocks);

/* While loop takes 4 cycles */

/* For 1 us delay, need to divide with 4M */

multiplier = RCC_Clocks.HCLK_Frequency / 4000000; }

void Delay_Us(uint32_t micros) { /* Multiply micros with multipler */ /* Substract 95 */

micros = micros * multiplier - 95; /* 4 cycles for one loop */

while (micros--); }

(40)

37 | P a g e

void init_SPI1(void){

RCC_HSEConfig(RCC_HSE_ON); //Wait for clock to stabilize

while (!RCC_WaitForHSEStartUp());

Delay_Init(); // initialize delay functions

GPIO_InitTypeDef GPIO_InitStruct;

// enable clock for used IO pins

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);

/* configure pins as used in SPI1 config * PA5 = SCK

* PA6 = MISO * PA7 = MOSI */

GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_5; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStruct); GPIO_InitStruct.GPIO_Pin = GPIO_Pin_6; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOA, &GPIO_InitStruct);

// enable clock for used IO pins

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE);

/* Configure the chip select pin in this case we will use PE7 */

GPIO_InitStruct.GPIO_Pin = GPIO_Pin_7; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStruct.GPIO_OType = GPIO_OType_PP; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOE, &GPIO_InitStruct);

GPIO_SetBits(GPIOE, GPIO_Pin_7); // set PE7 (CSS) high GPIO_ResetBits(GPIOA, GPIO_Pin_5);

GPIO_SetBits(GPIOA, GPIO_Pin_6); GPIO_SetBits(GPIOA, GPIO_Pin_7); }

(41)

38 | P a g e

/* This funtion is used to transmit and receive data * with SPI1

* address --> data to be transmitted */

void SPI_send(uint8_t address){

for( int i = 1; i < 9; i++){ // sending bit by bit int y = (address>>8-i)&1; //checking bit value if( y!=0 ) {

clockUp(1); //going up with high on MOSI

clockDown(1); //going down with high value on MOSI }

else {

clockUp(0); //going down with low on MOSI clockDown(0); //going down with low on MOSI }

} }

uint8_t SPI_analyze(){

uint8_t ret = 0x00; //returned value (8 bits)

for( int i = 1; i < 9; i++ ){ clockUp(1);

if( GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_6)!=0 ){ //analyzing bit by bit ret|=(1<<8-i); //putting in value 1 - operating with bit shift

} else{

ret|=(0<<8-i); //putting in value 0 } clockDown(1); Delay_Us(delay); } return ret; }

uint8_t SPI1_read(uint8_t address){ uint8_t ret; //return value

CSSLow(); //chip select low Delay_Us(30);

SPI_send(address); //to be read address

ret = SPI_analyze(); //getting value back

GPIO_SetBits(GPIOA, GPIO_Pin_7); //manual precaution Delay_Us(20);

(42)

39 | P a g e

Delay_Us(40);

return ret; // return received data from SPI data register }

void SPI1_write(uint8_t address, uint8_t data){ CSSLow(); //chip select low

Delay_Us(30);

SPI_send(address | 0x80); //notify to be modified address SPI_send(data); //written data

GPIO_SetBits(GPIOA, GPIO_Pin_7); //manual precaution Delay_Us(20);

CSSHigh(); //chip select high Delay_Us(40);

}

void clockUp(uint8_t bit){ switch (bit) {

case 0: //sent bit is low

GPIO_ResetBits(GPIOA, GPIO_Pin_7); break;

case 1: //sent bit is high

GPIO_SetBits(GPIOA, GPIO_Pin_7); break; } Delay_Us(delay); GPIO_SetBits(GPIOA, GPIO_Pin_5); }

void clockDown(uint8_t bit){ switch (bit) {

case 0: //the sent bit is low

GPIO_ResetBits(GPIOA, GPIO_Pin_7); break;

case 1: // sent bit is high

GPIO_SetBits(GPIOA, GPIO_Pin_7); break; } Delay_Us(delay); GPIO_ResetBits(GPIOA, GPIO_Pin_5); } void CSSLow(){ GPIO_ResetBits(GPIOE, GPIO_Pin_7); } void CSSHigh(){ GPIO_SetBits(GPIOE, GPIO_Pin_7);

Referenties

GERELATEERDE DOCUMENTEN

This is a mistake on the part of the church since less moral and reconciling leaders have abused the relationship with their faith and the church for party political aims that

Die ontwerp en i mplementering van 'n intervensieprogram om die woordeskat en leesbegrip van Xhosa-moedertaalsprekers in graad 4 tot 6 Afrikaansmedium klasse te bevorder,

The risk of developing colorectal carcinoma (CRC) for patients with primary sclerosing cholangitis with concomitant inflammatory bowel disease (PSC-IBD) is 50% after

The average flow throughput performance for the inter-operator CoMP degrades only in the case of non co-azimuth antenna orientation (it is even worse than intra-operator

Een stookkuil is wel aangetroffen tijdens de opgraving, maar een verband tussen deze stookkuil en één van de ovens kon niet worden gelegd door recente(re) verstoringen.

In this study, we chose to focus on the interaction of research and practice in design projects as evidenced through study of: the instructional solutions created

The Bophuthatswana National Education Act of 1979 and the Botswana Edu= cation Law of 1966 determine that the systems of education in those countries remain

Since the PLL operates in burst mode, the fine tuning operation does not require a power hungry bang-bang phase detector but only requires simple logic circuits [6]. 4 shows