Internship Report
Internship Report
Internship Report
Author Note
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.
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.3. Other comparisons (make sure signal received, amplifier, downlink, duty limit,
noise)
2.3.3. Chosen configuration and justification (include Vann Diagram for classification
by code available)
3. Implementation
3.1. Sensors
3.1.2.
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 4
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
1.1. Aim
Optimise the configuration and code of network system employing LoRaWAN network
1.2. Objectives
2. Background research
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
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
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
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
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
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
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
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).
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
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 from
https://www.mobilefish.com/developer/lorawan/lorawan_quickguide_build_lora_gateway
.html or https://www.hackster.io/ChrisSamuelson/lora-raspberry-pi-single-channel-
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
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
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
(we still need a concentrator board to read at multiple channels). This is a suitable low-cost
the bandwidth, BW, coding rate, CR and spreading factor, SF must be programmed to be the
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).
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
3. Implementation
3.1. Sensors
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
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
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
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
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
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
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
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
To do, forward the packet to server (try SQL server Ivan setup).
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 16
Suggestion use ethernet shield rather than raspi to forward the packet to the server.
Use RFM95 and raspi. Problem with transceiver receiving second packet.
4.1. Code
4.2. Gateway
4.3. Server
5. Conclusion
LORAWAN APPLICATION FOR HAZE SENSOR NETWORK 18
References
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
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
For more information about all elements of APA formatting, please consult the APA Style