Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 97 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
97
Dung lượng
6,54 MB
Nội dung
MINISTRY OF EDUCATION AND TRAINING HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION GRADUATION THESIS COMPUTER ENGINEERING TECHNOLOGY DESIGN AND IMPLEMENTATION OF A ROBOT FOR ENVIRONMENT MONITORING LECTURER: M.ENG TRUONG QUANG PHUC STUDENTS: NGUYEN NGOC TU DO QUANG VINH TRUONG SKL 011179 Ho Chi Minh City, June 2023 HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION PROJECT DESIGN AND IMPLEMENTATION OF A ROBOT FOR ENVIRONMENT MONITORING NGUYỄN NGỌC TÚ Student ID: 18119052 ĐỖ QUANG VINH TRƯỜNG Student ID: 18119049 Major: COMPUTER ENGINEERING TECHNOLOGY Advisor: M.Eng TRƯƠNG QUANG PHÚC Ho Chi Minh City, June 2023 SUPERVISION APPROVAL I ACKNOWLEDGEMENTS During the implementation of the project, our team received a lot of valuable support to help us complete the project as well as overcome the difficulties encountered in the process of completing the product Firstly, we would like to thanks to the School Board of the Ho Chi Minh City University of Technology and Education and Faculty for High Quality Training creating wonderful conditions for me to take my project Secondly, sincerely thank to Mr.Trương Quang Phúc, our advisor who gave us useful guidance and instruction that help us to finish our project successfully From these advices we can improve our project contents and correct the mistakes as well Thirdly, we are grateful to all of the nice classmates of class 18119CLA for their thoughtful advice and guidance whenever we needed support Finally, due to limited knowledge and implementation time, we cannot avoid mistakes We look forward to receiving your comments to improve this topic Overall, we really thank to all people are a part of our achievement Ho Chi Minh city, Thursday, May 25, 2023 Student performance Nguyễn Ngọc Tú Đỗ Quang Vinh Trường II ABSTRACT Nowadays, technology has significantly improved industrial performance and people's lives Industries are increasingly adopting automatic technology to track products and reduce the workload on engineers In the field of agriculture, environmental factors play a crucial role in determining crop productivity and ensuring the safe storage of flammable or dry food products In this project, we aim to develop an IoT system that utilizes an environment monitoring robot to collect environmental parameters in both automatic and manual modes The robot is designed with a microcontroller, specifically the ESP32, which offers advantages such as a large RAM capacity and low power consumption Additionally, a GPS module is used to orient the robot to its destinations To calculate the bearing angle between two given longitude and latitude points, we employ GPS and a magnetometer The bearing angle represents the angle formed by the North-South axis and the line connecting the two GPS locations The robot will be deployed to measure environmental factors, including humidity, temperature, and air quality, in a specific outdoor area The scope of the robot's operation is approximately kilometer The IoT system will log the robot's path, display its position, and provide other relevant parameters All data will be transmitted to a real-time database on Firebase, enabling seamless connectivity for any running applications To facilitate interaction with the robot, we have developed an application using PyQt5, which can be run on server computers Users can provide input information, such as GPS locations, to control and monitor the robot through the application Overall, this project aims to leverage IoT technology and a monitoring robot to collect and analyze environmental data, allowing engineers to efficiently manage and monitor the designated area III TABLE OF CONTENTS SUPERVISION APPROVAL I ACKNOWLEDGEMENTS II ABSTRACT III TABLE OF CONTENTS IV LIST OF PICTURES VII LIST OF TABLES X ABBREVIATION XI CHAPTER 1: OVERVIEW 1.1 Introduction 1.2 Objective 1.3 Related Work 1.4 Research Method 1.5 Scope of the study 1.6 Outline CHAPTER : BACKGROUND 2.1 The overview of ROBOT 2.1.1 Introduction about ROBOT 2.1.2 The fundamental architecture of an ROBOT system 2.2 PYQT5 Platform 2.3 Firebase 10 2.3.1 Introduction about Firebase 10 2.3.2 Some features of Firebase 11 2.4 Other techniques used in the project 12 2.4.1 Working Principle of GPS Navigation Circuit 12 IV 2.4.2 Pulse Width Modulation (PWM) 13 2.4.3 Working Principle of HMC5883L in ROBOT 14 2.4.7 The Central Processing Block 15 2.4.4 General Operating Principles of ROBOT 16 2.4.5 Robot GPS Outdoor Localization 17 2.4.6 The Output of ROBOT System 18 2.4.8 Ultrasonic Sensor HC-SR05 20 2.4.9 The Power Supply of ROBOT System 22 2.4.10 Inter-Integrated Circuit (I2C) 23 2.4.11 Universal Asynchronous Receiver / Transmitter (UART) 27 CHAPTER 3: DESIGN AND IMPLEMENTATION 30 3.1 System Requirements 30 3.2 Block Diagram 30 3.3 ROBOT System 32 3.3.1 Mechanical Design 32 3.3.2 Detail hardware design 36 3.3.3 The schematic diagram of ROBOT system 37 3.3.5 Detail software design 44 3.3.5.1 General flowchart of the ROBOT system 45 3.3.5.2 Functionality flowchart of the system 48 3.4 User Application System 49 3.4.1 User Interface Design 50 3.4.2 Database design 51 3.4.3 Detail Software Design 52 3.4.3.1 Block diagram 52 V 3.4.3.2 General flowchart of the application system 53 3.4.3.3 Firebase data communication 56 CHAPTER 4: RESULT 59 4.1 Introduction 59 4.2 hardware implementation 59 4.3 System Operation 62 4.4 Software System 69 4.5 evaluation and comparison…………………………………………………………80 CHAPTER 5: CONCLUSION AND FUTURE WORK………………………………….81 5.1 Conclusion…………………………………………………………………………81 5.1 Future Work…………… …………………………………………………………81 APPENDIX 83 REFERENCE 84 VI LIST OF PICTURES Figure 2.1: ROBOT block diagram Figure 2.2: The basic structure of an ROBOT system Figure 2.3: Inference of Qt Designer Software Figure 2.4: Image of QmainWindow Figure 2.5: Firebase Database Figure 2.6: GPS NEO-M6 Figure 2.7: GPS connecting with satellite Figure 2.8: Time diagram of the PWM pulse Figure 2.9: HMC5883L Figure 2.10: The magnetic field direction in space Figure 2.11: ESP32 block diagram Figure 2.12: General structure of ROBOT Figure 2.13: Heading angle of the robot Figure 2.14: L298N block diagram Figure 2.15: DC motor block diagram Figure 2.16: HC-SR05 block diagram Figure 2.17: DHT11 block diagram Figure 2.18: Battery 18650 pin block diagram Figure 2.19: LM2965 block diagram Figure 2.20: I2C bus network connection Figure 2.21: I2C transmission or recession data Figure 2.22: I2C Start Condition And Stop Condition Transitions Figure 2.23: I2C data validity Figure 2.24: Frame of I2C protocol Figure 2.25: UART bus connection VII Figure 2.26: UART frame format Figure 2.27: UART frame format with even parity bit example Figure 3.1: General block diagram of the system Figure 3.2: Model of forces acting on the wheel Figure 3.3: Calculation model and force analysis when the car is cornering Figure 3.4: The 3D design of robot ROBOT Figure 3.5: The block diagram of ROBOT system Figure 3.6: The schematic diagram of ROBOT system Figure 3.7: The schematic diagram of CPB Figure 3.8: The schematic diagram of SB Figure 3.9: The schematic diagram of PSB Figure 3.10: The schematic diagram of OB Figure 3.11: General flowchart diagram of system connectivity Figure 3.12: Flowchart of the main program part Figure 3.13: Flowchart of the main program part Figure 3.14: Flowchart of wheel turning decision Figure 3.15: Page division of the application Figure 3.16: Data storage of the system Figure 3.17: Block diagram of the operation of the entire system Figure 3.18: General flowchart of the application system Figure 3.19: Flowchart of the timer updating functions Figure 3.20: Example of controlling operation over Firebase Figure 4.1: the module driver and DC motor Figure 4.2: the power supply and module LM2596 Figure 4.3: the microcontroller ESP32 and circuit board Figure 4.4: the sensors and module GPS Figure 4.5: Interface of web taking point Figure 4.6: ENABLE OFF and information of this state VIII Figure4 12: The interface of LoginUI The figure 4.12 presents the interface of a Login function in the application system, the login page contains the logo of the university and line edits features in PyQt5 framework, the placeholder tells the user to input user name and password in line edits The username and password is created with the sign-in method on Firebase authentication feature In the Figure 4.13 we have: Figure4 13: The account user of Login The username and password added on Firebase, the sign-in method using is email and password 70 The login button checks the username and password registered on Firebase, if the credentials are matched, the Login page will be turned off, and the application will turn on the Home page Figure4 14: Interface of Home page on application 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, Two small frames are used to show a sliding graph of 30 values of temperature and humidity information collected from the Firebase, any new data will be pushed to the right and removes the most left element 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 Four small frames are used to display numerical information of data such as temperature, humidity, heading, number of waypoints, and a frame to show status of the system such as Firebase connection, status of the robot, GPS coordinates, and the thresholds of temperature and humidity data for warning 71 Figure4 15: Interface of GPS page on application This figure 4.15 shows the GPS page, this page gives the detailed information of the robot displayed on a map, and allows the user to control the robot, the window shows the number of waypoints, current coordinates, heading angle of the vehicle and push buttons and check boxes • 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 72 There are checkboxes for logging the path of the robot on the map and enabling the waypoints to be looped in ascending and descending order The path log contains multiple latitude and longitudes of the robot over a period of time Figure4 16: Interface of Data page on application The figure 4.16 shows the Data page, where we can log the history of the information collected, the data stored on SQLite database contains temperature, humidity, log time when data is recorded, and Area that is divided by the number of waypoints We have the Area column by calculating the smallest distance between the current position of the robot and the waypoints There are several text edits that allow the user to type in the specific time for logging the information, the information will be logged between the start time and the end time A “graph” button to display the logging information as a graph like Home page instead of a table 73 Figure4 17: The graphs off temperature and humidity In this section, the figure 4.17 illustrates the graphs of temperature and humidity values as we search The graph shows vividly the change in temperature and humidity parameter on September of 2023 from 12:21 PM to 12:24 PM Where the blue-filled area implies the values of humidity or temperature is under the threshold we set on the Home page, the pink-filled area implies the values of humidity or temperature exceeds the threshold we set on the Home page 74 Figure4 18: Interface of Contact page on application The figure 4.18 shows the Contact page, where the user can read the introduction about the products and the engineers, also there is contact information such as place address, phone number, and email address There is a textbox that allows the user to write messages and send them to the engineers, the message is sent over email address 75 Figure4 19: The example of sending mail The figure 4.19 shows the successful message sent from the application, the header of the message is filled with the information that the user types in the application including username, email, phone number The body is the message from the application The message is sent through a third email that is hardcoded in the program called “tuoxen20@gmail.com” Any message from the user will be transferred to the creator via this email, therefore, we require personal information to classify the user 76 Figure4 20: The Settings page In this section, the figure 4.20 shows the Settings page, where we can modify all the global variables, these variables are the path or file name of the system As shown in the figure, there are line edits of the PyQt5 framework used to input the value of the system variables The “database name” field is “data”, which means that the recorded monitoring parameters will be stored in a SQLite database file named “data.db” If the file does not exist, the system will create a new one The “Path to database” field is “C:\Users\name\Downloads”, which means that the “data.db” file will be created in the folder “Downloads” inside the path “C:\Users\ name \” The “Path to export CSV” field is “C:\Users\ name \Downloads”, which means that when we export the database file into CSV file, the file will be placed in the folder “Downloads” inside the path “C:\Users\ name \” 77 4.5 Evaluation and comparison This robotic system combines temperature-humidity sensors, ultrasonic sensor HCSR04, compass sensor and GPS to realize comprehensive environmental monitoring Using I2C, UART, 1-wire and digital IO protocols, the system has flexible communication capabilities and is compatible with a variety of devices and technologies With its fast analysis speed, the system can efficiently collect and process data from sensors, allowing users to have reliable and specific environmental information The accuracy of the data collected from the temperature-humidity sensors, the ultrasonic sensor HC-SR04, is also relatively high While the compass and GPS sensors sometimes have some inaccurate data, influenced by the environment and the vehicle's location, the GPS coordinates may deviate from the actual position by approximately 1-5 meters This discrepancy leads to incorrect vehicle positioning, causing the vehicle to deviate from its actual trajectory Moreover, the digital compass should be is calibrated to remove the offset values affected by the magnetic field caused in electronic wire, and the MCU The system also has somewhat limited mobility, allowing it to travel only in flat environments and with little complexity for data collection In terms of energy consumption, the system is designed for relatively low energy consumption, optimized uptime and uses intelligent energy management methods This ensures the system can operate for a long time without changing batteries or recharging frequently 78 CHAPTER 5: CONCLUSION AND FUTURE WORK 5.1 Conclusion In conclusion, the design and implementation of the GPS-based environment monitoring robot have proven to be a solution for a mobile monitoring gateway in IoT systems This project successfully addressed the need for a mobile and efficient system that can gather real-time information about the environment in a precise and reliable manner By integrating GPS technology into the robot, we were able to enhance its navigation capabilities and accurately record the geographic coordinates of the collected data Throughout the project, we accomplished several key objectives ➢ Firstly, the system has the capability to gather various environmental factors like temperature and humidity, as well as the GPS coordinates of the vehicle ➢ Secondly, the system uses the Wi-Fi network protocol for transmitting information, while real-time communication between the ROBOT system and the application is established through the utilization of a Firebase database ➢ Finally, a desktop application designed for Windows operating systems provides a user interface to view monitoring information such as temperature, humidity, the heading direction, and GPS coordinates of the ROBOT system Additionally, the application offers functionalities such as logging the path based on recorded GPS coordinates, searching for specific recorded data by date, and controlling the robot Following this project, we learn more about embedded system design in IoT systems that solve problems with requirements In addition, we learn more about hardware and mechanical design in order to construct a system that can be applied in the real world 5.2 Future work Based on the results obtained while implementing this project, we can see that the project is limited in navigation process with the accuracy of the GPS module as well as noise appearance in the digital compass sensor, and the system is restrictedly installed 79 outdoors We want to improve the accuracy of the system by combining more sensors to enhance the navigation such as fusing imu sensors and the GPS module with filter algorithm to improve navigation and reduce error in output of 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 80 APPENDIX 81 REFERENCE [1] [2] [3] [4] [5] [6] [7] [8] L T Samuel J.O Corpe, "GPS-Guided Modular Design Mobile Robot Platform for Agricultural Applications," Seventh International Conference on Sensing Technology (ICST), 2013 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 Sustainable Systems [ICISS 2020], 2020 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 B M Jalpa Shah, "IoT enabled Environmental Monitoring System for Smart Cities," International Conference on Internet of Things and Applications (IOTA), 2016 S Campbell, "HOW TO SETUP A MAGNETOMETER ON THE ARDUINO," [Online] Available: https://www.circuitbasics.com/how-to-setup-a-magnetometer-onthe-arduino/ R Schwarz, "the UART (universal asynchronous receiver/transmitter) serial protocol, including a description of the frame structure and the significance of each frame bit." K Nayak, "(MCU1) Learn bare metal driver development using Embedded C: Writing drivers for STM32 GPIO,I2C,SPI,USART from scratch" G K S K Christodoulos Asiminidis, "DATABASE SYSTEMS PERFORMANCE EVALUATION FOR IOT APPLICATIONS," International Journal of Database Management Systems (IJDMS ) , 2018 82 83