1. Trang chủ
  2. » Luận Văn - Báo Cáo

Khóa luận tốt nghiệp: Nghiên cứu, thiết kế và hiện thực thiết bị đo đạc và hệ thống hiển thị mức độ bao phủ của gateway LoRaWan

73 1 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Research, Design, and Implementation of Measuring Device and LoRaWAN Gateway’s Coverage Display System
Tác giả Vu Dinh Bao Phuc, Nguyen Quang Tien
Người hướng dẫn PHD. Trinh Le Huy
Trường học University of Information Technology
Chuyên ngành Computer Engineering
Thể loại Capstone Project
Năm xuất bản 2023
Thành phố Ho Chi Minh City
Định dạng
Số trang 73
Dung lượng 43,84 MB

Nội dung

The measured information of the device will be stored in Firebase Database throughThe Things Network TTN Server and the team's NodeJS server.. The application and operation of LoRa techn

Trang 1

VIETNAM NATIONAL UNIVERSITY, HO CHI MINH CITY

UNIVERSITY OF INFORMATION TECHNOLOGY

FACULTY OF COMPUTER ENGINEERING

VU DINH BAO PHUC - 19522048

NGUYEN QUANG TIEN - 19522338

CAPSTONE PROJECT

RESEARCH, DESIGN, AND IMPLEMENTATION OF

MEASURING DEVICE AND LORAWAN GATEWAY’S

COVERAGE DISPLAY SYSTEM

NGHIEN CUU, THIET KE VA HIEN THUC THIET BI DO DAC

VA HE THONG HIEN THI MUC DO BAO PHU CUA

Trang 2

First, we would like to thank the University of Information Technology teachers

While studying and practicing at the school, with the dedicated teaching and guidance

of the teachers, they have equipped me with professional knowledge and soft skills,giving us solid baggage in the future Life and work in the future

Next, we thank the Department of Computer Engineering for always creatingfavorable conditions for us to study and develop

In particular, to complete this graduation thesis, we would like to express our deepgratitude to Mr Trinh Le Huy for his enthusiastic guidance and equipment supportfor us during this thesis At the same time, we would also like to thank former students

Nguyen Binh Phuong, Le Xuan Minh, Nguyen Minh Khoa, and Tran Quoc Son from

the research group of Mr Huy We also want to thank all the companies and

developers providing free services, open-source libraries, and projects These tools

and libraries are necessary for my thesis to be as complete as it is now

Finally, we would like to thank our family, who always encouraged us throughout

this thesis

Ho Chi Minh city, July 26", 2023

StudentsNguyen Quang Tien Vu Dinh Bao Phuc

Trang 3

TABLE OF CONTENTS

Chapter 1 OVERVIEW 00000 ceccccccccescceseeesecesnecescecsaeeescecesceceaeecsaeeeaeceeeceaeessaeenaes 2

1.1 IntroduCHON SG G1 1 TH HH HH HH HH 21.2 The current situation of LoRa’s developmen( -.- «5s <+<£+<cxsex++ 3

1.2.1 — Global situation of LoRa’s development ‹ s5 +++<<++ss++s 3

1.2.2 Domestic situation of LoRa’s developmen( ‹ -«<++ss++ 3

| Pam Ko) 0) Coad X0)- | ee 5

1.4 Implementation method 0 cece ccecceeseesseeeseecesneceeeeeaeceeneceeeceseecsaeeesaeeeees 51.5 Contents Tồ nh 5

Chapter 2, METHODD SH 9 TT TH HH HH nh nh ghi ng 7

2.2.1 AVAaT(ÀCS ĂĂ TQ HH TH HH HH HH ke 92.2.2 DisadVanfaBes HH HH» ệt 102.3 A[CWAV HH HH HH HH HT ni, 10

"` 6000 g 11

2.4.1 Feature 1 e ỐẦ 12

2.4.2 Component archIt€CfUTe- - 5 1 1v 13

2.4.3 No nh 142.4.4 DiSadVanfage€s HH HH HH HH HH Hệ 152.5 The Things Network S€TV€T G1 ngư, 162.6 NOdCIS ooo - 16

2.6.1 Advantages Node]Š - HH HH kg 172.6.2 DisadVanfaBe€s Ăn ng HH nghệ 18

Trang 4

2.7 R€aC{f-ÌNa(IV© - LG L LH g1 1 xe 19

2.7.1 AdVAT(AB€S SH HH HT HH HH HH HH 20

2.7.2 DiSadVanfaỹ€S QnH*nHHTH HT 212.8 Firebase Database - - HH HH HT HH 22

2.8.1 AdVantages he 232.8.2 DiSad vantages cecccescccessceseceseeceseceseeceseeceaeeeeseceeeceaeeceaeeeeaeeesneesaes 24Chapter 3 PROPOSAL SOLUTION 0 ice ceceesceceeseneeseesesessecsessessessesseeeneens 25

3.1 SysteM oan 25

E VAN s nšäašẦẦ 27

3.2.1 RAK3172 modUle - c2 3111311 * 3 ESkkrikerkrerkrree 27

3.2.2 GPS Quectel LC76F module + << + s + +2 ++++zsee+ 28

3.2.3 Hardware device OV€TVICW HH krt 29

3.2.4 Antena me TS U vựnm / ì 30

3.2.5 Operating ImO€S 4 eee 1E 1E931 E3 11 1 vn ng ngư 343.3 S€TV€T HH HH HH HH HH 34

3.3.1 The Things Network S€TV€T - Ăn ret 343.3.2 NodeJS S€rV€Y LH HH HH TH HH Hệ 363.4 Firebase Database - su HH nhện 373.5 Application €SIET - c1 TH HH HH ngư 38Chapter 4 RESULFTS Ăn g gkrưy 40

4.1 Hardware (€VICG LH ng nh ng ng rờ 40

4.1.2 Hardware đesIgn Ăn HH Hư 414.1.3 Actual @VIC - - - << << 11000005501 kkkkkkkek 43

Trang 5

4.2 Software T@SỤ{S 0000010100111 55555 44

4.2.1 Database and S€TVT - - G1 HH ng rưy 44

4.2.2 — NodeJS SGTV€T on HH TH ng HH, 46 4.2.3 0) 0) | (6r-1 8 (0) | Q1 HH HH ng ngư 48 4.3 Experimental f€SỤ(S - - c1 HH HH nh 51

CN 5i 2iàáv0i)) 000 0 ï 5 54

4.4.1 | Energy consumption of the board in sleep mode -‹ 54

4.4.2 Energy consumption of the board in active mode - ‹‹ 56

4.5 Overall result 00 58 Chapter 5 _ CONCLUSIƠN SG SH HH HH HH HH HH 59

5.1 Conclusion based on measured r€SuÏfS - 5+ + +s£+£sesseessesse 59

5.2 Advantages and disadvantages - - + «+ kg tr 60

5.2.1 — AVAnẨÀ€S QQQ HT HH HH TH 60 5.2.2 DisadVan(age€s Ă SH ch HH HH ng như 60

5.3 Difficulties encounf€r€C - - - s11 HH rưy 60

5.4 Future WOFĂK << 0100 g1 kvkkkkkEk 61

Trang 6

LIST OF FIGURES

Figure 2.1 The layers in the LoRa System, - - 5 2c 1323139 1 rrrerree 8Figure 2.2 LORaWAN n€tWOFK - -.- ch HH HH ng HH re 9Figure 2.3 RAK7240 SITUCfUT€ - Ác ST HH ngư 11

Figure 2.4 Component architecture of the MQTT protocol ‹ «++s<«++ 13Figure 2.5 Firebase provides real-time syncing across deVICes - 22Figure 3.1 Functional block diagram of the system - - «5+5 s «+ <++ss+sses 25

Figure 3.2 System OV€TVICW HH TH HH TH HH HH 26Figure 3.3 The RAK3172 modu]ẹ - + + E331 * EEEEESEeeEkkserereereeeereere 28Figure 3.4 LC76F GPS mOdUÌẸ - G5 3 3191911 9111 vn Hàng HH ng rưệt 29Figure 3.5 LoRa anf€TTIẠ - << 111v HH HH HH nh 31Figure 3.6 GPS an(t€TTẠ - G01 2111210111101 139101 1911 vn ng HH ng 33

Figure 3.7 Overview diagram of the (Ì@VICC - s6 + + re 33

Figure 3.8 Gateway interface on TTN S€TVCT - Ăn series 35Figure 3.9 The end device’s configuration settings on TTN platform 36

Figure 3.10 NodeJS server COTISOÏ Ác HnnnHnHnHnHkrn 37Figure 3.11 Firebase Database data Structurẹ ccceeceeeseeeseeceneeeeeeeeeeeeeaeeenneesaes 37

Figure 3.12 The platform interfaces that can be applied to the application 38Figure 4.1 Device block diagram .0 ce ceeccecescesecesceeeseeeeseeeeeeceneeeaeeesaecesneeeeneeeaes 40Figure 4.2 Top side of the 3D PCB model ceeecsseeeseeeseceeeeeeeeeeeaecesaeeesneesaes 42Figure 4.3 Bottom side of the 3D PCB model . - 5< + *+++sexsseessesss 42Figure 4.4 Our team's circuit board after soldering and finishing 43

Figure 4.5 Our team's circuit board after soldering and finishing .- 43

Figure 4.6 Live data on TTN S€TV€T G Q1 HH TH HH ng 44IanisEJAN0I0)00) Gì 1+ 44Figure 4.8 Uplink message payÌOặ - -.- sgk Hy 45Figure 4.9 Gateway ITOTITAfIOH G5 3 111911910193 911 9119 ng nh 45Figure 4.10 Measurement information in the databasẹ - -« «<< x+s<+sx+ 46Figure 4.11 NodeJS server COTISOÏÌẹ 4 + 11 ng nHng ng rên 47

Trang 7

Figure 4.12.

Figure 4.13

Figure 4.14

Figure 4.15

Figure 4.16

Figure 4.17

Figure 4.18

Figure 4.19

Figure 4.20

Figure 4.21

Figure 4.22

Invalid parameters on server COISỌ€ - 5c ++csseeess 47

I0 Up oi 48

s10) 50

The profile SCre@N oo eee 51

University of Information Technology heatmap . ‹ 52

Measurement information 1n ÏTÌP - - «<< £+s£eseeseeseeseree 53 Energy consumption of the board when GPS is Off - 55

Energy consumption when GPS and RAK are is sleep mode 55

Energy consumption when RAK and GPS are in sleep mode 56

Energy consumption of the board when active .- -«« 57

Energy consumption of the board when sending LoRa packets 57

Trang 8

LIST OF TABLES

Table 3.1 Price vi i9 017 30Table 3.2 Antenna SD€CIÍICAfIOT - 2G 1 12101119101 9101993112 HH ng ng 32Table 4.1 Heatmap color SCaÏG - - c1 18211183111 E911 189111 11 811 8111 re 49Table 4.2 Example points to demonstrate heatmap display - -«-«+ 50Table 4.3 Device energy COTSUITDẨIO - 5 5 63119311511 911 3 91v ren 58Table 5.1 Achieved result compared to topic’s GOA eeeeseeceeeceeseeeeeeeeeeteeeaeeeee 59

Trang 9

TIN The Things Network

MCU Microcontroller Unit

MQTT Message Queuing Telemetry Transport

ITP Information Technology Park

LDO Low-dropout regulator

LPWAN Low Power Wide Area Network

AWS Amazon Web Services

M2M Machine to Machine

QoS Quality of Service

loT Internet of Things

OASIS Organization for the Advancement of Structured

Information Standards

AMQP Advanced Message Queuing Protocol

RHCP Right Hand Circular Polarization

RSSI Received signal strength indicator

P2P Point-to-Point

LNA Low-noise amplifier

SNR Signal-to-noise ratio

Trang 10

THESIS SUMMARY

The topic "RESEARCH, DESIGN, AND IMPLEMENTATION OF MEASURINGDEVICE AND LORAWAN GATEWAY'S COVERAGE DISPLAY SYSTEM" isresearched and developed by the team; the project uses GPS module LC76F to locate

and combine with the RAK module which is capable of transmitting and receiving a

signal through LoRa wave, instead of using MCU (Microcontroller Unit) like ESP32,STM32 to control LoRa chip/module This helps optimize the size of the circuitboard The group's hardware device is used to locate and determine the signal strengthbetween the device and the gateway

The measured information of the device will be stored in Firebase Database throughThe Things Network (TTN) Server and the team's NodeJS server The team used theReact-Native framework to implement the application to display the location andsignal strength of devices and gateways stored on the Firebase Database

The system had been used for measuring and testing at the University of Information

Technology campus

Trang 11

Chapter 1 OVERVIEW

1.1 Introduction

Nowadays, the great development of science and technology has changed everyaspect of our lives The daily needs of people are constantly increasing, especially inthe field of technology, leading to the number of technological devices produced eachyear increasing exponentially In that development trend, IoT (Internet of Things) isthe field of leading focus in research and development thanks to the ability to connectmany devices [2] For IoT technology to work optimally, choosing an appropriateprotocol for communication between devices is extremely important The protocolsused in IoT today are very diverse, such as Bluetooth, Wi-Fi, Zigbee, Z-Wave, NFC,Cellular, and LoRa Each protocol type has its advantages, disadvantages and is usedfor different purposes Among the above protocols, LoRa is one of the most popularIoT communication protocols today, LoRa stands out for its long-range, energy, andcost savings and the ability to connect to a wide range of devices [1] With theadvantages of LoRa, it is being applied in many different fields such as environmental

monitoring, energy management, and remote warning system The application and

operation of LoRa technology are quite simple, it only needs a Gateway device toreceive information from end-node devices and transmit it to a cloud server In anopen area and with very few obstacles, LoRa technology works extremely effectively

On the other hand, when used in clustered spaces with many obstacles, LoRa doesnot always work optimally In that case, the connectivity of LoRa technology depends

on quite a lot on the location of the Gateway so that the signal strength to the node devices is as good as possible [3] Therefore, the research, design, andimplementation of a device capable of measuring together with a system to displaythe coverage of the Gateway will help determine the ideal Gateway's location

Trang 12

end-1.2 The current situation of LoRa’s development

1.2.1 Global situation of LoRa’s development

LoRa is a wireless communication technology that supports the Internet of Things

(IoT) and Machine-to-Machine (M2M) applications It provides a comprehensive

communication range, low power consumption, and low cost, enabling remoteconnectivity for IoT devices

In recent years, LoRa has attracted the attention of companies and organizations

worldwide Some essential news and trends in the field of LoRa are [16]:

LoRa network deployments: Telecom operators and technology companies aredeploying LoRa networks in many countries worldwide This has made LoRa

a popular lo communication technology supported in many areas

Application in various industries: LoRa is being applied in several industrialsectors such as environmental monitoring, smart agriculture, energymanagement, asset management and traffic monitoring This technology

offers a flexible and cost-effective solution for collecting data from IoT

devices in different environments

Standardization and collaboration: Standardization organizations like theLoRa Alliance are working to ensure compatibility and global development ofLoRa Collaboration between companies, service providers, and governments

is also being pursued to harness the potential of LoRa

Competition with other technologies: LoRa is one of many technologies in theIoT field Other technologies, such as NB-IoT (Narrowband IoT), are alsodeveloping and competing with LoRa The choice of technology will depend

on the specific requirements of each application and deployment location

1.2.2 Domestic situation of LoRa’s development

The development of LoRa (Long Range) technology in Vietnam has shownsignificant progress in recent years and continues to attract the interest of businesses,

Trang 13

organizations, and the loT community LoRa is a wireless communication technology

suitable for loT and M2M applications, offering long-range connectivity, low power

consumption, and cost-effectiveness [17]

The deployment of LoRa networks in Vietnam started in major cities such as Hanoi,

Ho Chi Minh City, and Da Nang [17] Telecom operators and technology companieshave invested in building LoRa infrastructure and deploying base stations andgateways to create an extensive LoRa network coverage in the area

LoRa applications in Vietnam have diversified across various industries Forinstance, in smart agriculture, monitoring soil moisture, temperature, air humidity,and other environmental parameters, providing farmers and agricultural managerswith valuable information to optimize cultivation and water management [16]

Participation in the LoRa Alliance, an international organization promoting LoRatechnology, has significantly developed LoRa in Vietnam [17] The LoRa Alliancemembers, including manufacturers, service providers, and other partners, collaborate

to establish standards, enhance compatibility, and drive global advancements in LoRatechnology Vietnam's involvement and contribution to this community havefacilitated support and knowledge exchange to develop LoRa within the countryfurther

However, the LoRa landscape in Vietnam is still in the developmental stage and mayhave yet to reach all regions and scales Building LoRa infrastructure andimplementing applications require investments and efforts from businesses andorganizations Government support and a favorable business environment for LoRaprojects are crucial in fostering the technology's development in Vietnam

With potential expansion and growth, Vietnam is expected to continue driving and

utilizing LoRa technology in IoT and M2M applications Vietnam companies and

organizations will continue researching, developing, and deploying LoRa in aintelligent and efficient ways to meet market demands and benefit the community

Trang 14

1.3 Topic’s goal

- Capable of positioning via GPS and measuring signal strength between

end-node devices and outdoor Gateway RAK7240

- Compact device: 5cm x 10cm, simple to use

- The device can connect within 3km, in an obstacles-free area and [km in an

urban area

- Capable of connecting to the outdoor Gateway RAK7240, sharing location

data and signal strength between the device and the gateway

- Design an application that can display the device’s location and the gateway

along with the signal strength between the device and the gateway

- Design a system including a server to transmit and receive information

between The Things Network server and Firebase database

1.4 Implementation method

The topic focuses on developing and implementing devices that locate andcommunicate with gateways As for the innovative mobile app, the team will reusethe open-source code shared on the Internet The system design process will bedivided into two main phases In phase 1, the team will focus on developing a devicethat can locate via GPS and measure the signal strength between that device and theGateway The device will connect to the Gateway, and those parameters will becaptured by the Gateway and forwarded to the server of TTN In phase 2, afterobtaining the measured parameters in phase 1, the team will design a server to deliverthose parameters for storing and displaying the Gateway's coverage area

1.5 Contents of the thesis

The topic consists of 5 chapters:

e Chapter 1: Overview - An overview of the background, the topic's objectives

and the method of implementing the topic

e Chapter 2: Method - Theoretical basis of the thesis

Trang 15

Chapter 3: Proposed solution - Propose solutions to implement the topic and

achieve the objectives of the topic

Chapter 4: Results — Achieved result

Chapter 5: Conclusion - Compare the results achieved with the objectives ofthe topic

Trang 16

Chapter 2 METHOD

2.1 LoRa protocol

LoRa [7], short for Long Range Radio, is a wireless communication technology

developed by Cycleo LoRa is characterized by its ability to transmit data over longdistances with a low power consumption This saves energy and facilitates datatransmission/receiving

LoRa technology uses a transmission method called Chirp Spread Spectrum Thistechnique transforms data into a signal with a frequency range higher than the originaldata This process is done by hashing the data with high-frequency pulses, creating asignal with a broader frequency range Then, this high-frequency signal is further

encoded in a sequence of chirp signals, i.e., sinusoidal signals whose frequency varies

with time This encoding process helps to increase the stability and accuracy of thesignal before it is transmitted to the antenna for sending

With the combination of the Chirp Spread Spectrum and the dominant design ofLoRa, this technology enables data transmission over distances of up to kilometerswith a low power consumption This means energy savings and increasedperformance of LoRa data transmitters/receivers

Another critical advantage of LoRa is its ability to receive data over long distanceswithout requiring high transmission power This is especially useful when receiversreceive data from a nearby source and face interference from the surroundingenvironment LoRa can decode data at a received signal strength lower than the noise

level, ensuring reliability and operability in poor environments

LoRa technology provides various benefits, it saves energy, increases signal stability

and accuracy, and allows data transmission in poor conditions while ensuringreliability This technology is widely used in IoT (Internet of Things), wireless sensornetworks, and remote communication applications

Trang 17

of the various LoRaWAN networks world-wide There is usually a mix up whenpeople try to define LoRa and LoRaWAN which is probably best solved byexamining the OSI reference stack model.

Based on the OSI stack model, LoRaWAN corresponds to the Media Access protocolfor the communication network, while LoRa corresponds to the Physical layer ThusLoRaWAN defines the network's communication protocol and system architecture,while LoRa architecture enables the long-range communication link The two of themmerged to provide the functionality that determines the battery life of a node, thenetwork capacity, the quality of service, the security, and other applications served

by the network While LoRaWAN is the most popular MAC layer for LoRa, otherproprietary layers also built on the LoRa technology exist [18] Figure 2.1 is an imageshowing the layers in the LoRa system

Figure 2.1 The layers in the LoRa system

The LoRaWAN network structure is usually built in a star model, in which thegateway acts as a bridge between the terminals and the server These gateways

Trang 18

connect to the internet via regular IP connections, allowing data from the terminals

to be forwarded to the server and vice versa Wireless end devices are devices

equipped with LoRa technology to communicate with gateways They can be sensors,

data collection devices, or other IoT devices Figure 2.2 describes how the systemworks using the LoRaWan network protocol

End Nodes /Gateway Server

water

meter

vending

machine.

LoRa® RF TCP/IP SSL TCP/IP SSL

LoRaWANTM LoRaWANTM Secure Payload

AES Secured Payload

Figure 2.2 LoRaWAN network

2.2.1 Advantages

e Low energy sensor and coverage up to kilometers

e Operates on free frequencies (no license), with no upfront licensing costs to

use the technology

e Low power means long-lasting battery life for devices Sensor batteries can

last 2—5 years (Type A and Type B)

e Single LoRa Gateway device is designed to take care of thousands of terminals

or nodes It is easy to deploy due to its simple architecture

e Itis widely used for M2M/IoT applications

e Better payload size (100 bytes) than SigFox, which is 12 bytes

Trang 19

e The low bandwidth makes it ideal for practical IoT deployments with fewer

data and intermittent data transmission

e Security: one layer of security for the network and one layer for the application

with AES encryption

e Supported by CISCO, IBM, and 500 other LoRa Alliance member companies.2.2.2 Disadvantages

e Not intended for large data payloads; payloads are limited to 100 bytes

e Not for continuous monitoring (except for class C devices)

e Density of LoRaWAN: The growth of LPWAN technologies, especially

LoRaWAN, poses challenges when deploying gateways into urban areas

e The disadvantage of an available frequency is that you can get noise on that

frequency, and the data rate can be low

2.3 Gateway

Gateway acts as a bridge between the end device and the TTN server Gateway helpsforward packets from end devices to the data processing server in this case, the TTNserver The quality of the gateway greatly affects the stable operation of the system

In this topic, we use the RAK7240 WisGate Edge Prime RAK7240 is designed to beinstalled on a pole or a wall, making it especially suitable for construction sites andtower installations [19]

The Gateway comes with a mounting kit and a PoE injector to facilitate quick andeasy deployment in any scenario [19] Figure 2.3 is the structure of the RAK7240

10

Trang 20

RAK7240 components

1 Mounting kit 8 Ethernet port cable gland

2 Backplate 9 Service port covers ®

3 2x LoRa concentrators 10 WiFi antenna

4 Main board 11 LTE antenna

5 TF and SIM cards 12 LTE/LoRa antenna

6 Metal Casing 13 LoRa antenna

7 GPS antenna connector

Some outstanding function of the RAK7240 [19]:

e You have a choice between 8 or 16 LoRa Channels (by adding a second

Concentrator module) You can either use the built-in BG96 cellular module

or add your own via the mPCle slot

e RAK7240 supports multiple backhaul connectivity options including WiFi,

LTE, and Ethernet

e To achieve a low-power, multimode connectivity solution, we based the CPU

Module (RAK634) on MTK7628 which supports 2.4G WiFi in a 2x2 MIMOconfiguration

e There is a built-in surge protection for the Ethernet port, so no external SPD

is needed

2.4 MQTT

MQTT (Message Queuing Telemetry Transport) [6] is an _ event-driven

communication protocol developed for transmitting data between IoT (Internet ofThings) devices MQTT allows devices to send and receive data through lightweight,efficient, and reliable messages

11

Trang 21

MỌTTTT operates on a publish-subscribe model, classifying devices into publishers andsubscribers Publisher devices send data messages to a central broker, and subscriber

devices register with the broker to receive notifications they are interested in MQTT

is designed to work with limited bandwidth and unstable networks, making it apopular choice for IoT applications The protocol allows devices to send data to otherdevices in real-time, reducing latency in data transmission and increasing systemavailability

Using MQTT, developers can design IoT applications with various features without

worrying about handling complex communication protocols MQTT is also supported

by popular IoT platforms such as Amazon Web Services (AWS) and MicrosoftAzure, simplifying the deployment of IoT applications

MQTT is ideal in cases like:

e Places where telecommunications networks are expensive, or bandwidth is

low or unreliable

e When running on embedded devices, speed, and memory resources are

limited

e This protocol uses low bandwidth in high latency environments, which is ideal

for M2M (Machine to Machine) applications

e MQTT is also the protocol used in Facebook Messenger

2.4.1 Feature

e The Pub/Sub message passing model provides one-way distributed

communication, separate from the application part

e The transmission of the message is instant, regardless of the content being

transmitted

e Using TCP/IP as the background protocol

e There exist three levels of reliability for data transmission (QoS: Quality of

service)

12

Trang 22

e QoS 0: Broker/client will send data exactly once; sending is confirmed by

TCP/IP protocol only

e QoS 1: Broker/client will send data with at least one acknowledgment from

the other end, meaning there can be more than one acknowledgment of datareceived

e QoS 2: Broker/client ensures that when sending data, the receiver only

receives it once; this process must go through 4 handshake steps

e The transmission data wrap is small and minimized to reduce the load on the

transmission line

2.4.2 Component architecture

Figure 2.4 is component architecture of the MQTT protocol is described in detail inthe figure below [6]

Figure 2.4 Component architecture of the MQTT protocol

e The main components of MQTT are Client (Publisher/Subscriber), Server

(Broker), Sessions, Subscriptions, and Topics

e MQTT Client (Publisher/Subscriber): Clients will subscribe to one or more

topics to send and receive messages from the respective topics

13

Trang 23

MQTT Server (Broker): Broker receives subscription information

(Subscriptions) from the client, receives messages, and delivers the messages

to the corresponding Subscriber based on Subscriptions from the client

Topic: The topic can be considered a queue of messages, and templates areavailable for subscribers or publishers Logically, topics allow the client

exchanges information with predefined semantics For example, temperature

sensor data of a building

Session: A session is defined as the connection from the client to the server.All the client and server communication are part of the session

Subscription: Unlike a session, a subscription is logically connected fromclient to topic Once subscribed to a topic, the Client can receive/sendmessages (message) with that topic

2.4.3 Advantages

MOQTT is an ultra-lightweight binary communication protocol that transmits data

between IoT (Internet of Things) devices and host systems Here are some criticaladvantages of MQTT:

Save bandwidth: MQTT uses TCP/IP protocol and a publish-subscribe model

to transmit data This protocol is very lightweight and has a small packet size,which reduces network traffic and saves bandwidth

High reliability: MQTT supports guaranteed delivery, which ensures that

messages sent from the source will reach the destination reliably If a message

is not sent successfully, MQTT will automatically retry until it succeeds

Energy efficient: The MQTT protocol is designed to work efficiently withresource-constrained devices such as lo devices MQTT uses a keep-alivemechanism and can keep the connection open for a long time withoutconsuming much energy

Multi-platform support: MQTT is a platform-independent protocol that allowsdata transmission across many platforms and devices, such as mobile devices,

14

Trang 24

personal computers, IoT-embedded devices, servers, etc This makes MQTT a

flexible choice for communication between components in a distributed

system.

Ease of deployment and integration: MQTT has rich libraries and open-sourceversions, making protocol implementation and integration quick and easy Inaddition, MQTT also supports many programming languages and is ready touse with popular technologies and frameworks

Openness and standards: MQTT is developed and managed by Organizationfor the Advancement of Structured Information Standards (OASIS), ensuringthe openness and standardization of the protocol This makes MQTT widelyused and compatible with many different systems and technologies

2.4.4 Disadvantages

Does not support strong security: The MQTT protocol does not provide robust

security features such as end-to-end encryption or strong authentication Thismeans that data protection and confidentiality during data transmission must

be handled outside the MQTT protocol, for example, using SSL/TLS for thetransport layer

Complexity when implementing complex features: MQTT is designed to be

simple and light, so it does not provide complex features like AMQP(Advanced Message Queuing Protocol) If you need to implement features like

an assurance of trust, session management, or latency management, you musthandle them customarily or use other, more complex protocols

Limited scalability: Although MQTT is scalable with a publish-subscribe

architecture, it limits the number of subscribers and publishers a broker canhandle Managing and scaling an MQTT broker can be challenging if yourapplication requires handling thousands or millions of IoT devices

No message archiving: MQTT only focuses on message transmission betweendevices and brokers but does not provide message archiving in case of

15

Trang 25

connection loss or device inactivity This means that if a device is inactiveduring the message storage period, it will lose information and cannot receive

messages sent during that time

However, these disadvantages are sometimes a big deal and can be solved throughadditional methods and technologies MQTT remains an efficient and popular datatransfer protocol in IoT system deployments and distributed applications

2.5 The Things Network Server

The Things Network (TTN) Server [9] is an open-source, cloud-based network serverdesigned for LoRaWAN IoT applications It provides a scalable and reliableinfrastructure for managing LORaWAN devices, gateways, and applications

TIN Server uses a distributed architecture, with multiple components workingtogether to provide the necessary functionality The components include the Router,

Broker, and Handler The Router handles the LoORaWAN traffic, while the Broker

manages the communication between the Router and the Handler The Handlerprocesses the data received from the Router and stores it in a database

TIN Server supports various data integration options, including HTTP (HypertextTransfer Protocol), MQTT, and Webhooks It also provides a user-friendly web

interface for managing devices, gateways, and applications The interface lets users

view device data, configure devices and gateways, and set up integrations with other

platforms

TIN Server is open-source and can be deployed on-premises or in the cloud Itprovides a cost-effective solution for managing LORaWAN devices and applications,allowing developers to focus on building their IoT solutions rather than managinginfrastructure

2.6 NodeJS

NodeJS [10] is an independent development platform (Platform) built on V8JavaScript Engine This interpreter executes JavaScript code that makes building web

16

Trang 26

applications such as video clips and forums possible, especially a narrow socialnetworking site that quickly and easily expands NodeJS can run on many differentoperating system platforms, from Windows to Linux, and OS X, which is also anadvantage NodeJS provides rich libraries in various JavaScript Modules that simplify

programming and optimize development time

The main idea of NodeJS is to use non-blocking, quickly directing data input andoutput through real-time tasks Because NodeJS has fast scalability and can handlemany connections simultaneously with high throughput If requests in traditional web

applications create a new request processing thread and occupy the system's RAM,

the system's resources will be used inefficiently Therefore, the solution that NodeJS

offers is to use a single thread (Single-Threaded), connecting compatible with

non-blocking I/O to execute requests, allowing tens of thousands of concurrentconnections to be supported

2.6.1 Advantages NodeJS

e Performance and scalability: NodeJS uses a non-blocking and event-driven

I/O model, allowing concurrent processing of requests without being blocked

by a single thread This ensures high performance and scalability, especiallywhen dealing with high-traffic applications and many concurrent requests

e Rapid development: NodeJS uses JavaScript, a popular and accessible

programming language This reduces the complexity of applicationdevelopment, enables code sharing between the server and client side Can usethe same resources as JavaScript libraries and development tools, speeding upthe development process

e Extensible ecosystem: NodeJS has a robust ecosystem with thousands of

open-source modules available through Node Package Manager These modulesprovide rich and ready-to-use functionality for handling tasks such as fileprocessing, emailing, database queries, string processing, etc As a result,application development and expansion have become fast and convenient

17

Trang 27

Single-threaded but capable of multi-threading: Although NodeJS runs on a

single thread, its asynchronous processing model and non-blocking I/O

operations can handle thousands of concurrent connections This reduces theserver load and increases the application's responsiveness

Good integration with new technologies: NodeJS constantly updates andsupports the latest features and technologies in the development community

It provides the ability to use new ECMAScript features, supports ES6

modules, and collaborates with popular frameworks and libraries such asExpress.js, Socket.io, React, and many more

Strong community team: NodeJS has a large developer community and manycontributors This ensures continuous updates, maintenance, support, andknowledge sharing among community members

2.6.2 Disadvantages

Single-threaded: While single-threaded can provide performance and

multithreading capabilities, it can sometimes become a limitation whendealing with tasks requiring synchronous and complex handling It isnecessary to ensure the use of non-blocking and asynchronous methods toavoid blocking the main thread and reducing performance

Memory management: NodeJS uses memory management in the form ofgarbage collection This can lead to inefficient memory usage and causeapplication stuttering if not managed carefully

Concurrency: Although NodeJS has good concurrency, it is unsuitable for

tasks requiring intense multi-threading In cases like image processing or

complex computations, using NodeJS alone can cause performancedegradation

Reliance on third-party modules: Although NodeJS has a rich module

ecosystem, depending on third-party modules can present stability and security

18

Trang 28

risks It is necessary to select trusted modules and check their compatibility,and update support.

2.7 React-Native

React Native [11] is an open-source mobile application framework developed byFacebook It allows developers to build native mobile applications using JavaScriptand React, a popular JavaScript library for creating user interfaces

React Native provides a set of components and APIs that allow developers to createmobile applications for both iOS and Android platforms using a single codebase

This approach enables faster development and easier maintenance of mobileapplications React Native also provides access to native platform features such ascamera, contacts, and location services, allowing developers to build high-performance applications with a native look and feel

One of the critical benefits of React Native is its ability to provide a smooth andresponsive user experience Using native components and animations, React Native

applications can achieve high performance and offer a native-like experience, even

on older devices React Native also supports hot reloading, allowing developers topreview changes to the application in real-time, which can speed up the development

process.

React Native has a large and active community of developers, and many third-partylibraries and plugins are available to extend its functionality It's also backed byFacebook, which provides regular updates and improvements to the framework

React Native is a robust, flexible framework that allows developers to build performance, native mobile applications using JavaScript and React Its ability toprovide a native-like experience and its large and active community make it a popular

high-choice for building mobile applications

19

Trang 29

2.7.1 Advantages

React Native, a cross-platform mobile application development framework offersmany notable advantages Here are some advantages of React Native:

e Use once, deploy on multiple platforms: One of the essential advantages

of React Native is code reusability Programmers only need to write codeonce and then can deploy the app on both iOS and Android platforms.This saves development time and effort, reduces complexity, andensures app consistency across different platforms

e Almost the same performance as a native app: React Native uses the

primary user interface components of the operating system, helping to

achieve almost the same performance as native app UI components arerendered directly into native components, which speeds up the renderingand responsiveness of the app

e Use JavaScript: React Native uses the JavaScript programming

language, a popular and flexible programming language This is

convenient for many programmers who already have some knowledge

of JavaScript and helps streamline the learning and application

development process

e Extensive community and good support: React Native has a large

community, and the community provides a lot of documentation,tutorials, and open-source libraries This makes it easy for developers tofind solutions and support during application development

e Hot-reloading and live-reloading: React Native supports hot-reloading

and live-reloading, allowing developers to make changes in the code andsee immediate results in the application without starting up again Thissaves time during application development and testing

20

Trang 30

e Easy integration with external libraries and modules: React Native

allows developers to easily integrate external libraries and modules

thanks to community support and compatibility with protocols like

Native Modules and Native UI Components

2.7.2 Disadvantages

While React Native has many advantages, some disadvantages should be noted:

e Third-party libraries: React Native relies heavily on third-party libraries

to access native platform features, which can lead to compatibility issues

and dependency management challenges

e Performance: Although React Native has significantly improved

performance compared to previous versions, performance issues can still

be encountered when dealing with applications with complex interfaces

or requirements for extensive data management Interface componentsrendered via a bridge can cause latency and degrade the application'soverall performance

e Limitations of external modules: Although React Native can integrate

external libraries and modules, not all modules are fully compatible withReact Native This can make finding and using the correct librarieschallenging, especially for special features and application-specificrequirements

e Development time: Although using React Native saves time compared

to developing separately for different platforms, some aspects of platform mobile app development can take much time This includeshandling compatibility issues, optimizing performance, and testingdifferent platforms

cross-e Uscross-er intcross-erfaccross-e limitations: Although Rcross-eact Nativcross-e providcross-es somcross-e

essential interface components, it is impossible to directly access all of

21

Trang 31

the operating system's native interface elements This means it can bechallenging to create complex interfaces and customize some of theunique features of each platform.

e Dependency on Bridge: React Native uses a bridge to communicate

between JavaScript code and native components, which can create alayer of abstraction and increase latency in the communication process

This can affect the performance and user experience of the application.

2.8 Firebase Database

Firebase Database [12] is a cloud-based NoSQL database provided by Google as part

of the Firebase platform It is designed to provide a scalable and secure infrastructure for managing data for web and mobile applications Firebase Database uses a

document-centric data model, storing data as JSON objects, making it easy fordevelopers to store and retrieve data without worrying about complex SQL queries or

data normalization Firebase Database provides real-time updates to clients, making it ideal for building applications that require real-time data synchronization [12] Figure 2.5 describes the ability to synchronize data in real time of Firebase Realtime

Database

22

Trang 32

Firebase Realtime Database is a specific type of database offered by Firebase thatprovides real-time data synchronization and offline support It is built on the FirebaseDatabase infrastructure and uses the same document-centric data model as FirebaseDatabase Firebase Realtime Database provides a flexible, hierarchical data model thatallows developers to store and retrieve data efficiently It also offers real-time updates

to clients, enabling developers to build real-time collaborative applications, chatapplications, and other applications that require real-time data synchronization.Firebase Realtime Database includes built-in security features, such as FirebaseAuthentication and Firebase Security Rules, providing a secure infrastructure for

managing real-time data

2.8.1 Advantages

Firebase has many advantages that make it a popular choice for app development:

e Development time: Although using React Native saves time compared

to developing separately for different platforms, some aspects of platform mobile app development can take much time This includeshandling compatibility issues, optimizing performance, and testingdifferent platforms

cross-e Eascross-e of uscross-e: Fircross-ebascross-e providcross-es a simplcross-e intcross-erfaccross-e that makcross-es it quick for

new users and developers to get started without in-depth knowledge ofthe cloud infrastructure

e Good integration: Firebase integrates well with many development

platforms and technologies, including React Native, Android, 10S, Web,

and other programming languages This simplifies cross-platformdevelopment and integrates Firebase features into apps

e Realtime data updates: Firebase supports live and instant data updates

across devices and servers through services like Realtime Database and

23

Trang 33

resources and expanding databases is easy and automated with Firebase.

Security: Firebase provides tools and security features to protect data andusers It supports user authentication, access management, and data

encryption during transmission and storage

DisadvantagesHowever, Firebase also has some disadvantages:

The free version has limited features: Firebase offers a free plan withlimited resources and scalability As the application grows and scales,upgrading to a paid plan may be necessary to meet the application's

requirements

Reliance on Google services: Firebase is developed and managed by

Google, which can create a dependency on the company and can befrustrating if there are changes or restrictions on Google's part

Restrict access to infrastructure: Firebase provides cloud computingservices that do not allow access to lower-level infrastructure, such as a

physical server This may limit specific customizations and controls

24

Trang 34

Chapter 3 PROPOSAL SOLUTION

3.1 System overview

The system consists of six main components: hardware device, gateway, TTN server,NodeJS server, Firebase Realtime Database and mobile application Figure 3.1 is thefunctional block diagram of the system

Start

Get GPS information from GPS module

The NodeJS server gets

the information sent by

the Gateway to the

\ TIN server

Valid longitude and latitude

Figure 3.1 Functional block diagram of the system

e Hardware device: The team designed a device to send data about location

information and signal strength to the gateway This device is responsible for

collecting measurement data and sending them to the gateway for forwarding

onto TIN

25

Trang 35

e Gateway: Gateway is a station that receives information from devices and

forwards it to TTN Server Gateway ensures the connection and data

transmission between the device and the system

e TTN server: TTN server receives data from the gateway and performs

necessary processing before data is collected by the NodeJS server

e NodeJS server: Server is designed by the team to get information from TTN

Server, then store it in Firebase Realtime Database NodeJS server ensureseasy and efficient data synchronization and storage

e Firebase Realtime Database: The application uses this real time database to

store information Data is fetched by NodeJS server from TTN server andstored on Firebase Realtime Database This ensures that the data is always up

to date and available for display on the mobile app

e Mobile Application: Finally, the mobile application will pull the information

from the Firebase Realtime Database and display it on the user interface Themobile application allows users to view location and signal strengthinformation on a heatmap and manage personal and account information

Figure 3.2 is an overview diagram of the system

Trang 36

3.2 Hardware design

3.2.1 RAK3172 module

RAK3172 [13] is a low-power, long-range transceiver module for LoRa and

LoRaWAN applications based on the STM32WLESCC chip Its firmware is based

on RAKwireless Unified Interface V3 (RUI3), which allows you to create differentfunctionalities using RUI APIs It provides an easy-to-use, small-size, low-powersolution for long-range wireless data applications This module complies with Class

A, B, & C of LoRaWAN 1.0.3 specifications It can easily connect to LoRaWANserver platforms like TTN , Chirpstack, Helium, etc It also supports LoRa Point-to-Point (P2P) communication mode, which helps you implement your customized long-range LoRa network quickly

It can work as a stand-alone device by creating custom firmware via RUI3 APIs orcan be deployed as a LoRa modem with an external host like a microcontroller ormicroprocessor that configures and sends commands to the module using AT and

Binary commands via a UART interface

Product Features:

e LoRa module for Smart City, Smart Agriculture, Smart Industry

e Compact Form Factor: 15 x 15.5 x 3.5 mm 32 Pin Stamp Pad for PCB SMT

mounting I/O ports: UART/I2C/SPI/ADC/GPIO

e Temperature range: -40 °C to +85 °C

e Supply voltage: 2.0 ~ 3.6 V

e Frequency range: 150 MHz to 960 MHz

e Low-Power Wireless Systems with 7.8 kHz to 500 kHz Bandwidth

e Ultra-Low Power Consumption 1.69 A in sleep mode

e Core: ARM 32-bit Cortex—M4 with MPU Up to 256 KB flash memory with

ECC

e 64KB RAM

27

Ngày đăng: 02/10/2024, 03:54

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w