0% found this document useful (0 votes)
38 views

Output 5

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Output 5

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY


FACULTY OF COMPUTER SCIENCE AND ENGINEERING

REPORT
COMPUTER ENGINEERING PROJECT

Development of a wireless sensor network


for agricultural systems

Major: COMPUTER ENGINEERING

THESIS COMMITTEE: CE-CC


SUPERVISOR: Dr. Le Trong Nhan
SECRETARY: MSc. Huynh Hoang Kha
REVIEWER: MSc. Nguyen Cao Tri
—o0o—
STUDENT 1: Nguyen Thai Thanh Binh 1952584
STUDENT 2: Le Gia Huy 1952717
STUDENT 3: Le Thanh Tuan 1852835

HO CHI MINH CITY, JANUARY 2024


DECLARATION OF AUTHORSHIP

We, the members of the implementation group, under the guidance of Dr.Le Trong
Nhan, hereby declare that:

• The Computer Engineering Project is a serious and honest scientific research work
of our team.

• All content presented in this Computer Engineering Project is our own work, except
for the parts stated in the footnotes, clearly citing sources in the reference section.

We take full responsibility if there is any fraud in the content of the group’s Project.

Implementation group
Nguyen Thai Thanh Binh
Le Gia Huy
Le Thanh Tuan
ACKNOWLEDGEMENT

Under the scientific direction of Dr. Le Trong Nhan of the Faculty of Computer Science
and Engineering, University of Science and Technology - Vietnam National University, Ho
Chi Minh City, the computer engineering-focused project was finished. The implementa-
tion team would like to express their profound gratitude to Dr. Le Trong Nhan for his
professional assistance, discussions, recommendations, and creation of favorable conditions
that allowed us to finish the project.
We also want to express our gratitude to the reviewers, who reviewed our work and
offered suggestions that enabled us to finish this specific project.
The implementation team would also like to express their deep gratitude to the teach-
ers of the Department of Computer Science and Engineering, University of Science and
Technology - Vietnam National University, Ho Chi Minh City, who have imparted spe-
cialized knowledge subject, has created conditions for us to study and develop during the
past time.
We wish all teachers good health, success and continued training of new generations
of students in the future.
We sincerely thank you.

Implementation group
Nguyen Thai Thanh Binh
Le Gia Huy
Le Thanh Tuan
ABSTRACT

A new era of precision agriculture has been ushered in by the merging of traditional
farming methods with technology in the modern agricultural environment. Among the
most significant developments in this field is the creation of Wireless Sensor Networks
(WSNs) specifically designed for agricultural applications. This innovative technology has
the potential to completely transform agricultural practices, maximize resource efficiency,
and reduce environmental impact.
This project at the nexus of technology and agriculture has the potential to completely
transform farming in the future and bring in a new age where efficiency and precision work
together to fulfill the demands of a growing global population.
In the current agricultural system architecture, the irrigation control system has been
implemented with the CM4 embedded computer. The system needs further develop-
ment to integrate sensors to measure information about the growing environment, related
to the soil and surrounding air environment. To be able to deploy a sensor measurement
system, it needs to be optimized in terms of connectivity. In this project, each sensor node
will act as a child node of the central control cabinet, and communicate wirelessly with
the central control cabinet. Sensor data will be synchronized and displayed in the central
cabinet (also known as IoT Gateway). This data will then be sent to the cloud for remote
monitoring.
Throughout phase 1, the goals set for the Computer Engineering project have
been mostly completed. The basic knowledge and system have initially been built on the
operating machine cluster.
In phase 2 - Capstone project, we will integrate the system and synchronize data
with the central cabinet. Some smart features related to data monitoring or sensor main-
tenance warnings can be proposed and integrated in the system. Then, apply the practical
problem with the data set from the server and test and evaluate the practicality of the
solution.
Contents
INTRODUCTION 0
1.1 Rationale of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0
1.1.1 Effects of Agriculture on the Industrial Revolution . . . . . . . . . 0
1.1.2 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.3 Internet of Things (IoT) . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.4 MQTTBroker in Agriculture: Facilitating Intelligent Communication 3
1.2 Objectives of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 Clarifying basic knowledge and some technologies . . . . . . . . . . 4
1.2.2 Implementing the satellite station system . . . . . . . . . . . . . . . 4
1.2.3 Evaluate and test system performance . . . . . . . . . . . . . . . . 5
1.3 Scope of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Structure of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

LITERATURE REVIEW 8
2.1 Overview of Agricultural System . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1 Agricultural System Definition . . . . . . . . . . . . . . . . . . . . . 8
2.1.2 Smart Agricultural Systems: Components and their roles . . . . . . 9
2.2 Overview of Wired Sensor Networks . . . . . . . . . . . . . . . . . . . . . . 10
2.2.1 Definition of Wired Sensor Networks . . . . . . . . . . . . . . . . . 10
2.2.2 Advantages and Disadvantages of Wired Sensor Networks . . . . . . 10
2.2.3 Application of Wired Sensor Networks . . . . . . . . . . . . . . . . 11
2.2.4 Wired Sensor Networks protocol . . . . . . . . . . . . . . . . . . . . 13
2.3 Overview of Wireless Sensor Networks . . . . . . . . . . . . . . . . . . . . 14
2.3.1 Definition of Wireless Sensor Networks . . . . . . . . . . . . . . . . 14
2.3.2 Advantages and Disadvantages of Wireless Sensor Networks . . . . 16
2.3.3 Application of Wireless Sensor Networks . . . . . . . . . . . . . . . 17
2.3.4 Wireless Sensor Networks Protocol . . . . . . . . . . . . . . . . . . 19
2.4 ESP-NOW: The optimal choice for smart agriculture systems . . . . . . . . 21
2.4.1 ESP-NOW: Definition . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.4.2 ESP-NOW: Data Frame Format . . . . . . . . . . . . . . . . . . . . 22
2.4.3 The reasons why ESP-NOW is the best choice for this project . . . 25

SYSTEM ARCHITECTURE AND IMPLEMENTATION 27


3.1 System Architecture Overview . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.2 Sensor Node module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2.1 Sensor Nodes Architecture Overview . . . . . . . . . . . . . . . . . 31
3.2.2 Hardware components . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2.2.1 Power Unit . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2.2.2 Sensing Unit . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2.2.3 Processing Unit and Communication Unit . . . . . . . . . 37
3.2.3 Software development . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.2.3.1 Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.2.3.2 C/C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2.3.3 RS-485 protocol . . . . . . . . . . . . . . . . . . . . . . . 40
3.2.4 Sensor Node Flow Diagram . . . . . . . . . . . . . . . . . . . . . . 40
3.3 Communication Network module . . . . . . . . . . . . . . . . . . . . . . . 42
3.3.1 Communication between Sensor Stations and Gateway . . . . . . . 42
3.3.2 Communication between Gateway and Server . . . . . . . . . . . . 43
3.4 IoT Gateway module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.5 Data storage module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.5.1 Supabase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.5.2 Data relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.6 Application module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.1 Software development . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.1.1 Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.6.1.2 Tkinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.6.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

EXPERIMENTAL RESULT AND EVALUATION 57


4.1 Response time and packet loss analysis for 5m distance . . . . . . . . . . . 57
4.2 Response time and packet loss analysis for 170m distance . . . . . . . . . . 58
4.3 Response time and packet loss analysis for 200m distance . . . . . . . . . . 59

CONCLUSION AND FUTURE WORK 61


5.1 Procedure Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.2 Future Tasks for the Capstone Project . . . . . . . . . . . . . . . . . . . . 62

REFERENCES 64
List of Figures
1 Map of Agritech Technologies. . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Wired Sensor Networks Applications in Environment, Entertainment, In-
dustrial and Agriculture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3 Wireless Sensor Networks including 3 main module: Sensor Node, Base
Station (also known as IoT Gateway) and Communication module. . . . . 14
4 WSNs applications in Environment, Healthcare, Industrial and Agriculture 17
5 ESP-NOW: Data transmission without a central hub . . . . . . . . . . . . 22
6 OSI model: A standard framework for data communication . . . . . . . . . 23
7 The advantages of ESP-NOW over the OSI model . . . . . . . . . . . . . . 24
8 System architecture with five interchangeable parts. . . . . . . . . . . . . . 28
9 System implementation including Sensor Nodes, IoT Gateway and Server. . 30
10 Sensor Node Architecture including 4 main unit:Power unit, Sensing unit,
Processing unit and Communication unit . . . . . . . . . . . . . . . . . . . 31
11 Soil Sensor Device is capable of reading 7 parameters: Temperature, Hu-
midity, Electrical conductivity, pH, Nitrogen, Phosphorus, Potassium . . . 33
12 Air Sensor Device is capable of reading 7 parameters: Temperature, Hu-
midity, Noise, PM2.5, PM10, Atmospheric pressure and Luminosity . . . . 35
13 Water Sensor Device is capable of reading 5 parameters: Temperature, PH,
Electrical conductivity, ORP (Oxygen Reduction Potential) and Salinity . 36
14 M5 Atom Lite Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
15 M5 Atom Lite Schematic Diagram . . . . . . . . . . . . . . . . . . . . . . . 37
16 M5 Atom Lite PinMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
17 ATOMIC RS485 Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
18 ATOM RS485 Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
19 Flow-chart of Sensor Node . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
20 Gateway-server Communication . . . . . . . . . . . . . . . . . . . . . . . . 43
21 MQTT Broker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
22 Nestjs Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
23 The Raspberry Pi Compute Module 4 . . . . . . . . . . . . . . . . . . . . . 46
24 The implementation of IoT Gatway . . . . . . . . . . . . . . . . . . . . . . 47
25 Firebase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
26 MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
27 DynamoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
28 Supabase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
29 Data relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
30 Nodes table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
31 Sensors table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
32 Sensors output table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
33 Some applications for the python programming language. . . . . . . . . . . 53
34 The Implementation of IoT Gateway to Application. . . . . . . . . . . . . 54
35 Display air sensors node and chart for data retrieval. . . . . . . . . . . . . 56
36 Response time distribution from IoT Gateway to Sensor Node at a distance
of 5m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
37 Pareto Chart of time response from IoT Gateway to Sensor Node at a
distance of 5m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
38 Response time distribution from IoT Gateway to Sensor Node at a distance
of 170m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
39 Pareto Chart of time response from IoT Gateway to Sensor Node at a
distance of 170m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
40 Response time distribution from IoT Gateway to Sensor Node at a distance
of 200m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
41 Pareto Chart of time response from IoT Gateway to Sensor Node at a
distance of 200m. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
List of Tables
1 Comparison of Sensor Node and Actuator Node . . . . . . . . . . . . . . . 15
2 Comparison of Wireless Sensor Network Protocols: Zigbee, LoRaWAN,
BLE, Wi-Fi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3 Communication Basic Parameters . . . . . . . . . . . . . . . . . . . . . . . 33
4 Register address for soil parameters . . . . . . . . . . . . . . . . . . . . . . 34
5 Register address for air parameters . . . . . . . . . . . . . . . . . . . . . . 35
6 Register address for water parameters . . . . . . . . . . . . . . . . . . . . . 36
List of abbreviations

IoT Internet of Things


WSNs Wireless Sensor Networks
SPI Serial Peripheral Interface
I2C Inter-Integrated Circuit
UART Universal Asynchronous Receiver-Transmitter
BLE Bluetooth Low Energy
SNs Sensor Nodes
ANs Actuator Nodes
M2M Machine-to-Machine
P2P Peer-to-Peer
OSI Open Systems Interconnection
DB Database
GUI Graphical User Interface
CM4 Compute Module 4
MQTT Message Queuing Telemetry Transport
JWT JSON Web Token
API Application Programming Interface
OOP Object-Oriented Programming
GPIO General Purpose Input/Output
ORP Oxygen Reduction Potential
RTU Remote Terminal Unit
PV Photovoltaic
DC Direct Current
BLE Bluetooth Low Energy
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

CHAPTER 1

INTRODUCTION

The content of chapter 1 briefly presents the topic, the current context and clarifies
the reason the topic was chosen. From there, determine the goals to be achieved when
implementing and the scope of the project.

1.1 Rationale of the Study

1.1.1 Effects of Agriculture on the Industrial Revolution

A succession of industrial revolutions have had a significant impact on the development


of agriculture, each bringing about a fundamental change in the methods by which we grow
and manufacture food. The transition from Agriculture 1.0 to Agriculture 5.0 has brought
about revolutionary developments with important ramifications for global food systems,
from the automation of labor in the 18th century to the incorporation of cutting-edge
technology in the 21st.

• Agriculture 1.0: The Mechanization Era:


With the introduction of machinery in the late 1700s, agriculture underwent its first
industrial revolution, also known as Agriculture 1.0. Crop cultivation became more
efficient as manual labor was replaced by steam engines and mechanized implements.
The basis for higher agricultural output was built during this age, which was marked
by a lack of technical innovation and a dependence on simple gear.

• Agriculture 2.0: The Green Revolution:


The Green Revolution, often referred to as Agriculture 2.0, began to take shape
in the middle of the 20th century. High-yielding crop types, artificial fertilizers,
and pesticides were widely used during this time. Global food production increased
dramatically as a result of the Green Revolution, reducing hunger and promoting
economic expansion. But there were also worries raised regarding the usage of agro-
chemicals and environmental sustainability.

• Agriculture 3.0: The Precision Agriculture Era:


The late 20th century saw the integration of information technology, ushering in

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 0/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

the age of Precision Agriculture, or Agriculture 3.0. The use of sensors, GPS, and
data analytics became crucial for enhancing farm management techniques and max-
imizing resource use. This stage attempted to reduce the negative effects on the
environment, increase crop productivity, and bring data-driven decision-making to
the agricultural industry.

• Agriculture 4.0: The Rise of Smart Farming:


Agriculture 4.0, also known as Smart Farming, brought in a new age in the 21st cen-
tury by combining robots, artificial intelligence, and the Internet of Things (IoT).
This stage makes accurate data analytics, task automation, and real-time moni-
toring possible. Smart farming improves production forecast, increases agricultural
operations’ efficiency, and supports sustainable farming methods.

• Agriculture 5.0: Towards a Holistic Ecosystem:


At the nexus of Agriculture 5.0, the emphasis is on developing an integrated agri-
cultural ecosystem. This stage imagines a networked system in which cutting edge
technologies, environmentally friendly methods, and a wide range of stakeholders
work together harmoniously. Agriculture 5.0 seeks to use inclusive, resilient, and
adaptable methods to address global issues including food security, resource scarcity,
and climate change.

Additionally, the word "Agricultural technology" (agritech) appears in Agriculture 5.0. It


uses robotics, artificial intelligence (AI), and the Internet of Things (IoT) to increase the
efficiency of food production. In this project, we demonstrate how to set up an information
network and agricultural cabinet that are utilized in a complete ecosystem setting.

1.1.2 Problem Statement

The World Government Summit in their report entitled "Agriculture 4.0 – The future
of farming technology" looks at three main trends that define agritech: new techniques,
increasing efficiencies and the use of cross-industry technologies.
Out of the different pillars, Tech is perhaps the easiest to grasp and in many ways is
the primary element that enables the newer techniques and helps farms develop efficien-
cies. From the technologies: Internet of Things and Data Analytics are two of the most
established.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 1/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 1 – Map of Agritech Technologies.

1.1.3 Internet of Things (IoT)

A new age of efficiency and connection has been brought about by the Internet of
Things (IoT) across a number of industries, with agriculture being one of the more no-
table ones. Applications for the Internet of Things (IoT), a network of linked sensors and
gadgets that exchange data and interact online, are particularly interesting for the agri-
culture industry. The incorporation of IoT technology into farming methods is converting
conventional agriculture into an intelligent and data-driven field, providing a number of
advantages that tackle the intricacies of contemporary agricultural problems.
Benefits of IoT application in agriculture

• Precision Farming

• Resource Optimization

• Crop Monitoring and Management

• Livestock Management

• Weather Monitoring

• Supply Chain Efficiency

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 2/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Data-Driven Decision-Making

Due of the many benefits of IoT technology, the majority of individuals in the 5.0 Indus-
trial Revolition utilize it for agriculture.

1.1.4 MQTTBroker in Agriculture: Facilitating Intelligent Communication

Strong communication infrastructure is essential in the quickly developing field of


smart agriculture, where data-driven decision-making and real-time monitoring are crit-
ical. Message Queuing Telemetry Transport, or MQTT, has become a robust protocol
for dependable and effective device-to-device communication. The MQTT broker is the
central component of this communication architecture. The MQTTBroker for server turns
becomes a crucial facilitator in the area of agriculture, enabling smooth communication
between various agricultural systems and equipment.
The combination of IoT devices, sensors, and precision farming technology has brought
about a paradigm change in agricultural operations. To fully utilize these technologies, a
scalable, durable, and low-latency communication infrastructure is required. Because of its
publish-subscribe paradigm and lightweight design, MQTT has emerged as the preferred
communication protocol, and its broker, the MQTT broker, is essential to maintaining an
effective information flow.
MQTTBroker is a key component of the communication infrastructure that enables
accuracy, scalability, and dependability as smart agriculture develops. Its capacity to
enable smooth data transfer between various farming equipment puts it in a key role
in the digital farming practices revolution, promoting a more networked and intelligent
farming environment.
We will utilize MQTT Broker for data storage and integrate it into the database server
portion of our project due to its numerous advantages.

1.2 Objectives of the Study


By analyzing and clarifying the advantages and disadvantages of applying IoT tech-
nology and its application in practice, the topic aims at four main goals:

• First, clarify the basic knowledge and some technologies about Internet of Thing ap-
plications in agriculture, read information from sensors and wireless communication
protocols.

• Second, Implementing a satellite station system for agriculture to integrate sensors


to measure information about the growing environment, related to the soil and
surrounding air environment. Additionally, we consider building a server if necessary.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 3/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Third, clarify the synchronization of sensor data with the IoT Gateway and auto-
matically identify wireless sensor devices

• Forth, evaluate and test system performance based on proposed scenarios.

During the Computer Engineering Project phase, the team works towards the first two of
the presented goals. The remaining two goals will be realized during the Capstone Project
phase.

1.2.1 Clarifying basic knowledge and some technologies

To be able to design and deploy a satellite station system, the topic requires basic
knowledge around the core of the intended architecture such as:

• Knowledge of how to process data sent from sensors.

• Knowledge about energy to maintain the system.

• Knowledge about wireless signal transmission.

• Knowledge about saving and retrieving data from the server.

• Knowledge about python’s tkinter library.

1.2.2 Implementing the satellite station system

This article will offer a method to IoT technology that simplifies the architecture for
gathering and organizing data over a vast region of land, both to install and use:

• Concerning data gathering and sensor cabinet construction:

– Construct systems to gather information from several sensor cabinets.


– Construct a storage system, the server is in place.

• Concerning problems with electricity and connectivity:

– Construct an easily navigable solar-powered system.


– Supports wireless, Internet, and local network connections, among the three
connection options.
– Utilize wireless sensor technologies to communicate data between cabinets and
the satellite station.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 4/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

1.2.3 Evaluate and test system performance

In order to fully assess the satellite station system’s performance, scenarios based on
each step must be planned:

• Test the accuracy of each sensor value in relation to reality.

• Test the connectivity between the three connection kinds.

• Test the solar panels’ capacity to store energy and their running duration.

• Test the signal transmission between the sensor cabinets and the IoT Gateway.

• Test the architecture as a whole.

The scenarios will mostly center on obstacles to external influences, such as:

• Lack of sunshine.

• Capability to retain data across sensor cabinets in the event of a loss of connection
to the IoT Gateway.

• The server is receiving a large volume of data at a fast rate that is continuous and
parallel to demand. Analysis of users in real time.

• Test the system’s capacity to handle a huge amount of data transmitted to the
server by increasing the number of sensor cabinets for big tracts of land..

1.3 Scope of the Study


Regarding the general goal, the project aims to design and apply IoT technology and
wireless networks to solve the problem of organizing and distributing small agricultural
cabinets in a large area of agricultural land.
Regarding expected results, the project will provide a system with an interface for users
to interact and carry out business processes related to checking environmental factors,
thereby making judgments about farmland. agricultural work.
Regarding time, the project includes two main stages:

• The Computer Engineering Project phase lasts for 15 weeks.

• The Capstone Project phase lasts 15 weeks.

Regarding the target field, the topic focuses on researching and solving problems related
to wireless transmission, when the Internet is lost or there are problems related to energy.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 5/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

1.4 Structure of the Study


The specialized project will include five (5) chapters, including this chapter. The con-
tent of each chapter is as follows:

• Chapter 1: Introduction.
Briefly present the context, challenges and practical problems, and provide goals
and scope of solution

• Chapter 2: Literature Review.


This chapter covers the basic theoretical knowledge and principles that need to be
ensured when implementing and comparing and selecting the technology to use.

• Chapter 3: System Architecture.


Based on the problem requirements, the main components will be divided, imple-
menting sensor cabinets and servers to store data. The application on the cabinet is
designed to display data from the sensor cabinets. Component blocks will be tested
for performance and processing capabilities separately.

• Chapter 4: Test Evaluation.


Conduct testing of the data processing ability of the built sensor cabinet based on
the proposed scenarios and provide analysis and evaluation.

• Chapter 5: Conclusion.
Present system assessments and determine plans for the Capstone Project phase.

1.5 Conclusion
As a result, enterprises are struggling to simultaneously address the demands for data
storage and connection distance. This issue can be resolved with servers and wireless con-
nections thanks to modern technologies. Nevertheless, there will be several issues with
infrastructure, data synchronization, energy consumption, and operations when two sys-
tems run simultaneously. On the other hand, if there is a problem, it will be hard to
transfer data to the server due to the weakness in each architecture’s power and connec-
tion. As a result, incorporating a local wireless sensor into the circuit that receives data
from the sensor and utilizing mutual connection without a network’s assistance is a crucial
component, appropriate for the given issue.
Extending the architecture to handle the requirement for system integration over a
sizable amount of land for agriculture is one of the project’s primary objectives. The
topic’s focus is on problems with sensors and wireless networks, as well as data that is
uploaded to the server and can react to power or network disruptions.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 6/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Prior to developing a solution, it is essential to gather background information and


select the right technology. The chapter 2 on Literature Review will touch on these
topics.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 7/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

CHAPTER 2

LITERATURE REVIEW

The ideas and theoretical underpinnings of data retrieval, tasks, and generic struc-
tures and designs are covered in Chapter 2. Subsequently, examine workable technical
alternatives to select workable approaches for sensor cabinet and satellite cabinet design
in agricultural.

2.1 Overview of Agricultural System

2.1.1 Agricultural System Definition

Agricultural systems can be described in many ways. Over the years, researchers and
farmers have used a variety of terms, such as farming system, cropping system, organic,
and ecological, to identify agricultural systems based on specific characteristics or defini-
tions. However, in general, an agricultural system is an assemblage of components united
by interaction and interdependence, operating within a prescribed boundary to achieve a
specified agricultural objective on behalf of the beneficiaries of the system. Agricultural
systems face several challenges, including the need for energy-efficient hardware and soft-
ware protocols, robust security and privacy measures, and the ability to scale the network
to accommodate a large number of nodes.

• Requirement for energy-efficient hardware and software protocols: Agri-


cultural systems are often deployed in rural areas, where electricity is unstable and
expensive. Therefore, the components of agricultural systems need to be designed to
consume low power. In addition, software protocols need to be optimized to reduce
the amount of data transmitted, as well as the time required to process data.

• Implementation of robust security and privacy measures: Agricultural sys-


tems often collect sensitive data, such as information about the health of crops,
weather, and the operation of agricultural equipment. Therefore, strong security
measures are needed to protect this data from unauthorized access. In addition,
privacy measures are needed to ensure that farmers’ data is used safely and respon-
sibly.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 8/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Ensuring scalability of the network to support a vast number of nodes:


Agricultural systems are often deployed over a wide area, including multiple farming
regions. Therefore, solutions are needed to scale the network, allowing the system
to connect to more nodes.

2.1.2 Smart Agricultural Systems: Components and their roles

Smart farming, also known as precision agriculture, is a modern approach to farming


that integrates advanced technologies such as the Internet of Things (IoT), sensors, posi-
tioning systems, robots, and artificial intelligence into farming practices. These technolo-
gies enable the collection and transmission of data about soil, air, and other important
factors on farms, allowing for remote monitoring and strategic decision-making. Smart
farming aims to increase crop quality and yield while optimizing human labor through
processes such as precision irrigation, greenhouse climate management, and data analytics.
The system consists of four main systems, including the sensor system, the control
system, the automation system, and the information system.

• Control system: manage sensor input, delivering remote information for supply
and decision support, in addition to the automation of machines and equipment for
various agricultural tasks.

• Automation system: are responsible for the remote activation of multiple pro-
cesses simultaneously, enhancing product quality and volume by better controlling
production processes.

• Information system: such as software platforms and data analytics tools, help
farmers make data-driven decisions based on the collected data from sensors and
other sources.

• Sensor system: collect valuable data on factors such as soil moisture, tempera-
ture, light, and humidity, helping farmers make informed decisions about irrigation,
fertilization, and crop rotation. Sensor systems today are implemented in two main
types: Wired Sensor Networks and Wireless Sensor Networks.

These components work together to create a more efficient, sustainable, and productive
agricultural environment. By collecting and analyzing data from various sensors, farmers
can make data-driven decisions to optimize crop growth, reduce resource consumption,
and minimize environmental impacts.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 9/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

2.2 Overview of Wired Sensor Networks

2.2.1 Definition of Wired Sensor Networks

Wired Sensor Networks are a type of sensor network in which individual sensors are
physically connected to each other and to a central control system via cables, wires, or
other fixed communication channels. These sensors are often used in new construction or
renovation projects where infrastructure is already available. They provide a stable and
reliable connection, ensuring continuous data transmission without interference, signal
loss, or interruptions. Wired sensors can transmit large amounts of data over a wired
network, providing high data transfer speeds and a source of real-time analysis data
with low latency. They are suitable for organizations with fixed locations or large-scale
operations that require large amounts of data. Wired sensors are known for their accurate
and reliable data transmission, making them ideal for applications where data security
and reliability are top priorities.

2.2.2 Advantages and Disadvantages of Wired Sensor Networks

Advantages of Wired Sensor Networks

• Stable and reliable connection: Wired sensors provide a stable and reliable
connection, ensuring consistent data transmission without interference, signal loss,
or interruption

• Accurate data transmission: Wired sensors provide precise and accurate data
transmission because they are not subject to weather conditions or physical obstruc-
tions

• Lower maintenance costs: Wired sensors are generally less expensive to maintain
over the long term compared to wireless sensors because they do not require batteries
or frequent updates

• No limitation on distance: Wired sensors do not have limitations on distance,


unlike wireless sensors

• Lower cost installation: There is an extra cost associated with a wireless sensor
installation, while wired sensors have a lower cost of installation

Disadvantages of Wired Sensor Networks

• Cost ineffective for short lease terms: Wired installations can sometimes
require infrastructure changes and may not make sense for short lease terms

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 10/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Complex installation: Wired systems require a large amount of space and are
much more complicated to install compared to wireless systems

• Limited flexibility: Wired systems are less flexible and scalable compared to wire-
less systems

• Higher installation costs: Wired sensor systems require drilling, wiring, and
structural building changes, leading to higher installation costs

• Security concerns: Wired sensors can be more vulnerable to physical tampering


and damage compared to wireless sensors

2.2.3 Application of Wired Sensor Networks

Wired sensor networks are a type of network employing physical cables for linking
sensors to a central control system. This type of network is often used in applications
where security, reliability, and data integrity are critical.

Figure 2 – Wired Sensor Networks Applications in Environment, Entertainment, Industrial and


Agriculture

• Environment: Wired sensor networks are applied in environmental monitoring


systems, offering several advantages in this context. Some of the key applications
and advantages of wired sensor networks in the environment include:

– Air quality monitoring: Wired sensor network can be used to monitor air
pollutants such as particulate matter, ozone, and emissions from vehicles. This

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 11/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

data can be used to alert the public to air pollution and help policymakers
make decisions about air quality.
– Water quality monitoring: Wired sensor network can be used to monitor
water quality in lakes, rivers, and streams. This data can be used to detect
pollution and help protect water resources.
– Wildlife monitoring: Wired sensor network can be used to monitor wildlife
populations in the wild. This data can be used to study species and help con-
serve the environment.

• Entertainment: Wired sensor networks can also be applied in the entertainment


industry, particularly in the following areas:

– Theme Parks: Wired sensor networks can be used in theme parks to monitor
and control various aspects of the park, such as ride safety, lighting, and sound.
– Audio and Video Production: Wired sensor networks can be used in audio
and video production to monitor and control various aspects of the production
process, such as lighting, sound, and camera angles.
– Gaming: Wired sensor networks can be used in gaming to monitor and control
various aspects of the gaming experience, such as lighting, sound, and player
feedback.

• Agriculture: Wired sensor networks have several applications in agriculture:

– Precision Agriculture: Wired sensor networks can be used in precision


agriculture to monitor soil moisture, temperature, and other properties, help-
ing farmers make informed decisions about irrigation, fertilization, and crop
rotation.
– Greenhouse Monitoring: Wired sensor networks can be used in greenhouse
monitoring to collect data on various environmental factors, such as tempera-
ture, humidity, and light, ensuring optimal growing conditions for plants.
– Crop Monitoring: Wired sensor networks can be used in crop monitoring to
collect data on various factors, such as growth rate, yield, and quality, enabling
farmers to make informed decisions about harvesting and marketing.

• Industrial: Wired sensor networks have several applications in the industrial sec-
tor, including:

– Quality control: Wired sensor networks can be used to monitor quality pa-
rameters such as temperature, humidity, and pressure. This data can be used
to ensure that products meet quality standards.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 12/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

– Asset management: Wired sensor networks can be used to track the location
and condition of industrial assets such as machinery and equipment. This can
help reduce maintenance and insurance costs.
– Security and safety : Wired sensor networks can be used to detect security
threats such as intrusion, fire, and explosions. This can help protect people and
property.

2.2.4 Wired Sensor Networks protocol

Wired sensor networks are used in various applications, such as industrial automa-
tion, environmental monitoring, and smart agriculture. These networks provide a stable
and reliable connection, ensuring consistent data transmission without interference, sig-
nal loss, or interruption. They offer high data transfer rates, making them suitable for
applications that require real-time data processing or control. Wired sensor networks are
also secure, with encryption protocols that protect data transmission from unauthorized
access. Their simplicity and straightforward implementation make them an attractive op-
tion for many applications, particularly in the fields of automation, control systems, and
consumer electronics
Here are some of the most popular wired communication protocols between sensor
nodes and the base station:

• Serial Peripher Interface (SPI): is a synchronous communication protocol that


uses a single master and multiple slave devices connected through a shared commu-
nication line. The master controls the communication process, sending data to and
receiving data from the slaves. SPI is widely used in various applications, such as
microcontroller communication, digital signal processing, and embedded systems. It
offers advantages like simple and straightforward implementation, low power con-
sumption, and compatibility with various devices. SPI is a versatile and efficient
communication protocol that has become popular in modern applications, particu-
larly in the fields of automation, control systems, and consumer electronics.

• Inter-Integrated Circuit (I2C): is a widely used synchronous serial communi-


cation protocol. It is commonly employed to enable communication between various
digital integrated circuits and microcontrollers. The protocol utilizes a master-slave
architecture, where the master device initiates communication and the slave devices
respond to the master’s commands. I2C is known for its simplicity, efficiency, and
versatility, making it suitable for a diverse range of applications, including sensor
interfacing, data acquisition, and control systems. The protocol’s ability to support
multiple devices on the same bus, along with its relatively low pin count, further
contributes to its widespread adoption in modern electronic systems. Additionally,

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 13/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

I2C’s support for both standard (100 kbit/s) and fast (400 kbit/s) modes, as well
as high-speed modes (3.4 Mbit/s and 5 Mbit/s), enhances its flexibility and appli-
cability in various scenarios.

• Universal Asynchronous Receiver-Transmitter (UART): is a widely used


hardware communication protocol that facilitates asynchronous serial communica-
tion between devices. It is not a communication protocol like SPI and I2C, but
a physical circuit in a microcontroller or other integrated circuit. UART commu-
nication involves two UARTs communicating directly with each other, with the
transmitting UART converting parallel data into serial form and transmitting it to
the receiving UART, which then converts the serial data back into parallel form
for the receiving device. UART communication typically requires only two wires to
transmit data between two UARTs, with the data organized into packets contain-
ing a start bit, 5 to 9 data bits, an optional parity bit, and 1 or 2 stop bits. The
protocol is known for its simplicity, efficiency, and versatility, making it suitable for
a diverse range of applications, including sensor interfacing, data acquisition, and
control systems. UART is widely used in microcontroller chips and is an essential
component of modern electronic systems.

2.3 Overview of Wireless Sensor Networks

2.3.1 Definition of Wireless Sensor Networks

Wireless sensor networks (WSNs) are systems designed to remotely monitor and con-
trol a specific phenomenon or event. They are a network of electronic, digital sensors
known as nodes that use wireless links (radio, infrared, or optical) to collect data from
the surrounding environment and transmit that data to a control center or another sen-
sor node. Sensors in a WSN can measure environmental conditions such as temperature,
humidity, sound, pollution levels, humidity, and wind.

Figure 3 – Wireless Sensor Networks including 3 main module: Sensor Node, Base Station (also
known as IoT Gateway) and Communication module.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 14/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

A wireless sensor network (WSN) comprises nodes, routers, and a gateway that col-
laborate to monitor and control specific phenomena or events in various applications.
Nodes: Sensors are essential devices that measure environmental conditions and trans-
form them into electronic signals. They are crucial for gathering data within the network.

• Sensor nodes (SNs): the primary data-gathering devices in a WSN. They are
equipped with sensors to measure various environmental parameters, such as tem-
perature, humidity, pressure, light intensity, sound levels, and chemical concentra-
tions. The collected data is processed by the SN’s processor and transmitted to other
nodes or the gateway for further analysis and decision-making.

• Actuator nodes (ANs): on the other hand, are responsible for acting upon the
data collected by SNs. They receive control signals from the network and execute
specific actions, such as turning on or off a light, opening or closing a valve, or
triggering an alarm. ANs typically consist of a control unit, an actuator, and a
transceiver. The control unit interprets the received commands and activates the
actuator accordingly.

Sensor nodes (SNs) Actuator nodes (ANs)


Primary function Gather data from the environ- Respond to data and take actions
ment
Key components Sensors, processor, transceiver, Control unit, actuator,
power supply transceiver
Data flow Receives power and control sig- Receives data and control signals;
nals; transmits data performs actions
Application Environmental monitoring, asset Smart buildings, automated sys-
tracking, healthcare monitoring tems, environmental control

Table 1 - Comparison of Sensor Node and Actuator Node

Base Station (IoT Gateway):

• The gateway serves as the crucial link between the WSN’s internal network and the
external world, enabling data exchange and communication with external systems.

• Acting as a data translator, the gateway converts the WSN’s data format into a lan-
guage that external systems can comprehend, facilitating data analysis and decision-
making.

• The gateway acts as a guardian of the WSN, implementing security measures to


protect the network from unauthorized access and ensuring controlled data flow
between the WSN and external systems.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 15/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Communication module:

• Communication modules play a crucial role in establishing and maintaining the


network, ensuring that the network remains functional and efficient.

• Communication modules collect and transmit data collected by the sensor nodes,
ensuring that the data is accurately and efficiently transmitted to the central hub
or other nodes.

• Communication modules execute spectrum sensing, which is the process of detecting


and identifying available wireless signals in the environment.

2.3.2 Advantages and Disadvantages of Wireless Sensor Networks

Advantages of Wireless Sensor Networks (WSN):

• Low Cost: WSNs utilize small, inexpensive sensors that are easy to deploy, making
them a cost-effective solution for various applications.

• Wireless Communication: WSNs eliminate the need for wired connections, re-
ducing installation costs and enabling flexible network deployment and reconfigura-
tion.

• Energy Efficiency: WSNs employ low-power devices and protocols to conserve


energy, ensuring long-term operation without frequent battery replacements.

• Scalability: WSNs can be easily scaled up or down by adding or removing sensors,


making them adaptable to various applications and environments.

• Real-time Monitoring: WSNs facilitate real-time monitoring of physical phe-


nomena in the environment, providing timely information for decision-making and
control.

Disadvantages of Wireless Sensor Networks (WSN):

• Limited Range: The range of wireless communication in WSNs is limited, posing


challenges for large-scale deployments or in environments with obstacles that hinder
radio signals.

• Limited Processing Power: WSNs rely on low-power devices that may have
limited processing power and memory, restricting their ability to perform complex
computations or support advanced applications.

• Data Security: WSNs are susceptible to security threats like eavesdropping, tam-
pering, and denial-of-service attacks, which can compromise data confidentiality,
integrity, and availability.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 16/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Interference: Wireless communication in WSNs can be affected by interference


from other wireless devices or radio signals, potentially degrading data transmission
quality.

• Deployment Challenges: Deploying WSNs can be challenging due to the need for
proper sensor placement, power management, and network configuration, requiring
significant time and resources.

2.3.3 Application of Wireless Sensor Networks

Wireless Sensor Networks (WSNs) have a wide range of applications across various
industries, including industrial, environmental, health, home, agriculture, and more.

Figure 4 – WSNs applications in Environment, Healthcare, Industrial and Agriculture

• Environment: WSNs are well-suited for environmental monitoring applications


due to their ability to collect data from remote and difficult-to-access locations.

– Air quality monitoring: WSNs can be used to measure air pollution levels,
such as particulate matter, ozone, and carbon monoxide, to track air quality
trends and identify areas that need improvement.
– Water quality monitoring: WSNs can be used to measure water quality pa-
rameters, such as the concentration of pollutants, pH, and turbidity, to protect
the environment and ensure safe water for human consumption.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 17/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

– Forest fire detection: WSNs can be used to detect the early signs of for-
est fires, such as changes in temperature, humidity, and air quality, to help
firefighters quickly contain and extinguish fires.

• Healthcare: WSNs are being used in a variety of healthcare applications to improve


patient care and reduce costs.

– Remote patient monitoring: Remote patient monitoring: WSNs can collect


data from patients who are not in the hospital, such as their heart rate, blood
pressure, and blood sugar levels to monitor patient health and identify potential
problems early on.
– Tracking medical equipment: Tracking medical equipment:Wireless sensor
networks (WSNs) have the ability to track the location and status of med-
ical devices in real time, such as pacemakers and ventilators. This can help
prevent accidents and allow healthcare professionals to make more informed,
personalized treatment decisions.
– Physiological data gathering: Wireless sensor networks (WSNs) have the
ability to collect physiological data from patients, such as heart rate, brain
activity, etc. This data allows healthcare professionals to remotely monitor
patients, diagnose diseases early, and develop personalized treatment plans.

• Agriculture: WSNs are being used in agriculture to improve crop yields and reduce
the use of resources.

– Soil condition monitoring: WSNs have the ability to monitor soil indica-
tors such as moisture, pH, and nutrient levels. This allows farmers to have a
more comprehensive overview of their cropland, and subsequently optimize the
amount of resources they need for their cropland.
– Crop growth monitoring: WSNs allow farmers to monitor crop growth,
including height, yield, and disease status. Thanks to WSNs, farmers can detect
crop diseases earlier, which helps to intervene early, thereby reducing losses and
increasing crop yields.
– Weather pattern monitoring: WSNs can monitor weather indicators such
as temperature, humidity, and rainfall, providing farmers with important in-
formation to prepare for and respond to weather events, thereby protecting
crops.

• Industrial: WSNs are being used in industry to improve efficiency, safety, and
productivity.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 18/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

– Industrial automation: Wireless sensor networks (WSNs) can be used to


automate industrial processes, helping to monitor the status of machinery and
production lines, detect faults and repair them in time, and extend the service
life of equipment. WSNs also help to reduce production costs by optimizing
the use of resources such as energy and raw materials, avoiding waste due to
human errors.
– Predictive maintenance: Wireless sensor networks (WSNs) can be used
to monitor the condition of equipment, from which to detect early signs of
abnormalities, such as strong vibrations, high temperatures, or strange noises.
This helps technicians to proactively maintain and replace components before
failures occur, ensuring the continuous operation of machinery.
– Supply chain management: Wireless sensor networks (WSNs) can help to
track the entire journey of goods in the supply chain, from the manufacturer to
the end consumer. For example, WSNs can be used to track the location and
condition of shipping containers, ensuring that goods are transported safely and
on time. They can also be used to monitor the temperature and humidity of
perishable goods, such as food and pharmaceuticals, to ensure product quality.
In doing so, WSNs can help businesses to improve operational efficiency.

2.3.4 Wireless Sensor Networks Protocol

When multiple sensor nodes are deployed in a large area to cooperatively monitor the
environment, wireless communication between sensor nodes and between sensor nodes and
the base station (also known as the gateway) is a matter of concern. The choice of wire-
less communication protocol between sensor nodes and base station also depends on the
needs and factors such as transmission distance, transmission speed, power consumption,
scalability, and cost.
Here are some of the most popular wireless communication protocols between sensor
nodes and the base station:

• Zigbee: is a wireless mesh networking protocol used to connect devices in low-


power machine-to-machine (M2M) networks. It is characterized by its low power
consumption, long range, and high scalability. First released in 2004, ZigBee boasts
an operating range of up to 100 meters, hardware-powered 128-bit encryption, back-
wards compatibility, unique 2.4 GHz frequencies, and a minimal per-node power
footprint.

• LoRaWAN: a protocol based on the LoRa technology, is increasingly being used


in wireless sensor networks (WSNs) due to its low-cost, long-range communication

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 19/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

between millions of devices and cloud applications., and low-data-rate capabilities.


It is built on top of the LoRa radio modulation technique, which provides long range
and low power consumption.

• Bluetooth Low Energy (BLE): Introduced in 2010 as part of the Bluetooth 4.0
specification, BLE (Bluetooth Low Energy) is a wireless communication protocol
designed for applications requiring minimal power consumption and data trans-
mission. Unlike its predecessor, BLE operates independently, offering advantages
specifically tailored for low-power devices. Its key features include ultra-low power
consumption, short-range communication of up to 100 meters, and support for mesh
networks. These characteristics make it perfect for applications like environmental
monitoring, wearable tech, smart home automation, and asset tracking. Addition-
ally, BLE leverages the Generic Attribute Profile (GATT) for data exchange and
provides various profiles to cater to diverse applications and services.

• Wifi: Wifi is a wireless communication technology that enables devices to con-


nect to the internet or other networks wirelessly. It is widely used in various fields,
including healthcare, industrial automation, and environmental monitoring. Wi-Fi
provides a stable and reliable connection, ensuring consistent data transmission
without interference, signal loss, or interruption. It offers high data transfer rates,
making it suitable for applications that require real-time data processing or control.
Wi-Fi is also secure, with encryption protocols that protect data transmission from
unauthorized access. Wi-Fi is a versatile technology that has revolutionized the way
we connect and communicate, making it an essential component of modern life.

A summary table of the technical specifications of wireless communication protocols is


shown below.

Feature Zigbee LoRaWAN BLE Wi-Fi


Transmission distance Up to 100 meters Up to 10 km Up to 100 meters Up to 100 m
Transmission speed Up to 250 kbps Up to 300 kbps Up to 1 Mbps Up to 10 Gbps
Power consumption Low Very low Very low High
Scalability Good High High High
Cost Low Low Moderate High

Table 2 - Comparison of Wireless Sensor Network Protocols: Zigbee, LoRaWAN, BLE, Wi-Fi

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 20/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

2.4 ESP-NOW: The optimal choice for smart agriculture sys-


tems

2.4.1 ESP-NOW: Definition

ESP-NOW is a wireless communication protocol defined by Espressif, which offers a


cost-effective and low-power solution for on-site Internet of Things (IoT) devices. It is
a connectionless Wi-Fi communication protocol that encapsulates application data in a
vendor-specific action frame and then transmits it from one Wi-Fi device to another.
ESP-NOW is suitable for a variety of fields, including industrial automation, environ-
mental monitoring, and is especially integrated into smart agro-industrial monitoring
systems, providing a reliable communication framework for multi-sensor networks. Its
energy-efficient and low-cost nature makes it an optimal choice for smart agriculture,
enabling autonomous monitoring and reporting capabilities while supporting various ap-
plications such as air quality monitoring, aquaculture, and soil condition control. The
protocol’s versatility and widespread adoption in industrial, smart agriculture, and smart
home applications further underscore its suitability for addressing the specific communi-
cation requirements of modern agricultural systems.
The ESP-NOW protocol is a peer-to-peer (P2P) protocol, which means that devices
can communicate directly with each other without the need for a central hub. This makes
the ESP-NOW protocol ideal for applications where devices are located close together,
such as in a smart home or factory automation environment. This protocol operates on
the 2.4 GHz radio frequency band, which is familiar territory for Wi-Fi devices, ensuring
seamless integration and minimizing interference from other wireless technologies.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 21/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 5 – ESP-NOW: Data transmission without a central hub

2.4.2 ESP-NOW: Data Frame Format

The OSI model is a standardized model for data communication protocols in computer
networks. It divides the process of data communication into seven layers:

• Physical layer: Provides protocols for transmitting data in the form of bits over a
transmission medium.

• Data link layer: Provides protocols for controlling the flow of data and detecting
errors on the transmission medium.

• Network layer: Provides protocols for routing data between networks.

• Transport layer: Provides protocols to ensure that data is transmitted reliably.

• Session layer: Provides protocols for establishing and managing communication


sessions between applications.

• Presentation layer: Provides protocols for converting data between different for-
mats.

• Application layer: Provides protocols for specific applications

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 22/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 6 – OSI model: A standard framework for data communication

ESP-NOW is a wireless communication protocol that operates on the data-link layer,


reducing the seven layers of the OSI model to only one. This eliminates the need for data
transmission through the network layer, transport layer, session layer, presentation layer,
and application layer, and eliminates the need for packet headers or unpackers on each
layer. This leads to a quick response, reducing the delay caused by packet loss in congested
networks. This daring move has significant advantages:

• Rapid Delivery: By passing the traffic jams of the upper layers, ESP-NOW delivers
data with lightning speed. No more waiting in line for processing at each level. This
makes it ideal for applications where every millisecond counts, like sensor networks
monitoring critical environments or industrial robots needing instant feedback.

• Efficient and Streamlined: ESP-NOW sheds the heavy headers and unpackers
that weigh down traditional protocols. This reduces processing overhead and frees
up resources, making it incredibly efficient.

• Real-Time Ready: ESP-NOW’s low latency ensures data reaches its destination
with minimal lag, making it perfect for real-time applications like video conferencing
or remote surgery.

• Embracing Simplicity: Forget complex configurations and intricate setups. ESP-


NOW is designed for ease of use. Its simple data structure and direct communication
make it accessible even for beginners in the world of IoT.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 23/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 7 – The advantages of ESP-NOW over the OSI model

ESP-NOW: Data frame format ESP-NOW uses a vendor-specific action frame to


transmit ESP-NOW data. The format of the vendor-specific action frame is as follows:

————————————————————————————————————
| MAC Header | Category Code | Organization Identifier | Random Values | Vendor Specific Content | FCS |

————————————————————————————————————
24 bytes 1 byte 3 bytes 4 bytes 7-257 bytes 4 bytes

• Category Code: The Category Code field is set to the value (127) indicating the
vendor-specific category.

• Organization Identifier: The Organization Identifier contains a unique identifier


(0x18fe34), which is the first three bytes of MAC address applied by Espressif.

• Random Value: The Random Value filed is used to prevents relay attacks.

• Vendor Specific Content: The Vendor Specific Content contains vendor-specific


fields as follows:

———————————————————————
| Element ID | Length | Organization Identifier | Type | Version | Body |

———————————————————————
1 byte 1 byte 3 byte 1 bytes 1 byte 0-250 bytes

• Element ID: The Element ID field is set to the value (221), indicating the vendor-
specific element.

• Length: The length is the total length of Organization Identifier, Type, Version
and Body.

• Organization Identifier: The Organization Identifier contains a unique identifier


(0x18fe34), which is the first three bytes of MAC address applied by Espressif.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 24/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Type: The Type field is set to the value (4) indicating ESP-NOW.

• Version: The Version field is set to the version of ESP-NOW.

• Body: The Body contains the ESP-NOW data.

Since ESP-NOW skips the whole connection setup, its MAC header doesn’t follow the
usual rules. Instead of marking the direction of data flow, it simply uses the first address
field to point to the receiving device. The second address tells who sent the information,
and the third address is always set to broadcast mode, reaching everyone within range.

2.4.3 The reasons why ESP-NOW is the best choice for this project

The ESP-NOW protocol offers several advantages in the context of smart agricultural
systems, including:

1. Low-Cost and Low-Power: ESP-NOW is a low-cost and low-power wireless


communication protocol, making it suitable for in-situ Internet of Things (IoT)
devices operating at the 2.4GHz ISM spectrum.

2. Long-Distance Communication: ESP-NOW supports long-distance communi-


cation, ensuring a stable and quick response, which reduces the delay caused by
packet loss in congested networks.

3. Scalability and Flexibility: ESP-NOW can handle communication between mul-


tiple devices without requiring a central hub or gateway.It provides a flexible data
transmission that is suitable for connecting “one-to-many” and “many-to-many” de-
vices. This makes it scalable for large farms with numerous sensors and actuators
spread across a wide area.

4. Real-time Data Transmission: ESP-NOW offers low latency communication,


reducing the delay caused by packet loss in congested networks. This is crucial for
applications like precision irrigation and pest control, where immediate action based
on sensor readings is critical.

5. Security: ESP-NOW supports data encryption to protect sensitive information like


sensor readings and actuator commands from unauthorized access. This is essential
for ensuring the reliability and integrity of data in smart agricultural systems.

6. Cost-Effectiveness: ESP-NOW is a royalty-free protocol, making it an attractive


option for cost-conscious farmers. Additionally, the minimal infrastructure require-
ments compared to other protocols like LoRaWAN further contribute to cost savings.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 25/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

7. Simple to implement: ESP-NOW has a relatively simple programming interface,


making it easier for developers to integrate into their agricultural applications.

8. Supports large data packets: ESP-NOW can handle data packets up to 250
bytes, which is sufficient for most agricultural sensor data.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 26/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

CHAPTER 3

SYSTEM ARCHITECTURE AND IMPLEMENTA-


TION

Sensor cabinets and satellite cabinets will be made possible by the knowledge base and
technological combination described above to meet the most particular requirements in a
sizable agricultural area:

• Data collection and storage;

• Energy and connection

The design of a satellite station system for agriculture will be covered in this chapter, from
an overview to specifics of the system’s parts. After that, go on to the system infrastruc-
ture’s design and installation.

3.1 System Architecture Overview


Our system architecture in Figure 8 offers a thorough overview of the design of
an Internet of Things wireless network. Every replaceable component is essential to the
effective operation of the system as a whole. After delving further into each module’s
capabilities, let’s examine the implementation specifics shown in Figure 9.
The architecture includes five (5) interchangeable parts, each part holds an important
function in the system:

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 27/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 8 – System architecture with five interchangeable parts.

• Sensor Node module: in charge of obtaining data from several sensors that mea-
sure various parameters. This module collects measurements from the environment
in real time, acting as the first data source.

• Communication module: helps the data to be sent from various sensor nodes to
the IoT Gateway. By serving as a bridge, this module makes sure that sensor nodes

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 28/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

and the system’s core components communicate with each other seamlessly.

• IoT Gateway module: gathers data from sensor cabinets and sends it to the
server so that it may be stored. Enabling effective data flow, this gateway module is
a crucial link between the centralized data storage and the on-field data collecting.

• Data storage module: after obtaining data from sensor cabinets, IoT Gateway
store a significant amount of data. In order to facilitate historical analysis and future
reference, this module makes sure that data is persistently and securely preserved.

• Application module: is charge of giving consumers access to measured sensor


findings. In order to create charts and do statistical analysis, it gets data from
the server. This module serves as the user interface, allowing user interaction and
offering a visual representation of the data that has been gathered.

With the help of the architectural overview diagram, our team can finish implementing
the system. Figure 9 provides a summary of the system implementation.
The detailed architectural overview and system implementation diagrams provide a
solid foundation for our team’s development efforts. By focusing on the unique function-
ality of each module, our team can efficiently collaborate to bring this IoT-based wireless
network system to fruition.
The upcoming discussions in the following portion of this chapter will delve into specific
implemen-tation strategies and considerations for each module, ensuring a successful and
robust deployment.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 29/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 9 – System implementation including Sensor Nodes, IoT Gateway and Server.
COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 30/66
University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.2 Sensor Node module

3.2.1 Sensor Nodes Architecture Overview

A sensor node in our project consists of four main components:

1. Power unit: The power unit provides power to the sensor node. It can be a battery,
a solar panel, or a power adapter.

2. Sensing unit: The sensing unit collects data from the environment. It can be a
temperature sensor, a humidity sensor, or a light sensor.

3. Processing unit: The processing unit processes the data collected by the sensing
unit. It can be a microcontroller, a microprocessor, or a computer.

4. Communication unit: The communication unit transmits the data collected by


the sensing unit to a central location. It can use a wireless protocol, such as Wi-Fi
or Bluetooth, or a wired protocol, such as Ethernet.

Figure 10 – Sensor Node Architecture including 4 main unit:Power unit, Sensing unit, Processing
unit and Communication unit

Data from the environment is collected by a sensor, then processed by a controller. The
controller can perform simple or complex calculations to clean, convert, or analyze the
data. After processing, the data is transmitted to an IoT gateway using a communication
module. The communication module can use a wireless protocol, such as ESP-NOW.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 31/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.2.2 Hardware components

3.2.2.1 Power Unit

Solar Panel: A solar panel is a device that converts sunlight into electricity by using
photovoltaic (PV) cells. PV cells are made of materials that produce excited electrons
when exposed to light. The electrons flow through a circuit and produce direct current
(DC) electricity, which can be used to power various devices or be stored in batteries.
Solar panels are also known as solar cell panels, solar electric panels, or PV modules.
Particularly for soil and water sensors — both of which must be left outside in the
elements and are mobile and long-lasting — using solar panels allows the sensor cabinet
to be placed more freely without being overly dependent on the 220V power source. Thus,
we have installed a solar panel with the following parameters:

• Charged Power: 10 W ± 3%

• Charged Voltage: 18.23 V

• Charged Current: 0.60 A

Anytime solar energy is utilized, a technique to store extra energy for cloudy, rainy,
or nighttime days must always be found. As a result, we gave batteries some thought.
However, this approach was dropped and lithium batteries were used in its stead since
it was excessively large, heavy, and had a limited lifespan.
Lithium Li-ion Battery: A lithium-ion or Li-ion battery is a type of rechargeable
battery that uses the reversible intercalation of Li+ ions into electronically conducting
solids to store energy. In comparison with other rechargeable batteries, Li-ion batteries
are characterized by higher specific energy, higher energy density, higher energy efficiency,
a longer cycle life, and a longer calendar life.
As the result, we have installed a 4-cell Lithium Li-ion battery pack with the following
parameters:

• Voltage: 11.1V ∼ 12.6V

• Capacity: 2200 mAh

• Charger: 8.4V1A ∼ 2A

3.2.2.2 Sensing Unit

Soil satellite station: The ES-SOIL-7-IN-1 is a 7-in-1 integrated soil sensor that
measures various soil parameters, making it suitable for various agricultural applications.
The sensor measures conductivity, moisture, temperature, pH, nitrogen content, and other

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 32/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

soil properties, making it suitable for different soil qualities. It can be buried directly into
the soil, allowing for real-time monitoring of soil moisture, temperature, EC, pH, and
NPK levels.
The sensor is compatible with the Modbus communication protocol, which enables
seamless integration with various devices and systems. It can be used in smart agricultural
systems, greenhouses, and other environments where precise soil monitoring is essential
for optimal crop growth and yield. The sensor’s compact design and miniaturization make
it an ideal choice for space-constrained applications, such as small farms and greenhouses.

Figure 11 – Soil Sensor Device is capable of reading 7 parameters: Temperature, Humidity,


Electrical conductivity, pH, Nitrogen, Phosphorus, Potassium

Communication Basic Parameters:

Parameter Content
Coding 8-bit binary
Data bit 8-bit
Parity bit No
Stop bit 1-bit
Error check CRC (Redundant Cyclic Code)
BAUD RATE 115200

Table 3 - Communication Basic Parameters

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 33/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Data frame format:

• Address code = 1 byte : is the address of the transmitter, which is unique in the
communication network (factory default 0x01).

• Function code = 1 byte : The instruction function of the command sent by the
host. This transmitter only uses function code 0x03 (read register data).

• Data area = N bytes : The data area is the specific communication data.

• Error check = 16-bit CRC code : Two-byte check code

Register address

Register Address Content Operation


0006H PH Values (unit 0.01pH) Read-Only
0012H Soil Moisture(unit 0.1%RH) Read-Only
0013H Soil Temperature(unit 0.1℃) Read-Only
0015H Soil Conductivity(unit 1us/cm) Read-Only
001EH Soil Nitrogen (unit mg/kg) Read-Only
001FH Soil Phosphorus (unit mg/kg) Read-Only
0020H Soil Potassium (unit mg/kg) Read-Only

Table 4 - Register address for soil parameters

Air satellite station: The ES-INTEGRATE-ODR-01 is a sensor designed to measure


various environmental parameters, including PM2.5 and PM10 particle content, temper-
ature, humidity, and noise levels. The sensor utilizes RS485 output and is often based
on the Modbus RTU communication protocol, allowing for digital communication with
other devices. This type of sensor is commonly used for outdoor air quality monitoring,
weather stations, greenhouse monitoring, and various agricultural and industrial appli-
cations. The RS485 output enables the sensor to be integrated into larger monitoring
systems, providing valuable data for environmental and air quality analysis. The sensor’s
ability to measure multiple parameters and its digital output make it a versatile and
valuable tool for comprehensive environmental monitoring.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 34/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 12 – Air Sensor Device is capable of reading 7 parameters: Temperature, Humidity, Noise,
PM2.5, PM10, Atmospheric pressure and Luminosity

Register address

Register Address Content Operation


01F4H Humidity value (10 times the actual value) Read-Only
01F5H Temperature value (10 times the actual Read-Only
value)
01F6H Noise value (10 times the actual value) Read-Only
01F7H PM2.5 value (actual value) Read-Only
01F8H PM10 value (actual value) Read-Only
01F9H Atmospheric pressure value (unit Kpa, 10 Read-Only
times the actual value)
01FAH 20W Lux value high 16-bit value (actual Read-Only
value)
01FBH The lower 16-bit value (actual value) of the Read-Only
Lux value of 20W

Table 5 - Register address for air parameters

Water satellite station: The digital sensors that measure water quality parameters,
including conductivity, ORP (Oxygen Reduction Potential) , salinity,temperature and pH,
and utilize RS485 output for digital communication. These sensors are commonly used in
water quality monitoring, industrial environmental sensing, and agricultural applications.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 35/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

The sensors are designed to provide accurate and reliable measurements of various water
quality parameters, enabling real-time monitoring and analysis. The RS485 output enables
the sensors to be integrated into larger monitoring systems, providing valuable data for
environmental and water quality analysis. The sensors are available in different models
and designs, including those with waterproof aviation connectors, hook-up wires, and
different output interfaces, making them versatile and suitable for various applications.

Figure 13 – Water Sensor Device is capable of reading 5 parameters: Temperature, PH, Electrical
conductivity, ORP (Oxygen Reduction Potential) and Salinity

Register address

ID address Register Address Content Operation


0x04 0000H Read conductivity value Read-Only
0x04 0008H Read salinity value Read-Only
0x02 0001H Read PH value Read-Only
0x05 0001H Read ORP value Read-Only
0x05 0003H Read Temperature value Read-Only

Table 6 - Register address for water parameters

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 36/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.2.2.3 Processing Unit and Communication Unit

M5 Atom Lite

Figure 14 – M5 Atom Lite Device

The M5 Atom Lite is a compact development board in the M5Stack development kit
series. It is powered by the ESP32-PICO chip, which integrates Wi-Fi technologies and
includes a 4MB SPI flash memory, ensuring seamless connectivity and providing sufficient
storage capacity for applications. The board features a HY2.0 interface, buttons, RGB
LED, infrared LED. Additionally, Atom Lite can be easily connected to external sensors
and actuators through its 6 GPIOs. It also includes a USB-C port for both power and
programming purposes, and some versions may come with an integrated pin header for
mobile projects. Additionally, it may have a TF card slot for additional storage or data
logging capabilities. The operating temperature range of this ATOM board is 0°C to 40°C
with a 5V power supply. The development board measures 24 x 24 x 10 mm, and its small,
lightweight design makes it suitable for space-constrained applications and wearable device
projects. The M5 Atom Lite boasts a versatile development environment, supporting
both MicroPython and Arduino alongside various programming languages. Additionally,
M5Stack’s official documentation offers comprehensive resources such as pinout diagrams,
technical specifications, and example code, facilitating a smooth learning curve for users
of all skill levels.

Figure 15 – M5 Atom Lite Schematic Diagram

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 37/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 16 – M5 Atom Lite PinMap

Six GPIO pins (general-purpose input/output) line the board’s edge, granting access to
a world of external sensors and actuators. These can be used for diverse applications, from
monitoring environmental conditions to controlling motors and LEDs. Additionally, the
HY2.0 interface expands the board’s reach by enabling connection to specialized M5Stack
modules.
For peripheral communication, the Atom Lite boasts built-in support for popular
protocols like I2C and SPI. This allows for seamless integration with various sensors,
displays, and other peripherals, further enriching our project’s capabilities. Finally, the
Type-C USB port facilitates convenient power supply and program upload, streamlining
the development process.
The M5 Atom Lite is equipped with an ESP32-PICO chip that includes ESP-NOW,
which enables the M5 Atom Lite to communicate directly with other ESP32 or ESP32-
PICO devices without the need for an intermediary device.
ATOMIC RS485 Base

Figure 17 – ATOMIC RS485 Device

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 38/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

The Atomic RS485 Base is a versatile TTL-RS485 converter expressly crafted for
M5Atomic utilization. Its purpose is to act as an interface between TTL level and RS485
level, facilitating seamless communication among devices.
RS485 stands as a widely embraced communication protocol standard, delineating the
electrical characteristics of drivers and receivers in a serial communication system. No-
tably, it supports a multi-point system, making it a favored selection in diverse industrial
applications. When RS485 communication and control capabilities are requisite for our
equipment, the ATOM RS-485 emerges as a commendable solution.
Distinguishing itself, the Atomic RS485 Base incorporates an integrated DC/DC volt-
age regulator chip. This enables the direct conversion of RS485’s 12V voltage to 5V,
serving as a power supply for M5ATOM without the necessity of an additional power
source. This streamlined design mitigates the complexity associated with managing mul-
tiple power supplies, ensuring a simplified and efficient setup.

Figure 18 – ATOM RS485 Device

After connecting the M5 Atom Lite and ATOMIC RS485 Base, the G19 and G22 pins
of the M5 Atom Lite are connected to the corresponding pins 19 and 22 on the ATOMIC
RS485. This allows the M5 Atom Lite to communicate with RS-485 devices, such as the
sensor devices used in this project.

3.2.3 Software development

3.2.3.1 Arduino IDE

Arduino IDE is an open-source software that is primarily used to write and compile
code into the Arduino module. It can also be used to compile code into other modules
such as Esp32, Esp8266.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 39/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Arduino IDE is a completely free software that is widely used and appreciated by
programmers around the world. Users have the right to modify, improve, develop, and
upgrade it according to some general principles allowed by the publisher without the need
to ask for anyone’s permission, which they are not allowed to do for closed-source software.

3.2.3.2 C/C++

C++ is an object-oriented programming language (OOP) developed by Bjarne Strous-


trup. C++ is a programming language developed on the basis of the C programming
language. Therefore, C++ has both the style of structural programming similar to C and
the object-oriented style. In many cases, C++ uses a combination of both styles. There-
fore, it is considered a "hybrid" language. The outstanding advantage of C++ is its high
processing speed and performance. In addition, C++ is a low-level language that is easy
to communicate with hardware and consumes less hardware resources, making it very
suitable for programming hardware in IoT systems.

3.2.3.3 RS-485 protocol

The RS-485 protocol, originated by Allen-Bradley, is a proprietary communication


protocol extensively employed in industrial control units and diverse automation appli-
cations. This standard is bidirectional and operates in a half-duplex mode, incorporating
multiple "bused" drivers and receivers, allowing each driver to release the bus. Renowned
for its resistance to electrical noise, capability for extended cable runs, support for mul-
tiple slaves in one connection, and rapid data transmission speed, RS-485 finds common
usage in programmable logic controllers, factory environments, and commercial aircraft
cabins for low-speed data communications. Its efficiency lies in requiring minimal wiring
and the ability to share wiring among multiple seats, contributing to weight reduction.

3.2.4 Sensor Node Flow Diagram

The flowchart of soil, water, and air monitoring stations is as follows:

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 40/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 19 – Flow-chart of Sensor Node

1. Select Parameter: The system first selects the desired parameter to read. This
parameter can be one of the following:

• Water satellite station: EC, PH, Temperature, ORP, Salinity.


• Soil satellite station: Temperature, Humidity, EC, PH, N, P, K.
• Air satellite station: Temperature, Humidity, Noise, PM2.5, PM10,Air pres-
sure, Luminosity.

2. Send Read Command: The system then sends the corresponding read command
to the sensor via the Atomic RS485 device. The Atomic RS485 device is a serial
communication device that is used to connect the sensor to the system.

3. Process Sensor Response: If the system does not receive a response from the
sensor, it repeats step 2. This is to ensure that the sensor is properly connected and
functioning.

4. Decode Sensor Data: If the system receives a response from the sensor, it decodes
the data read from the sensor into a meaningful value. This is typically a decimal
number.

5. Send Decoded Data: The system then sends the decoded value to the IoT gate-
way via the ESP-NOW protocol. The ESP-NOW protocol is a low-power, wireless
communication protocol that is used to transmit data between devices.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 41/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

6. Process IoT Gateway Response: If the system does not receive a response
from the IoT gateway, it returns to step 4. This is to ensure that the IoT gateway
is properly connected and functioning.

7. Continue with Next Parameter: If the system receives a response from the IoT
gateway, it returns to step 1 to continue with other parameters.

In the "Decode sensor data" step, each station will have a different algorithm, depend-
ing on the data returned from the sensors. For example, the data returned from soil and
air sensors is 2-byte signed numbers, so we can decode them into real numbers. The data
returned from water sensors is 32-bit, so we need to decode it into floating point numbers
using the 32-bit Single Precision IEEE 754 Floating Point algorithm.

3.3 Communication Network module

3.3.1 Communication between Sensor Stations and Gateway

The data exchange between the sensor node and the IoT gateway is implemented
using the ESP-NOW protocol. The reasons for this choice are clearly explained in section
2.4.3. The following are the steps involved in implementing the data exchange between
the sensor node and the IoT gateway:

1. Initialization:

• Wi-Fi Setup: Ensure Wi-Fi is active before starting communication.


• Initialization: Use esp_now_init() to initialize ESP-NOW.

2. Obtaining MAC Addresses: Use tools like M5Burner to retrieve the MAC
address of each sensor station (water and soil-air).

3. Adding Paired Devices:

• Add both water and soil-air satellite stations as paired devices to the gateway
using esp_now_add_peer(). This allows direct communication between
each station and the gateway.
• Paired device channels range from 0 to 14. Channel 0 uses the local device’s
current channel. For other channels, set them explicitly to the local device’s
channel.

4. Sending ESP-NOW Data:

• Use esp_now_send() to send data from the sensor stations to the gateway.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 42/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Register a callback function with esp_now_register_send_cb() to receive


sending status updates.
• The callback returns ESP_NOW_SEND_SUCCESS for successful data
reception on the MAC layer, or ESP_NOW_SEND_FAIL otherwise.
• Implement acknowledgement (ack) data and retransmission mechanisms for
reliable communication, as data might not always reach the gateway.

5. Receiving ESP-NOW Data:

• Use esp_now_register_recv_cb() to register a callback function for re-


ceiving data from the sensor stations at the gateway.
• This callback will be triggered whenever ESP-NOW data is received from either
station.

3.3.2 Communication between Gateway and Server

In the realm of modern agricultural systems, the integration of wireless sensor net-
works (WSNs) has become paramount for efficient and data-driven farming practices. The
success of such systems relies heavily on robust communication mechanisms between the
deployed sensors and the central server. In this section, we delve into the communica-
tion architecture established between the Gateway and the Server, employing the MQTT
(Message Queuing Telemetry Transport) protocol. The server, powered by NestJS, serves
as the backbone orchestrator, managing and processing data from the agricultural sensor
network.

Figure 20 – Gateway-server Communication

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 43/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Publisher-Subscriber Model: The communication between the Gateway and


the Server is facilitated through MQTT’s publisher-subscriber model. The Gate-
way, acting as a publisher, transmits data to specific topics on the MQTT broker,
while the Server, functioning as a subscriber, listens to these topics for incoming mes-
sages. This decoupled architecture ensures that components operate independently,
enhancing system flexibility and scalability. To ensure standardized communication,
a well-defined message format and payload structure are established. Each message
encapsulates crucial sensor data, including sensor type, timestamp, and the actual
reading. This uniformity in message structure ensures compatibility between diverse
sensor nodes and simplifies data processing on the Server side.

• MQTT Broker: A pivotal component in this communication paradigm is the


MQTT broker, which acts as an intermediary facilitating message exchange. The
broker efficiently routes messages from publishers (Gateway) to subscribers (Server)
based on predefined topics. In our deployment, a dedicated MQTT message broker
is employed to manage the communication flow and maintain the integrity of the
data exchange process

Figure 21 – MQTT Broker

• NestJS: NestJS, a progressive Node.js framework, is chosen as the server-side


technology for its scalability, maintainability, and ease of development. The server
subscribes to relevant MQTT topics, processing incoming messages and executing
predefined actions based on the received data. The NestJS application is config-
ured to establish a secure and efficient connection with the MQTT broker, ensuring
seamless communication and timely data processing.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 44/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 22 – Nestjs Module

The "Users" module facilitates user registration through a RESTful API, allowing
users to create accounts by providing essential information. Passwords are securely
hashed and stored in the database, ensuring data integrity and user security. Addi-
tionally, the module incorporates JWT (JSON Web Token) authentication to verify
user identities during subsequent interactions with the server.
Within the "MQTT" module, a robust MQTT client is implemented to establish
connections with the MQTT broker. This client subscribes to relevant topics, allow-
ing the server to receive real-time updates from the agricultural field. The module
also manages the publication of commands to the Gateway, enabling bidirectional
communication. Incoming MQTT messages are processed within the "MQTT" mod-
ule, extracting sensor data and relevant information. The module orchestrates the
conversion of raw sensor data into a standardized format, ensuring consistency and
compatibility with the rest of the system.
The "Supabase" module integrates the Supabase platform into the NestJS server,
enabling efficient data storage and retrieval.

The integration of MQTT protocol for communication between the Gateway and Server
in our wireless sensor network for agricultural systems lays the foundation for a respon-
sive and adaptable data ecosystem. This architecture, complemented by the robustness of
NestJS, establishes a reliable communication channel that is crucial for the timely acqui-
sition and processing of sensor data, ultimately contributing to informed decision-making
in precision agriculture.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 45/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.4 IoT Gateway module


Raspberry Pi Compute Module 4:

• The power of Raspberry Pi 4 in a compact form factor for deeply embedded applica-
tions. Raspberry Pi Compute Module 4 incorporates a quad-core ARM Cortex-A72
processor, dual video output, and a wide selection of other interfaces. Available in
32 variants, with a range of RAM and eMMC Flash options, and with or without
wireless connectivity.

• It serves as the primary processing unit in our design, and we have cleverly included
it there to take use of its computing capabilities for effective data management and
analysis. We’ve used the dependable serial communication protocol UART (Univer-
sal Asynchronous Receiver-Transmitter) capabilities to provide smooth communi-
cation and data transmission.

Figure 23 – The Raspberry Pi Compute Module 4

Figure (14) shows the ATOM LITE device that we use for data collecting. Data gath-
ered from sensor cabinets is sent to the CM4’s UART interface via this small but powerful
device. Information may go more efficiently from the sensors to the processing unit thanks
to the ATOM LITE’s bridge function.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 46/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 24 – The implementation of IoT Gatway

Processing and maintaining the sensor data is the task of the CM4, which receives it
via UART. This design offers a scalable and flexible method for integrating various sensor
inputs in addition to guaranteeing the effective use of the CM4’s computing power.
Two primary approaches are provided by our system in situations when obtaining large
amounts of data from the server is necessary: data posting and data subscription.

• Data Publishing: When large datasets need to be distributed to the server, the
CM4, enabled by the MQTT protocol, broadcasts the pertinent information. This
guarantees that the server can store or analyze the incoming data effectively and
gets changes in real time.

• Data Subscription: On the other hand, the CM4 subscribes to the appropriate
data channels when it is necessary to retrieve substantial amounts of data from
the server. Our system’s bidirectional connectivity ensures a flexible and responsive
design by enabling our system to dynamically adjust to changing data needs.

This dual communication strategy, together with the MQTT’s scalability and the
UART interface’s durability, presents our system as an adaptable option for managing

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 47/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

a variety of data circumstances. By including the ATOM LITE as a data bridge, the
system’s flexibility is increased and a dependable connection is made between the CM4’s
computing power and the physical sensors.
This design not only meets the current data transmission demands of our system as
we go further into the era of Industry 4.0, but it also establishes the foundation for fur-
ther improvements and optimizations. Our dedication to developing a stable and flexible
system architecture that keeps up with the changing needs of sensor-based technologies
and data-driven applications is demonstrated by the use of UART and MQTT.

3.5 Data storage module

3.5.1 Supabase

In the landscape of third-party databases, Supabase emerges as a formidable choice


for our agricultural wireless sensor network’s storage needs. Several databases vie for
attention, including Firebase, MongoDB, and Amazon DynamoDB.

• Firebase: While Firebase excels in real-time data synchronization, Supabase offers


a more comprehensive relational database model, allowing for complex queries and
relationships between data entities.

Figure 25 – Firebase

• MongoDB: MongoDB, a NoSQL database, is renowned for its flexibility and


scalability. However, Supabase, built on top of PostgreSQL, provides the familiarity
of SQL queries along with the robustness of a relational database.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 48/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 26 – MongoDB

• Amazon DynamoDB: DynamoDB is a serverless NoSQL database offered by


AWS. Supabase, being open-source and developer-friendly, allows for greater cus-
tomization and control over the database infrastructure.

Figure 27 – DynamoDB

However, the decision to integrate Supabase into our system is driven by several key fac-
tors:
Supabase distinguishes itself by combining the advantages of a traditional relational
database with real-time capabilities, making it an ideal fit for our dynamic and evolving
sensor network. Supabase is built on top of PostgreSQL, a proven and reliable relational
database. This ensures data integrity and consistency, critical for the accurate repre-
sentation of sensor information. Supabase leverages PostgreSQL’s real-time capabilities,
providing instant updates to subscribed clients. This feature is invaluable for monitoring
and responding to changes in sensor data in near real-time. Supabase’s open-source na-
ture fosters a collaborative and extensible environment. It aligns with our commitment
to transparency and adaptability in the development of our agricultural sensor network.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 49/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 28 – Supabase

The integration of Supabase as the storage backend for our agricultural wireless sensor
network establishes a robust foundation for data persistence and retrieval. The seamless
communication between NestJS and Supabase ensures that the data received from the
MQTT channel is not only securely stored but also organized in a structured manner,
facilitating efficient analysis and decision-making in the agricultural domain.

3.5.2 Data relationship

Upon receiving data from the MQTT channel, NestJS initiates a series of data trans-
formation and validation steps. This includes parsing the incoming data, ensuring its
integrity, and converting it into a format compatible with the Supabase schema.

Figure 29 – Data relationship

• Nodes Table: The nodes table, representing the geographical locations of sensor
nodes, is populated with data such as id, name, and createdAt. The relationship
between the nodes and sensors tables is established through the nodeId foreign key,
enabling a many-to-one relationship.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 50/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 30 – Nodes table

Nodes table has been established to encapsulate the three distinct environmental
nodes denoted as water 0001, air 0001, and soil 0001. Each of these nodes is equipped
with multiple sensors, collectively constituting a sensors table.

• Sensors Table: The sensors table captures information related to individual sen-
sors, including id, name, nodeId, currentValue, and createdAt. The nodeId foreign
key establishes a connection to the nodes table, creating a hierarchical structure.
This allows for efficient organization and retrieval of sensor data based on their
associated nodes.

Figure 31 – Sensors table

Sensors are designated as WaterStation/PH, WaterStation/SALINITY, WaterSta-


tion/ORP, WaterStation/TEMP, WaterStation/EC, AirStation/LUX, AirStation/HUMID,
AirStation/TEMP, AirStation/NOISE, AirStation/PM2.5, AirStation/PM10, AirSta-
tion/ATMOSPHERE, SoilStation/TEMP, SoilStation/HUMID, SoilStation/EC, Soil-
Station/PH, SoilStation/N, SoilStation/K, and SoilStation/P.
Of particular significance is the inclusion of a current value field associated with
each sensor, which serves as a repository for the most recent data point acquired.
This architectural configuration facilitates the real-time monitoring and retrieval of

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 51/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

pertinent environmental parameters. The dynamic nature of this dataset is accen-


tuated by the continuous updating of the current value field as new sensor readings
are obtained.

• Sensor output Table: The sensorOutput table records the output data from
sensors, including id, value, sensorId, and createdAt. The sensorId foreign key links
to the sensors table, creating a chain of relationships. This structure enables the
correlation of sensor output data to specific sensors and, subsequently, to their
associated nodes.

Figure 32 – Sensors output table

A dedicated "sensors output" table has been instituted to systematically archive


historical data spanning from the initial deployment of the sensors to the present
moment. This comprehensive repository serves as a valuable resource for conducting
longitudinal analyses, allowing for the generation of line charts that encapsulate the
temporal evolution of sensor readings

The integration of Supabase as the storage backend for our agricultural wireless sensor
network establishes a robust foundation for data persistence and retrieval. The seamless
communication between NestJS and Supabase ensures that the data received from the
MQTT channel is not only securely stored but also organized in a structured manner,
facilitating efficient analysis and decision-making in the agricultural domain.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 52/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.6 Application module

3.6.1 Software development

3.6.1.1 Python

Python is now widely used in software development and data science fields because to
its versatility and dynamic interpretation. Python was developed by Guido van Rossum
and was initially made available in 1991. It places a strong emphasis on readability,
simplicity, and flexibility, making it a great language for novice programmers as well
as a useful tool for seasoned professionals. Python is widely used in many different sectors
because of its large standard library and active community.

Figure 33 – Some applications for the python programming language.

Python is the preferred language for developing our software application because of
its extensive feature set and adaptability. Python was chosen because of its ease of use in
managing a number of activities, such as receiving UART data from the ATOM LITE,
publishing to the server, and synchronizing with it.
To sum up, Python’s vast range of features makes it an invaluable tool for developing
software applications. It enables us to effortlessly combine various functionality and satisfy
the intricate needs of our project. Because of the language’s versatility and broad support,
our software is not only able to satisfy present needs but also be prepared for future
improvements and optimizations.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 53/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

3.6.1.2 Tkinter

Tkinter: Python comes with Tkinter, a common GUI (Graphical User Interface)
toolkit. It offers a collection of resources and tools for creating dynamic and aesthetically
pleasing desktop programs. Tkinter is an easy option for developers who want to construct
graphical interfaces without external dependencies because it is based on the Tk GUI
toolkit and has been a part of Python from its early releases.
Even if its design aesthetics may be viewed as a little boring, Tkinter is a dependable
and effective tool in the field of graphical user interface (GUI) development. Tkinter, in
spite of its simplicity, is essential to the process of displaying data from the Compute
Module 4 (CM4) on the screen when using HDMI. In the framework of the CM4, this
study examines the useful parts of Tkinter’s contribution to data display and visualization.

Figure 34 – The Implementation of IoT Gateway to Application.

Tkinter turns out to be a useful tool for projecting data from the CM4 onto the screen
via HDMI, even if its design may seem a little repetitive at first. Its ease of use, com-
patibility with HDMI output, and effectiveness in data representation make it a sensible
option for tasks where effective information dissemination is essential. Tkinter’s contribu-
tion to effective and practical GUI design continues to be a significant feature of Python
application development, even as the development environment changes.

3.6.2 Implementation

Careful information design and organization are necessary to provide a comprehensive


and user-friendly application for managing and monitoring sensor nodes. The software
will be divided into four separate frames, each of which will have a particular function to
improve user experience and speed up data processing.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 54/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Active Sensor Nodes Frame: The app will dynamically display the active sensor
nodes in the first frame. The display will instantly erase any disconnected node,
allowing for real-time sight of the functional nodes. Users may instantly obtain an
overview of the current state of the network using this frame.

• Sensor Parameters Frame: The comprehensive sensor parameters that were gath-
ered from the active nodes will be displayed in the second frame. Real-time informa-
tion on temperature, humidity, pressure, and other pertinent variables is included
in this. The metrics are readily monitored and analyzed by users to provide insights
into the processes or environmental conditions being assessed.

• Data History Frame: The historical data that the sensor nodes have sent is pre-
sented in the third frame. The chronology of data points may be reviewed by users,
who can then see any trends or abnormalities. Before the data is sent to the server,
this frame also serves as a staging area, ensuring that only pertinent and thoroughly
examined material is sent.

• Data Graphic Frame: The fourth frame shows a data graphic that spans the
previous 12 hours, offering a thorough and aesthetically pleasing depiction of the
sensor data. Users may immediately understand trends, fluctuations, or important
occurrences within the given era thanks to this graphical depiction. The image
facilitates decision-making and improves the monitoring experience overall.

We hope that this application structure would simplify the user interface and make it
easier for users to monitor, evaluate, and interact with the sensor data. Every frame has
a defined function thanks to the well-organized layout, which enhances the coherence and
usability of the application design.
An illustration of the completed app’s appearance, including the frame organization
and information flow, may be found in the following figure:

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 55/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 35 – Display air sensors node and chart for data retrieval.

The goal of this user interface design is to improve the user’s ability to interact with
the program more easily, monitor nodes that are active, examine sensor characteristics in
depth, go over previous data, and extract insightful information from the graphical data
representation.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 56/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

CHAPTER 4

EXPERIMENTAL RESULT AND EVALUATION

In this chapter, we present an assessment of the response time from the IoT Gateway
to the Sensor Node and the proportion of data packets that failed to transmit successfully.
This analysis was conducted under three distinct scenarios with varying distances between
the Sensor Node and the IoT Gateway: 5 meters, 170 meters, and 200 meters.

4.1 Response time and packet loss analysis for 5m distance


After collecting approximately 1500 samples of feedback time from the IoT Gateway
to the Sensor Node at a distance of 5m, the number of unsuccessful data transmissions
was 0.

Figure 36 – Response time distribution from IoT Gateway to Sensor Node at a distance of 5m.

The response time range is from about 2 millisecond to 35 millisecond. The most
common response time is about 2 millisecond, which accounts for about 37.73% of the total
samples. The standard deviation and the average response time is about 4.08 millisecond
and 5.08 millisecond respectively, indicating that the response time is quite stable.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 57/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

Figure 37 – Pareto Chart of time response from IoT Gateway to Sensor Node at a distance of
5m.

Through statistics and from the Pareto chart, there are 4 types of data that account
for a high rate (total over 80%) of the total number of samples, which are 2,3,12 and
11 millisecond. It can be seen that the response time from IoT Gateway to Sensor Node
when the distance is 5m is efficient. The average response time and standard deviation
is low,indicating that the response time is quite stable and is less affected by external
factors.

4.2 Response time and packet loss analysis for 170m distance
After collecting approximately 1000 samples of feedback time from the IoT Gateway
to the Sensor Node at a distance of 170m, the number of unsuccessful data transmissions
was 40 which contribute to 4% of total data packets sent, suggesting a reliable connection
with minimal data loss.

Figure 38 – Response time distribution from IoT Gateway to Sensor Node at a distance of 170m.

The response time range is from about 2 millisecond to 97 millisecond. The most
common response time is about 3 millisecond, which accounts for about 17.08% of the

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 58/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

total samples. There are a few outliers with high response times, up to 97 milliseconds.
These outliers account for about 4% of the total samples. The standard deviation and
the average response time is about 8.68 millisecond and 9.32 millisecond respectively,
indicating that there is a significant spread in the individual response times, with some
being much faster or slower than the average.

Figure 39 – Pareto Chart of time response from IoT Gateway to Sensor Node at a distance of
170m.

Through statistics and from the Pareto chart, there are 12 types of data that account
for a high rate (total over 80%) of the total number of samples, which are 3, 2, 4, 5,
6, 1, 8, 9, 11, 12, 7 and 13 millisecond, indicating a reliable connection and efficient
communication.

4.3 Response time and packet loss analysis for 200m distance
The reason we measure the response time at a distance of 200 meters is because the
manufacturer of ESP-NOW states that it operates within a range of 200 meters or less.
Therefore, we collected 1000 samples and found that about 85 data packets were not
successfully transmitted, accounting for up to 8.5%.

Figure 40 – Response time distribution from IoT Gateway to Sensor Node at a distance of 200m.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 59/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Packet loss rate The packet loss rate is 8.5%, which is equivalent to 85 packets
out of 1000 samples. This is a relatively high rate that can affect the performance
of the system. The cause of this failure rate can be due to a number of factors, such
as network interference, hardware or software errors.

• Response time The average response time of the system is 13.98 millisecond,
which is a very good response time for a wireless sensor network for agricultural
systems. However, the standard deviation of the response time is quite high, at
14.03 milliseconds. This shows that there is a fairly large dispersion in the response
time values.

Figure 41 – Pareto Chart of time response from IoT Gateway to Sensor Node at a distance of
200m.

Through statistics and from the Pareto chart, there are 12 types of data that account
for a high rate (total over 80%) of the total number of samples, which are 3, 2, 5, 7, 6,
4, 10, 9, 11, 8, 13 and 14 millisecond, The system exhibits a promising average response
time for agricultural sensor networks; however, it is hindered by a high packet loss rate
of 8.5% and a considerable standard deviation in the response time. Addressing these
shortcomings through the reduction of noise, optimization of the transmission protocol,
and hardware upgrades is imperative to ensure reliable data transmission and enhance the
network’s performance. By mitigating these issues, the system can achieve more consistent
and dependable communication, which is essential for the effective operation of sensor
networks in agricultural environments.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 60/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

CHAPTER 5

CONCLUSION AND FUTURE WORK

The content of chapter 5 presents an assessment of the process of implementing spe-


cialized projects against the set goals. Besides, this chapter also sets out the work plan for
the Graduation Project phase in the next semester.

5.1 Procedure Evaluation


Over the course of the 15-week specialized project implementation, the group has
achieved the following objectives:

1. Providing clarification on some basic information about the satellite station system:

• Knowledge of how to process data sent from sensors: Understand and


grasp how to read and get values from sensors.
• Knowledge about energy to maintain the system: Find out what energy
source is needed for the sensor cabinet, and determine the capacity and amount
of electricity needed to actually operate the sensor cabinet.
• Knowledge about wireless signal transmission: Understand the concepts
as well as basic knowledge, advantages and disadvantages in how to organize
and deploy wireless network connections. At the same time, understand the
strengths and weaknesses of ESPNOW
• Knowledge about saving and retrieving data from the server: Under-
stand the concepts, characteristics, tasks, and difficulties and challenges related
to storing and processing data pushed from sensors.
• Knowledge about python’s tkinter library: Get familiar with Tkinter’s
commands and support libraries and apply them to implement an application
for IoT Gatway

2. Implementing the satellite station system:

• Sensor node: Completed in integrating soil and air sensors in 1 sensor cabinet,
separate water sensors in 1 sensor cabinet. The sensor cabinets are all connected
to 1 solar panel and 1 battery for storage.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 61/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Server: Complete a server to store data.


• Application: Complete an application with 4 main, user-friendly functions.
• IoT Gateway: Complete the central cabinet that acts as an IoT Gatway.

3. Remaining errors:

• ESPNOW distance is not suitable for One-Hop Communication and smart


agriculture systems.
• Charging from solar cells to lithium batteries has not been improved

5.2 Future Tasks for the Capstone Project


The next Capstone Project will prioritize system integration, data synchronization
with the central cabinet, and the addition of intelligent features intended to improve
sensor maintenance alerts and data monitoring. Important assignments and specifications
that will be included in the report are outlined in the future plan.
Key Tasks for the Future Work:

1. Data Accuracy Checking:

• Examine and document the techniques used to confirm that sensor data is
accurate when compared to actual circumstances.
• Addressing immediately any discrepancies encountered with the values taken.
• Execution time: 2 weeks.

2. Intelligent Detection of Wireless Sensors:

• Describe the automated identification techniques used to handle connections


in the event of a loss or to smoothly incorporate more sensor nodes.
• Discuss the effectiveness of the identification system in maintaining system
integrity.
• Execution time: 2 weeks.

3. Automated Handling of Connections:

• Describe the methods used to automatically connect to the closest sensor node
cabinet in the case that there is a connection issue with IoT Gateway.
• Evaluate the system’s flexibility and continuity of data transfer.
• Execution time: 2 weeks.

4. Assessment and Measuring of System Performance:

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 62/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

• Provide a comprehensive examination of the latency, data collision, and com-


munication distance parameters related to system performance.
• Talk about how system performance affects data transmission dependability
and overall efficiency.
• Execution time: 2 weeks.

5. Operational Testing and Evaluation of Durability:

• Describe the operational protocols used in the testing process, emphasizing the
system’s robustness and durability
• Evaluate the system’s resilience to changing circumstances and possible stres-
sors.
• Execution time: 4 weeks.

6. Report Writing:

• Put the results, techniques, and conclusions together in a thorough report


manner.
• Make sure the report follows a logical format and covers all relevant topics,
including system performance, integration, and the use of intelligent features.
• Execution time: 3 weeks.

The Capstone Project report will function as a thorough manual for the integration
and performance assessment stage, highlighting the precision of sensor data, the system’s
flexibility, and its general durability. Intelligent feature integration and a thorough eval-
uation of system performance will provide important new perspectives on the efficiency
and dependability of the system that has been designed. The report attempts to give a
detailed scenerio of the system’s capabilities and possible areas for improvement through
thorough analysis and reporting.

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 63/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

REFERENCES
[1] Akyildiz, I. F., W. Su, Y. Sankarasubramaniam, and E. Cayirci(2002). Wireless sensor
networks: a survey.<https://edis.ifas.ufl.edu/publication/AE521>

[2] Administrator(2019). Basics of Wireless Sensor Networks (WSN) | Clas-


sification, Topologies, Applications.<https://www.electronicshub.org/
wireless-sensor-networks-wsn/>

[3] shivam verma(2023). Wireless Sensor Networks (WSN) Glossary.<https://


toolsense.io/glossary/wireless-sensor-network/>

[4] Sarah Lewis(2019). Wireless Sensor Networks: Overview and Applications.<https:


//www.scaler.com/topics/wireless-sensor-networks/>

[5] Lynnette Reese, Mouser Electronics. RF Sensor Net-


works.<https://www.mouser.vn/applications/rf-sensor-networks/
?_gl=1*dntwqc*_ga*MTY5NjE2NDQ4LjE3MDE2Mjk4MDE.*_ga_
15W4STQT4T*MTcwMTYyOTgwMC4xLjEuMTcwMTYyOTgwMy41Ny4wLjA.>

[6] Nguyen Thao Truong. 5 Giao thuc ket khong day cho thiet bi IoT, smart home quan
trong va cac ung dung tieu bieu<https://dienelectric.com/...>

[7] Nguyen Chi Nhan, Pham Ngoc Tuan, Nguyen Huy Hoang. Wireless Sensor Net-
works for Smart Agriculture in Vietnam.<https://stdjns.scienceandtechnology.
com.vn/index.php/stdjns/article/view/704/1137#figures>

[8] Janakiram MSV(2015). Tutorial: Prototyping a Sensor Node and IoT Gateway with
Arduino and Raspberry Pi (Part 1).<https://thenewstack.io>

[9] Microsoft Research. FarmBeats: AI for Agriculture.<https://www.microsoft.com/


en-us/research/project/farmbeats-iot-agriculture/>

[10] Espressif Systems. ESP-NOW.<https://www.espressif.com/en/solutions/


low-power-solutions/esp-now>

[11] Espressif Systems. ESP-NOW Documentation.<https://docs.espressif.com/


projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html>

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 64/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

[12] Random Nerd Tutorials. (n.d.). ESP-NOW Two-Way Com-


munication with ESP32.<https://randomnerdtutorials.com/
esp-now-two-way-communication-esp32/>

[13] MDPI(2021). Design and Implementation of Wireless Sensor Network Based on ESP-
NOW Protocol. Applied Sciences, 11 (12), 5374.<https://www.mdpi.com/2076-3417/
11/12/5374>

[14] Food and Agriculture Organization of the United Nations. Wireless Sensor Networks
for Agriculture.<https://www.fao.org/3/w7365e/w7365e04.htm>

[15] National Center for Biotechnology Information(2017). Wireless Sensor Networks: Ap-
plications in Agriculture. Journal of Animal Science and Biotechnology, 8 (47).

[16] Sustainable Agriculture Research and Education(2013). Systems Research for Agri-
culture.

[17] Indian Institute of Technology Kharagpur. Wireless Sensor Networks for Agriculture:
A Review.

[18] National Institute of Food and Agriculture. Agricultural Systems.<https://www.


nifa.usda.gov/topics/agricultural-systems>

[19] Corinne Bernstein. Smart Farming.<https://smartertechnologies.com/guides/


the-complete-guide-to-smart-agriculture-farming/>

[20] Smarter Technologies. The Complete Guide to Smart Agri-


culture (Farming).<https://smartertechnologies.com/guides/
the-complete-guide-to-smart-agriculture-farming/>

[21] VergeSense(2023). Wired vs. Wireless Sensors: A Comprehensive Compari-


son.<https://www.vergesense.com/occupancy-intelligence-collaborative/
industry-resources/wired-vs-wireless-sensors>

[22] Sensor Works(2017). Wireless Sensors Versus Wired Sensors. <https://www.


sensor-works.com/wireless-sensors-versus-wired-sensors/>

[23] SensorsONE. Wired Sensor Advantages and Wire-


less Sensor Disadvantages.<https://www.sensorsone.com/
wired-sensor-advantages-wireless-sensor-disadvantages/>

[24] Industrialization of Agriculture<https://foodsystemprimer.org/production/


industrialization-of-agriculture>

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 65/66


University of Technology, Ho Chi Minh City
Faculty of Computer Science and Engineering

[25] Agricultural revolution and industrialization.<https://www.sciencedirect.com/


science/article/abs/pii/S0304387822000529>

[26] National Center for Biotechnology Information(2008).


Cambridge University Press.<https://www.cambridge.org/core/
books/abs/cambridge-economic-history-of-modern-britain/
agriculture-during-the-industrial-revolution-17001850/
5DBC1F2D7CDDE24E0806D0C1602B68FB>

[27] Effects of the Agricultural Revolution <https://courses.


lumenlearning.com/suny-hccc-worldhistory2/chapter/
effects-of-the-agricultural-revolution/>

[28] Alexander S. Gillis internet of things (IoT) <https://www.techtarget.com/


iotagenda/definition/Internet-of-Things-IoT>

[29] TIMELINE OF AGRICULTURAL DEVELOPMENT <https://www.slideshare.


net/VizmaBramane/timeline-of-agricultural-development>

[30] HomeTechHacker MQTT With Home Assistant Us-


ing Docker and Mosquitto<https://hometechhacker.com/
mqtt-home-assistant-using-docker-eclipsemosquitto/fbclid=
IwAR0ywhqRLIS78ABDGNjg2nnRCioGHr5ss7UZI6npkBSIYXEFyfHBwF7yLZ0>

[31] Kamil Mysliwiec Nestjs<https://nestjs.com/>

[32] MQTT: The Standard for IoT Messaging<https://mqtt.org/>

[33] Build in a weekend Scale to millions <https://supabase.com/>

[34] Kamil Mysliwiec Nestjs Modules<https://docs.nestjs.com/modules>

[35] Supabase VS MongoDB <https://www.saashub.com/


compare-supabase-vs-mongodb>

[36] Rahul Malik Supabase or Firebase: which is the right tool


for your project in 2023? <https://www.linkedin.com/pulse/
supabase-firebase-which-right-tool-your-project-2023-rahul-malik>

[37] Firebase Introduction<https://www.geeksforgeeks.org/


firebase-introduction/>

COMPUTER ENGINEERING PROJECT - Academic year 2023-2024 Page 66/66

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy