Đây là tài liệu rất chi tiết để thiết kế một con robot dò đường.
"Making Microcomputer Controlled Line Tracing Robot" Edited by Shibaura Institute of Technology, Center for Lifelong Learning and Extension Programs S.I.T LTR04 Line Tracing Robot Hardware & Software Manual Shibaura Institute of Technology Center for Lifelong Learning and Extension Programs Ver.0.2 for UCI Summer Session Preface Recently, various topics on robot are frequently appearing in TV. Though people are increasingly interested in the robot, there is a little chance to learn how to make robots by themselves. Since Shibaura Institute of Technology (SIT) has experiences in the making of micro mouse robot, we developed the educational robotics workshop program using the new line tracing robot (S.I.T LTR01) with digital logic circuit for celebrating the 70th anniversary of Shibaura Institute of Technology in 1997. After this, we developed variety of robots and programs for the workshops. Based on these experiences, we began to develop the microprocessor controlled line tracing robot again in 2000, and developed the line tracing robot (S.I.T LTR02) in 2001. It was a robot with a simple structure for easy understanding of electronics, computer system and control mechanism, and the line tracing robot (S.I.T LTR03) was improved based on the experiences of the workshops over several times in 2002, and started a line tracing robot workshops every year. After this, robot has been improved and completed as the S.I.T LTR04 course. This lecture will use a line tracing robot that contains all three elements that make up robot “Sensor”, “Microcomputer processing”, “Motor drive control”. And this purpose is to get a deep understanding of the mechanism by making every student make a robot mechanism and electronics circuit as well as writing and debugging control programs to control the robot actually. The robot is composed of as few parts as possible for the purpose of understanding the principle of control program as well as the configuration of the circuit behavior. Therefore, you also will notice principle of the device you are using in the circuit. The one-chip microprocessor is used for computer which provides intelligence to the robot. The microprocessor contains all the features of the computers, and is an affordable material to understand the principle of operation of the computer and programming. We think you will have many difficulties in the workshop, however are confident that you will reach the confidence that “I can control anything using a microcomputer” by the end. Finally, we would express our gratitude for manual editing to many members of each laboratory including Mr. Koji Noda. July 25, 2005 Shibaura Institute of Technology, Center for Lifelong Learning and Extension Programs Robot Seminar Group Shibaura Institute of Technology, College of Engineering, Dept. of Electrical Engineering Human Robot Interaction Laboratory Professor Makoto Mizukawa Robotics Laboratory Associate Professor Yoshinobu Ando Shibaura Institute of Technology Professor Emeritus Chie Kasuga Ftech Co.,LTD Yasuo Ogawa English version was prepared for UC Summer Session in S.I.T. in 2012 with the support from following professors. Shibaura Institute of Technology, College of Design Engineering, Dept. of Design Engineering Robotics Laboratory Professor Yoshinobu Ando Shibaura Institute of Technology, College of Engineering, Dept. of Electrical Engineering Robot Task & System Laboratory Professor Takashi Yoshimi Micro-Mechatronics Laboratory Associate Professor Tadahiro Hasegawa Human Robot Interaction Laboratory Professor/Dean, College of Engineering Makoto Mizukawa July, 8th, 2012 Table of contents Chapter 1 Introduction ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・1 Chapter 2 Configuration of the line tracing robot kit ・・・・・・・・・・・・・・・・・・・・・・2 2.1 A circuit diagram, a printed circuit board, and a part list ・・・・・・・・・・・・・・2 2.2 Drawing aluminum bracket, figure aluminum mounting for cart ・・・・・・・・・・6 Chapter 3 Assembly・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・8 3.1 Printed circuit board assembly procedure ・・・・・・・・・・・・・・・・・・・・・8 3.2 Parts mounting procedure・・・・・・・・・・・・・・・・・・・・・・・・・・・・23 Chapter 4 Program development・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・26 4.1 Port Assignments ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・26 4.2 Program development by assembly language・・・・・・・・・・・・・・・・・・・27 4.2.1 Assembly ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・27 4.2.2 Flashing LED, switch operation ・・・・・・・・・・・・・・・・・・・・・28 4.2.3 Straight, curve・・・・・・・・・・・・・・・・・・・・・・・・・・・・・37 4.2.4 How to detect the line using the photo sensor ・・・・・・・・・・・・・・・42 4.2.5 How to follow the line ・・・・・・・・・・・・・・・・・・・・・・・・・43 4.3 Sample program using assembly language・・・・・・・・・・・・・・・・・・・・68 4.3.1 Turn on and off LEDs ・・・・・・・・・・・・・・・・・・・・・・・・・68 4.3.2 Go straight ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・71 4.3.3 Line trace1・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・74 4.3.4 Line trace2・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・78 4.4 Program development by C language・・・・・・・・・・・・・・・・・・・・・・・86 4.4.1 Flow of program development ・・・・・・・・・・・・・・・・・・・・・・86 4.4.2 Blinking of LED, Switch operation ・・・・・・・・・・・・・・・・・・・86 4.4.3 Go straight,Turn ・・・・・・・・・・・・・・・・・・・・・・・・・・・92 4.4.4 Method of detecting the line by sensor ・・・・・・・・・・・・・・・・・・100 4.4.5 How to trace a line・・・・・・・・・・・・・・・・・・・・・・・・・・・102 4.5 Example Program by C Language ・・・・・・・・・・・・・・・・・・・・・・・ 110 4.5.1 Blinking LED ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・110 4.5.2 Go straight ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・112 4.5.3 Line Trace(for beginners)・・・・・・・・・・・・・・・・・・・・・・・113 4.5.4 Line Trace(for middle level)・・・・・・・・・・・・・・・・・・・・・・116 4.5.5 Line Trace(for advanced level)・・・・・・・・・・・・・・・・・・・・・119 1 Chapter 1 Introduction 【Background and features of production kit】 In 1997, the line tracing robot “S.I.T LTR01” was developed to celebrate the 70th Anniversary of Shibaura Institute of Technology (SIT). Afterwards, we have been working on the development of various robots, such as multi-legged walking robot for the robot seminar. In 2001, we designed line tracing robot again with the “S.I.T LTR02”. From this experience, we continued to make “S.I.T LTR03” in 2002. It was awarded the Good Design Award in 2003. After that, “S.I.T LTR04” was developed with improvements to increase robot’s speed. S.I.T LTR series are designed with a minimum number of elements that make up the robot, so it can be easily assembled in a short time even by beginners and can be used as the material for introduction to microcomputer. Moreover, it carefully supports the creation of robot for beginners. For reference in case you cannot participate in the seminar, the content of the lectures is included in CD-ROM provided with this textbook. 【Kit Contents】 Main components of S.I.T LTR04: 1. Microcomputer board: 1x PIC16F84 (20MHz) microcomputer and peripheral circuits. 2. Detection sensor line: 3x LED and phototransistor pairs. 3. Gear motor: 1x double gear box. 4. Power supply circuit and battery box. Figure 1.1 Line tracing robot S.I.T LTR04 2 Chapter 2 Configuration of the line tracing robot kit 2.1 Circuit diagram, printed circuit board (PCB), and part list The following figures and table show configuration of S.I.T LTR04 robot kit. • Figure 2.1: circuit diagram. • Figure 2.2: PCB top layer. • Figure 2.3: PCB bottom layer. • Figure 2.4: PCB pattern (top layer). • Figure 2.5: PCB pattern (bottom layer). • Table 2.1: part list (bill of material – BOM). Figure 2.1 S.I.T LTR04 schematic diagram 3 Figure 2.2 S.I.T LTR04 printed circuit board (Top) Figure 2.3 S.I.T LTR04 printed circuit board (Bottom) 4 Figure 2.4 S.I.T LTR04 PCB pattern (Top) Figure 2.5 S.I.T LTR04 PCB pattern (Bottom) 5 Table2.1 S.I.T-LTR04 BOM No. NAME Component arrangement number Part name Part number Number 1 Monolithic Ceramic Chip Capacitors C2,C3,C5,C6,C7,C8C9 0.1μ 7 2 Electrolytic Capacitor C4 10220(E) 1 3 Electrolytic Capacitor C1 50V10(E) 1 4 Diode D1,D2 1SS133 1SS133 2 5 Diode D3,D4 11EQS03L 11EQS03L 2 6 Transistor Q4,Q5 Tr 2SD2106 2 7 One-Chip Microcomputer IC1 PIC16F84 PIC16F84A-20/P 1 8 LED(Green) LED1 LED GL3KG8 1 9 LED(RED) LED2,LED3,LED4 LED GL3PR8 3 10 IR LED LED2,LED3,LED4 TLRE180AP(F) TLRE180AP(F) 3 11 Photo transistor Q1,Q2,Q3 TPS615(F) TPS615(F) 3 12 Resistor(O,O,Bl,Bl,Br)* R8,R9,R10 100 100R0 3 13 Resistor(Br,Bl,Bl,R,Br)* R4,R19,R20 10 K 1002 3 14 Resistor(O,O,Bl,Go,Br)* R6,R7 1 K 1001 2 15 Resistor(B,G,Bl,Bl,Br)* R1 680 6800 1 16 Resistor(Br,Bl,Bl,Br,Br)* R3,R11,R12,R13,R14 1 K 1001 9 17 Resistor(O,Bl,Bl,R,Br)* R2 30 K 3002 1 18 Resistor(R,Bl,Bl,O,Br)* R5 200 K 2003 1 19 Mechatronics Key Switch SW1,SW2 B3F-1052 B3F-1052 2 20 Toggle Switch SW3 SW(POWER) 1 21 Pre-Set Variable Resistor VR1,VR2,VR3 50 K 3 22 Connector CN1 S5B-XH- A 1 23 CERALOC K X1 20MHz 1 24 IC Socket DIP-18P IC Socket(18P) 1 25 Battery Holder Battery Box MC-304-3 1 26 A luminum Chassis A luminum Chassis 1 27 NabeM3-10 screw thread 4 28 NabeM2-6 Brass screw thread 2 29 Sara M3-6 Brass Nickel screw thread 2 30 Nylon Spacer Spacer 3×3 4 31 Caster Dokodemo Caster 1 32 circuit board F0278 1 33 Double Gear BOX NO.168 1 34 Tire Track Tire Set NO.101 2 35 M2Nat 2 36 M3nat 6 37 φ3 Spring washer 4 Resister is 5-digit display, with tolerance of ±1%. In case of 4-digit display, see p.150 of reference book [1]. *Resistor color code: Black Bl, Brown Br, Red R, Orange O, Blue B, Grey G, Gold Go, 6 2.2 Drawings of aluminum frame and robot assembly Figure 2.6 shows the drawing of aluminum frame and figure 2.7 shows assembly drawing of S.I.T.LTR04. Figure 2.6 Drawing of aluminum frame. [...]... development by C language 4.4.1 Flow of program development In this section you will learn about programming of the line tracing robot LTR-04 using C language The detailed description in assembly language cannot be done in C language However, C language can describe similar function in just a few lines of code In addition, it is easier to describe high level operation such as math expression or algorithm... assembly procedure This section describes the assembly procedure of robot s body After soldering all parts to PCB, attach gearbox and PCB to the provided aluminum frame as in Fig 3.33 For C type(Double gear box,Gear ratio of 114.7:1) Wheel diameter 36mm(Tamiya TRUCK TIRE SET) Fig 3.33 Assembly procedure (1) Then attach battery box to robot s frame as in Fig 3.34 Fig 3.34 Assembly procedure (2) Wiring... Mounting position of resistor 8 (b) Diode・・・4pcs D1, D2・・・2pcs D3, D4・・・2pcs (a) Enlarged (b) 1SS133 (c) 11EQS03L Diode Diode Figure 3.3 (d) PCB symbol ・Cathode is marked by a yellow line ・Be careful with the orientation of diodes Figure 3.4 Mounting position of diodes 9 (c) Light-emitting diode・・・4pcs LED1 (power indicator) green・・・1pcs LED5~7 (sensor indicator) red・・・3pcs (a) Enlarged... (2) Wiring of motors should perform as shown in Fig 3.35 Be sure not to mistake wiring on motor 23 Fig 3.35 Assembly procedure (3) Fig 3.36 LTR04 photograph (side) 24 By the steps described above, the robot is complete Fig 3.37 Complete picture 25 Chapter 4 Program development 4.1 Port assignment, motor control logic • Table 4.1 a) and b) show pin assignment of PORT A and PORT B • Table 4.2 shows port... shorter lead The longer lead lead PCB K Caution! Anode Cathode (a) Enlarged view A Solder firmly to PCB (b) Side view (d) PCB symbol Fig 3.27 Red LED ・ Emit red light to the floor under robot ・ Be careful with the polarity of anode and cathode LED2~4 Solder to bottom layer Caution! Push all the way down to PCB Solder to bottom layer Fig 3.28 Position of red LEDs 20 (o) Battery box … 1pcs... chart (3)if statement Description of input and output setting by TRISA and TRISB TRISA = 0xFC; /* A0,1:output, 2,3,4:input */ TRISB = 0xC7; /* B0,1,2:input, B3,4,5:LED output, other bits input */ The two lines of code above set the operational input/output setting of PIC’s PORTA and PORTB Detailed setting is shown in Figure 4.33 below Input for Switch Input for Sensor(L) Input for Sensor(C) Input for Sensor(R) . Institute of Technology, Center for Lifelong Learning and Extension Programs Robot Seminar Group Shibaura Institute of Technology, College of Engineering, Dept. of Electrical Engineering Human. beginners. For reference in case you cannot participate in the seminar, the content of the lectures is included in CD-ROM provided with this textbook. 【Kit Contents】 Main components of S.I.T. orientation of diodes. Figure 3.4 Mounting position of diodes 10 (c) Light-emitting diode・・・4pcs LED1 (power indicator) green・・・1pcs LED5~7 (sensor indicator) red・・・3pcs (a) Enlarged