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 1 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.
III TABLE OF CONTENTS .IV LIST OF PICTURES. VII LIST OF TABLES .XI CHAPTER 1: OVERVIEW .5 Scope of the study .1 The overview of ROBOT .1 Introduction about ROBOT .2 The fundamental architecture of an ROBOT system .1 Introduction about Firebase .2 Some features of Firebase .4 Other techniques used in the project .1 Working Principle of GPS Navigation Circuit .2 Pulse Width Modulation (PWM) .3 Working Principle of HMC5883L in ROBOT .7 The Central Processing Block .4 General Operating Principles of ROBOT .5 Robot GPS Outdoor Localization .6 The Output of ROBOT System .8 Ultrasonic Sensor HC-SR05 .9 The Power Supply of ROBOT System.10 Inter-Integrated Circuit (I2C) .11 Universal Asynchronous Receiver / Transmitter (UART). 27 CHAPTER 3: DESIGN AND IMPLEMENTATION.2 Detail hardware design .3 The schematic diagram of ROBOT system .5 Detail software design .1 General flowchart of the ROBOT system .2 Functionality flowchart of the system .4 User Application System .1 User Interface Design .3 Detail Software Design.2 General flowchart of the application system .3 Firebase data communication .5 evaluation and comparison…………………………………………………………80 CHAPTER 5: CONCLUSION AND FUTURE WORK…………………………………. 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.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 1 Figure 3.13: Flowchart of the main program part 2 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 Figure 4.7: ENABLE ON and MCU calculate with control the ROBOT error Figure 4.8: ROBOT is moving forward Figure 4.9: ROBOT is stop and wait the new location Figure 4.10: GPS path logging Figure 4.11: The interactive features of the application Figure 4.12: The interface of LoginUI Figure 4.13: The account user of Login Figure 4.14: Interface of Home page on application Figure 4.15: Interface of GPS page on application Figure 4.16: Interface of Data page on application Figure 4.17: The graphs of temperature and humidity Figure 4.18: Interface of Contact page on application Figure 4.19: The example of sending mail Figure 4.20: The Settings page IX LIST OF TABLES Table 2.1: different mode of I2C protocol Table 3.1: Specifications Dual Shaft Geared Plastic TT Motor Table 3.2: The pin connection of the system Table 3.3: The pin connection of Sensors Table 3.4: The pin connection of PSB Table 3.5: The pin connection of OB Table 3.6: Power calculation of the system Table 3.7: Current latitude and longitude in Json file Table 3.8: Data collection of Firebase Table 4.1: The variable and function when ENABLE OFF Table 4.2: The variable and function when ENABLE ON Table 4.3: The variable and function when ENABLE ON and STATUS is MOVING Table 4.4: the variable and function when the ROBOT arrive at the destination X ABBREVIATION IoT: Internet of things GPS: Global positioning system Wi-Fi: Wireless fidelity ROBOT: Automated guided vehicles SDA: Serial data SCL: Serial clock PWM: Pulse width modulation UART: Universal asynchronous receiver-transmitter LSB: Least significant bit SB: Sensing block OB: Output block CPB: Central processing block PSB: Power supply block XI CHAPTER 1: OVERVIEW 1.1 Introduction A popular technology trend worldwide is the Internet of Thing (IoT).
IoT has a great influence in many industries as well as human life. In today's modern agriculture, IoT is an extremely important key because it not only helps to improve productivity and quality while reducing resource costs, but also collects, converts, aggregates and statistics of agricultural products. Currently, there is a plan to invest in agricultural land for projects, resources, industrial parks, etc. Therefore, agricultural land is increasingly shrinking.
But at the same time, the global demand for food is also increasing. Land is increasingly shrinking due to bad farming methods, lack of science, climate change, etc. In response, the agricultural IoT application has been developed to allow farmers to adjust and monitor the circumstances, conditions and yields of their farms in real time. IoT in agriculture collects information, recognizes and reports diseases, tracks crop growth, and more.
and collect data so farmers can immediately understand the problem. Agricultural IoT applications can reduce labor and save time by automating processes. such as watering plants, fertilizing, automatic harvesting, etc. For today's embedded system, it is often a common combination of embedded devices and IoT technology to provide intelligent solutions in many fields and in which the agricultural industry is indispensable.
An embedded system will often support features such as remote monitoring, control, and optimization of agricultural processes, increasing productivity, reducing costs and using more optimal resources. Including components that we can mention such as: sensor devices, control devices, connection networks. management system as well as user interface and application. depending on the type of system, it will have its own specifications.
The application of robotics in agriculture is a very popular and valuable topic globally. In Vietnam, a country with a strongly developed agriculture, the pursuit of smart agriculture trends to solve the problem of human resources and quality of agricultural products is the policy of our government in economic development. Since its invention in 1961, robots have been widely used, preeminent in industrial environments. Especially in enterprises, factories, and production systems 1 when the work environment is specifically configured for tasks and the robot is trained to operate in a low-volatility environment.
Agriculture can be considered as an area where the development of robots has not been promising for a long time. Projects on automated systems and automated tractors began in the early 1960s, opening the possibility of using unmanned equipment for forestry and agriculture.2 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.
➢ Lastly, we will design an algorithm that utilizes the GPS module and digital compass sensor to calculate coordinates and angles from the initial starting point to the intended destination. Additionally, we will establish a connection between the ESP32 microcontroller and the associated devices and sensors.3 Related Work The mobile system for environment monitoring has been searched and developed for tackling the problems of navigating and environmental indices transferring. The entire system consists of 2 subsystems, an ROBOT system which is responsible for collecting environmental factors and sending GPS location, as well as bearing angle to the tracking system.