Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 60 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
60
Dung lượng
3,03 MB
Nội dung
MINISTRY OF EDUCATION AND TRAINING HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION PROJECT AUTOMATION AND CONTROL ENGINEERING TECHNOLOGY DESIGN MONITORING AND PLATFORM OF IOT FOR ELECTRIC MOTORBIKE ADVISOR: PhD DO DUC TRI STUDENT: NGUYEN HUU THIEN AN SKL 0 6 Ho Chi Minh City, July, 2022 HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION PROJECT DESIGN MONITORING AND PLATFORM OF IOT FOR ELECTRIC MOTORBIKE Nguyễn Hữu Thiên Ấn Student ID: 17171003 Major: Automation and Control Engineering Technology Advisor: Đỗ Dức Trí, PhD Ho Chi Minh City, July 2022 i THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -Ho Chi Minh City, August 1st, 2022 GRADUATION PROJECT ASSIGNMENT Student name: Nguyen Huu Thien An Student ID: 17151003 Major: Automation and Control Engineering Technology Class: 17151CLA1 Advisor: PhD Do Duc Tri Phone number: 0908387655 Date of assignment: August 6th, 2022 Date of submission: August 6th, 2022 Project title: Design Monitoring and Platform of IoT for Electric Motorbike Initial materials provided by the advisor: References, scientific articles, reference programs, data sets, expected parameters of the System Content of the project: - Design, implement a kit include screen and IoT system with 3D-printting technology Design and build monitor system to work as a dashboard of motorbike Deploy Internet Connection to system and build dashboard in server Final product: Finish a dashboard system that have abilities to show data with high accuracy and communicating with server by wireless connection CHAIR OF THE PROGRAM ADVISOR ii THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -Ho Chi Minh City, August 1st, 2022 ADVISOR’S EVALUATION SHEET Student name: Nguyen Huu Thien An Student ID: 17151003 Major: Automation and Control Engineering Technology Project title: Design Monitoring and Platform of IoT for Electric Motorbike Advisor: PhD Do Duc Tri EVALUATION Content of the project: - Design, implement a kit include screen and IoT system with 3D-printting technology - Design and build monitor system to work as a dashboard of motorbike - Deploy Internet Connection to system and build dashboard in server Strengths: The content of the thesis fully meets the requirements Students have designed a Dashboard System that have abilities of monitor data and performing basic communications with server The results of monitoring and communication are quite good when experimenting on the Dashboard System Weaknesses: To consider experiments on more conditions to have a reference for evaluating the accuracy of the system Approval for oral defense? (Approved or denied) Approved Overall evaluation: (Excellent, Good, Fair, Poor) Excellent Mark: 8.5 (in words: eight point five.) Ho Chi Minh City, month day, year ADVISOR iii THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -Ho Chi Minh City, August 1st, 2022 PRE-DEFENSE EVALUATION SHEET Student name: Nguyen Huu Thien An Student ID: 17151003 Major: Automation and Control Engineering Technology Project title: Design Monitoring and Platform of IoT for Electric Motorbike Name of Reviewer: PhD Le My EVALUATION Content and workload of the project The content and workload meet requirement of project, however author should explain clearly the objectives of the project Strengths: The system can work under ideal conditions in the laboratory Weaknesses: The author needs to refer to the existing systems related to the project Explain the meaning and purpose of the project clearly Approval for oral defense? (Approved or denied) Approved Overall evaluation: (Excellent, Good, Fair, Poor) Fair Mark7.5 (in words: seven point five) Ho Chi Minh City, August 18th, 2022 REVIEWER (Sign with full name) iv ACKNOWLEDGEMENT Firstly, allow me to send to school board, all lecturers of the Faculty of High-Quality Training and Huynh Vo Group the sincerest thanks for creating favorable conditions for the next generation to learn, to work and to develop their creativity During our studies at Ho Chi Minh City University of Technology and Education, not only have the lecturers communicated their erudite knowledge but also motivated them to be able to finish their final thesis Simultaneously, I especially would like to express my sincerest gratitude to M.Eng Do Duc Tri who directly guided me to complete my thesis We highly appreciate his conscientious guidance throughout the implementation process By his extensive intellect and enthusiasm, he has instructed me to the final step of the thesis Besides, I would like to acknowledge my family, my friends who have assisted me during the implementation of the scheme v TÓM TẮT Đồ án tập trung nghiên cứu sở lý thuyết khả triển khai nhằm phát triển mơ hình IoT tồn diện cho xe máy điện thị trường Việt Nam Đề tài lập kế hoạch thực dựa sở thu từ nghiên cứu thị trường, nghiên cứu xe máy điện sử dụng tảng IOT truyền liệu giám sát Nhiệm vụ luận án tóm tắt sau: Tổng quan thị trường xe máy điện toàn cầu Việt Nam Nhìn chung, chương phân tích đầy đủ yếu tố khách quan chủ quan phát triển thị trường xe máy điện Việt Nam nhu cầu thiết bị kết nối Tập trung phân tích giao thức CAN Bus xe điện Xây dựng mô xe điện Nội dung thể rõ việc lựa chọn điều khiển vi mơ cơng cụ mơ để thích ứng với tín hiệu tiêu chuẩn xe máy điện Giới thiệu thuật toán xây dựng thiết bị IoT cho xe máy điện Nội dung chương trình bày tồn q trình làm việc với Raspberry Pi, tảng Thingspeak cách xây dựng thiết bị truyền tín hiệu tối ưu từ mơ tín hiệu CAN xe điện Mô tả cách xây dựng hệ thống dashboard phù hợp nhất, bao gồm phần cứng, phần mềm, cấu trúc dashboard Chạy demo đánh giá hoạt động Nền tảng IoT Kết luận hướng phát triển cho đề tài Do thời gian kinh phí có hạn nên luận văn cịn nhiều sai sót Em mong nhận góp ý chân thành từ giảng viên Trân trọng vi ABSTRACT Thesis focuses on researching theoretical foundations and implementation possibilities to develop the most comprehensive IoT model for electric motorbikes in Vietnamese market The thesis is planned and implemented based on the bases obtained from market research, electric motorcycles research and using the latest IOT platforms on data transmission and monitoring The main task of thesis summarizes as below: An overview of the global and Vietnamese electric motorcycle markets In general, chapter one fully analyzes the objective and subjective factors for the development of the electric motorcycle market in Vietnam and the need for connectivity devices Focus on analyzing CAN Bus protocol on electric vehicles Building an electric vehicle simulator The content clearly demonstrates the selection of micro-controllers and simulator tools to adapt with standard signals of an electric motorcycle Introduction to algorithms and building IoT devices for electric motorbikes The content of the chapter outlines the entire process of working with the Raspberry Pi, the Thingspeak platform, and how to build an optimal signal transmission device from the electric vehicle CAN signal simulator Describe how to build the most appropriate dashboard system, include hardware, software, structure of dashboard Run a demo and evaluate the operation of the IoT Platform Conclusions and development directions for the topic Due to the limited time and budget, the thesis still has many errors I hope to receive honest feedback from lecturers Sincerely vii Contents ACKNOWLEDGEMENT v TÓM TẮT vi ABSTRACT vii LIST OF ABBREVIATIONS xiii CHAPTER 1: OVERVIEW 1.1 Motivate for selecting the topic 1.2 Existing project 1.3 Subjective factors from the Vietnamese market 1.3 Thesis Mission 1.4 Project scope 1.5 Research method 1.6 Content CHAPTER 2: THEORETICAL BASIS 2.1 Internal electric 2-wheeler vehicle system 2.2 What is internet of vehicle (IoV)? 2.3 Definition of layers of internet of vehicle 2.4 Controller Area Network (CAN) protocol 10 2.5 2.4.1 Application 10 2.4.2 Architectures 11 Dashboard system 13 2.5.2 The microcontroller 13 2.5.3 System architecture 14 2.5.6 About QT designer 14 CHAPTER 3: BUILD HARDWARE AND PROGRAMING 3.1 Component used in the project 16 16 3.1.1 Microcontroller 16 3.1.2 High-Speed CAN Transceiver 17 3.2.3 7-inch HDMI LCD screen 19 3.2.4 ThingSpeak cloud for IoT application 20 3.2.5 Module SIM7600E-H 4G HAT 20 3.3 Architecture of system 21 3.3.1 Flowchart of system 21 3.3.3 Mechanical part 21 viii 3.3.4 Screen configuration 23 3.3.4.2 Implementation results on screen 23 3.3.4.3 Analyze screen’s operation 23 3.4 Graphical User Interface (GUI) Deployment 24 3.5 Setup for CAN for sub-system and main-system 26 3.5.1 Setup for sub-system and main-system 26 3.5.2 Upload code test for sub-system 26 3.5.3 Upload code test for main-system 27 3.6 Process to setup system 28 3.6.1 Setup for Raspberry Pi B4 28 3.6.2 Deploy final version to Raspberry Pi B4 28 3.6.3 Prepare for the internet of Raspberry Pi B4 29 3.6.4 Prepare for CAN module 31 3.6.5 Prepare server for uploading data 31 3.6.6 How to run all of them whenever system boot up automatically? 31 3.6.6.1 Create a launcher script 32 3.6.6.2 Make It Executable 32 3.6.6.3 Add Logs Directory 32 3.6.6.4 Add to Crontab 33 3.6.6.5 Reboot and See If It Works 33 CHAPTER 4: EXPERIMENT RESULT AND DISCUSSION 4.1 Result 34 34 4.1.1 Result overview 34 4.1.2 Image of real-life system 34 4.2 Discussion 34 4.2.3 Error Signal Detection 37 CHAPTER 5: CONCLUSION & FUTURE DEVELOPMENT 5.1 Conclusion REFERENCES 39 39 41 Bibliography 41 APPENDIS 42 ix 3.6.4 Prepare for CAN module First of all, CAN module needs to be connected with Raspberry Pi B4 After that, the student installs some libraries that need operation Then, the student config for system If the result is just like the following pictures, it means that CAN module is compatible with Figure 3.23: when CAN module connect success system After that, the student will connect the H and L port of RS485 CAN HAT to another subsystem 3.6.5 Prepare server for uploading data First, we need to create channel, then create many fields that will show data on it To collect data, the student had to copy channel links and API keys to deploy to program Figure 3.24: create new channel in thingspeak 3.6.6 How to run all of them whenever system boot up automatically? This is one of the most critical of system Normally, dashboard needs to boot everything automatically To solve this problem, the student has chosen a simple way, which is create a launcher script and run it automatically whenever Raspberry boost There are following steps that need to complete 31 3.6.6.1 Create a launcher script My python script is called: main.py and lives in a directory called main that is in the root directory We will use the Linux crontab to run the Python script The launcher script will look like the following picture Figure 3.25: Create a launcher script in Raspberry What this script will is to navigate to the root directory, then to the bbt directory, launch the Python script and then return to the root directory 3.6.6.2 Make It Executable We need to make the launcher script an executable, which we with this command: $ chmod 755 launcher.sh Now test it, by typing in: $ sh launcher.sh This should run the Python code 3.6.6.3 Add Logs Directory We will get to using crontab in a minute, but first we need to make a directory for the any errors in crontab to go Navigate back to home directory: $ cd Create a logs directory: $ mkdir logs 32 3.6.6.4 Add to Crontab Figure 3.26: add to crontab in raspberry Crontab is a background (daemon) process that lets you execute scripts at specific times It's essential to Python and Raspberry Pi The details are confusing, as is often the case with Linux Once I got the hang of the format, I've found it to be incredibly easy to use Type in: $ sudo crontab -e This will bring up a crontab window Now, enter the line: $ @reboot sh /home/pi/bbt/launcher.sh >/home/pi/logs/cronlog 2>&1 What this does is rather than executing the launcher script at a specific time, it will execute it once upon startup 3.6.6.5 Reboot and See If It Works Unplug the power or just type in: $ sudo reboot Wait for startup and see if your script automatically launches 33 CHAPTER 4: EXPERIMENT RESULT AND DISCUSSION 4.1 Result 4.1.1 Result overview Figure 4.1: overview of system 4.1.2 Image of real-life system Figure 2: real-life system's image 4.2 Discussion The performance test was repeated three times, and the device was run continuously for 12 hours The experiment was designed to examine the device's ability to operate for a period of time comparable to or greater than the operational time of an electric motorcycle Flowing the green rectangle to compare the data 34 First time: 21st June 2021| 12:28:00 PM: Figure 4.3: screenshot of terminal screen when receive CAN signal Figure 4.4: screenshot of dashboard These above images are the data that is read from sub-system at 22st June 2021| 00:28:00 PM Then the author left system and sub-system work for day continuously to test how consistence of the system was First time: 22st June 2021| 00:28:00 PM: 35 Figure 4.5: screenshot of terminal screen when receive CAN signal It can be seen from figure 33 that data sent to IoT platform was continuous and stable after the whole day It proves that system can work well with the mentioned scope Figure 4.6: screenshot of dashboard After day, system and sub-system still worked well, data was not interrupt and correct all the time I show that system meet the requirement of the mentioned objective 36 4.2.3 Error Signal Detection 180 160 140 120 100 80 60 40 20 13 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 127 133 139 145 151 157 163 169 175 181 187 193 199 205 211 217 Figure 4.7: Normal signal connection During operating, system may break down for some reasons To observe and measure data of break down time The author was record normal data and data with issue With these data, user can easier fix system when they met problem like this The data in figure 35 show normal data and the following data show how I would be when system got problem and which problem are normally happened to system 180 160 140 120 100 80 60 40 20 17 25 33 41 49 57 65 73 81 89 97 105 113 121 129 137 145 153 161 169 177 185 193 Figure 4.8: Lost-signal connection When system lost internet connection, all data record was drop to and remain until internet connection fixed 37 180 160 140 120 100 80 60 40 20 10 19 28 37 46 55 64 73 82 91 100 109 118 127 136 145 154 163 172 181 190 199 208 217 226 235 Figure 4.9: Lost CAN connection When system lost CANbus connection, system will keep the value of system at the moment it lost CANbus connection and kept updated after connection recovery COMMENT ● For each different case, the device receives and transmits exactly as required ● No problems with delay or mis-transmission in the event of an error ● Based on the shape of the graph, we can predict the problem of the device and the user From there, there are reasonable measures ● Therefore, the main system is adjusted and repaired by the OEM to better meet the demands of the user 38 CHAPTER 5: CONCLUSION & FUTURE DEVELOPMENT 5.1 Conclusion The thesis has completed all missions: ● Study and complete the fundamentals and theoretical foundation for electric vehicles (electric vehicle internal system, protocol communication, wiring diagram) ● Research and successfully build a potential IoT device working well at sending and receiving signals between electric vehicles and IoT platform ● Testing and validating results of project to ensure the quality performance of IoT device Based on the results, we have completely connected an electric motorcycle to an IoT platform for analyzing and monitoring user data By our method processes some pros and cons - Advantages: ● The signal is less delayed and correctly matches the simulated data ● from the EV simulator ● On electric vehicles, the connection protocol is quick to use and install ● Due to the usage of the user's Internet, the connection is simple and ● convenient ● The device's transmission algorithm is not incredibly complicated Data management interface that is simple to use and can support a massive number of devices at the same time - Disadvantages: The device depends a lot on the battery system, if the battery does not work, the device will also be affected Due to limited time and budget, we have not applied more for a real electric motorcycle Certainly, in the near future, the IoT for electric vehicles will be widely applied to improve our mobility and reduce traffic jams So, I hope the thesis will be a stepping stone for the development of electric motorcycles in the Vietnamese market 5.2 Future development The current research serves as the foundation and premise for effectively building and developing the issue at a higher level Improve the system in general and make it more stable in a variety of environments: ● Improving qualities of firmware and signals 39 ● Before becoming commercial, hardware optimization should be considered ● Modeling data and visualization to find the customer insights and detect issues as soon as possible 40 REFERENCES Bibliography [1] P S Preeti Wadhwani, "Electric Motorcycles & Scooters Market Size By Product (Motorcycles, Scooters), By Battery (SLA, Liion), By Voltage (24V, 36V, 48V), COVID-19 Impact Analysis, Regional Outlook, Growth Potential, Price Trends, Competitive Market Share & Forecast, 2021 – 20," Jun 2021 [2] A D Bank, "“Electric Two-Wheelers in India and Viet Nam- Market Analysis and Environmental Impacts ”," 2009 [3] Prof Mahesh S Khande, Mr Akshay S Patil, Mr Gaurav C Andhale, Mr., "Design and Development of Electric scooter," 2019 [4] Juan Contreras-Castillo, Sherali Zeadally & Juan Antonio Guerrero Ibáñez, "A sevenlayered model architecture for Internet of Vehicles," Journal of Information and, 2017 [5] A R SLOA101, "Introduction to the Controller Area Network (CAN)," Department of Computer Science, Texas Instruments Incorporated, August 2002 [6] Wikipedia, "Wikipedia," [Online] [7] EAS3 Robert Bosch Engineering and Business Solutions Việt Nam, "XCollaboration Project for G4," 2020 [8] Matthew N O Sadiku, Mahamadou Tembely, and Sarhan M Musa, “Internet of Vehicles: An Introduction”, January 2022 41 APPENDIS import os import sys from PyQt5 import QtCore, QtGui, QtWidgets from widgets import Speedometer, Battery ########################################################################## ###################### # Convert UI to PyQt5 py file ########################################################################## ###################### # os.system("pyuic5 -o ui_main.py ui_main.ui") # os.system("pyuic5 -o analoggaugewidget_demo_ui.py analoggaugewidget_demo.ui.oQCkCR") ########################################################################## ###################### # Import the generated UI ########################################################################## from ui_main import Ui_MainWindow ########################################################################## ###################### # MAIN WINDOW CLASS ########################################################################## ###################### class MainWindow(QtWidgets.QMainWindow): def init (self, parent=None): QtWidgets.QMainWindow. init (self) ########################################################################## ###################### # Setup the UI main window ########################################################################## ###################### self.ui = Ui_MainWindow() self.ui.setupUi(self) ########################################################################## ###################### # Setup the UI speedometer ########################################################################## ###################### self.spdm = Speedometer(self.ui.speedometer) # Set kich thuoc toi da cua cong to met self.spdm.setMinimumSize(QtCore.QSize(320, 320)) # Set kich thuoc nho toi da cua cong to met self.spdm.setMaximumSize(QtCore.QSize(500, 500)) # Set kich thuoc mac dinh ban dau cua cong to met self.spdm.setBaseSize(QtCore.QSize(320, 320)) #Set value cho cong to met 42 self.spdm.value = 50 ########################################################################## ###################### # SET DEFAULT THEME SPEEDOMETER ########################################################################## ###################### self.spdm.setGaugeTheme(2) ########################################################################## ###################### # Setup the UI BATTERY ########################################################################## ###################### self.btr = Battery(self.ui.battery) # Set kich thuoc lon toi da cua cong to met self.btr.setMinimumSize(QtCore.QSize(320, 320)) # Set kich thuoc nho toi da cua cong to met self.btr.setMaximumSize(QtCore.QSize(500, 500)) # Set kich thuoc mac dinh cua cong to met self.btr.setBaseSize(QtCore.QSize(320, 320)) #Set value cho cong to met self.btr.value = 20 ########################################################################## ###################### # SET DEFAULT THEME PIN ########################################################################## ###################### self.btr.setGaugeTheme(1) ########################################################################## ###################### # SET VALUE DISTANCE ########################################################################## ###################### self.valueDistance(69696) ########################################################################## ###################### # Show window ########################################################################## ###################### self.show() def valueDistance(self,value): self.ui.distance.setText(str(value)+ "km") 43 ######################################################################## ## EXECUTE APP ######################################################################## if name == ' main ': app = QtWidgets.QApplication(sys.argv) ######################################################################## ## ######################################################################## window = MainWindow() window.show() sys.exit(app.exec_()) ######################################################################## ## END===> ######################################################################## 44 S K L 0