1. Trang chủ
  2. » Luận Văn - Báo Cáo

Line tracking robot

71 932 6
Tài liệu đã được kiểm tra trùng lặp

Đ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

Thông tin cơ bản

Tiêu đề Line Tracking Robot
Người hướng dẫn Professor Makoto Mizukawa, Associate Professor Yoshinobu Ando, Professor Takashi Yoshimi, Associate Professor Tadahiro Hasegawa
Trường học Shibaura Institute of Technology
Chuyên ngành Electrical Engineering
Thể loại Học đề tài
Năm xuất bản 2005
Thành phố Tokyo
Định dạng
Số trang 71
Dung lượng 10,57 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Đây là tài liệu rất chi tiết để thiết kế một con robot dò đường.

Trang 1

"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

Ver.0.2 for UCI Summer Session

Trang 2

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

Trang 3

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

Trang 4

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.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

Trang 5

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

Trang 6

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

Trang 7

Figure 2.2 S.I.T.-LTR04 printed circuit board (Top)

Figure 2.3 S.I.T.-LTR04 printed circuit board (Bottom)

Trang 8

Figure 2.4 S.I.T.-LTR04 PCB pattern (Top)

Figure 2.5 S.I.T.-LTR04 PCB pattern (Bottom)

Trang 9

Table2.1 S.I.T-LTR04 BOM

arrangement number Part name Part number Number

7 One-Chip

26 Aluminum Chassis Aluminum

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,

Trang 10

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

Trang 11

Figure 2.7 Assembly drawing

Trang 12

Chapter 3 Assembling 3.1 Printed circuit board assembly procedure

(a) Resistor・・・20pcs

Refer to the BOM in Table 2.1 for value of each resistor and resistor color code

(a)Enlarged view (b) A real resistor (c) Schematic symbol

Figure 3.1 Resistor

<Characteristics >

・No polarity, no need to worry about orientation when assembling

・Be careful with color code Reference 1

Figure 3.2 Mounting position of resistor

Trang 13

・Cathode is marked by a yellow line

・Be careful with the orientation of diodes

Figure 3.4 Mounting position of diodes

Trang 14

(c) Light-emitting diode・・・4pcs

LED1 (power indicator) green・・・1pcs

LED5~7 (sensor indicator) red・・・3pcs

(a) Enlarged view (b) Actual LED (c) PCB symbol

Figure 3.5 Light-emitting diode (LED)

<Characteristics >

・By lead length: the longer lead is “+”, the shorter lead is “-”

・By electrode size: the smaller one is ”+”, the larger one is “-“

・ Checking with multimeter: when the minus rod (black) is attached to LED’s anode (+) and the plus rod (red) is attached to LED’s cathode, multimeter’s needle will swimg

Figure 3.6 Mounting position of LEDs

Trang 15

(d) Multilayer ceramic capacitor ・・・7pcs

C2, C3, C5, C6, C7, C8, C9 0.1[μF]・・・7pcs

(a) Enlarged view (b) Actual capacitor (c) PCB symbol

Figure 3.7 Multilayer ceramic capacitor

<Characteristics >

・Function: eliminating the noise from motors and other parts

・No polarity, no need to worry about direction when assembling

Trang 16

(e) DIP-18P IC socket (18 pin socket)・・・1pcs

(a)Enlarged view (b) Actual socket (c) PCB symbol

Figure 3.9 DIP-18P IC socket

<Characteristics >

・Fit the Notch in socket and the Notch in schematic symbol

1 When soldering a socket, firstly fix it with some tape (Figure 3.10)

2 Temporary solder from pin 1 to pin 10 (Figure 3.11)

3 With your finger pressing the socket, use the soldering iron to thoroughly melt the solder

at each pin

(3.10) Attaching socket (1) (3.11) Attaching socket (2) (3.12)Attaching socket (3)

Time-saver

Trang 17

(f) CERALOCK ・・・1pcs

CERALOCK (ceramic resonator) 20[MHz]・・・1pcs

(a) Enlarged view (b) Actual ceralock (c) PCB symbol

Figure 3.13 CERALOCK

<Characteristics >

・”GND” is the center pin

・No polarity, no need to worry about orientation when assembling

Figure 3.14 Mounting position of CERALOCK

Trang 18

(g) Mechanical key switch ・・・2pcs

SW1 (Reset)・・・1pcs

SW2 (Start)・・・1pcs

(a) Actual switch (b) PCB symbol

Figure 3.15 Mechanical key switch

<Characteristics>

・No polarity, no need to worry about orientation when assembling

・Press the switch’s shoulders to plug it in a parallel basis(3.15(a))

Figure 3.16 Mounting position of mechanical key switches

Trang 19

(h) Semi-fixed variable resistor・・・3pcs

VR1~VR3 50[kΩ]・・・3pcs

(a) Actual one (Top view) (b) PCB symbol

Figure 3.17 Semi-fixed variable resistor

<Characteristics >

・Resistance value changes from 0[kΩ] to 50[kΩ] by turning the knob in the center

・Mounting is uniquely determined because of special pin arrangement

<Tips for mounting>

・Solder one pin first to fix the part’s position and keep it from floating

・ Then solder the last two pins when position is fixed

Figure 3.18 Mounting position of semi-fixed variable resistor

Trang 20

(i) Electrolytic capacitor … 2pcs

C1 10[μF] … 1pcs

C4 220[μF] … 1pcs

(a) Enlarged view (b) Actual capacitor (c) PCB symbol

Fig 3.19 Electrolytic capacitor

<Characteristics >

・ Attach “ + ” of part to “ + ” on schematic symbol

・ In actual capacitor, the polarity of “ - ” marked lead is minus

・ In case of no “-“ mark found, the polarity of longer lead is “ + ”

Fig 3.20 Position of electrolytic capacitors

Pay attention to the polarity ! Marked by

“-” sign

1

C1,C4

Trang 21

・ From the front, left to right, the order of three leads is B (base), C (collector), and E (emitter)

Fig 3.22 Positions of transistors

B

E C

Trang 22

(k) Toggle switch 3P … 1pcs

SW3 … 1pcs

(a) Actual switch (b) PCB symbol (c) Position

Fig 3.23 Toggle switch 3P

(l) S5B-XH-A downloader connector … 1pcs

It can be assembly

i ith di ti

Carefully check orientation!!

Solder to bottom layer

Trang 23

(m) Phototransistor … 3pcs

Q1, Q2, Q3 … 3pcs

Caution) Phototransistors Q1, Q2, Q3 must be soldered to PCB’s bottom layer.

(a) Enlarged view (b) Side view (d) PCB symbol

Fig 3.25 Phototransistor

<Characteristics>

・ Phototransistors receive reflecting light from the floor

・ Be careful with the polarity of emitter and collector

Fig 3.26 Position of phototransistors

l d

Collector

The shorter lead

The longer lead The smaller one

Q1~3 Solder to bottom layer

Caution!

Push all the way down to PCB Solder to bottom layer

Trang 24

(n) Red LED … 3pcs

LED2, LED3, LED4 … 3pcs

Caution) LED2-4 must be soldered to PCB’s bottom layer

(a) Enlarged view (b) Side view (d) PCB symbol

Fig 3.27 Red LED

<Characteristics>

・ Emit red light to the floor under robot

・ Be careful with the polarity of anode and cathode

Fig 3.28 Position of red LEDs

Anode Cathode

Anode Cathode

The longer lead The shorter lead

LED2~4 Solder to bottom layer

Caution!

Push all the way down to PCB Solder to bottom layer

Trang 25

(o) Battery box … 1pcs

(a) (b) PCB symbol

Fig 3.29 Battery box

Caution) Thread the wires through the hole near battery connection points before soldering

Fig 3.30 Position of battery box connection

PCB Solder Hole

Trang 26

Motors wiring

Perform wiring and solder motor power wires to PCB as below Be careful with colors and polarity

of the wires Sometimes it is necessary to widen the hole for easier wire threading

Fig 3.31 PCB symbol

Fig 3.32 Position of motors power wires connection

Black wire Red wire

+ -

PCB

Solder Hole Wires

M2 M1

Thread wires through this hole

Trang 27

3.2 Parts 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

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 of motors should perform as shown in Fig 3.35 Be sure not to mistake wiring on motor

For C type(Double gear box,Gear ratio of 114.7:1)

Wheel diameter 36mm(Tamiya TRUCK TIRE SET)

Trang 28

Fig 3.35 Assembly procedure (3)

Fig 3.36 LTR04 photograph (side)

Trang 29

By the steps described above, the robot is complete

Fig 3.37 Complete picture

Trang 30

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 assignment of sensor input and LED output

• Table 4.3 shows motor control logic according to sensor input

• Table 4.4 shows motor control logic

Table 4.1 a) PORT A

Table 4.1 b) PORT B

Right LED Middle LED Left LED LED output

Trang 31

Table 4.3 Motor control logic according to sensor input Right sensor Middle sensor Left sensor

Table 4.4 Motor control logic

Left motor Right motor

Trang 32

4.4 Program 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 in C than in assembly

Development of a program in C language (C program) is done in following order First of all, C program

is created by using an editor with personal computer Then the C program is converted into machine program composed of machine codes that can be understood and executed by microcomputer The set

of software to convert a C program into machine codes includes compiler, assembler, and linker Fig.4.30 shows the process to compile and build an executable program from C program with pre-processor, compiler, assembler, and linker

Fig.4.30 Flow of making executable program from C program

4.4.2 LED blinking, push button handling

(a) LED blinking

Figures 4.31(a) and (b) shows the hardware for LED driving

• In Figure 4.31(a), when high level voltage (5V) is output from PORT, LED will turn on

• In Figure 4.31(b), when low level voltage (0V) is output from PORT, LED will turn off

• To output high level voltage (5V), we set value “1” for PORT: PORT = 0;

• To output low level voltage (0V), we set value “1” for PORT: PORT = 1;

C program

C program without directives

Assembly program

Machine code program

Eg.Pre-processor (“#” directives are processed)

Compiler (C language ⇒ assembly language)

Assembler (assembly language ⇒ machine code)

Executable machine code program

Linker (Machine code and libraries are linked)

Trang 33

(a)LED on (b)LED off

図 4.31 Hardware component for LED driving

• LED blinking example (1) All LEDs blink every 0.5 second

Below is sample program to control the three LEDs connecting to bit 3, bit 4, and bit 5 of PORTB When the program is executed, all LEDs turn on and off every 0.5 second

LED (PORTB) ○○○ all LEDs on

LED (PORTB) ●●● all LEDs off

-(Repeat) -

(all LEDs off)PORTB=0x00;

(all LEDs on)PORTB=0x38;

short j; /* declaration of 16 bit variables */

for(j=0;j<k;j++){ /* (k×3000) times iteration */

0

RB6 RB5 RB4 RB3 RB2 RB1 RB0 RB7

0 0

0 0

Trang 34

}

main(void)

{

TRISA = 0xFC; /* A0,1:output, 2,3,4:input */

TRISB = 0xC7; /* B0,1,2:input, B3,4,5:LED output, other bits input */

while(1){ /* infinite loop */

PORTB=0x00; /* LEDs off */

wait0(50); /* wait time = 0.5 sec */

As initial setting, configuration bits (1)~ (4) are set up as below

(1)Code protection is turned off

(2)Power up timer is turned off

(3)Watch-dog timer is turned off

(4)High-speed oscillator mode is selected (4~20MHz)

Trang 35

Wait for 0.5 sec

The flow charts of the typical syntax in C language, (1) for statement, (2) while statement, and (3)

if statement are shown below

(1)while statement (2)for statement (3)if statement

Fig 4.32 Flow chart

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

Fig 4.33 Input and output setting of PORTs

RA2 RA3 RA4 MCLR Vss RB0 RB1 RB2 RB3

RA0

RA1 OSC1 OSC2 Vdd RB7 RB6 RB5 RB4 Output for LED(L)

Input for Switch

Output for Motor(L) Output for Motor(R)

Input for Sensor(L)

Input for Sensor(C)

Input for Sensor(R)

Output for LED(C) Output for LED(R)

Ngày đăng: 22/05/2014, 20:53

TỪ KHÓA LIÊN QUAN

w