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

Monitoring and management system for growing bulbs at home using ai

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

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

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Monitoring and Management System for Growing Bulbs at Home Using AI
Tác giả Nguyen Minh Duc
Người hướng dẫn Dr. Pham Ngoc Thanh
Trường học Vietnam National University, Hanoi International School
Chuyên ngành Major: [Major information not available in provided text]
Thể loại Graduation Project
Năm xuất bản 2024
Thành phố Hanoi
Định dạng
Số trang 34
Dung lượng 1,6 MB

Cấu trúc

  • Chapter 1: OVERVIEW OF THE SMART GARDEN SYSTEM (8)
    • 1.1 OVERVIEW OF SMART AGRICULTURE (8)
      • 1.1.1 Introduction to Smart Agriculture (8)
      • 1.1.2 Reasons for Choosing the Topic (9)
    • 1.2 OVERVIEW OF IOT (10)
      • 1.2.1 Definition (10)
      • 1.2.2 Concept of IoTS (10)
      • 1.2.3 IoT from a Technical Perspective (11)
      • 1.2.4 Basic Characteristics and High-Level Requirements of an IoT System (13)
        • 1.2.4.1 Basic Characteristics (13)
        • 1.2.4.2 High-Level Requirements of an IoT System (14)
      • 1.2.5 Model of an IoT System (15)
        • 1.2.5.1 Application Layer (15)
        • 1.2.5.2 Service Support and Application Support Layer (15)
        • 1.2.5.3. Network layer (16)
        • 1.2.5.4. Device layer (16)
    • 1.3 Overview of ESP8266 (16)
      • 1.3.1 ESP8266 (16)
        • 1.3.1.1 Pin Diagram & Block Diagram (17)
        • 1.3.1.2 Hardware Specifications (17)
    • 1.4 Overview of DHT11 (17)
      • 1.4.1 Concept (17)
      • 1.4.2 Features (17)
    • 1.5 Soil Moisture Sensor (18)
      • 1.5.1 Concept (18)
      • 1.5.2 Technical Specifications (18)
      • 1.5.3 Sensor Operating Principle (19)
      • 1.5.4 Module Operating Principle (19)
      • 1.5.5 Board Input/Output Ports (19)
      • 1.5.6 Board Operation (19)
      • 1.5.7 Applications (19)
    • 1.6 Relay (20)
      • 1.6.1 Concept (20)
      • 1.6.2 Classification (20)
      • 1.6.3 Technical Specifications of the Relay Module (20)
  • Chapter 2: CONNECTING AND CONTROLLING THE HARDWARE (21)
    • 2.1 Reading Signals from DHT22 (21)
      • 2.1.1 Block Diagram of Connecting ESP8266 with DHT11 (21)
      • 2.1.2 Flowchart for DHT11 Sensor Algorithm (21)
    • 2.2 Reading Signals from the Soil Moisture Sensor (21)
      • 2.2.1 Block Diagram of Connecting ESP8266 with the Soil Moisture Sensor (21)
      • 2.2.2 Flowchart for Soil Moisture Sensor Algorithm (21)
    • 2.3 Reading Signals from the Light Sensor (21)
      • 2.3.1 Block Diagram of Connecting ESP8266 with the Light Sensor (21)
      • 2.3.2 Flowchart for Light Sensor Algorithm (21)
    • 2.4 Overall System Connection Diagram (21)
      • 2.4.1 General Flowchart (21)
  • Chapter 3: AI in IoT and Smart Gardens (22)
    • 3.1 Overview of AIoT (22)
    • 3.2 AI in Smart Agriculture (22)
      • 3.2.1 Smart Agriculture Processes (23)
      • 3.2.2 CLASSIFICATION OF SMART AGRICULTURAL TECHNOLOGIES (24)
        • 3.2.2.1 Smart monitering (24)
        • 3.2.2.2 Smart water management (25)
        • 3.2.2.3 Disease Management (26)
    • 3.3 Smart Irrigation System (26)
      • 3.3.1 Classical Classification Model (27)
        • 3.3.1.1 Logistic regression (LR) (27)
        • 3.3.1.2 Support vector machine (SVM) (28)
      • 3.3.2 Convolutional Neural Network (CNN) (29)
      • 3.3.3 Evaluation Metrics (29)
    • 3.4 Result (30)
      • 3.4.1 Performance of Logistic Regression (30)
      • 3.4.2 Performance of Support Vector Machine (31)

Nội dung

Monitoring and management system for growing bulbs at home using ai Monitoring and management system for growing bulbs at home using ai

OVERVIEW OF THE SMART GARDEN SYSTEM

OVERVIEW OF SMART AGRICULTURE

In the era of Industry 4.0, the agricultural sector is known to be enhanced with significant investment in the experience and perspectives of farmers This sector faces the challenge of finding new methods to bring better efficiency to families and improve production The only way is to apply new technologies to existing production activities, especially IoT IoT is transforming agriculture into a sector of precise production, with specific focus on accurate data collection, aggregation, and statistical analysis.

Vietnam is a developing country with a strong reliance on agriculture This article aims to address the main benefits and development trends of countries like Vietnam in the process of applying IoT in agriculture.

1.1.2 Reasons for Choosing the Topic

❖ Agriculture: a fertile ground for IoT experimentation

From the past until now, agriculture has been one of the fields where IoT is most widely applied Especially for developing and underdeveloped countries, agriculture is closely tied to the economic experience of the farmer and the special characteristics of each cultivated area, soil, etc Therefore, productivity and yield will be higher when monitored and controlled by machines.

At the same time, in the face of challenges such as climate change and increasing population, ensuring stable productivity in agriculture is becoming increasingly difficult The agricultural sector is seeking new methods to bring better efficiency to families and improve production The only way is to apply new technologies to existing production activities, especially IoT.

This is also why IoT is a vital solution for the agricultural sector at present It will change how IoT is perceived and applied in various fields This is the reason why this is one of the areas receiving a lot of attention and chosen by many startups for investment.

❖ What does IoT bring to agriculture?

IoT will transform agriculture from a qualitative production sector into a precise production sector based on collected, aggregated, and statistically analyzed data. Instead of relying on weather, climate, etc., farmers can autonomously adjust everything to achieve the desired efficiency.

Increasing cultivation efficiency: Sensor systems and measurement devices will be interconnected, integrating GPS and camera systems to collect data, connect to satellites and cloud infrastructure for data retrieval, and analysis to make decisions optimizing water, fertilizer usage, automate daily agricultural activities, and provide real-time solutions As a result, nutritional conditions for crops will be optimized, ensuring the best growth efficiency.

Disease management: Minimizing disease is also a crucial factor in improving cultivation efficiency Additionally, there is a growing consumer trend towards organic products, prompting the agricultural sector to start seeking solutions to reduce crop diseases without using pesticides.

Consequently, IoT systems help monitor pest numbers, and when pest levels become too high, the system automatically interferes with their mating process to reduce reproduction Monitoring will also alert farmers to choose methods for manual,biological, or pesticide intervention.

OVERVIEW OF IOT

For the Internet of Things (IoT), this is a part of the system with the mandatory functions of communication and optional functions such as: sensing, executing, data collection, storage, and data processing.

It is a global infrastructure for the information society, providing advanced services by connecting "things" (both physical and virtual) based on existing and evolving information and communication technologies.

For the Internet of Things, a "Thing" is an object in the physical world (physical things) or the information world (virtual things) "Things" can be identified and integrated into communication networks.

IoT is considered a broad and deep vision of technology and life From a technical standard perspective, IoT can be seen as a global infrastructure for the information society, enabling advanced services by connecting "things." IoT is expected to integrate many new technologies, including existing technologies such as machine-to-machine communication, smart networks, data collection and decision-making systems, private and secure systems, and cloud computing In the past, information systems provided two-way communication - "Any TIME" and

"Any PLACE" communication Now, IoT has created a new dimension in information systems, which is "Any THING" Communication (connecting everything).1

In the IoT system, "Things" refer to objects in the physical world or virtual things.

"Things" can be identified and can be integrated into information networks "Things" relate to information, which can be static or dynamic "Physical Things" exist in the physical world and can be sensed, activated, and connected For example, "Physical Things" include the surrounding environment, industrial robots, goods, or electrical devices "Virtual Things" exist in the world of information and have the ability to store, process, and access data For instance, "Virtual Things" include content such as media and application software.

As mentioned in section 1.1, "Things" in IoT can be physical objects or virtual objects These objects can be mapped to the physical or virtual world One of the most widely presented concepts is that information objects can interact with physical objects.

Figure 1.2: IoT system from a technical perspective

In figure 1.2, a "device" is a part of the IoT system The mandatory function of each device is communication, and the mandatory functions include sensing, collecting, storing, processing data, or handling data Devices that collect information at different levels provide that information to a network where the information is processed Some devices perform direct actions based on received information.

Device-to-device communication is implemented There are three types of device-to-device communication interfaces:

(a) Devices communicate through connected network layers like a gateway, or (b) Devices communicate through unconnected network layers without a gateway, or (c) Devices communicate directly without any network layer.

In figure 1.2, the only interaction is between Physical Things (direct device-to-device communication) However, there are other types of interactions that are also implemented These are Virtual Things interactions (interactions between virtual things), and interactions between Physical Things and Virtual Things.

IoT applications are diverse, such as "smart transportation systems," "smart power grids," "smart health," and "smart homes." These applications can be implemented on a small scale or can be built on a larger, more general scale, such as in monitoring, theoretical analysis, estimation, and computation.

"Communication networks" transfer data collected from devices to data-using devices, such as gateways, storage devices, or networks, which then send commands from applications to devices The role of communication networks is to transmit data effectively and reliably.

Figure 1.3: Different types of devices and their relationships

The basic requirement of an IoT "device" is its communication capability Devices are classified into data-carrying devices, data-capturing devices, sensing/actuating devices, and general devices:

● Data carrying device: A device that carries information integrated into a physical thing to simplify the connection between physical things and communication networks.

● Data capturing device: A device that collects data from the environment or has the ability to interact with physical things These devices collect information and send it directly to communication networks or other physical things.

● Sensing/actuating device: A device that senses the environment or performs actions based on received information.

In this figure, the relationship between physical things and communication networks is highlighted, showing how different types of devices interact and communicate.

Sensing devices and actuators (Thiết bị cảm ứng và thiết bị thực thi)

● A sensing device and actuator can detect or measure information related to the surrounding environment and convert it into a digital signal It can also convert digital signals from networks into actions (such as turning lights on/off, sounding alarms, etc.) In general, sensing devices and actuators together form a local network that communicates with each other using wired or wireless communication technologies and gateways.

● A general device has been integrated with networks via wired or wireless networks General devices include various devices used in different domains of IoT, such as machinery, household electrical equipment, and smartphones.

1.2.4 Basic Characteristics and High-Level Requirements of an IoT System

The basic properties of IoT include [1], [2];

● Interconnectivity: With IoT, anything can be connected to each other through information networks and the overall communication infrastructure.

● Services related to "Things": The IoT system is capable of providing services related to "Things", such as protecting privacy and consistency between Physical Things and Virtual Things To provide this service, both hardware and information technology (software) will have to change.

● Heterogeneity: Devices in IoT are heterogeneous because they have different hardware and different networks Devices between networks can interact with each other thanks to the interconnection of networks.

● Dynamic change:The status of devices automatically changes, for example, sleeping and waking up, connected or disconnected, device position has changed, and speed has changed Moreover, the number of devices can change automatically.

● Large scale: There will be a very large number of devices that need to be managed and communicated with each other This number is much larger than the number of computers currently connected to the Internet The amount of information transmitted by devices will be much larger than that transmitted by humans.

1.2.4.2 High-Level Requirements of an IoT System

An IoT system must meet the following requirements:

Overview of ESP8266

ESP8266 is a chip that integrates 2.4GHz Wi-Fi, can be programmed, and is initially manufactured by a leading Chinese company: Espressif Systems.

It was first released in August 2014, packaged and brought to market in the ESP-01

Wi-Fi in a very fast way and use the accompanying components With the above features, it is not surprising that the ESP8266 chip has become very popular.

ESP8266 has a large community of developers, providing many programming modules that help users easily access and build applications.

Currently, all ESP8266 chips on the market are labeled ESP8266EX, which is an upgraded version of ESP8266.

1.3.1.1 Pin Diagram & Block Diagram image

● 32-bit RISC CPU: Tensilica Xtensa LX106 running at 80 MHz

● External flash support from 512KiB to 4MiB

● Complies with IEEE 802.11 b/g/n, Wi-Fi 2.4 GHz Integrated TR switch, balun, LNA, power amplifier, and matching network Supports WEP,

WPA/WPA2, and Open network

● Supports SDIO 2.0, UART, SPI, I2C, PWM, I2S with DMA

Overview of DHT11

DHT11 is a sensor that measures temperature and humidity, providing data at a very low cost and is very easy to use through a single-wire interface (1-wire digital signal transmission) The sensor's data signal is processed and transmitted with high precision, so it does not require additional calibration.

● Humidity range: 20% - 90% RH, accuracy ±5%RH

● Sampling rate: 1Hz (1 reading per second)

● Currently, the DHT11 sensor has 2 power supply pins, 1 data pin, and 1 ground pin There is also an external version with 3 pins See below.

Note: The DHT11 temperature and humidity sensor is affordable, easy to use, and suitable for applications that do not require high accuracy and are not in harsh environments Note: The DHT11 temperature and humidity sensor is affordable, easy to use, and suitable for applications that do not require high accuracy and are not in harsh environments.

The DHT11 sends and receives data using a single-wire DATA signal, with the data transmission standard on a single wire We must ensure that the idle mode (idle) of the DATA pin is at a high value, and inside the DHT11, the DATA pin must be pulled up with a resistor (usually a 4.7kΩ resistor).

The data transmitted and received by the DHT11 is 40 bits of data, including 16 bits for humidity, 16 bits for temperature, and 8 bits for the checksum The 16-bit humidity data is divided into two 8-bit integers and an 8-bit decimal part Similarly, the 16-bit temperature data is divided into two 8-bit integers and an 8-bit decimal part.

For example, we receive 40 bits of data as follows:

8-bit checksum: 0011 0101 + 0000 0000 + 0001 1000 + 0000 0000 = 0100 1101 Humidity: 0011 0101 = 35H = 53% (no decimal part, so the decimal part is 0000

Temperature: 0001 1000 = 18H = 24°C (no decimal part, so the decimal part is 0000

Soil Moisture Sensor

It is a sensor that can accurately measure soil moisture It is used in smart garden projects with an automatic irrigation system when there is no human supervision. This sensor can detect soil moisture levels and can be adjusted The probe is inserted into the soil to detect soil moisture levels When the soil moisture level exceeds the set threshold, the DO pin switches to a low state.

Power indicator LED, moisture detection LED

DO: Digital output signal (0 and 1)

AO: Analog output signal (analog signal)

The absorption of moisture (water vapor) changes the composition of the sensor, causing the sensor's resistance to change through the determined conductive wires (such as scientific materials like LiCl, P2O5).

The soil moisture module consists of a soil moisture sensor and a signal processing board.

The soil moisture sensor is inserted into the soil to measure moisture levels.

2 pins for VCC and GND to power the circuit

2 output pins: DO and AO

When powered on, the power indicator LED lights up.

The circuit has 2 outputs: DO (digital output) and AO (analog output).

The board integrates a voltage divider circuit and a comparator circuit using an operational amplifier (op-amp).

The voltage divider circuit converts the analog signal from the sensor into a signal for the comparator circuit and the analog output pin.

The comparator circuit compares the signal and outputs a logical value (1 or 0) to the digital output The board also has 2 LEDs: one for power indication and one for status indication.

At the digital output pin: The circuit works as follows: The threshold is set by the potentiometer on the comparator The sensor's resistance varies with soil moisture levels, causing the voltage across the sensor to change When the soil moisture level is below the threshold, the voltage is low, and the comparator outputs a low signal

(0), turning off the status LED When the soil moisture level exceeds the threshold, the voltage is high, and the comparator outputs a high signal (1), turning on the status LED.

At the analog output pin: The circuit outputs an analog signal that varies with soil moisture levels, directly proportional to the voltage across the sensor This signal can be used for monitoring, measurement, and other applications.

The soil moisture sensor module has two outputs, DO and AO, for different control purposes, depending on the project's needs.

The soil moisture sensor module is suitable for environmental monitoring projects, agriculture, etc.

Instructions for using the soil moisture sensor module to make an automatic irrigation system You need to prepare the following modules and devices:

Working principle of the automatic irrigation system using the soil moisture sensor module:

When the soil is dry, the sensor module outputs a high signal (DO = 1) The relay module does not activate the pump When the soil is wet, the sensor module outputs a low signal (DO = 0), and the relay module activates the pump.

Relay

A relay is a type of switch (K switch) Unlike a basic switch that is manually operated, a relay is electrically operated Therefore, a relay is used as an electrical switch A relay has two states: closed and open.

Generally, there are two types of relay modules: low-level trigger relay modules (the relay is activated when the signal pin is low) and high-level trigger relay modules (the relay is activated when the signal pin is high) If you are unsure which type of relay module you have, you can distinguish them by examining the transistors on the module Typically, the transistors on the module differ in their placement or type. Specifically, there are two types of transistors: NPN (used in low-level trigger) and PNP (used in high-level trigger).

How to identify which type of relay module you have? Search the transistor type on Google to determine the relay module type: if it's an NPN transistor, it's a high-level trigger relay module; if it's a PNP transistor, it's a low-level trigger relay module.

1.6.3 Technical Specifications of the Relay Module

A relay module consists of two main components: a mechanical relay and a transistor, so the relay module has the following specifications To put it simply, different methods can be used to list the specifications as shown below The efficiency is optimal For instance, you can use a relay module to turn on a 220V light bulb when a sensor detects light levels between 5-12V The relay module operates at 5V (5 volts) or 12V (12 volts) for high or low-level triggers The sensor will send a signal to the relay module to activate or deactivate the connected device.

CONNECTING AND CONTROLLING THE HARDWARE

Reading Signals from DHT22

2.1.1 Block Diagram of Connecting ESP8266 with DHT11

2.1.2 Flowchart for DHT11 Sensor Algorithm

Reading Signals from the Soil Moisture Sensor

2.2.1 Block Diagram of Connecting ESP8266 with the Soil Moisture

Figure 2.2: Soil Moisture Sensor Connecting Esp8266

2.2.2 Flowchart for Soil Moisture Sensor Algorithm

Reading Signals from the Light Sensor

2.3.1 Block Diagram of Connecting ESP8266 with the Light Sensor

2.3.2 Flowchart for Light Sensor Algorithm

Overall System Connection Diagram

Figure 2.3: Overall System Connection Diagram

AI in IoT and Smart Gardens

Overview of AIoT

The integration of Artificial Intelligence (AI) and the Internet of Things (IoT) has recently sparked transformative changes across various industries, redefining the technological and innovative landscape One area where this synergy shows immense promise is in architecture, engineering, and construction The adoption of AI and IoT-based sensors within the AEC sector heralds a new era, offering unprecedented abilities to monitor, control, and optimize processes.

Figure 3.1: Block diagram showing disease detection and identification system using

AI in Smart Agriculture

A domain where this convergence holds great potential is agriculture, especially in the development of Smart Gardens The infusion of AI and IoT-based sensors in agriculture signals a new era, providing unparalleled capabilities for monitoring, controlling, and optimizing agricultural processes.

Smart Gardens, powered by AI and IoT, exemplify this transformation These advanced systems utilize IoT sensors to collect real-time data on soil moisture, temperature, light levels, and plant health AI algorithms then analyze this data to make informed decisions, such as adjusting irrigation schedules, optimizing nutrient delivery, and predicting pest outbreaks This intelligent approach not only enhances crop yields but also promotes sustainable farming practices by minimizing water usage and reducing the need for chemical interventions.

Furthermore, AI-driven predictive analytics can forecast weather patterns and recommend the best planting and harvesting times, ensuring optimal growth conditions By integrating AI and IoT, farmers gain a comprehensive understanding of their crops' needs, enabling them to respond proactively to any issues that arise.

In summary, the convergence of AI and IoT in agriculture, particularly through innovations like Smart Gardens, is revolutionizing the way we approach farming. These technologies offer unprecedented insights and control, paving the way for more efficient, sustainable, and productive agricultural practices.

The processes involved in smart agriculture from collecting data to applying decisions are visualized in Fig 5 and described below:

Figure 3.2: Block diagram showing smart agriculture processes.

● Data Collection: Sensors placed on different parts of the field and farm collect data about soil condition, crop condition, humidity, temperature, weather, cattle health etc and send it to the servers using wired or wireless technology.

● Data Diagnosis: The data from sensors are kept in a cloud-hosted IoT server for further analysis The analysis process checks the data using a predefined model and decision rules to identify any defects and needs.

● Decisions: Based on the data analysis, use of machine learning algorithms and/or manual user commands, the IoT system determines what actions are to be taken.

● Action: The actions identified in the decision-making step are executed manually or automatically In this way, the cycle/process continues as the new measurement is taken This process can be done with or without any human intervention The process is highly efficient, precise, and controlled so that it saves a considerable amount of resources and increases high-quality production.

3.2.2 CLASSIFICATION OF SMART AGRICULTURAL TECHNOLOGIES

Based on applications and services provided by IoT devices, Smart Agriculture technology can be divided into five categories

Figure 3.3: Classification of smart agriculture technologies.

Smart monitoring enables farmers to monitor agricultural systems to ensure better agricultural quality products A 24-hour remote surveillance of the agricultural fields and farms helps to identify possible defects and flaws in an area. This monitoring system detects the changes in the environment and informs the farmers about the situation along with the way to handle it It was proposed that a smart monitoring agricultural design which is shown in fig ?

Figure 3.4: Schematic diagram showing smart monitoring system.

The design shows that by using sensor data, the internet, web services, and database, farmers can continuously monitor their crops and livestock Environmental monitoring technology monitors the environmental variables and field conditions to maintain the crop-developing environment in an optimal status [22] Various factors such as temperature, humidity, soil and water content etc are monitored continuously to facilitate maintaining a proper environment for crop growth and development.

IoT can be utilized to improve water resource management and produce more efficient as well as optimum outcomes Water resources management is very important because it is responsible for increasing crop yields and decreasing costs By implementing smart water management techniques, farmers can make efficient use of water resources and maintain sustainability in the long run In the present context, many technologies are available for water management purposes Some of them are as follows:

● Smart Irrigation: Weather and soil moisture data are used by smart irrigation technology to identify the need for water on the field By implementing smart irrigation technology water wastage can be reduced and plant health and quality can be preserved It was also proposed that a smart irrigation system as shown in Fig

● Water quality and pressure monitoring techniques: help us to know about the physical and chemical composition of water It also facilitates identifying the water leaks and breaks in an irrigation system [7] This will reduce the cost and make efficient use of water resources for higher crop yield.

Figure 3.5: Block diagram showing smart irrigation system.

Diseases in crops and livestock are one of the major causes of the decrease in production It affects the yield rate in crop farming and animal products in livestock farming The use of IoT in disease management will allow farmers to precisely detect, identify and prevent diseases as soon as possible which will directly or indirectly help in production rate, cost minimization, and early prevention from the spreading of diseases.

Figure 3.6: Block diagram showing the implementation of IoT and AI in smart agriculture.

How to Detection, Identification and Prevention of Diseases in garden? IoT devices along with AI-trained models can be used to precisely detect, identify and prevent the spread of diseases in agricultural lands and farms Fig 6 shows the simple process of disease management technology The data collected from the sensors are sent to the servers via the Internet The data are of different types and can be used for different purposes The image data can be used by AI technologies such as Computer Vision, Convolutional Neural Networks, and Support Vector Machines etc to classify images into healthy or infected categories as well as suggest preventive measures based on the classification These results are sent to farmers' web portals or mobile devices to alert them about the diseases and their preventive measures Such technology will help in increasing production because machines can identify and detect such diseases with higher accuracy than human beings

Smart Irrigation System

Water loss and improper scheduling are problems with traditional irrigation techniques, making it difficult to meet the growing demand for food production paper introduces a cutting-edge smart irrigation system that leverages the power of the Internet of Things (IoT), data analysis, and machine learning to determine the most efficient way to apply and schedule water for irrigation The cornerstone of this innovative system is the utilization of a carefully curated dataset, "Crop Irrigation Scheduling," sourced from Kaggle This dataset comprises six crucial attributes: Crop Type, Crop Days, Soil Moisture, Temperature, Humidity, and

Irrigation These attributes, described in detail in the dataset's metadata, provide the foundational information required for precise irrigation management The system operates seamlessly by deploying IoT sensors to collect real-time data from the field This data is then preprocessed to ensure its quality and consistency.

Subsequently, a machine learning model is trained using this dataset to make intelligent irrigation decisions in real time The model's predictions are seamlessly integrated with control mechanisms that govern the irrigation process.

Figure 3.7: Crop Irrigation Scheduling dataset

In this instance, the LR is used to classify data that is generated depending on whether the smart irrigation equipment is turned "ON" or "OFF." Since the LR technique uses supervised learning, labels are given for

"ON = 1" and "OFF = 0" Either our dependent or target class is "ON" or it is "OFF." The variables that are independent are SM, T, H, and t.

Taking 𝜋as the probability of the event occurring, the L R model is therefore represented as:

1+𝑒 2 where𝑧= 𝛽0 +𝛽1𝑥1 +⋯+𝛽𝑛𝑥𝑛 and 𝛽0,𝛽1 …𝛽𝑛are model parameters (estimators).

In our case, 𝑌represents the outcome of our prediction (ON or OFF).𝑋1,𝑋2,…,𝑋𝑛 are a set of n explanatory variables (SM, T, H and t) (Bhowmik et al., 2011)

Both separable and non-separable instances can be handled by the linear SVM In our case, the radial basis function, or "RBF," was employed as the default kernel.

The following illustration shows a two-dimensional data set that can be divided along a line:

(4) γ = α𝑥 + 𝑏 if𝑦 = , and𝑥 𝑥 = , the we get:

Based on the hyperplane, we can make predictions using the hypothesis function (h), defined as:

Therefore, any point above the hyperplane will be classified as +1 class, whereas any point below the hyperplane will be considered as -1 class (Fan, 2018).

The CNN (Krizhevsky et al., 2017) is used in this work since it has been demonstrated in literature to be one of the most often used artificial neural networks. The objective of this experiment is to use CNN to categorize IoT-smart irrigation data according to whether the device is "ON" or "OFF." The first class is denoted by the number 1 for "ON," and the second class, "class 0," is denoted by the number 0 for

"OFF." The following steps illustrate the CNN setup used in this

1 The dataset described in 3.1 is used

2 The sequential model “sequential ( )” is used as the first layer due to the fact that we are using linear stack of layers

3 The model added the first hidden layer with 4 input parameters, and 480 neurons. The rectified linear activation function (ReLu) is first chosen due to its ability to achieve higher performance

4 Additional two dense layers are added with 240, and 120 neurons, respectively

5 The model is ended with a dense layer, no activation, and a sigmoid activation function The sigmoid activation function is chosen because we are considering a binary classification (ON or OFF) and the sigmoid activation function best fits our case in order to acquire our score

6 Our compiled model is done using the binary cross entropy, the Adam optimizer, and accuracy.

7 The training data of X, training data of Y are fit to our model using 1000 epochs, and a batch size of 128 The test data of X, and test data of Y are validated as well using the same epochs and batch size.

Based on the above setup, the results achieved are presented in Section 3.4.

To evaluate the proposed approach, the following evaluation measures are used: i Accuracy: Expressed mathematically as:

Accuracy = (𝑇𝑃 + 𝑇𝑁 + 𝐹𝑃 + 𝐹𝑁)(𝑇𝑃 + 𝑇𝑁) (8) ii Precision: Expressed mathematically as:

Precision = (𝑇𝑃 + 𝐹𝑃) (𝑇𝑃) (9) iii Recall: Expressed mathematically as:

(𝑇𝑃 + 𝐹𝑁) iv F1-Score: Expressed mathematically expressed as:

True Positive (TP): The outcome of the developed model correctly predicts the positive class.

True Negative (TN): The outcome where the negative class is correctly predicted by the developed model.

False Positive (FP): The outcome

Result

To classify data from IoT-enabled smart irrigation devices, four algorithms were used (LR, RF, SVM, and CNN) Based on the information produced by the IoT smart irrigation system, the machine learning algorithms were able to divide the dataset into two classes Class 0 (information while the smart irrigation pump is off) and Class 1 (data when the smart irrigation pump is ON) The data (100,000 rows) are divided at random into 70% training and 30% testing, with the results displayed and discussed.

The pre-processed IoT-enabled smart irrigation data given are supplied into the LR algorithm As can be seen in Figure 3.8, the logistic regression technique achieved 71.76% accuracy, 0.7155 F1 score, 0.7303 precision value, and 0.7501 recall, respectively.

Figure 3.8 Results of Logistic Regression Again, Figure 3.9 shows the result of the confusion matrix for the LR algorithm The

LR algorithm correctly classified 9469 as class 0 (OFF) and wrongly classified 4454 samples of class 0 as class 1 (ON) Furthermore, the LR algorithm correctly classified

12059 samples of class 1 (ON), and wrongly classified 4018 samples of class 1 as class 0 (OFF).

Figure 3.9: Confusion Matrix for Logistic Regression

3.4.2 Performance of Support Vector Machine

As shown in Figure 3.10, the Support Vector Machine (SVM) algorithm achieved 90.21% Accuracy, 0.9014 F1 scores, 0.9019 Precision value, and 0.9170 Recall.

Figure 3.10: Support Vector Machine ResultsAgain, the confusion matrix for the SVM shows that it correctly classified 12319 samples as class 0 (OFF) and wrongly classified 1604 samples of class 0 as class 1(ON) Furthermore, the SVM algorithm correctly classified 14743 samples of class 1(ON), and wrongly classified 1334 samples of class 1 as class 0 (OFF) as seen inFigure 3.11.

Figure 3.11: Confusion Matrix for Support Vector Machine This further proves that our proposed method can effectively be applicable for the separability of smart irrigation IoT data using SVM with a high accuracy of 90.21%.

3.4.3 Performance of Convolution Neural Network

The Convolutional Neural Network (CNN) algorithm achieved an accuracy of

0.9823, precision of 0.98, recall of 0.98, and F1 score of 0.98 Furthermore, the training loss vs the epochs for the CNN classification of the IoT-enabled dataset is presented in Figure 3.12.

Figure 3.12 Training Loss Vs Epochs for the CNN Generally, when the Loss Vs Epochs graph is taken into account, lower Loss values result in a good performance Figure 3.12 shows that the graph was more consistent for the train datasets The Loss values got closer to zero as the number of Epochs tends towards 1000 Additionally, as Epoch values tend towards 1000, the Loss values tend more towards zero (0) for the validation dataset Once more, while

3.15, it can be seen that the accuracies for the train dataset and test dataset were over 0.98 when the epochs were closer to 1000.

Figure 3.15: Training Accuracy Vs Epochs for the CNN This demonstrates that for this experiment, epochs of over 1000 were well suited for the effective classification of IoT enabled data The confusion matrix is shown in Figure 3.16 to clearly demonstrate the number of samples that were classified using CNN based on the "ON" or "OFF" of the smart irrigation device.

Figure 3.16: Confusion Matrix for the CNN

It can be seen from Figure 3.16 that the CNN algorithm correctly classified 0.98 (98%) samples as class 0 (OFF) and wrongly classified 0.02 (2%) samples of class 0 as class 1 (ON) Furthermore, the CNN algorithm correctly classified 0.98 (98%) samples of class 1 (ON), and wrongly classified 0.02 (2%) samples of class 1 as class

0 (OFF) With an accuracy of up to 98% shown in the confusion matrix, it proved

Ngày đăng: 21/11/2024, 21:20

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

TÀI LIỆU LIÊN QUAN