1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Design and implementation of a robot for environment monitoring

97 10 0

Đ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 đề Design and Implementation of a Robot for Environment Monitoring
Tác giả Nguyen Ngoc Tu, Do Quang Vinh Truong
Người hướng dẫn M.Eng Truong Quang Phuc
Trường học Ho Chi Minh City University of Technology and Education
Chuyên ngành Computer Engineering Technology
Thể loại Graduation Project
Năm xuất bản 2023
Thành phố Ho Chi Minh City
Định dạng
Số trang 97
Dung lượng 6,54 MB

Cấu trúc

  • CHAPTER 1: OVERVIEW (14)
    • 1.1 Introduction (14)
    • 1.2 Objective (15)
    • 1.3 Related Work (15)
    • 1.4 Research Method (16)
    • 1.5 Scope of the study (17)
    • 1.6 Outline (17)
  • CHAPTER 2 BACKGROUND (19)
    • 2.1 The overview of ROBOT (19)
      • 2.1.1 Introduction about ROBOT (19)
      • 2.1.2 The fundamental architecture of an ROBOT system (20)
    • 2.2 PYQT5 Platform (22)
    • 2.3 Firebase (23)
      • 2.3.1 Introduction about Firebase (23)
      • 2.3.2 Some features of Firebase (24)
    • 2.4 Other techniques used in the project (25)
      • 2.4.1 Working Principle of GPS Navigation Circuit (25)
      • 2.4.2 Pulse Width Modulation (PWM) (26)
      • 2.4.3 Working Principle of HMC5883L in ROBOT (27)
      • 2.4.7 The Central Processing Block (28)
      • 2.4.4 General Operating Principles of ROBOT (29)
      • 2.4.5 Robot GPS Outdoor Localization (30)
      • 2.4.6 The Output of ROBOT System (31)
      • 2.4.8 Ultrasonic Sensor HC-SR05 (33)
      • 2.4.9 The Power Supply of ROBOT System (35)
      • 2.4.10 Inter-Integrated Circuit (I2C) (36)
      • 2.4.11 Universal Asynchronous Receiver / Transmitter (UART) (40)
  • CHAPTER 3: DESIGN AND IMPLEMENTATION (43)
    • 3.1 System Requirements (43)
    • 3.2 Block Diagram (43)
    • 3.3 ROBOT System (45)
      • 3.3.1 Mechanical Design (45)
      • 3.3.2 Detail hardware design (49)
      • 3.3.3 The schematic diagram of ROBOT system (50)
      • 3.3.5 Detail software design (57)
        • 3.3.5.1 General flowchart of the ROBOT system (58)
        • 3.3.5.2 Functionality flowchart of the system (61)
    • 3.4 User Application System (62)
      • 3.4.1 User Interface Design (63)
      • 3.4.2 Database design (64)
      • 3.4.3 Detail Software Design (65)
        • 3.4.3.1 Block diagram (65)
        • 3.4.3.2 General flowchart of the application system (66)
        • 3.4.3.3 Firebase data communication (69)
  • CHAPTER 4: RESULT (72)
    • 4.1 Introduction (72)
    • 4.2 hardware implementation (72)
    • 4.3 System Operation (75)
    • 4.4 Software System (82)
    • 4.5 evaluation and comparison (91)
  • CHAPTER 5: CONCLUSION AND FUTURE WORK (92)
    • 5.1 Conclusion (92)
    • 5.1 Future Work (0)

Nội dung

OVERVIEW

Introduction

The Internet of Things (IoT) is a significant global technology trend that greatly impacts various industries, particularly modern agriculture IoT enhances productivity and quality while minimizing resource costs by collecting, converting, and analyzing critical agricultural data With the increasing global food demand and the shrinking of agricultural land due to poor farming practices and climate change, IoT applications enable farmers to monitor and manage their farms in real time These applications facilitate disease recognition, crop growth tracking, and data collection, allowing for immediate problem identification Furthermore, agricultural IoT automates processes such as irrigation, fertilization, and harvesting, thereby reducing labor and saving time Embedded systems, which combine IoT technology with devices, play a crucial role in the agricultural sector by providing features like remote monitoring and process optimization, ultimately increasing productivity and resource efficiency Key components include sensors, control devices, network connections, and user interfaces, tailored to specific system requirements.

The integration of robotics in agriculture is gaining global attention, particularly in Vietnam, where agriculture plays a crucial role in the economy The Vietnamese government is actively promoting smart agriculture to address labor shortages and enhance the quality of agricultural products Since their inception in 1961, robots have become essential in industrial settings, significantly benefiting enterprises, factories, and production systems.

The configuration of the work environment for specific tasks, combined with training robots to function in low-volatility settings, is crucial for effective automation Agriculture has historically seen limited advancements in robotics, despite early initiatives in the 1960s that introduced automated systems and tractors, paving the way for unmanned equipment in forestry and farming.

Objective

In this project, our objective is to research, construct, and implement an automated environmental monitoring system employing GPS-based positioning robots The project entails the following steps:

➢ Firstly, we will develop software capable of displaying environmental index information, providing real-time control, and locate the robot position

➢ Secondly, we will establish a connection between the sensors and Firebase, enabling the transmission of data through Wi-Fi technology to the monitoring device

We will develop an algorithm that leverages the GPS module and digital compass sensor to determine coordinates and angles from the starting point to the destination Furthermore, we will connect the ESP32 microcontroller with the relevant devices and sensors.

Related Work

A mobile system for environmental monitoring has been developed to address challenges in navigation and the transfer of environmental indices This system comprises two subsystems: a ROBOT system that collects environmental data, transmits GPS locations, and provides bearing angles to the tracking system.

The tracking system utilizes GPS coordinates from satellites to determine the vehicle's location and calculates the bearing angle to its intended destination Additionally, a magnetometer is installed on the vehicle to monitor its heading angle, ensuring accurate navigation This information is then transmitted to the relevant systems for further processing.

3 tracking system via Wi-Fi, which is deployed commonly within vast areas like agriculture and farming

The monitoring system is designed for mobile devices, allowing for remote control of electronic components like DC motors and drivers By connecting to the internet, users can access and manage recorded data from anywhere, while the graphical user interface (GUI) presents real-time information about the vehicle on the screen.

The application system, designed for the Windows operating system, provides real-time monitoring of temperature and humidity Users can easily set customizable alert thresholds and receive notifications, while also having the ability to control vehicle actions, including stopping and moving the vehicle as needed.

The system utilizes three key indices—GPS coordinates, temperature, and humidity—collected from sensors to analyze and predict weather conditions and climate change in a specific region By integrating additional sensors to monitor more environmental factors, the system can enhance its accuracy and provide more reliable forecasting results.

In [8], collected information is stored in a local database, ensuring permanent storage and ample space for data analysis and processing A real-time database functions as a cloud server, facilitating the transfer of information and signals between the application and the ROBOT system, while noting that data on Firebase is temporarily stored and requires internet access for retrieval.

Research Method

Research methods help shape and as well as approach and conduct research accurately, reliably, and objectively Our research methods include:

➢ Analyze the energy efficiency, processing speed, and performance of the IoT system, calculate the speed and scope of data communication on the robot

➢ Learn and design a mathematical method to calculate the orientation of the vehicle and solve obstacle avoidance problem

➢ Test the product on environment with different temperature, and humidity And analyze the power consumption of the system

Scope of the study

This project focuses on developing a ROBOT system controlled by a PyQt5 application, which includes features for data logging, position tracking, and alerts based on predefined thresholds.

• The vehicle is conducted to run and test on plain fields, which require exposure to outdoor space to ignore the impact of inaccurate result of GPS coordinates

• A real-time database on Firebase is used to establish the communication between the vehicle and the application

The navigation of the robot is achieved through a combination of the HMC5883L sensor and a GPS module, which work together to calculate the vehicle's direction These calculations enable the robot to make precise turns, either left or right, at specified angles.

• The monitoring process of the robot is obtained by receiving DHT11 sensor, the result will be pushed on Firebase for the application to receive and analyze.

Outline

This report is structured into five chapters to enhance reader comprehension and facilitate a clear understanding of the report's progression Each chapter focuses on distinct topics, including hardware and software knowledge, methodology, implementation, and testing results.

Chapter 1: A summary of the subject, the goals of the study, the project's scope, and its organization

Chapter 2: Background This chapter focuses on relevant ideas, such as understanding of the communication protocol, the way to communicate with GPS module, magnetometer, monitoring sensors like DHT11, and driving motors

Chapter 3: Design and implementation The system model, comprising the block diagram and the operational concept of the system, will be presented in depth in this chapter The system will next be designed, with a connection diagram showing which electronic module, and module-to-component connections should be made to attain the

5 best efficiency Lastly, implement the system's hardware and software construction based on flowchart and algorithm design

Chapter 4: Result In addition to commenting on and evaluating the theory offered in previous theory chapters, this chapter will present the efficiency of the system

Chapter 5: Conclusion and future work In order to provide answers and new development paths for the subject, this chapter analyzes what has already been done, identifies its limits, and assesses the system

BACKGROUND

The overview of ROBOT

Automated Guided Vehicles (ROBOTs) are advanced automated systems designed to transport products within industrial and agricultural settings without human intervention In our project, we aim to develop a ROBOT system that functions autonomously, specifically as an automatic vehicle responsible for delivering measuring sensors to designated areas for environmental data collection The block diagram of the ROBOT system is illustrated in Figure 2.1.

The plain environment, characterized by vast flat lands ideal for agriculture, features a consistent elevation and minimal topographical variation Consequently, the design of ROBOT vehicles must focus on facilitating smooth movement across terrain with few obstacles or challenges.

The ROBOT vehicle will be equipped with essential sensors, including the HC-SR05 ultrasonic sensor for obstacle detection, the GPS-GY-NEO6MV2 for navigation, and the HMC5883L digital compass for precise positioning Additionally, it will feature a control system along with moving components such as wheels, a DC motor, and the L298N motor driver, enabling efficient navigation and movement.

2.1.2 The fundamental architecture of an ROBOT system

In a straightforward environment, robots are utilized to transport environmental sensors to designated measurement locations A robot is composed of a vehicle, an integrated controller, management software, and a navigational communication system.

Figure2 2: The basic structure of an ROBOT system

Effective management software is crucial for overseeing all ROBOTs, ensuring optimal utilization and real-time updates of environmental parameters The server is responsible for determining and storing the coordinates of both the current location and intended destinations Since ROBOT movements are pre-programmed, they primarily require destination coordinates, allowing navigation systems to guide the ROBOT to its target The speed of the ROBOT is influenced by the terrain, necessitating precise speed adjustments to maintain the correct trajectory, avoid obstacles, and ensure timely execution of additional tasks without collisions.

Communication system includes communication between the host and robots

The integration of wireless network technology in robotic systems has become increasingly prevalent, with the ESP32 board playing a crucial role This board features a built-in Wi-Fi module, making it a popular choice for Internet of Things (IoT) projects, as it enables seamless connectivity and communication between devices over Wi-Fi networks.

The ESP32 module offers versatile WIFI capabilities, including station mode, soft AP (Access Point) mode, and the ability to operate in both modes simultaneously This functionality enables the ESP32 to connect to various internet networks as a client or to establish its own WIFI network for other devices to join.

To utilize the ESP32's WiFi features, it is essential to include the WiFi library in your code The ESP-IDF (Espressif IoT Development Framework) offers a range of functions and APIs for WiFi management, including network scanning, connecting to networks with credentials, retrieving IP addresses, and troubleshooting connection issues such as disconnections and reconnections.

PYQT5 Platform

QT Designer is a powerful software application that enables users to quickly create visual interfaces using the Qt graphical user interface framework With its intuitive drag-and-drop functionality, users can easily arrange various components such as buttons, input fields, containers, and widgets.

Figure2 3: Inference of Qt Designer Software

Qt Designer generates ui files, which utilize a distinct XML-based format to organize widgets in a tree structure These files can be loaded during runtime or converted into programming languages like C++ or Python.

PyQt5 is a robust Python framework designed for creating cross-platform desktop applications with graphical user interfaces (GUIs) As a Python binding for the Qt application framework, it provides essential features like buttons, menus, dialogs, layout management, and event handling Its cross-platform compatibility, seamless integration with Qt Designer, signal and slot mechanism, and Pythonic API contribute to its popularity in Python GUI development Notably, the QMainWindow component is one of the standout features of PyQt5, enhancing the user experience in desktop applications.

The QMainWindow class is a crucial component of the Qt framework, including PyQt5, used for developing desktop applications It serves as a container for various widgets and includes essential features such as a menu bar, toolbar, and status bar, facilitating a well-organized layout for application development.

QMainWindow is the primary interface for managing application components and navigation, acting as the top-level window that organizes various elements effectively.

Firebase

Firebase is a cloud-based API service by Google that facilitates data storage and synchronization across multiple devices It accelerates application development by simplifying database operations, making it an essential tool for developers looking to create efficient and scalable apps.

Firebase offers a cloud-based real-time database utilizing a NoSQL model, allowing for seamless synchronization with client devices and storing data in JSON format By integrating with the Android, iOS, or JavaScript SDK, it facilitates a shared real-time database that is accessible to all users, ensuring that any data modifications prompt instant updates to all connected clients.

Firebase Authentication enables users to easily verify their accounts through multiple methods, including email, Facebook, Twitter, Google, and GitHub This service streamlines the storage of user authentication data in the Firebase Database without the need for server-side setup Furthermore, it facilitates the sending of confirmation emails for both registration and password recovery.

Firebase Crash Reporting provides extensive logging features for application crashes, capturing essential OS information and error details This functionality offers valuable insights for developers, making it an indispensable tool in the app development process.

Other techniques used in the project

2.4.1 Working Principle of GPS Navigation Circuit

In this project, we selected the GPS NEO-M6 module due to its renowned accuracy in positioning and navigation This module features the NEO-6M GPS receiver chipset and a ceramic antenna, ensuring reliable location data Utilizing the NMEA protocol, it captures signals from multiple GPS satellites to determine latitude, longitude, altitude, and time Notable attributes include a fast time to first fix, low power consumption, and high sensitivity, making it ideal for applications in vehicle tracking, robotics, navigation devices, and IoT projects.

GPS circuitry in robots leverages signals from nearby satellites to accurately determine their real-time position This process involves gathering data on satellite locations and transmission times, and by analyzing signals from a minimum of four satellites, the GPS module employs trilateration to pinpoint the robot's exact location The circuitry then processes this information to deliver precise location results.

13 determine speed, direction, distance traveled, and other parameters, facilitating control and navigation of the ROBOT's automatic movement The figure 2.7 shows the GPS module receive signals from satellites

Figure2 7: GPS connecting with satellite

PWM operates on the principle of adjusting a motor's rotational speed by keeping the input voltage constant while altering the duration of its application This means that as the Ton (high time) in a pulse cycle increases, the average voltage supplied to the motor rises, while a longer Toff (low time) results in a decrease in average voltage Notably, larger motors typically experience a reduction in the average voltage applied The relationship between the Ton and Toff periods is quantified by the duty cycle, calculated using a specific formula.

Figure2 8: Time diagram of the PWM pulse [6]

In Figure 2.4, the pulse period is set at 1kHz, with a high pulse duration (Ton) of 0.3ms and a low pulse duration (Toff) of 0.7ms, resulting in an amplitude of 12Vdc The rotor operates at a rotational speed of 1,500 RPM, leading to a duty cycle of 30% Consequently, the average voltage supplied to the motor is calculated as 12Vdc multiplied by 30%, yielding 3.6Vdc This results in an effective rotor speed of 450 revolutions per minute, derived from 1,500 RPM multiplied by the duty cycle of 30%.

2.4.3 Working Principle of HMC5883L in ROBOT

The HMC5883L digital compass sensor plays a crucial role in the ROBOT (Automated Guided Vehicle) system by accurately determining the vehicle's direction Utilizing magnetic induction technology, the HMC5883L measures and identifies the orientation of the Earth's magnetic field, ensuring precise navigation for automated vehicles.

The HMC5883L sensor is specifically engineered to measure the Earth's magnetic field, detecting and quantifying variations in this magnetic environment.

The HMC5883L sensor detects changes in the magnetic field and converts these variations into a digital signal, enabling the calculation of the angle between the magnetic field and the sensor's orientation.

The HMC5883L sensor collects magnetic field data, which is then transmitted to Firebase and the ESP32 microcontroller on the ROBOT for processing This information is crucial for determining the ROBOT vehicle's travel direction and executing direction-related tasks effectively.

Figure2 10: the magnetic field direction in space [5]

The robot system must meet the criteria of power-saving, low-cost The ESP32 microcontroller is used because of its ability to integrate with a Bluetooth module, Wi-

The ESP32 features a Wi-Fi module that enables seamless connectivity to Firebase, along with a substantial RAM capacity for enhanced processing and storage capabilities compared to similar microcontrollers It boasts a robust community support and is compatible with the Arduino IDE and the ESP-IDF framework, providing comprehensive functionality for the ESP family.

The ESP32 microcontroller will manage all read and write operations for the HMC5883L sensor, GPS module, and HC-SR04, enabling it to gather data and execute algorithms to calculate the angle and direction towards the destination.

The ESP32 microcontroller features a 32-bit Xtensa Dual-Core LX6 architecture, offering 448 Kb of ROM and 520 Kb of SRAM With a programmable clock speed ranging from 40 MHz to 80 MHz, it supports Wi-Fi (802.11 b/g/n/e/i) and Bluetooth (v4.2 BR/EDR and BLE) for seamless connectivity with other devices The ESP32 provides 34 GPIOs, 18 channels of 12-bit ADCs, and 16 channels of PWM, along with essential components for USB communication with other microcontrollers.

2.4.4 General Operating Principles of ROBOT

The ROBOT will navigate using coordinates from a Python application, requiring two peripheral sensors: the HMC5883L compass and the GY-NEO 6MV2 GPS navigation circuit for direction detection Additionally, it will feature a four-wheel drive system powered by DC motors, controlled through a dedicated circuit for efficient movement.

17 will use the ultrasonic sensor HC-SR05 to handle avoiding obstacles in front of the moving direction of the ROBOT

This section outlines the process of calculating the robot's position using a GPS navigation circuit and determining its direction with a compass sensor Additionally, the integration of ultrasonic sensors allows the robot to avoid obstacles in its path By calculating the bearing angle between the current and destination coordinates from GPS data, and combining this with the compass sensor's direction, we can establish the necessary rotation angle for the robot This enables the robot to navigate directly toward its intended destination.

After obtaining values from the sensors, we determine the smallest angle between the bearing and heading angles, referred to as the "Error." This Error indicates how far the vehicle is deviating from the road We calculate the Error angle through a straightforward abstraction process If the Error exceeds 5°, the ROBOT must adjust its direction to turn right.

Figure2 12: General structure of robot

If the Error angle is less than -5°, the ROBOT must turn left to align correctly with its destination.

DESIGN AND IMPLEMENTATION

System Requirements

1) The robot can measure environmental parameters such as temperature, humidity and GPS coordinates of the vehicle Through the use of temperature and humidity sensors, these parameters will be updated to a real-time database on firebase and the application will connect to it and retrieve the value

2) The robot uses magnetic sensor and GPS module for navigating direction in outdoor environments

3) The information transmission of the system is done using the Wi-Fi network protocol A real-time database on Firebase is used to perform the communication between the robot and the application system On firebase there will be fields to manage sensor values, vehicle information

4) An application written on PyQt5 is design to run on Windows OS, offer a display of monitoring parameters including temperature, humidity, position and heading direction of the robot, and provide functionalities such as logging path by GPS coordinates, searching for specific recorded data, controlling the robot.

Block Diagram

In the block diagram, the monitoring robot system consists of three main parts that are interconnected: the ROBOT system, the user application system, and a real-time database

Figure3 1: General block diagram of the system

Central processing block: the central processing block of this whole system is an

The ESP32 microcontroller processes and analyzes data collected from sensors in the sensing block, enabling it to control the output block effectively Additionally, it connects to Firebase via Wi-Fi, enhancing its functionality and data management capabilities.

Output block: output block is DC motor control components, L298N module

Sensing block: includes sensor devices such as HMC5883L (digital compass sensor), DH11 (temperature and humidity sensor), HC-SR04 (distance sensor), GPS module and Wi-Fi module

The power supply block is essential for ensuring a stable source for the robot system, with the microcontroller and peripherals receiving a precise 5V from an LM2596 voltage regulator that provides up to 3A output Meanwhile, the DC motor and driver are powered directly by a 18650 LiPo battery, ensuring efficient operation.

The user application system retrieves data from the robot via Firebase and presents it to the user Developed using PyQt5, a GUI library tailored for IoT applications, this system can be operated on any computer with an internet connection.

In this project, we utilize the Firebase block as a real-time database, enabling seamless communication between processing and software blocks through a Wi-Fi connection Additionally, this block serves the crucial function of storing the system's information and data efficiently.

ROBOT System

In this chapter, we develop a wheel-operated robot designed to efficiently transport items to designated locations We begin by designing and selecting mechanical components, including the wheel frame, to enhance the vehicle's performance Next, we focus on integrating electronic components that ensure high efficiency and low power consumption Finally, we implement a programming design that aligns with the system's specifications, ensuring optimal functionality of the robot.

We will determine the mechanical design requirements for the ROBOT vehicle system based on the system requirements:

• Maximum speed of vehicle: Vmax = 0.25 m/s

• The vehicle structure is compact, sturdy, does not shake, moves flexibly

• The ROBOT has the ability to move left and right to avoid obstacles

• The vehicle's four-wheel chassis is driven by four separate DC motors

• The car will be designed with separate floors to store different components for the project

We will select the right hardware for the vehicle design based on the mechanical design specifications

Precision and silk choose the engine

Considering the forces operating on a wheel, a mathematical model has been developed:

Figure3 2: Model of forces acting on the wheel

We suppose that the automobile accelerates from 0 m/s to its maximum speed of 0.25 m/s in one second We may conclude that the car's acceleration is:

The moment of inertia for the wheel is calculated as I = m*R²/2, where the mass m is 0.025 kg The wheel's angular acceleration is influenced by this moment Additionally, the equivalent mass M that each rear wheel must support when transporting a heavy load is determined to be 2.1 kg, derived from the formula M = R²/g.

We choose a Dual Shaft Plastic Geared TT Motor with reducer and encoder based on the predicted capacity Load torque 0.07 Nm

Table3 1: Specifications Dual Shaft Geared Plastic TT Motor

Operating Voltage 3~9VDC Current Consumption 110~200mA

Anti-roll while navigating corners

Centrifugal force during cornering can lead to vehicle rollover, necessitating careful design to prevent tipping To mitigate this risk, it's essential to optimize the distance between the wheels and the vehicle's height Employing a mathematical model can help achieve these design parameters effectively.

Figure3 3: Calculation model and force analysis when the car is cornering

Let a represent the distance between the wheels, and b represent the height of the center of gravity We hold:

Moment that causes the car to flip:

To prevent the automobile from toppling: 𝑀 2 ≥ 𝑀 1

The combined width of the two motors measures 44 mm, resulting in an initial distance of 100 mm between the wheels By applying the ratio of b to a, which is 0.5, the vehicle's center of gravity is calculated to be 150 mm in height.

After assessing the dimensions of the ROBOT, we will optimize its design for enhanced compatibility with the system's features We selected a four-wheeled ROBOT equipped with four DC motors due to its superior balancing capabilities and adaptability to various terrains This configuration also allows for increased speed, reducing shipping time Below, you can find the SolidWorks 3D design of the ROBOT.

Figure3 4: The 3D design of robot ROBOT

The design of the ROBOT is influenced by the configuration of its GPS system It features a four-level structure: the first level accommodates the motor and its control module, while the second level houses the power supply, which includes a 5V source for the microcontroller, a sensor, and a 12V source.

The third floor will house the ESP32 microcontroller along with the distance sensor and connection board, while the top floor will be dedicated to temperature and humidity sensors, compass sensors, and GPS technology.

In this section, we will create a reliable and efficient system utilizing a power-saving central processor that supports WiFi standards like ESP32 This microcontroller will manage the device by accessing WiFi to receive new location coordinates sent to Firebase It will integrate data from sensors, including GPS, a compass, and an ultrasonic sensor, to accurately determine the direction needed to reach the specified location.

Based on the system requirements, our group decided to divide the system into 9 blocks The block below diagram will show functions working for each smaller block

Figure3 5: The block diagram of ROBOT system

The ESP32 microcontroller will serve as the central processing unit and nucleus of the ROBOT vehicle system, ensuring compliance with WIFI communication standards for seamless integration with other systems Its primary functions include navigation and controlling the vehicle to accurately follow the designated trajectory to reach the specified location Additionally, the central processing unit will retrieve request coordinates from the Firebase system, facilitating efficient operation and precise movement of the ROBOT vehicle.

The ESP32 microcontroller utilizes sensor data to determine the direction and distance to a target location Upon reaching the desired position, it sends a Stop signal to Firebase, indicating successful arrival At this point, the system measures environmental parameters and enters a standby mode, awaiting the next coordinate update.

The guiding sensor block plays a crucial role in determining the transmission path and relaying data to the central processor for analysis The GPS sensor calculates the angle and distance between two points relative to the north axis, while the compass sensor measures the vehicle's directional angle, enabling accurate rotation adjustments Additionally, the ultrasonic sensor HC-SR05 is responsible for detecting obstacles in front of the vehicle to ensure safe navigation Finally, the motor control module receives commands from the central processing unit and provides 12V power to the DC motors, facilitating the vehicle's movement as per the processing system's directives.

3.3.3 The schematic diagram of ROBOT system

After carefully selecting and calculating the appropriate components for the ROBOT system, we will proceed to connect them In this setup, the ESP32 serves as the core of the system while also facilitating connections to the surrounding peripherals.

The system's power block will provide two 12V main voltage levels for the L298N motor control block to execute motor control 5V power will power the operation of additional blocks

Figure3 6: The schematic diagram of robot system

Power Supply Block Central Processing Block

Schematic of Central Processing Block (CPB)

This section focuses on integrating peripherals like the microcontroller, GPS navigation module, and motor control module A 5V power supply will be utilized, connected through the 5V pin and the GND ground pin.

Figure3 7: The schematic diagram of CPB Table3 2: The pin connection of the system

Serial clock for I2C of HMC5883L SCL

Serial data for I2C of HMC5883L SDA

TX of UART for GPS NEO-M6 G1

RX of UART for GPS NEO-M6 G2

The echo pin connect to HC-SR05 echo The trig pin connect to HC-SR05 trig

In the sensing block, we will have peripherals such as temperature and humidity sensor DHT11, ultrasonic sensor HC-SR05, GPS navigation module NEO-M6, compass sensor HMC5883L

DHT11: will include 3 lines, VDD will be connected to the 3V3 power pin The GND and DATA pins will be connected to pin 32 of the microcontroller

Figure3 8: The schematic diagram of SB

Table3 3: The pin connection of Sensors

Receive pin of GPS RX

Transmit pin of GPS TX

5V power of HC-SR05 VCC

Trig pin of HC-SR05 Trig

Echo pin of HC-SR05 Echo

Ground of HC-SR05 GND

Serial Clock of HMC5883L SCL

Serial Data of HMC5883L SDA

HC-SR05: the power pin will be taken from the 5V power supply after a 330kΩ level resistor has been attached

To connect the GPS module to the ESP32, the power pin should be linked to the 5V pin of the microcontroller Additionally, the two signal pins of the UART protocol must be connected to the corresponding UART pins on the ESP32.

To connect the HMC5883L, attach the power pin to the 5V pin after incorporating a 330kΩ resistor Additionally, connect the I2C protocol lines to the SDA and SCL pins of the ESP32 microcontroller.

User Application System

This section introduces PyQt5, a powerful framework for designing and developing desktop applications using Python It offers an extensive array of features and widgets that facilitate the creation of interactive and visually appealing graphical user interfaces.

Figure3 15: Page division of the application

The application design depicted in Figure 3.16 provides users with essential information about the ROBOT system, including temperature, humidity, heading angle, GPS coordinates, and a GPS map, while also presenting statistical data from the database.

The application consists of six pages, starting with an authentication section where users enter their Firebase-registered name and password Upon successful login, users access a home window that provides comprehensive and compact information about the vehicle's surroundings In addition to the home page, there are three interactive feature pages for sending GPS coordinates, reading from a database, and sending emails The contact page introduces the author and provides contact information, while the data info page displays temperature and humidity, presenting the data in a table format using the SQLite3 library The GPS data page shows locations on a map and displays GPS coordinates Lastly, the final page allows users to modify global variables, such as the file path and file name for database output.

This section focuses on the design of the application's database and data storage system, which requires two types of data The first type is system control data, including GPS coordinates (latitude and longitude), while the second type encompasses environmental monitoring data This latter data is crucial for tracking changes in environmental elements such as temperature, humidity, and time.

Figure3 16: Data storage of the system

Figure 3.17 illustrates the use of two distinct data storage methods for recording information While data is collected from Firebase's real-time database, its storage capacity is limited, and older values are overwritten by newer ones, making it unsuitable for long-term data storage Additionally, access to this database requires an internet connection, which highlights the advantages of using a local database for storing information within an application.

Using a JSON file to store the ROBOT's latitude and longitude values is ideal for temporary data storage, as it allows for easy refreshing and overwriting of GPS coordinates This method is particularly effective for systems that manage smaller data volumes and have lower security requirements.

Temperature and humidity data are crucial, and by storing this information in a local database, we ensure ample storage space and a predefined structure with tables, rows, and columns This method is ideal for long-term storage, enhancing security and performance, while also allowing access to log information in various functions.

Figure3 17: Block diagram of the operation of the entire system

Figure 3.21 illustrates the operations of the application system and the ROBOT system via Firebase The application manages the monitoring robot by adjusting variables like GPS coordinates, enabling buttons, and storing status in Firebase These variables function as a set of commands, allowing the robot system to transmit data regarding its status, position, and monitoring information.

A real-time database serves as temporary storage for current variable values, but it is essential to maintain a historical record of the system's data To achieve this, the application will utilize a local SQLite database installed on the server, ensuring reliability even during server disruptions This database will specifically store temperature and humidity data along with corresponding timestamps.

3.4.3.2 General flowchart of the application system

Figure3 18: General flowchart of the application system

The flowchart in Figure 3.22 outlines the application system's general flow Initially, the window launches and connects to the Firebase account, setting the enable value to "OFF." This variable is crucial for controlling the monitoring robot's movement; without the enable signal from the application, the robot remains stationary while still transmitting data back to the application.

The system will initialize various timers to manage different functions, ensuring continuous updates of essential variables such as the current date and time, as well as the GPS coordinates for the current map It will regularly check for timer timeouts, and upon timeout, it will trigger the necessary updates.

The system utilizes multi-threading functions to efficiently manage multiple tasks simultaneously, ensuring proper functionality even under heavy load It features a user interface that responds to button presses, allowing seamless navigation between four distinct pages: the Home page, which provides general system information; the GPS page, which offers robot position details and control options; the Data page, which logs historical data collected from the robot; and the Contact page, which displays contact information To optimize resource usage, the system switches all resources to the active page, ensuring that only the current page is visible to the user while other pages remain inactive.

Figure3 19: Flowchart of the timer updating functions

This section highlights the flowchart of the timer process, a crucial component that updates system information The system monitors the timers for each function, and if any timer reaches its timeout, the corresponding function is activated to return results.

To optimize server performance, we initialize three distinct timers with varying timeout periods to minimize thread creation and CPU usage The first threading function retrieves temperature, humidity, and heading data from Firebase every three seconds, displaying it on the current page as needed, while also saving the information in a local SQLite database for offline access The second threading function updates the robot's GPS coordinates, refreshing the map with the new central coordinates and storing the longitude and latitude in a JSON file for easy access.

Table3 7: Current latitude and longitude in Json file

Data is stored in JSON format for future computations, such as tracking the vehicle's travel path and logging selected destinations on the map The third threading function operates with a 1-second timeout to update system changes, including clock time increments and GPS destination updates This function also checks the current page of the window; if it displays the home page, it will show the date, time, temperature, humidity, and GPS coordinates.

In this section, we will discuss about Real-time database on Firebase The following figure shows the data stored on Firebase, the data is formatted in json with hierarchy

We have 5 fields of data, which include CAR, ENABLE, ESP32, GPS, and STATUS

Table3 8: Data collection of Firebase

RESULT

Introduction

This chapter presents the outcomes of both software and hardware design for our monitoring robot We will detail the parameters collected, such as temperature, humidity, heading angle, and current GPS coordinates, which will be displayed on the user application interface Additionally, we will evaluate the robot's functionality by inputting new destination coordinates through the application.

hardware implementation

Figure 4.1 depicts the engine model in the first stage of the ROBOT vehicle:

Figure4 1: the module driver and DC motor

The motor system utilizes an L298N driver module to control four DC motors, enabling the movement of the ROBOT vehicle Control signals are transmitted from the ESP32 microcontroller to the L298N for precise operation.

Figure 4.2 will specify where to power the entire system and the lower voltage module LM2596 to reduce the voltage 8V to 5V power supply:

Figure4 2: the power supply and module LM2596

Our power supply system consists of two sets: one providing 8V and the other 12V To generate a 5V output for the system, we will utilize the LM2596 low voltage circuit to efficiently step down the 8V supply to the required 5V.

In Figure 4.3, we positioned the ESP32 microcontroller and designed a circuit board featuring a dedicated tray for mounting The board includes two barriers: one for a 5V power supply with pass-throughs for 220k ohm and 330k ohm resistors, and another for GND grounding This configuration results in the most extensive wiring at this stage.

61 connections, because the sensors and modules on the entire system will be linked and brought here where the microcontroller is located:

Figure4 3: the microcontroller ESP32 and circuit board

This article outlines the essential connections for a project, including linking the driver module, temperature and humidity sensor, ultrasonic sensor, compass sensor, and GPS module All components should ultimately connect to the power port via a low voltage circuit for optimal functionality.

In Figure 4.4, we outline the designated locations for all sensors and the GPS module, with connections to the main microcontroller routed to the layer below This setup allows for future enhancements, enabling the addition of new sensors on this level as needed.

Figure4 4: the sensors and module GPS

We placed all GPS sensors and modules on the top floor to enhance signal capture, as this location minimizes interference and allows for easier reception of GPS signals.

System Operation

To initialize the destination points on the map, the first step involves obtaining the coordinates, which will be done through an HTML output displayed by the application when new coordinates are selected These chosen points will be saved in a JSON file via the application and sent to the Firebase system sequentially each time the ROBOT passes a point The interface shown in Figure 4.5 illustrates how users can click on the map to select destination points for the ROBOT.

Initially, the vehicle remains stationary, continuously updating environmental parameters without moving In the ENABLE: "OFF" state, the vehicle does not transmit new destination or current point coordinates to Firebase As illustrated in Figure 4.6, when ENABLE is OFF, it only reports temperature and humidity, indicating that the vehicle is currently STOP Additionally, Firebase includes a STATUS variable that indicates whether the vehicle is MOVING or STOP.

Figure4 5: Interface of web taking point

Figure4 6: ENABLE OFF and information of this state

Table 4.1 will talk about the names of the values and their meanings:

Table4 1: The variable and function when ENABLE OFF

STATUS: STOP The state of ROBOT vehicle is STOP

ENABLE: OFF The car is stopping

Humid and Temp environmental parameters

When the ENABLE setting is activated, the vehicle continuously updates its current and destination coordinates along with environmental parameters If the destination coordinates are modified, it indicates a command for the vehicle to move The ROBOT vehicle then calculates the offset angle between its current position and the destination to align itself correctly Once the front of the vehicle is oriented toward the target, it will proceed forward to reach the destination, as illustrated in Figure 4.7, which depicts the vehicle rotating toward the target point when ENABLE is ON.

Figure4 7: ENABLE ON and MCU calculate with control the ROBOT error

Table 4.2 will talk about the names of the values and their meanings:

Table4 2: the variable and function when ENABLE ON

STATUS: STOP The state of ROBOT vehicle is STOP to check error ENABLE: ON The car now can move or check the error angle

Humid and Temp environmental parameters

When the deviation angle between the current coordinates and the destination exceeds 2 degrees, the vehicle is instructed to proceed straight to the destination Upon initiating movement, the STATUS variable in the GPS changes to the MOVING state Figure 4.8 illustrates the ROBOT correctly aligning and moving straight towards its target.

Figure4 8: ROBOT is moving forward

Table 4.3 will talk about the names of the values and their meanings:

Table4 3: the variable and function when ENABLE ON and STATUS is MOVING

STATUS: MOVING The state of ROBOT vehicle is MOVING

ENABLE: ON The car now can move or check the error angle

Humid and Temp environmental parameters

Upon reaching its destination, the ROBOT will revert its STATUS to STOP, awaiting new coordinates or an OFF command At this point, the current GPS coordinates of the ROBOT will closely align with the destination coordinates in the CAR.

5 meters apart Figure 4.9 will show us when the car has reached its destination and stopped.

Figure4 9: ROBOT is stop and wait the new location

Table 4.4 will talk about the names of the values and their meanings:

Table4 4: the variable and function when the ROBOT arrive at the destination

STATUS: STOP The state of ROBOT vehicle is STOP

ENABLE: OFF The car now is stopping

Now the lat and long of current and destination is closely matched within 5 meters

Figure 4.10 illustrates two logging paths of the robot in different locations, with red markers indicating the intended waypoints and blue markers representing the recorded GPS coordinates The robot's position is saved every 10 seconds, and the GPS module outputs this data to a real-time database, which the application accesses The blue path deviates from the intended route between the two red waypoints, highlighting the GPS module's error.

The GPS path shows that the error varies in time, after the blue line is not a straight line, the road we test the robot moving is 5 meters width

Software System

Figure4 11: The interactive features of the application

The application includes interactive features like buttons, checkboxes, and line edits across five distinct pages, each designed for specific tasks and functionalities Figure 4.12 illustrates the first page of the application, highlighting its unique features.

Figure4 12: The interface of LoginUI

Figure 4.12 illustrates the Login interface of the application system, featuring the university logo and two input fields designed with the PyQt5 framework These fields prompt users to enter their username and password The authentication process utilizes Firebase's sign-in method to create the username and password Figure 4.13 further elaborates on this functionality.

Figure4 13: The account user of Login

The username and password added on Firebase, the sign-in method using is email and password

The login button verifies the username and password stored in Firebase; if the credentials match, the Login page is deactivated, and the application navigates to the Home page.

The figure 4.14 above shows the interface design of the Home page of the application system, the window contains multiple frames with different layout,

The system utilizes two small frames to display a sliding graph that visualizes 30 data points of temperature and humidity collected from Firebase As new data arrives, it is added to the right side of the graph, while the oldest element on the left is removed, ensuring a dynamic and up-to-date representation of environmental conditions.

A big frame is used to show the GPS map using folium python library, the window of the map will be refreshed after a timeout of 10 seconds

The system utilizes four compact frames to showcase essential numerical data, including temperature, humidity, heading, and the number of waypoints Additionally, one frame provides the system's status, displaying information on Firebase connection, robot status, GPS coordinates, and the critical thresholds for temperature and humidity warnings.

Figure4 14: Interface of Home page on application

Figure 4.15 illustrates the GPS interface, which provides comprehensive details about the robot's location on a map This page enables users to control the robot and displays essential information such as the number of waypoints, current coordinates, and the vehicle's heading angle Additionally, it features three push buttons and two checkboxes for enhanced functionality.

• The “Send” button is used for choosing the waypoints of the robot

• The “Erase” button is used to clear recorded GPS coordinates for path logging function

• The “Enable” button is used to enable the robot to receive the new waypoints

Figure4 15: Interface of GPS page on application

The robot's path can be tracked on the map using checkboxes, which also allow for waypoints to be looped in both ascending and descending order This path log records multiple latitude and longitude coordinates of the robot over time, providing a comprehensive overview of its movements.

Figure4 16: Interface of Data page on application

Figure 4.16 illustrates the Data page, which allows users to log the history of collected information The data stored in the SQLite database includes key parameters such as temperature, humidity, the timestamp of when the data is recorded, and the area segmented by the number of waypoints.

The Area column is generated by determining the shortest distance from the robot's current position to designated waypoints Users can input specific start and end times for logging data, ensuring that information is recorded within this timeframe Additionally, a "graph" button enables users to visualize the logged data in a graphical format, similar to the display on the homepage, rather than in a table.

Figure4 17: The graphs off temperature and humidity

Figure 4.17 presents a clear depiction of temperature and humidity fluctuations on September 6, 2023, specifically between 12:21 PM and 12:24 PM The graph effectively highlights the variations in these environmental parameters during this brief time frame.

The blue area indicates that humidity or temperature values are below the threshold set on the Home page, while the pink area signifies that these values exceed the established threshold.

Figure4 18: Interface of Contact page on application

The Contact page, illustrated in figure 4.18, provides an introduction to the products and engineers, along with essential contact details including the address, phone number, and email Additionally, it features a textbox for users to compose and send messages directly to the engineers via email.

Figure4 19: The example of sending mail

Figure 4.19 illustrates a successfully sent message from the application, featuring a header that includes essential user information such as the username, email address, and phone number provided by the user.

The application communicates user messages through a hardcoded email, "tuoxen20@gmail.com," ensuring that all user interactions are forwarded to the creator To effectively categorize users, we require personal information from them.

The Settings page, illustrated in figure 4.20, allows users to modify all global variables, including the system's path or file name This interface utilizes line edits from the PyQt5 framework to facilitate the input of these system variable values.

evaluation and comparison

This advanced robotic system integrates temperature-humidity sensors, an HC-SR04 ultrasonic sensor, a compass sensor, and GPS for thorough environmental monitoring It employs I2C, UART, 1-wire, and digital IO protocols, ensuring flexible communication and compatibility with a wide range of devices and technologies.

The system's fast analysis speed enables efficient data collection and processing from sensors, providing users with reliable environmental information The temperature-humidity sensors and the HC-SR04 ultrasonic sensor deliver high accuracy in data collection However, the compass and GPS sensors may occasionally produce inaccurate data due to environmental factors and the vehicle's location, with GPS coordinates potentially deviating by 1-5 meters from the actual position, leading to incorrect vehicle positioning and trajectory deviation Additionally, the digital compass requires calibration to eliminate offset values influenced by magnetic fields from electronic wires and the MCU.

The system features limited mobility, enabling travel primarily in flat environments with minimal complexity for data collection It is designed for low energy consumption, optimized for extended uptime, and employs intelligent energy management techniques This design allows the system to operate for prolonged periods without the need for frequent battery changes or recharging.

CONCLUSION AND FUTURE WORK

Conclusion

In summary, the GPS-based environmental monitoring robot serves as an effective mobile monitoring gateway within IoT systems, fulfilling the demand for an efficient solution that collects real-time environmental data accurately The integration of GPS technology significantly improved the robot's navigation and ensured precise recording of geographic coordinates for the data gathered The project successfully achieved multiple key objectives, demonstrating its potential in enhancing environmental monitoring efforts.

➢ Firstly, the system has the capability to gather various environmental factors like temperature and humidity, as well as the GPS coordinates of the vehicle

The system employs Wi-Fi network protocol for data transmission, enabling real-time communication between the ROBOT system and the application via a Firebase database.

A Windows desktop application offers a user-friendly interface for monitoring essential data from the ROBOT system, including temperature, humidity, heading direction, and GPS coordinates It also features functionalities for logging paths using recorded GPS data, searching for specific entries by date, and controlling the robot efficiently.

This project enhances our understanding of embedded system design within IoT applications, focusing on addressing specific requirements Additionally, it deepens our knowledge of hardware and mechanical design, enabling us to create practical systems applicable in real-world scenarios.

The project's implementation reveals limitations in the navigation process due to the GPS module's accuracy and noise interference in the digital compass sensor, resulting in a restricted installation of the system.

To enhance outdoor navigation accuracy, we aim to integrate additional sensors by fusing IMU sensors with GPS modules and employing filtering algorithms This approach will significantly improve navigation performance and minimize output errors from the sensing block.

We will expand the application of the system in more scenarios such as running in a quarantined area, or difficult geographical areas like mountains, and indoor areas like large warehouses

[1] L T Samuel J.O Corpe, "GPS-Guided Modular Design Mobile Robot Platform for Agricultural Applications," Seventh International Conference on Sensing Technology

[2] M R I F F F H S A H S M H Mosfiqun Nahid Hassan, "An IoT based

Environment Monitoring System," The Third International Conference on Intelligent

[3] D M S P Sushma P Patil, "Design and Implementation of GPS Environment

Monitoring Robotic System Based on IOT and ARM," International Research Journal of Engineering and Technology (IRJET), 2020

[4] B M Jalpa Shah, "IoT enabled Environmental Monitoring System for Smart Cities,"

International Conference on Internet of Things and Applications (IOTA), 2016

[5] S Campbell, "HOW TO SETUP A MAGNETOMETER ON THE ARDUINO," [Online] Available: https://www.circuitbasics.com/how-to-setup-a-magnetometer-on- the-arduino/

[6] R Schwarz, "the UART (universal asynchronous receiver/transmitter) serial protocol, including a description of the frame structure and the significance of each frame bit."

[7] K Nayak, "(MCU1) Learn bare metal driver development using Embedded C: Writing drivers for STM32 GPIO,I2C,SPI,USART from scratch"

[8] G K S K Christodoulos Asiminidis, "DATABASE SYSTEMS PERFORMANCE EVALUATION FOR IOT APPLICATIONS," International Journal of Database

Ngày đăng: 08/12/2023, 15:31

w