Ultrasonic Guided Obstacle Detection Robot.

(1)

MOHD JOHARI BIN SANIMIN

BACHELOR OF MECHATRONIC ENGINEERING 2010


(2)

FACULTY OF ELECTRICAL ENGINEERING

FINAL YEAR PROJECT REPORT 2

ULTRASONIC GUIDED OBSTACLE DETECTION ROBOT

PREPARED BY

:

MOHD JOHARI BIN SANIMIN

B010710111


(3)

Obstacle Detection Robot” found that it has comply the partial fulfillment for awarding the degree of Bachelor of Mechatronic Engineering”

Signature : ……….

Supervisor’s Name : Prof. Madya Dr. Ismadi b. Bugis


(4)

MOHD JOHARI BIN SANIMIN

This Report is submitted in Partial Fulfillment of Requirements for the Degree of Bachelor in Mechatronic Engineering

FACULTY OF ELECTRICAL ENGINEERING UNIVERSITI TEKNIKAL MALAYSIA MELAKA


(5)

Detection Robot” is a result of my own work except for the excerpts that have been cited clearly in the references. The report has not been accepted for any degree and is not concurrently submitted in candidature of any other degree.”

Signature : ……… Name : Mohd Johari Bin Sanimin Date : 12 MAY 2010


(6)

ACKNOWLEDGEMENT

I wish to dedicate the most sincere thanks to my dearest supervisor, Prof. Madya Dr. Ismadi Bin Bugis for his invaluable editorial support, encouragement, supervision and useful suggestions throughout my meaningful accomplishment of the progress report and the progress of the project. His reputable moral support and continuous guidance enabled to complete my tedious work and task successfully.

I also would like to thank the panel, Mr. Muhammad Herman Bin Jamaluddin and Mr. Mohd Razali Bin Mohamad Sapiee @ Alia, whose give me a good comment during my presentation. I also would like to take this opportunity to express my appreciation to my family and friends for their patients, understanding and also for their undivided support that they had gave me throughout the completion of my project.

Last, but not least I also would like to thank all those helping and supporting me directly and indirectly during my Final Year Project 2.


(7)

ABSTRACT

The idea of this project is to create an Ultrasonic Guided Obstacle Detection Robot. This project basically describes the implementation of ultrasonic sensor to the robot. In an attempt to make the project, robot with only three wheels--one front and two rear was decided. The two rear wheels would be each driven by a motor, whereas the front wheel merely serves as a point of support to the frame of the robot. The autonomous component of Ultrasonic Guided Obstacle Detection Robot would come from the use of detection sensors and an accompanying algorithm that helps the unit avoid oncoming obstacles. This project is basically divided into three main section/parts namely design the mechanical structure, electronic circuit, and the programming. The motivation of this project due to the needs of the intelligent robot which is able to turn in precise, perfect and quick whenever it is facing obstacles.


(8)

ABSTRAK

Projek ini adalah untuk menghasilkan satu robot yang dinamakan Ultrasonic Guided Obstacle Detection Robot. Secara umumnya, projek yang dihasilkan adalah untuk mengaplikasikan penggunaan pengesan ultrasonik terhadap robot. Dalam menghasilkan projek ini, robot dengan menggunakan tiga roda--satu pada bahagian hadapan dan dua pada bahagian belakang robot telah dipilih. Dua roda pada bahagian belakang robot adalah dipacu dengan menggunakan motor manakala roda pada bahagian hadapan adalah bertujuan untuk memberi sokongan terhadap kerangka robot. Robot ini bergerak secara automatik di mana ianya terdiri daripada penggunaan deria pengesan dan aturcara program tertentu untuk membantu robot mengesan seterusnya mengelak daripada halangan yang mendatang. Projek ini umumnya dibahagikan kepada tiga bahagian di mana ianya terdiri daripada kerja-kerja membina bahagian struktur mekanikal, litar elektronik dan menghasilkan program. Hasil daripada projek ini adalah merujuk kepada kebolehan robot untuk melakukan pusingan dengan persis, sempurna dan pantas apabila berhadapan dengan halangan.


(9)

TABLE OF CONTENT

CHAPTER CONTENT PAGE

ACKNOWLEDGEMENT i

ABSTRACT ii

TABLE OF CONTENT iv

LIST OF FIGURES vii

LIST OF TABLES ix

LIST OF APPENDICES x

1 INTRODUCTION 1

1.1 Project Background 1 1.2 Problem Statement 2

1.3 Objective 2

1.4 Scope 3

1.5 Summary 3

2 LITERATURE REVIEW 4

2.0 Introduction 4

2.1 Obstacle Avoidance Mobile Robot Review 4 2.1.1 SR04 Mobile Robot 4 2.1.2 LEGO® Mindstorms NXT 5 2.1.3 Marcel Robot 6 2.1.4 The TriWheeler 7 2.2 Hardware Review 8 2.2.1 Ultrasonic Sensor 8 2.2.1.1 PING Ultrasonic Rangefinder 8 2.2.1.2 The MaxSonar®-EZ1™ 8 2.2.1.3 Crystal-lock Ultrasonic Motion Detector 9


(10)

2.2.2 Microcontroller 10

2.2.3 DC Motor 11

2.2.3.1 Voltage Rating 11 2.2.3.2 Current Rating 11 2.2.3.3 Torque 12 2.2.3.4 Velocity 12 2.2.3.5 Control Method 13 2.2.3.6 Pulse Width Modulation 14 2.2.3.7 DC Motor Speed 15

2.3 Summary 16

3 METHODOLOGY 17

3.0 Introduction 17

3.1 Flow Of Project 17 3.2 Project Design 18 3.3 Mechanical Design 19 3.3.1 Design Robot By Using SolidWorks Software 19 3.3.2 Basic Mechanical Parts Component 20 3.3.3 Build Mechanical Hardware Part 22 3.4 Electronic Design 22 3.4.1 Microcontroller Circuit Design 22 3.4.2 L293D Dual H-Bridge Motor Driver 25 3.4.3 MaxSonar®-EZ1™ 26 3.5 Software Design 28 3.5.1 Differential Drive Method 28 3.5.2 Program With MicroC Software 29 3.5.3 Simulate With Proteus Software 30 3.5.4 Burn The HEX File Into Microcontroller 31


(11)

4 RESULT AND ANALYSIS 33

4.0 Introduction 33

4.1 Design Robot Using SolidWorks 33 4.2 Build Robot Hardware 37 4.2.1 Mechanical Hardware 37 4.2.2 Electronic Hardware 39 4.3 Software Development 40

4.4 Analysis 42

4.4.1 Experiment 1 : DC Motor Control 42 4.4.2 Experiment 2 : ADC Application

- Potentiometer and Ultrasonic Range Finder 47 4.4.3 Experiment 3 : Measurement For Beam

Characteristic 52

5 DISCUSSION, CONCLUSION & RECOMMENDATION 57

5.1 Discussion 57

5.2 Conclusion 57

5.3 Recommendation 58

REFERENCE


(12)

LIST OF FIGURES

FIGURE TITLE PAGE

1.0 Robot Compare to Human 1 2.1.1 SR04 Mobile Robot. 4 2.1.2 LEGO® Mindstorms NXT 5 2.1.3 Marcel Robot 6 2.1.4 The TriWheeler 7 2.2.1.1 PING Ultrasonic Rangefinder 8 2..2.1.2 The MaxSonar®-EZ1™ 9 2.2.1.3 Crystal-lock Ultrasonic Motion Detector 9 2.2.2 The diagram of PIC16F877A and its pin description 10

2.2.3 DC Motor 11

2.2.3.3.1 Graph torque versus motor current 12 2.2.3.5 Structure of an H-bridge 13 2.2.3.6.1 Square wave 14 2.2.3.7.1 Motor Speed Curve 15 3.1.1 Flow Of Project Methodology 18 3.2.1 Project Design Ideas 18 3.3.1.1 SolidWorks 2008 software window 19 3.3.1.2 Simple Project Designed Overview 19 3.3.1.3 Ideas Of Sensor’s Location 20

3.3.2.1 Basic Mechanical Parts Description 21 3.3.3.1 Mechanical Tools 22 3.4.1.1 PIC16F877A pin diagram 23 3.4.1.2 Microcontroller schematic diagram 23 3.4.1.3 Electronic component and description 25 3.4.2.1 Simple schematic for interfacing a DC motor using L293D 25 3.4.3.1 MaxSonar®-EZ1 26

3.4.3.2 MaxSonar®-EZ1 Detection Angle 27

3.4.3.3 Simple schematic connections to an Analog to Digital Converter 28 3.5.1.1 Example For Robot Turning 28 3.5.1.2 Differential drive method 29


(13)

3.5.2.1 MikroC software 29 3.5.2.2 Example for C language programming 30 3.5.3.1 Proteus Software 30 3.5.3.2 Example for simulation with Proteus 31 3.5.4.1 PICkit 2 Programmer 32 3.5.4.2 PIC Programmer Hardware 32 4.1.1 Three main mechanical hardware parts 33 4.1.2 Design Of Ultrasonic Guided Obstacle Detection Robot 34 4.1.3 Complete Robot Designed By using SolidWorks Software 35 4.1.4 4 View For Ultrasonic Guided Obstacle Detection Robot 36 4.2.1.1 Basic Mechanical Part Components 37 4.2.1.2 View for real completed robot 38 4.2.2.1 PIC microcontroller Soldering board process 39 4.2.2.2 PIC microcontroller board 39 4.2.2.3 Digital Multimeter 39 4.2.2.4 Electronic part connection 40 4.3.1 Flow chart for robot’s movement 41 4.4.1.1 DC Motor Arrangement 43

4.4.1.2 IC L293 43

4.4.1.3 Motor Control Schematics 44 4.4.1.4 Program Wrote Using MikroC Software To Control

The Operation Of DC Motor 44 4.4.1.5 Changing parameter of the motor 45 4.4.1.6 (a) and (b) After pin connected on the PIC board 45 4.4.2.1 ADC Schematic diagram 48 4.4.2.2 Program wrote in MicroC 49 4.4.2.3 Draw and Measure 49 4.4.2.4 (a), (b) and (c) sensor’s reading 50 4.4.2.5 Graph Actual Range vs Sensor Reading 51 4.4.3.1 MaxSonar®-EZ1 Detection Angle 53

4.4.3.2 Schematic diagram 53 4.4.3.3 Draw and Measure 54 4.4.3.4 Result for beam characteristic using 2 unit sensor 55 4.4.3.5 Result for detection angle using 2 unit sensor 55


(14)

LIST OF TABLES

TABLE TITLE PAGE

3.4.3.1 Features and Benefits of MaxSonar®-EZ1 27


(15)

LIST OF APPENDICES

NO. TITLE

Appendix A Project Gantt Chart Appendix B MaxSonar®-EZ1™ Data Sheet Appendix C Coding For Ultrasonic Guided obstacle Detection Robot Appendix D Coding For Experiment 1 : DC Motor Control

Appendix E Coding For Experiment 2 : ADC Application - Potentiometer and Ultrasonic Range Finder Appendix F Assemble Mechanical Robot’s Parts


(16)

INTRODUCTION

There are many definitions of robot. It seems to be of difficulty to suggest an accurate meaning for the word robot, that there are various definitions of this word, different according to the point of view. Some view a robot through the aspect of reprogrammability while others more concern on the manipulation of the robot, behavior, intelligence and so on.

Generally, robot have three main parts known as processor, sensor and motor control system. If robot is replaced by human, sensor is represented eye, controller is represented brain and actuator is represented leg.

Figure 1.0 : Robot Compare to Human

1.1 PROJECT BACKGROUND

This project proposes method to solve the problem of collision avoidance for mobile robots. The project is about mobile robot that is able to detect obstacles and avoid them. The model based on ultrasonic sensor guided the direction, to generate collision free motion. It should be able to detect obstacles before collision occurs. It follows that, the robot should be able to draw conclusion either turns to the left or right. This type of mobile

Human Robot

Brain Controller Legs Actuator Eye Sensors


(17)

robot may need to carry out missions in hazardous or populated environments. A typical application is to assist human being in indoor environments, like offices, homes and etc. This project use PIC microcontroller to control the robot. The intelligent of the robot is implementing through PIC preprogrammed in such a why the robot is able to draw conclusion regarding to conditions detected.

1.2 PROBLEM STATEMENT

Nowadays, obstacles avoidance robots usually make collision with an object before turn around. The collision can damage the robot or component inside. So, to make sure the robot not damage because of collision, the ultrasonic sensor for obstacle detection can be perform.

The idea of projects based from the concept of an autonomous vehicle. It is apparent that a future of driverless cars is soon upon us. The motivation of this project is due to the needs of the robot which is able to turn in precise, perfect and quick when it is facing obstacles.

1.3 OBJECTIVE

The main objective of this project is to build An Ultrasonic Guided Obstacle Detection Robot. In order to make this project successful, the objectives have been declared that are:

1. To design a Ultrasonic Guided Obstacle Detection Robot.

2. To create hardware for Ultrasonic Guided Obstacle Detection Robot.


(18)

1.4 SCOPE

The scope of this project is to build a robot structure that will function properly according to the objective. This project uses ultrasonic sensor as its sensor. The robot uses a microcontroller for processing the sensor readings and responds by controlling the motors. Lastly, movement direction algorithm should be developed to make sure the product well function as stated in the objective.

1.5 SUMMARY

The summary of this chapter is, the good and well planning is very important to make this project success. Every planning that is planned should be obeyed in every milestone to make the project completed on the dateline or earlier before the dateline. Besides that, the projects that are developed are based on the problem statement that is stated in this chapter. The objective of the project is also important to make the project successfully and as aimed by the project. In addition, the scope of the project needs to recognize before the project started.


(19)

LITERATURE REVIEW

2.0 INTRODUCTION

Robot can be classified in two categories that are mobile robot and fixed robot [1]. The purpose of this chapter is to explain description for the previous project mobile robot which are mostly used in difficult task or dangerous environment. It also reviewed existing technologies and theory of mobile robot. Besides that, in order to create hardware of the mobile robot the suitable materials must be known and selected.

2.1 OBSTACLE AVOIDANCE MOBILE ROBOT REVIEW

2.1.1 SR04 Mobile Robot


(20)

Author : David P. Anderson.

Institution : Department of Geological Sciences, Southern Methodist University. Description :

SR04 is a small mobile robot suitable for exploring human habitats unattended. Two 12-volt DC gear-head motors maneuver the robot in a dual-differential drive configuration, balanced by a non-driven tail wheel caster and powered by a 12 volt 2.2 amp-hour sealed lead acid battery. Sensory input is provided by (in order of priority): front bumper switches, IR collision avoidance, stereo sonar ranging, photo detectors, passive IR motion detection, and shaft-encoder odometry [2].

2.1.2 LEGO® Mindstorms NXT

Figure 2.1.2 : LEGO® Mindstorms NXT Author : Pmocibov

Description :

This quite simple robot made with LEGO® Mindstorms NXT set is programmed in NXT-G (LEGO's visual programming language) to Avoid Obstacles using the Ultrasonic Sensor. The idea was to make a labyrinth with white, black and blue coloured walls. Coloured walls help our robot to find its way out of the labyrinth saying it to which side it


(21)

should turn. White wall means „turn 90˚ right“, black one means „turn 90˚ left“ and blue one means „stop“. Robot used light sensor to measure an amount of reflected light from coloured wall and then, depending on the colour of the wall, it turns right or left on spot. A.O.U.S. then again drives straight ahead until it spots another wall and then does the turn. Action is repeated until the robot comes to blue wall when program stops [15].

2.1.3 Marcel Robot

Figure 2.1.3 : Marcel Robot Author : Jordan Bridges (2007)

Description :

Marcel was designed to use no programming, and no sensors to detect obstacles and take an action to avoid them. It used a series of gears including a differential gear to switch the direction of the right wheel when an obstacle obstructed the robots path, making it turn right to avoid the obstacle. The robot has a long rail across the front that gets pressed down when it bumps into an object. This rail is connected to a mechanism that lifts two gears off of the differential and the right wheel axle, and engages a stationary gear below the differential to force the gears inside the differential to turn, reversing the right wheel; this process happens as long as the front rail is depressed. When the rail releases, the gears return to place, the stationary gear moves away from the differential, and the robot resumes going forward [16].


(22)

2.1.4 The TriWheeler

Figure 2.1.4 : The TriWheeler

Author : Chang 'Calvin' Liu (cl457) and Yi 'Tommy' Fan Tang (yft2)

Institution : School of Electrical and Computer Engineering, Cornell University. Discription :

The TriWheeler is a radio-controlled robot with three wheels. The lack of the fourth wheel is far from the only thing that renders it distinctively different from typical radio-controlled units. In addition to the capability of being freely radio-controlled with a remote control, The TriWheeler has a smart autonomous mode that allows the unit to move freely without running into major obstacles. Furthermore, The TriWheeler features 3 speeds and the cruising speed could be easily adjusted using the remote control on the fly [18].


(23)

2.2 HARDWARE REVIEW

2.2.1 Ultrasonic Sensor

2.2.1.1 PING Ultrasonic Rangefinder

The PING Ultrasonic Rangefinder is a great sensor to add to a robot when the robot needs to know how far it is from an object or obstacle. The rangefinder takes up only one I/O pin on microcontroller. Because it uses only a single I/O pin it needs a unique control algorithm. It sends out an ultrasonic signal from one of its ultrasonic transducers and measures how long it takes for that signal to bounce back to the 2nd ultrasonic transducer. The time can be converted to inches or cm.

Figure 2.2.1.1 : PING Ultrasonic Rangefinder

2.2.1.2 The MaxSonar®-EZ1™

The MaxSonar®-EZ1™ offers very short to long-range detection and ranging, in an incredibly small package with ultralow power consumption. The MaxSonar®-EZ1™ detects objects from 0-inches to 254-inches (6.45-meters) and provides sonar range information from 6-inches out to 254-inches with 1-inch resolution. Objects from 0-inches to 6-inches range as 6-inches. The interface output formats included are pulse width output, analog voltage output, and serial digital output.


(24)

Figure 2.2.1.2 : The MaxSonar®-EZ1™

2.2.1.3 Crystal-lock Ultrasonic Motion Detector

A pair of 40 KHz ultrasonic transducers detects moving objects or human bodies up to 10 meters. When any object is found moving in front of the transducers, the detector responds by energizing a miniature relay (LED on) for about 2 seconds. This will repeat continuously until the object stops moving. The transducers are mounted off board via 2 pairs of cables (as shown in the picture ).


(1)

LITERATURE REVIEW

2.0 INTRODUCTION

Robot can be classified in two categories that are mobile robot and fixed robot [1]. The purpose of this chapter is to explain description for the previous project mobile robot which are mostly used in difficult task or dangerous environment. It also reviewed existing technologies and theory of mobile robot. Besides that, in order to create hardware of the mobile robot the suitable materials must be known and selected.

2.1 OBSTACLE AVOIDANCE MOBILE ROBOT REVIEW

2.1.1 SR04 Mobile Robot


(2)

Author : David P. Anderson.

Institution : Department of Geological Sciences, Southern Methodist University. Description :

SR04 is a small mobile robot suitable for exploring human habitats unattended. Two 12-volt DC gear-head motors maneuver the robot in a dual-differential drive configuration, balanced by a non-driven tail wheel caster and powered by a 12 volt 2.2 amp-hour sealed lead acid battery. Sensory input is provided by (in order of priority): front bumper switches, IR collision avoidance, stereo sonar ranging, photo detectors, passive IR motion detection, and shaft-encoder odometry [2].

2.1.2 LEGO® Mindstorms NXT

Figure 2.1.2 : LEGO® Mindstorms NXT Author : Pmocibov

Description :

This quite simple robot made with LEGO® Mindstorms NXT set is programmed in NXT-G (LEGO's visual programming language) to Avoid Obstacles using the Ultrasonic Sensor. The idea was to make a labyrinth with white, black and blue coloured walls. Coloured walls help our robot to find its way out of the labyrinth saying it to which side it


(3)

should turn. White wall means „turn 90˚ right“, black one means „turn 90˚ left“ and blue one means „stop“. Robot used light sensor to measure an amount of reflected light from coloured wall and then, depending on the colour of the wall, it turns right or left on spot. A.O.U.S. then again drives straight ahead until it spots another wall and then does the turn. Action is repeated until the robot comes to blue wall when program stops [15].

2.1.3 Marcel Robot

Figure 2.1.3 : Marcel Robot Author : Jordan Bridges (2007)

Description :

Marcel was designed to use no programming, and no sensors to detect obstacles and take an action to avoid them. It used a series of gears including a differential gear to switch the direction of the right wheel when an obstacle obstructed the robots path, making it turn right to avoid the obstacle. The robot has a long rail across the front that gets pressed down when it bumps into an object. This rail is connected to a mechanism that lifts two gears off of the differential and the right wheel axle, and engages a stationary gear below the differential to force the gears inside the differential to turn, reversing the right wheel; this process happens as long as the front rail is depressed. When the rail releases, the gears return to place, the stationary gear moves away from the differential, and the robot resumes going forward [16].


(4)

2.1.4 The TriWheeler

Figure 2.1.4 : The TriWheeler

Author : Chang 'Calvin' Liu (cl457) and Yi 'Tommy' Fan Tang (yft2)

Institution : School of Electrical and Computer Engineering, Cornell University. Discription :

The TriWheeler is a radio-controlled robot with three wheels. The lack of the fourth wheel is far from the only thing that renders it distinctively different from typical radio-controlled units. In addition to the capability of being freely radio-controlled with a remote control, The TriWheeler has a smart autonomous mode that allows the unit to move freely without running into major obstacles. Furthermore, The TriWheeler features 3 speeds and the cruising speed could be easily adjusted using the remote control on the fly [18].


(5)

2.2 HARDWARE REVIEW

2.2.1 Ultrasonic Sensor

2.2.1.1 PING Ultrasonic Rangefinder

The PING Ultrasonic Rangefinder is a great sensor to add to a robot when the robot needs to know how far it is from an object or obstacle. The rangefinder takes up only one I/O pin on microcontroller. Because it uses only a single I/O pin it needs a unique control algorithm. It sends out an ultrasonic signal from one of its ultrasonic transducers and measures how long it takes for that signal to bounce back to the 2nd ultrasonic transducer. The time can be converted to inches or cm.

Figure 2.2.1.1 : PING Ultrasonic Rangefinder

2.2.1.2 The MaxSonar®-EZ1™

The MaxSonar®-EZ1™ offers very short to long-range detection and ranging, in an incredibly small package with ultralow power consumption. The MaxSonar®-EZ1™ detects objects from 0-inches to 254-inches (6.45-meters) and provides sonar range information from 6-inches out to 254-inches with 1-inch resolution. Objects from 0-inches to 6-inches range as 6-inches. The interface output formats included are pulse width output, analog voltage output, and serial digital output.


(6)

Figure 2.2.1.2 : The MaxSonar®-EZ1™

2.2.1.3 Crystal-lock Ultrasonic Motion Detector

A pair of 40 KHz ultrasonic transducers detects moving objects or human bodies up to 10 meters. When any object is found moving in front of the transducers, the detector responds by energizing a miniature relay (LED on) for about 2 seconds. This will repeat continuously until the object stops moving. The transducers are mounted off board via 2 pairs of cables (as shown in the picture ).