Internship Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

Running head: LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 1

Network system for Haze Sensor Network

Name: Abdullah Al Mubarak Mohammad Kazmin

Course: MEng Mechanical Engineering

Supervisor: Dr Suan Pu Hui

University of Southampton Malaysia Campus

Author Note

This report is submitted upon completion of Summer Research Internship at University of

Southampton Malaysia Campus


LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 2

Abstract

One of the main problem with pervasive wireless sensors are the limited range of transmission

and power consumption. Hence, a network system utilising the LoRa physical layer which

promises long range communication with low power consumption was proposed for this

application. Using the LoRa, a cheap and reliable haze sensing network is proposed. From the

myriad projects utilizing LoRa, a comparison of each project was done to establish the most

suitable configuration for this purpose. With the components available, few configurations were

tested to find the feasibility of each configuration and their pros and cons. Then, a method to

upload the sensor readings to few database servers was looked upon and few suggestions are

made.

Keywords: LoRa, LoRaWAN, IoT, sensor, haze

1
Media Access Control
2
Internet of Things
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 3

Table of content

1. Introduction

1.1. Aim

1.2. Objectives

2. Background research

2.1. Technology study (LoRaWAN VS other, journals, system requirements)

2.1.1. Bandwidth link versus range graph

2.1.2. Power requirement

2.1.3. Other comparisons (make sure signal received, amplifier, downlink, duty limit,

noise)

2.1.4. Final choice and justification

2.2. Frequency study (LoRaWAN documents and journals)

2.2.1. LoRaWAN regulations

2.2.2. MCMC regulations

2.3. Configuration available (node and gateway)

2.3.1. Complete solutions

2.3.2. DIY solutions (real gateway vs single channel packet forwarder)

2.3.3. Chosen configuration and justification (include Vann Diagram for classification

by code available)

3. Implementation

3.1. Sensors

3.1.1. Dust Sensor

3.1.2.
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 4

3.2. Configuration 1 (Cytron code and Raspi)

3.3. Configuration 2 (Cytron code and ethernet shield)

3.4. Configuration 3 (TTN)

3.5. Server tried

4. Recommendation and further improvement

4.1. Code

4.2. Gateway

4.3. Server

5. Conclusion
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 5

1. Introduction

This document is a report of a Haze sensor network using LoRaWAN. The project attempts to

replicate an existing configuration of LoRa nodes and gateway available and further improve on

it for our application.

1.1. Aim

Optimise the configuration and code of network system employing LoRaWAN network

system for haze monitoring purpose.

1.2. Objectives

1. Choose the best configuration for our application

2. Establish the main areas for improvement

3. Modify the configuration and code to optimize performance


LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 6

2. Background research

2.1. Technology study

A lot of IoT technologies are available in the market for various application and usage.

This project focuses on remote sensing of air quality with low data rate since particle density in

air does not change very frequently. Other than, large quantity of sensors is required to be spread

in a large area to get an indication of the surrounding air quality. Futhermore, since IoT devices

need to be pervasive hence they need to be battery powered and able to sustain years of operation

without the need for a battery replacement. Hence, low power consumption is a very important

consideration in this aspect.

Some rough technology categories can be seen in the bandwidth versus range chart

below. From the comparison, is can be seen that LPWAN (including LoRa, SigFox and UNB) is

the most suitable candidate for this purpose due to its long-range transmission as it has a larger

link budget compared to most technology. Even though the bandwidth is lower compared to

other categories, it is more than sufficient for our purpose. On the other hand, the low power

consumption makes it perfect for this application.

Source: https://www.youtube.com/watch?v=T3dGLqZrjIQ
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 7

A further detailed study of each candidate can be seen in folder Hand Written Notes >

IOT Protocol in which values and a more direct comparison for each technology can be seen.

With the justification stated above, we decided to focus on LPWAN technology. After

that, there are different modulation technology available like Semtechs LoRa, LinkLabs

Symphony Link, Ultra Narrow Band and so on provided by other companies. We decided to go

for LoRaWAN as is can be used with The Things Network which provides a free, open-sourced

network provider. It is a community based infrastructure and have a rich library of resources and

guides on how to setup a gateway and node. It also uses the unlicensed frequency band hence can

be used without the need to go through local government written approval. Even though the

infrastructure that has been setup in Malaysia is not yet wide-spread, a promising growth is

expected as more people become familiar with this new technology.

2.2. Frequency study

Frequency plan that was chosen for this project is influenced primarily on the availability

of the frequency band for ISM usage as dictated by local authority. After having chosen to go for

LoRaWAN technology, the available radio modules are tuned at 433MHz, 868MHz and

915MHz. Since 868MHz has been tendered to private telecommunication, it will no longer be

available for ISM usage starting from 1/1/2018. Other than that, the availability of the radio

module for purchase at the specific frequency plan played a crucial role before a decision can be

made. Since only bare radio chip is available for 433MHz, hence we opted for 915MHz since the

radio shield which stacks on Arduino Uno is available. Also, 915MHz would have less

interference compared to 433MHz. 433MHz band is shared with amateur radiolocation. Other

than that, the LMIC library (one of the code used) might not be compatible with 433MHz.
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 8

2.3. Configuration available

2.3.1. Complete solutions

List of configurations available and their key differences.

1. Kerlink IoT station. Expensive (around 1,200 euros) but great build quality and range.

2. LinkLabs LoRaWAN gateway. It costs 633 euro and uses proprietary hardware.

3. MultiTech Conduit. It costs about 450 euros but need a bigger antenna on it. Based on

plug and play configuration. MultiTech also has a rugged outdoor version. Uses their

hardware and software.

4. Lorank 8. Available at 412 euro. It is based a proprietary radio module but the code is

open-sourced.

5. The Things Gateway. Available at 300 euro. It is developed by The Things Network and

based on open-sourced hardware and software.

2.3.2. DIY gateway and node

List of configurations gateway available and their key differences.

1. LoRaWAN compliant gateway1 using Raspberry Pi and an IMST iC880A concentrator

board. At about 230 euros, this is the most cost-efficient option. But, IMST iC880A only

operates at 868MHz. The model iC980A which operates at 915MHz is currently available

for testing and evaluation only and sold at 189 euros (need to be ordered from Europe).

The concentrator board uses SX1301 or SX1257 based radio modules to detects the radio

signal at 8 different channels simultaneously and forwards it to Raspberry Pi. The

Raspberry Pi then can upload the data to a server via ethernet or Wi-Fi. It also has

downlink capability that is to send data from server to the node (e.g. for software update).

Complete guidelines and code can be get from https://github.com/ttn-zh/ic880a-


LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 9

gateway/wiki while a walkthrough video is available at

https://www.youtube.com/watch?v=ZFVA6cQyheY.

2. Single channel packet forwarder2 using Raspberry Pi and LoRa radio transceiver module

(e.g. Cytron LoRa shield, Dragino shield or bare radio transceiver module3). The radio

module is based on SX1272 or SX1276 and can only detect 1 channel. The radio

forwards the packet received to the Raspberry Pi. The Pi then forwards it to the server via

ethernet or Wi-Fi. Also, another disadvantage of this configuration is it cannot send

downlink message from the gateway to the node. This not a crucial feature for our

configuration might not require update. An ESP8266 or other WiFi module can also be

used to replace the Raspberry Pi to forward the packet to the internet. More details

available at https://www.thethingsnetwork.org/wiki/Hardware/Gateways/DIY. Codes are

based on deprecated repository by Tftelkamp at

https://github.com/tftelkamp/single_chan_pkt_fwd while walkthrough guidelines is

available from

https://www.mobilefish.com/developer/lorawan/lorawan_quickguide_build_lora_gateway

.html or https://www.hackster.io/ChrisSamuelson/lora-raspberry-pi-single-channel-

gateway-cheap-d57d36. These are made to connect to The Things Network. Another

repository can be used for SX1272/76 is from

https://github.com/CongducPham/LowCostLoRaGw for a different server.

3. Single channel packet forwarder using Wi-Fi module (e.g. ESP8266 or ESP32) and LoRa

radio transceiver module (e.g. Cytron LoRa shield, Dragino shield or bare radio

transceiver module3). It is similar to the above configuration with an additional downlink

capability. But on the flip side, it is quite hard to acquire the required Wi-Fi shield in
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 10

Malaysia. The code can be obtained from https://github.com/SensorsIot/ESP-1ch-

Gateway and walkthrough video is available at

https://www.youtube.com/watch?v=ZV_ZY-0Q1lo&t=217s.
1
LoRaWAN compliant gateway should comply with the specification stated in the LoRaWAN

datasheet. A general rule is it should be able to hear at more than 1 channel and enable frequency

hopping (in-case a channel is blocked, node can still transmit at another channel). This feature is

not crucial in our application since number of nodes used is small and does not need a very

reliable data transmission.


2
A single channel packet forwarder is not LoRaWAN compliant as it does only hear at 1 channel

(we still need a concentrator board to read at multiple channels). This is a suitable low-cost

solution for node testing and also simple communication.


3
Radio transceiver modules must be able to communicate is LoRa modulation. Other than that,

the bandwidth, BW, coding rate, CR and spreading factor, SF must be programmed to be the

same for both transceiver to communicate efficiently.

DIY gateway
No. Parts Radio module No. of channels Additional feature Comment
1 Rpi and iC980A SX1301 or SX1257 8 Downlink capability Not yet available for commercial use
2 Rpi and LoRa module SX1272 or SX1276 1 No downlink capability
3 WiFi and LoRa module ESP8266 or ESP32 and SX1272 or SX1276 1 Has downlink capability Similar WiFi module used in tutorial not available in Malaysia
List of configurations node available and their key differences.

1. Arduino Uno and Cytron LoRa-RFM95 Shield (using SX12761 radio module).

2. Arduino Uno and Dragino shield (using SX1276 radio module)

3. Arduino Uno and Cytron LoRa Shield (using RN29032 radio module).
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 11

1
SX1276 is a bare radio module and require the microcontroller unit, MCU to implement the

LoRaWAN stack.
2
RN2903 houses the radio module with a built in MCU which readily implement the LoRaWAN

stack. This module can be bought in bare or shield form. But it costs a bit more expansive.

DIY node
No. Parts Radio module Frequency Cost Comment
1 Arduino and Cytron LoRa-RFM95 shield SX1272 or SX1276 Programmable within 862MHz to 1020MHz RM104.94 Need to tune frequency with antenna.
2 Arduino and Dragino shield SX1272 or SX1276 Programmable within 862MHz to 1020MHz RM104.94 Need to tune frequency with antenna.
3 Arduino and Cytron LoRa shield RN2903 Set to 919MHz to 923MHz RM210.94 Need compatible gateway.
2.3.3. Chosen configuration and justifications

Based on the availability of the components in nearby shops (complete shop list in Appendix 2),

delivery time, cost, built quality and also complexity of the built, we opted for DIY configuration

2. A relatively cheap SX1276 based shield (Cytron Lora-RFM95 shield) is available and can be

easily stacked on Arduino Uno. Also, the same radio module can be used for DIY gateway

configuration 2 and also adaptation of DIY gateway configuration 3.


LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 12

3. Implementation

3.1. Sensors

3.1.1. Dust sensor

Reference: http://www.instructables.com/id/How-to-Interface-With-Optical-Dust-Sensor/

Included in the reference is the connection and code for the sensor. The connection includes a

capacitor believed to smooth the analog signal reading from the sensor. A resistor is also used but

the function is not yet to be understood.

A systematic error can be seen from the sensor reading. It always output zero for the first sensor

output after starting up. The main cause of the error is yet to be confirmed.
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 13

3.1.2. RTC module

Reference (for RPi):

https://www.dfrobot.com/wiki/index.php/Raspberry_Pi_RTC_Module_SKU:_DFR0386

Included in the reference is the connection and code for the sensor. Not able to make it work as I

am not able to perform all of the steps due to my limited knowledge in programming using the

GUI. But decided to ditch the idea since the RPi will be connected to the internet and can update

time from there.

Reference (for Arduino): https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-

kit/arduino-library

This configuration require some hacking. Firstly, make sure the battery is inserted in before the

RTC module is connected to the Arduino1. The RTC communicate to the Arduino via I2C

connection. Code can be downloaded from here2. An I2C scanned code is also useful to check if

connection of RTC to Arduino correct. Follow the connection to Arduino on picture on the left

hand side. Connection to the RTC module need to be modified as per picture on the right hand

side.

1
https://disqus.com/embed/comments/?base=default&f=dfrobot&t_i=prod-

1421&t_u=https%3A%2F%2Fwww.dfrobot.com%2Fproduct-

1421.html&t_d=DS1307%20RTC%20Module%20with%20Battery%20for%20Raspberry%20Pi
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 14

&t_t=DS1307%20RTC%20Module%20with%20Battery%20for%20Raspberry%20Pi&s_o=defa

ult#version=ddf43801e4a13666522a53b88c2abbc4
2
https://github.com/adafruit/RTClib

3.1.3. UV sensor

Reference: https://www.dfrobot.com/wiki/index.php/UV_Sensor_v1.0-ML8511_SKU:SEN0175

May get small negative reading when indoor.

3.1.4. Environmental sensor

Reference:

https://www.dfrobot.com/wiki/index.php/Gravity:_I2C_BME280_Environmental_Sensor_(Temp

erature,_Humidity,_Barometer)_SKU:_SEN0236

Can communicate via SPI or I2C connection. Recommended to use I2C connection as I had

some difficulty trying to connect the sensor via SPI connection as radio module also uses SPI to

communicate with Arduino. Need to include the following library #include

<DFRobot_BME280.h> inside the folder sensor > library > DFRobot_BME280-master.


LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 15

3.2. Code

The approach in this project can be divided into 2 path which is determined by the code used.

1. Cytron code. It is based on RadioHead library for node and gateway (but gateway called

as server in the code). It is available at

https://github.com/CytronTechnologies/RadioHead. Uses Arduino for node and

Arduino+RPi for the gateway. Sensor reading can be added to the radiopacket string

easily. Then the packet will be sent to the other Arduino on the gateway. The Arduino

print the radiopacket received on serial monitor while RPi reads the serial monitor

reading using Python. From there, the radiopacket can be sent to a database server via

Microsoft Azure or others.

2. The Thing Network, TTN code. It is based on LMIC library. Uses Arduino for the node

and RPi for the gateway. Data is encrypted before sent from the node. Gateway only

receives the

Name Library Size (without Node Gateway/Single Server Complexity


sensor) channel packet of code
forwarder
Cytron RadioHead Lighter (around Arduino Arduino & Rpi (use None Easier to
code 45% RAM and Python to read serial manipulate
50% memory) monitor reading of (in Arduino)
Arduino)
TTN LMIC Heavier (around Arduino Rpi The A bit more
code 50% RAM and Things complicated
55% memory) Network (in C++)

3.3. Configuration 1 (Cytron code and Raspi)

Use raspi to read serial monitor of Arduino.

To do, forward the packet to server (try SQL server Ivan setup).
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 16

3.3. Configuration 2 (Cytron code and ethernet shield)

Suggestion use ethernet shield rather than raspi to forward the packet to the server.

3.4. Configuration 3 (TTN)

Use RFM95 and raspi. Problem with transceiver receiving second packet.

3.5. Server tried


LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 17

4. Recommendation and further improvement

4.1. Code

4.2. Gateway

4.3. Server

5. Conclusion
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 18

References

Ferran Adelantado, X. V.-P.-S. (2017). Understanding the Limits of LoRaWAN. IEEE

Communications Magazine, 1.
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 19

Footnotes
1
[Add footnotes, if any, on their own page following references. For APA formatting

requirements, its easy to just type your own footnote references and notes. To format a footnote

reference, select the number and then, on the Home tab, in the Styles gallery, click Footnote

Reference. The body of a footnote, such as this example, uses the Normal text style. (Note: If

you delete this sample footnote, dont forget to delete its in-text reference as well. Thats at the

end of the sample Heading 2 paragraph on the first page of body content in this template.)]
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 20

Tables

Table 1

[Table Title]

Column Head Column Head Column Head Column Head Column Head
Row Head 123 123 123 123
Row Head 456 456 456 456
Row Head 789 789 789 789
Row Head 123 123 123 123
Row Head 456 456 456 456
Row Head 789 789 789 789

Note: [Place all tables for your paper in a tables section, following references (and, if applicable,

footnotes). Start a new page for each table, include a table number and table title for each, as

shown on this page. All explanatory text appears in a table note that follows the table, such as

this one. Use the Table/Figure style, available on the Home tab, in the Styles gallery, to get the

spacing between table and note. Tables in APA format can use single or 1.5 line spacing.

Include a heading for every row and column, even if the content seems obvious. A default table

style has been setup for this template that fits APA guidelines. To insert a table, on the Insert tab,

click Table.]
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 21

Figures title:

0
Category 1 Category 2 Category 3 Category 4

Series 1 Series 2 Series 3

Figure 1. [Include all figures in their own section, following references (and footnotes and tables,

if applicable). Include a numbered caption for each figure. Use the Table/Figure style for easy

spacing between figure and caption.]

For more information about all elements of APA formatting, please consult the APA Style

Manual, 6th Edition.

You might also like