Điều khiển mô hình xe bằng wifi

30 242 0
Điều khiển mô hình xe bằng wifi

Đ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

VIETNAM GENERAL CONFEDERATION OF LABOUR TON DUC THANG UNIVERSITY FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING REPORT PROJECT BUILD CONTROLLER FOR TOY CAR VIA INTERNET Lecturer: M.Sc PHAN TAN PHAT Student: DINH VAN CHUNG Student’s ID: 41301216 Class: 13040310 Course: 17 HO CHI MINH CITY, 2016 VIETNAM GENERAL CONFEDERATION OF LABOUR TON DUC THANG UNIVERSITY FACULTY OF ELECTRICAL AND ELECTRONICS ENGINEERING REPORT PROJECT BUILD CONTROLLER FOR TOY CAR VIA INTERNET Lecturer: M.Sc PHAN TAN PHAT Student: DINH VAN CHUNG Student’s ID: 41301216 Class: 13040310 Course: 17 HO CHI MINH CITY, 2016 PREFACE Now, with the application of advanced science and technology, the world changes every day, more civilized and more modern With the development of the Internet, smartphones and especially the sensors, the system connects all things, Internet of Things (IoT) is becoming the new trend of the world One of the applications of IoT is to control equipment From above reasons, a new design was created and implemented with topic “Build controller for toy car via internet” THANK YOU In the process of learning and completing this coursework, I have received the guidance and help of the lecturers, siblings and friends With respect and deep gratitude I would like to express sincere thanks Lecturers of faculty Electrical – Electronics engineering and the friends in the class and faculty who contributed ideas and exchange of experiences in process I made this project I sincerely thank M.Sc Phan Tan Phat was always interested and enthusiastic guide and help me complete this project In the process of implementing the project inevitably make mistakes, look forward to the contribution of lecturers and friends to me more complete this first project Ho Chi Minh City, November 5th, 2016 Author CƠNG TRÌNH ĐƯỢC HỒN THÀNH TẠI TRƯỜNG ĐẠI HỌC TƠN ĐỨC THẮNG Tơi xin cam đoan cơng trình nghiên cứu riêng hướng dẫn khoa học ThS Phan Tấn Phát Các nội dung nghiên cứu, kết đề tài trung thực chưa cơng bố hình thức trước Những số liệu bảng biểu phục vụ cho việc phân tích, nhận xét, đánh giá tác giả thu thập từ nguồn khác có ghi rõ phần tài liệu tham khảo Ngoài ra, luận văn sử dụng số nhận xét, đánh số liệu tác giả khác, quan tổ chức khác có trích dẫn thích nguồn gốc Nếu phát có gian lận tơi xin hồn tồn chịu trách nhiệm nội dung luận văn Trường đại học Tôn Đức Thắng không liên quan đến vi phạm tác quyền, quyền gây q trình thực (nếu có) TP Hồ Chí Minh, ngày 05 tháng 11 năm 2016 Tác giả (ký tên ghi rõ họ tên) COMMENT ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ……………………………………………………………………………………… ………………………………………………………………… CONTENTS LIST OF FIGURES IX LIST OF TABLES X LIST OF ACRONYMS XI CHAPTER 1.INTRODUCED THE INTERNET 1.1 THE INTERNET NETWORK 1.2 THE INTERNET OF THINGS (IOT) CHAPTER 2.SYSTEM DESIGN .3 2.1 BLOCK DIAGRAM 2.2 INTRODUCED BLYNK APP 2.3 MODULE ESP8266 .4 2.4 CONTROL UNIT 2.5 DC CONTROL UNIT 2.6 THE COMPONENTS USED IN THE CONTROLER CIRCUIT PIC 16F877A IC 7805 10 Some other components 11 CHAPTER 3.MODEL EXPERIMENT .12 3.1 CONTROL APP 12 3.2 KIT PIC PRINTED CIRCUIT 12 3.3 KIT PIC 13 3.4 CAR MODEL COMPLETE .14 CHAPTER 4.COMMENTS AND CONCLUSIONS 15 4.1 COMMENT 15 4.2 CONCLUSION 15 4.3 DEVELOPMENT 15 REFERENCES .16 APPENDIX A 17 ESP8266 CODE 17 MAIN CODE 17 LIST OF FIGURES FIGURE 2-1: THE MAIN CONTROL BLOCK FIGURE 2-2: BLYNK APP FIGURE 2-3: ESP8266 V7 MODULE .5 FIGURE 2-4: LOAD THE CODE WITH ARDUINO IDE SOFTWARE FIGURE 2-5: PIC KIT CIRCUIT DIAGRAM .7 FIGURE 2-6: CONTROL CIRCUIT BLOCK .7 FIGURE 2-7: MODULE L298 FIGURE 2-8: PIC 16F877A FIGURE 2-9: PINS DIAGRAMS PIC 16F877A 10 FIGURE 2-10: PINS DIAGRAMS IC 7805 11 FIGURE 2-11: DIAGRAM +5V SOURCE VOLTAGE 11 FIGURE 3-1: CONTROL APP INTERFACE 12 FIGURE 3-2: PRINTED CIRCUIT .12 FIGURE 3-3: PIC KIT 13 FIGURE 3-4: PIC KIT 13 FIGURE 3-5: CAR MODEL COMPLETE 14 FIGURE 3-6: CAR MODEL COMPLETE 14 LIST OF TABLES TABLE 2-1: CONNECTION DIAGRAMS ESP8266 TO USB UART REPORT PROJECT Page 5/19 - UART serial protocol with maximum baud rate 115200 - There are three modes of operation: Client, Access Point, Both Client and Access Point - Support for security standards: OPEN, WEP, WPA_PSK, WPA2_PSK, WPA_WPA2_PSK - Support communications TCP and UDP - Working as a server can connect up to workstations In the project, used ESP 8266 V7 module, as show in Figure 2-3 Figure 2-3: ESP8266 V7 module Pins diagrams:  REST: Reset pin  ADC: Read analog data  CH_PD: Enabled chip, use for Flash Boot and updating module  GPIO: I/O pins  VCC: Input voltage 3.3V (circuit >300mA)  GND: Ground pin  TXD: TX pin of protocol UART  RXD: RX pin of protocol UART Need to load the code for module esp8266 to it connect to the wifi and receive control signals from the controller app Used UART communication module to load the code with Arduino IDE software Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 6/19 ESP8266 USB UART TX RX RX TX CH_PD 3.3V VCC 3.3V GND GND GPIO0 GND Table 2-1: Connection diagrams ESP8266 to USB UART Used Arduino IDE software to load the code When software is shown in Figure 2-4 is finished Figure 2-4: Load the code with Arduino IDE software Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 7/19 2.4 Control unit Figure 2-5: PIC KIT circuit diagram Figure 2-6: Control circuit block The buttons corresponding with the GPIO pins are set before of the ESP8266 module In the real circuit, the GPIO pins of the ESP8266 module will be connected to the pins A0 to A3 of the PIC The input signals of the pins of the ESP8266 module will control the output signal of the B0 to B5 pins of the PIC to car forward, backward, turn left, turn right such as programming code Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 8/19 2.5 DC control unit In this project used the motor control module L298 to control two DC motors, a motor control forward, backward and a motor control left, right Figure 2-7: Module L298 Specifications:  L298 integrated H-bridge circuit  Voltage control: +5V ~ +12V  Maximum circuit for each H-bridge: 2A  The voltage of the control signal: +5 V ~ +7 V  The circuit of the control signal: ~36mA L298 includes the pins:  12V power: Supplies for motor (+6V ~ +35V)  5V power: 5V output  GND: Ground  Four INPUT pins: IN1, IN2, IN3, IN4 are connected in turn to the pins 5, 7, 10, 12 of the L298 This is the control signal pins Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 9/19  Four OUTUT pins: OUT1, OUT2, OUT3, OUT4 (corresponding to INPUT pins) is connected to the pins 2, 3, 13, 14 of the L298 These pins are connected to the DC motors  Two pins ENA and ENB used to control the L298 H-bridge circuit If at logic "1" (5V) allowing H-bridge circuits operation, if at logic "0", the Hbridge circuits are not operation  5V enable: This jumper is used to output power supply 5V If use source over 12V, remove the jumper out 2.6 The components used in the controler circuit PIC 16F877A Figure 2-8: PIC 16F877A PIC 16F877A is the most popular now Overall structure of 16F877A as follows: - 8Kbyte ROM Flash - 368 Byte RAM - 256 Byte EEPROM - Five ports (A, B, C, D, E) I/O with independent control signals - Two 8-bits timers (timer and timer 2) - One 16-bits timer (timer1) can operate in energy saving mode (SLEEP MODE) with external Clock source - Two CCP (Capture /Compare /PWM) - One 10 bits AD converter, inputs Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 10/19 - One analog comparators - One timer monitoring (WatchDog Timer) - One 8-bit parallel port with control signals - One serial port - 15 interrupt source - Loading programs by serial port ICSP (In-Circuit Serial Programing - Technology manufactured: CMOS - The maximum operating frequency 20MHz Figure 2-9: Pins diagrams PIC 16F877A IC 7805 7805 is IC voltage regulator 5V corresponding with line 1A structure - Pin 1: Input +8VDC to +25VDC - Pin 2: GND - Pin 3: Output +5V Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 11/19 Figure 2-10: Pins diagrams IC 7805 Principle diagram Figure 2-11: Diagram +5V source voltage Pin of 7805 connected with the input +8VDC to +25VDC, pin connected GND, pin is output +5V In power circuit used - Diode 1N4007 to avoid going backwards current - Capacitor used to stabilize output - Led to indicate the source and resistor is line limit for led Some other components - Diodes 1N4007 - Transistors: 10K - Crystal: 22M - Capacitor: 1nF, 100nF, 470uF, 2200uF Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 12/19 CHAPTER MODEL EXPERIMENT 3.1 Control app Figure 3-1: Control app interface When keypress on the interface of the app, the corresponding GPIO pins are set before of the esp8266 module will at logic 3.2 KIT PIC printed circuit Figure 3-2: Printed Circuit Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 13/19 3.3 KIT PIC Figure 3-3: PIC KIT Figure 3-4: PIC KIT Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 14/19 3.4 Car model complete Figure 3-5: Car model complete Figure 3-6: Car model complete Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 15/19 CHAPTER COMMENTS AND CONCLUSIONS 4.1 Comment Project “Build controller for toy car via internet” basically meet the requirements of second project This car relatively stable operations in accordance with the design and requirements set out Besides, circuit can use to control equipment via internet Example: light, fan, air conditioner… 4.2 Conclusion Project “Build controller for toy car via internet” is feasible and can be applied to produce unmanned vehicle, controller electrical equipment From the initial success can expect that products meet the needs smart devices of human 4.3 Development Product research is needed to complete, upgrade and optimization: - Design circuit to control electrical appliances - Design optimized for smaller circuit Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 16/19 REFERENCES Vietnamese: [1] https://vi.wikipedia.org/ [2] http://arduino.vn/ English: [3] http://www.blynk.cc/ [4] http://www.esp8266.com/ [5] http://www.alldatasheet.com/ [6] https://github.com Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 17/19 APPENDIX A ESP8266 code #define BLYNK_PRINT Serial #include #include char auth[] = "ec76ccf85995471d8d37edadd2e8a274"; //Auth Token Blynk app char ssid[] = "No Free";//Wifi name(ssid) char pass[] = "nolimit0979"; //wifi password void setup() { Serial.begin(9600); Blynk.begin(auth, ssid, pass); } void loop() { Blynk.run(); } Main code #include #fuses HS,NOWDT,NOPROTECT #use delay(clock=20M) #define UP PIN_A0 #define DOWN PIN_A1 #define RIGHT PIN_A2 #define LEFT PIN_A3 #define ENA PIN_B0 Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 18/19 #define IN1 PIN_B1 #define IN2 PIN_B2 #define IN3 PIN_B3 #define IN4 PIN_B4 #define ENB PIN_B5 void main() { set_tris_a(0xff); set_tris_b(0x00); output_b(00001100); output_high(ENA); output_high(ENB); while(TRUE) { //Car go straight if(input(UP)==1) { output_high(IN1); } else { output_low(IN1); } //Car go back if(input(DOWN)==1) { output_high(IN2); } else Build Controller for toy car via internet DINH VAN CHUNG REPORT PROJECT Page 19/19 { output_low(IN2); } //Car turn left if(input(RIGHT)==1) { output_high(IN3); } else { output_low(IN3); } //Car turn left if(input(LEFT)==1) { output_high(IN4); } else { output_low(IN4); } } } Build Controller for toy car via internet DINH VAN CHUNG ... #include char auth[] = "ec76ccf85995471d8d37edadd2e8a274"; //Auth Token Blynk app char ssid[] = "No Free";/ /Wifi name(ssid) char pass[] = "nolimit0979"; / /wifi. .. 3/19 CHAPTER SYSTEM DESIGN 2.1 Block diagram Control signals (Blynk app) Receives control signals (wifi module) Control (PIC16F877A) DC driver (H-bridge) DC motors Figure 2-1: The main control block... Kbyte Flash - Using serial protocol with baud rate 9600 (default) - Support standard 802.11 b/g/n - Wifi 2.4 GHz support WPA /WPA2 - Operating voltage: 3.3V Build Controller for toy car via internet

Ngày đăng: 16/10/2017, 13:47

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan