VIET NAM NATIONAL UNIVERSITY HO CHI MINH CITY HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY FACULTY OF COMPUTER SCIENCE AND ENGINEERING CAPSTONE PROJECT AIR QUALITY MONITORING BASED ON INTERNET OF THINGS AND ARTIFICIAL INTELLIGENCE MAJOR: COMPUTER ENGINEERING COUNCIL: COMPUTER ENGINEERING 1 SUPERVISOR: Dr. LE TRONG NHAN REVIEWER: Assoc. PHAM QUOC CUONG Student 1: Le Nguyen Gia Nghi 1952868 Student 2: Thieu Quang Trung 1953051 Student 3: Tran Kim Tung 1953087 Ho Chi Minh City, May 2023 ĐẠI HỌC QUỐC GIA TP.HCM CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM ---------- Độc lập - Tự do - Hạnh phúc TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA:KH & KT Máy tính ____ NHIỆM VỤ LUẬN ÁN TỐT NGHIỆP BỘ MÔN:KHMT ____________ Chú ý: Sinh viên phải dán tờ này vào trang nhất của bản thuyết trình HỌ VÀ TÊN: LÊ NGUYỄN GIA NGHI ________________ MSSV: 1952868 ______ HỌ VÀ TÊN: THIỀU QUANG TRUNG ________________ MSSV: 1953051 ______ HỌ VÀ TÊN: TRẦN KIM TÙNG _____________________ MSSV: 1953097 ______ NGÀNH: KĨ THUẬT MÁY TÍNH_______________ LỚP: ______________________ 1. Đầu đề luận án: Giám sát chất lượng không khí dựa trên kết nối vạn vật và trí tuệ nhân tạo (Communicate and control device based on OPC-UA) 2.
Nhiệm vụ (yêu cầu về nội dung và số liệu ban đầu): Monitoring sensory data concerning the air quality, including the temperature, humidity, PM 2.5, PM 10, O3, SO2, NO2 and CO Propose solution to increase the accuracy of the fire detection and global performance of the system Intergrade and run demo the system on the NVIDIA Jetson board. Other extended features can be proposed by students. Ngày giao nhiệm vụ luận án: 01/02/2023 4. Ngày hoàn thành nhiệm vụ: 30/05/2023 5.
Họ tên giảng viên hướng dẫn: Phần hướng dẫn: 1) TS. LÊ TRỌNG NHÂN Toàn bộ Nội dung và yêu cầu LVTN đã được thông qua Bộ môn. CHỦ NHIỆM BỘ MÔN GIẢNG VIÊN HƯỚNG DẪN CHÍNH (Ký và ghi rõ họ tên) (Ký và ghi rõ họ tên) TS. Lê Trọng Nhân PHẦN DÀNH CHO KHOA, BỘ MÔN: Người duyệt (chấm sơ bộ):________________________ Đơn vị: _______________________________________ Ngày bảo vệ: __________________________________ Điểm tổng kết: _________________________________ Nơi lưu trữ luận án: _____________________________ COMMITMENT We pledge that this project is based on our supervisors’ ideas and knowledge.
All studies and data have not been published. The references, numbers and statistics are reliable and honest. The group completed the thesis require- ments set by faculty of computer science and engineering - department of Computer Engineering. Sincerely, Le Nguyen Gia Nghi Thieu Quang Trung Tran Kim Tung i ACKNOWLEDGEMENT First and foremost, we would like to express our profound gratitude to our thesis supervisors, Ph.
Le Trong Nhan. Throughout our thesis journey, he has been a constant source of support and guidance, always there to lend a helping hand. His invaluable expertise, insightful suggestions, and unwaver- ing encouragement have played a crucial role in shaping this thesis. Without his dedicated involvement and mentorship at every step of the process, we would not have been able to accomplish this milestone.
We would also like to extend our heartfelt appreciation to the esteemed fac- ulty members of the Faculty of Computer Science and Engineering at Ho Chi Minh City University of Technology. Their unwavering commitment to imparting knowledge and their dedication to nurturing our academic growth have been instrumental in our development over the past four years. Their continuous support, encouragement, and credible ideas have significantly con- tributed to the successful completion of this thesis. Last but not least, It would be inappropriate if we omit to thank our friends and family.
Our late parents’ unconditional love and blessings, the care of friends and acquaintances who never let things get dull have all made a tremendous contribution in helping us reach this stage in our life. We thank them for putting up with us in difficult moments where we felt stumped and for goading us on to reach for our passions. Finally, we would like to wish you good health and success in your noble life. ii ABSTRACT Air quality has become a critical concern globally as poor air quality affects the health of millions of people.
To address this issue, our team has pro- posed an Air Quality Monitoring System based on the Internet of Things and Artificial Intelligence. The system aims to provide a cleaner and safer environment for people by continuously monitoring the air quality and detecting any hazardous conditions that might arise. The system em- ploys Artificial Intelligence and IoT technology, enabling it to function with minimal human intervention. This system simultaneously apply artificial intelligence and Internet of things technology so it requires minimal human interaction.
Although we encoun- tered certain challenges and afterwards gave temporary solutions for each situation, the project has been updated on the basis of friendliness, safety, and significant contexts. This thesis is structured into five comprehensive chapters, providing a clear and detailed explanation of our work. The final outcome of our research aims to empower individuals to comprehend the quality of the air they breathe, enabling them to take proactive measures to improve their immediate envi- ronment. Additionally, our system incorporates fire recognition capabilities, serving to minimize risks and enhance safety in emergency situations.
Keyword for our work: Intel NUC, Temperature Sensor, Moisture Sensor, Fire Recognition, IoT Services, Artificial Intelligence. iii Table of contents Chapter 1.2 Scope and Objectives .1 Air quality monitoring phase .2 Fire detection phase .3 Advantages and Challenges .1 Air Quality Monitoring .2 Air Quality Index .3 Apply Interpolation in AQI prediction .2 Fire Detection Method .1 Fire detection using the training model .2 Sensor for Fire Detection .3 Fire detection using pre-processing method .4 Fire detection using the image classification .3 Internet of Things Server .2 Create AI Model. 36 iv Table of contents 3.1 Collecting Our Training Images .2 Annotating Our Training Images .3 Install YOLO v5 dependencies .4 Define YOLO v5 Model Configuration and Architecture 40 3.5 Train a custom YOLOv5 Detector .6 Evaluate Custom YOLOv5 Detector Performance .7 Run YOLOv5 Inference on Test Images .3 Devices And Components .4 Create User Interface .1 File organization structure .2 Define View Parts .3 Define Model Parts .4 Define Controller Parts .5 Build Design Pattern .6 Implement and run GUI .2 Install Libraries, Dependencies .2 Install system-level dependencies .4 Setup AI for the system .1 Training AI with YOLOv5 .2 Implement Trained Models Into The Program .3 Process and Create Output .5 Set up Thermal Camera for the system .1 Send Image from AI to GUI .2 Send data from UI to database. 83 v Table of contents 4.7 Read Data from sensors .1 Connect the Serial .2 Read data from GEMHO Sensors .3 Send/Receive Data With Adafruit IO .8 Read Thermal Image using Thermal Camera .1 Program ESP32 to read Thermal camera .2 Analizing data sent from ESP32 .3 Integrate AI vs Thermal Camera .9 Web Application Implementation .10 Github Source code .1 Performanace evaluation for AI model.
102 REFERENCES 103 vi List of figures 2.1 AQI Scale and Color Legend .2 General formula for AQI calculation .3 BP and I correspoding value .7 Create Bounding Boxes .8 Intersection Over Unions .9 Non-Max Suppression .10 Detect Fire using Yolo5 Model .11 Non-linear two-stage with a high colour similarity background 25 2.12 Non-linear two-stage with a Fire .13 The proposed fire detection framework using a two-stage non- linear colour space transformation .14 Linear image transformation .15 Linear image transformation .16 Image Classification with fire .17 Image Classification without fire .20 Communication between sensors, gateway, and cloud server .21 Analog and Sensor Signal .4 Create Bounding Box .5 Install Yolov5 and set up requirements. 39 vii List of figures 3.8 Yolov5 Training Process .9 Yolov5 Training Result(1) .10 Yolov5 Training Result(2) .12 View of NUC Intel .16 Gemho dust Sensor .17 Gemho CO2 Sensor .18 Gemho SO2 Sensor .19 Gemho NO2 Sensor .20 Gemho CO Sensor .21 Gemho RS485 wiring label .22 Gemho analog wiring label .23 MLX90640 Thermal Camera .32 Adafruit Required Parameters .34 Yolov5 Detection Parameters. 72 viii List of figures 4.7 Connect with Feed .8 Name the Block .9 Temperature and Humidity Chart .10 Configure ON OFF value for button .11 Configure Feeds for stream records .13 Device connection Step 1 .14 Device connection Step 2 .15 RS485 to USB converter .16 RS485 to USB converter .17 RS485 to USB converter .18 Thermal Camera with ESP32 .19 Thermal Image Data Example .20 Output image MLX90640 thermal camera .21 Fire image to detect .24 User’s Application receive fire signal .25 Data after being published .1 Our final system .1 Specification of NUC Intel Essential Kit .2 Component Shown in above Figure .3 Specification of Gemho Temperature and Moisture sensor .4 Specification of Gemho Dust sensor .5 Specification of Gemho CO2 sensor .6 Specification of Gemho SO2 sensor .7 Specification of Gemho NO2 sensor .8 Specification of Gemho CO sensor .1 Thesis Introduction 2Regardless of the historical period of human existence, our lives have always been susceptible to various potential dangers. In the current era of rapid in- dustrialization and modernization, pollution has emerged as a prominent and pressing issue.
Just like soil and water pollution, air pollution carries severe consequences. Foremost, it directly impacts human health. Continuous ex- posure to polluted air increases the risk of respiratory illnesses, compromises lung function, and even leads to life-threatening heart diseases. Moreover, air pollution plays a significant role in phenomena such as the greenhouse ef- fect and climate change, which have far-reaching implications for the planet.
While industrialization and modernization have undeniably contributed to improving people’s lives in many ways, they have also been key contributors to the escalating pollution levels. The establishment of advanced industrial parks has brought about the release of countless toxic substances, includ- ing carbon, nitrogen, sulfur, and various metal compounds. Additionally, emissions from vehicles powered by fuels like gasoline and oil significantly contribute to the deterioration of air quality. Addressing this critical situa- tion requires the implementation of sustainable and long-term measures.
In response to the growing concerns about air pollution, numerous air quality monitoring devices have been invented to address these issues. However, de- spite their existence, these devices have not fully and specifically resolved the problem at hand. Recognizing the limitations and disadvantages of ex- isting solutions, our proposed system aims to overcome these challenges and 2 1. Thesis Introduction provide an improved approach to air quality monitoring.
By leveraging in- novative technologies and methodologies, our system offers a comprehensive and efficient solution. We have identified the shortcomings of existing de- vices and integrated cutting-edge advancements into our proposed system. Through meticulous research and development, we have designed a monitor- ing system that addresses the limitations of current solutions, providing more accurate and reliable measurements of air quality.1 Proposal System To build this system, we need to combine many different technologies, rang- ing from hardware to software. However, the most important technologies needed to build this system including Fire Recognition, Internet of Things and Mobile Application.
Sensing system: In order to accurately measure and monitor air quality, our system utilizes built-in sensors that have been specifically chosen for their reliability and long-term stability. These sensors continuously gather data on various parameters related to air quality and then transmit it to a central server for processing and analysis. This ensures that any deviations from acceptable parameters can be quickly detected and addressed. Additionally, our system is designed to automatically collect data and provide timely no- tifications in the event of any environmental changes that may pose a risk to public health or safety.
By utilizing advanced sensor technology and real- time monitoring capabilities, our system offers a comprehensive solution for ensuring clean and healthy air for all. Internet of Things: In this system, the integration of the Internet of Things (IoT) technology is pivotal for its successful implementation.