Sei sulla pagina 1di 59

UNIVERSITI TEKNOLOGI MALAYSIA

DECLARATION OF THESIS / UNDERGRADUATE PROJECT PAPER AND COPYRIGHT

Authors full name : Date of birth Title : :

ABDUL HAFIZ BIN AZIZ 30 APRIL 1988 SCAVOT A SCAVENGER ROBOT 2011/2012

Academic Session :

I declare that this thesis is classified as:


CONFIDENTIAL RESTRICTED OPEN ACCESS
(Contains confidential information under the Official Secret Act 1972)* (Contains restricted information as specified by the organisation where research was done)* I agree that my thesis to be published as online open access (full text)

I acknowledged that Universiti Teknologi Malaysia reserves the right as follows: 1. The thesis is the property of Universiti Teknologi Malaysia. 2. The Library of Universiti Teknologi Malaysia has the right to make copies for the purpose of research only. 3. The Library has the right to make copies of the thesis for academic exchange. Certified by:

SIGNATURE

SIGNATURE OF SUPERVISOR

880430-29-5119
(NEW IC NO. /PASSPORT NO.) Date : 06 JULY 2012

DR. KUMERESAN A. DANAPALASINGAM


NAME OF SUPERVISOR Date : 06 JULY 2012

NOTES :

If the thesis is CONFIDENTIAL or RESTRICTED, please attach with the letter from the organisation with period and reasons for confidentiality or restriction.

Date: 25 APRIL 2010

Date : 25 APRIL 2010

I acknowledge that I have studied this piece of work and in my opinion it is in accordance with the scope requirement and quality for the purpose of awarding the Bachelor of Engineering (Electrical - Mechatronics)

Signature

: DR. KUMERESAN A. DANAPALASINGAM 06 JULY 2012

Name of Supervisor : Date :

SCAVOT A SCAVENGER ROBOT

ABDUL HAFIZ BIN AZIZ

A report submitted in partial fulfilment of the requirements for the award of the degree of Bachelor of Engineering (Electrical Mechatronics)

FACULTY OF ELECTRICAL ENGINEERING UNIVERSITI TEKNOLOGI MALAYSIA

JUNE 2012

I declare that this thesis entitled SCAVOT A Scavenger Robot is the result of my own research except as cited in the references. The thesis has not been accepted for any degree and is not concurrently submitted in candidature of any other degree

Signature Name Date

: : : ABDUL HAFIZ BIN AZIZ 06 JULY 2012

ii

Specially dedicated to my beloved family and friends

iii

ACKNOWLEDGEMENT

Alhamdulillah, Praise to Allah S.W.T for blessing and guidance have helped me in completing my final year project. In preparing this thesis, I was in contact with many people, supervisor, researchers, academicians, and practitioners. They have contributed towards my understanding and thoughts. In this short column I would like to express fully appreciation to my final year project supervisor, Dr. Kumeresan A. Danapalasingam in providing his suggestions and ideas throughout my project.

On the other side, I would like to say thank you to my parents have always given me support, strength, motivation and inspiration in pursuing my ambition in life as well as to complete this thesis and final year project.

I also would also like to say thank you my course mates who are also share their technical knowledge of software and hardware. With their expertise, I solved hardware technical problem and learn more programming skills.

iv

ABSTRAK

Melihat kepada masalah pencemaran plastik di tapak pelupusan, satu inisiatif perlu diambil untuk mengurangkan pencemaran tersebut. Oleh itu, SCAVOT ini direka untuk mengesan botol plastik yang boleh dikitar semula dari tapak pelupusan. Berdasarkan kepada konsep memproses imej, SCAVOT mampu untuk mengesan dan mengambil botol plastik untuk digunakan bagi tujuan lain. Reka bentuk gripper, lengan dan roda adalah sesuai untuk digunakan di kawasan tersebut. Power window dan servo motor digunakan untuk semua pergerakan. Semua pergerakan robot dikawal oleh mikropengawal dan isyaratnya diperolehi daripada komputer. Bateri lithium polymer digunakan sebagai bekalan utama untuk litar pengawal dan untuk menggerakkan motor.

ABSTRACT

Looking at pollution in landfills caused by plastic bottles, an initiative must be taken to alleviate the problem. Therefore, this SCAVOT robot is designed to detect the plastic bottles that can be recycled from landfill. Based on image recognition concept, the SCAVOT is able to detect and take the plastic bottles to be used for other purpose. The design of gripper, arms and wheels are suitable to use such that area. Power window and servo motors are used for the movement and the gripper system. All movements of the robot are controlled by a microcontroller and the signal from the computer. Batteries are used as main power supply to drive the motor and circuit.

vi

TABLE OF CONTENTS

CHAPTER DECLARATION DEDICATION

TITLE

PAGE i ii iii iv v vi ix x xi xii

ACKNOWLEDGEMENTS ABSTRAK ABSTRACT TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF SYMBOLS LIST OF APPENDICES

INTRODUCTION 1.1 Background 1.2 Problem Statement 1.3 Objective 1.4 Scope 1 2 3 3

LITERATURE REVIEW 2.1 Introduction 2.2 Image Processing 2.3 Colour Filter RGB (Red Green Blue) 2.4 Background Subtraction Methods 2.5 Object Recognition and Orientation 2.6 Conclusion of Literature Review 5 6 8 8 9 10

vii

METHODOLOGY AND APPROACH 3.1 Introduction 3.2 Robot System 3.3 Hardware Development 3.3.1 Hardware Design 3.3.2 Gripper 3.3.3 Tank Tire 3.3.4 Power Window Motor 3.3.5 Servo Motor 3.3.6 Camera 3.4 Software Development 3.4.1 MicroC Pro for PIC 3.4.2 Visual Studio 2010 3.4.3 PICkit2 Programmer 3.4.4 OpenCV 3.4.5 SolidWork 2010 3.4.6 Proteus 3.4.7 Flow Chart of The Robot System 3.5 Circuit Development 3.5.1 Microcontroller 3.5.2 Motor Driver 3.5.3 Voltage Regulator 3.5.4 USB Programmer (UIC00A) 3.5.5 Power Supply 3.5.6 USB to UART (UC00A) 3.5.7 Circuit Diagram 3.5.7.1 Microcontroller 3.5.7.2 Voltage Regulator 3.5.7.3 Relay Motor Driver 11 11 12 12 13 13 14 14 15 16 16 16 17 18 19 20 21 22 22 23 23 24 24 25 26 26 27 27

RESULT AND DISCUSSION 4.1 Hardware Result 28

viii 4.2 Software Result 4.2.1 Colour Tracking 29 29

CONCLUSION AND RECOMMENDATION 5.1 Future Work 5.1.1 Hardware Improvement 5.1.2 Software Improvement 5.2 Conclusion 31 31 32 32

REFERENCES

33

APPENDICES

34

ix

LIST OF TABLES

TABLE NO. 1.1 1.2 FYP1 FYP2

TITLE

PAGE 4 4

LIST OF FIGURES

FIGURE NO. 2.1 2.2

TITLE Flow Diagram of Image Processing Step Procedures for Detecting Object Using Sliding Mode

PAGE 6 7

2.3 2.4 2.5 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 4.1

Representative of Addictive Colour Mixing Background Subtraction Methods Canny Edge Processed Template Flow of Detecting Plastic Bottles SolidWork Design Power Window Motor Servo Motor Camera Layout of Microsoft Visual Studio 2010 PICkit 2 Programmer Front, Side and Top View of SolidWork Design PCB Design Layouts Flow Chart for the Robot Recognition PIC Microcontroller 18F52 Pin Diagram Programmer UC00A Input / Output Connections for PIC18F452 Testing Circuit Using Proto Board Schematic for Voltage Regulator Motor Driver Schematic Robot Structure

8 9 10 12 13 14 14 15 17 18 19 20 21 22 24 25 26 26 27 27 28

xi 4.2 4.3 Circuit Placement Image Processing Base on Colour Detection 29 30

xii

LIST OF SYSMBOLS/ ABBREVIATIONS

A ANSI CAD CMOS GUI IDE OpenCV PCB PIC RGB USB UART V XML

Ampere American National Standards Institute Computer Aided Design Complementary Metal Oxide Semiconductor Graphical User Interface Integrated Development Environment Intel Open Source Computer Vision Library Printed Circuit Board Microcontroller Red, Green, Blue Universal Serial Bus Universal Asynchronous Receiver and Transmitter Volts Extensible Markup Language

xiii

LIST OF APPENDICES

APPENDIX A B C D E

TITLE Program Codes for Microcontroller - main.c Program Codes for Image Processing - main.ccp Program Codes for Image Processing - cvaux.h Program Codes for Image Processing - cxcore.h Program Codes for Image Processing - highgui.h

PAGE 34 41 43 43 43

CHAPTER 1

INTRODUCTION

This chapter gives some brief explanations of the project. The background, problem statements, objectives and project scopes will also be presented in this chapter.

1.1

Background

There are many applications that use image processing, including for security, industry and others. Its use is increasingly widespread because it can help people to do things without being monitored.

In electrical engineering, image processing is any form of signal processing for which the input is an image, such as a photograph or video frame, the output of image processing may be either an image or, a set of characteristics or parameters related to the image. Most image-processing techniques involve treating the image as a two-dimensional signal and applying standard signal-processing techniques to it.

2 Image processing usually refers to digital image processing, but optical and analogue image processing also are possible. This article is about general techniques that apply to all of them. The acquisition of images (producing the input image in the first place) is called imaging.

Many image processing techniques involve treating the image as a twodimensional signal and use signal processing techniques for the standard [9].

There are many ways to detect bottle based on colours and shape. Video and image processing speed is very important to detect accurately the bottle.

Arm and gripper designed system is able to take and hold the bottle after image processing detect the bottle. But there are many factors that cause the bottle cannot be traced.

1.2

Problem Statement

Most of the cameras available in market have limited monitoring view, this is due to the cameras are stationary. If a single target needs to be monitored in all corners, it requires too many cameras and is not cost effective. Speed and clarity of the rate of the camera will also affect the computer to locate a bottle.

Most of the cameras also need to be manually operated or else the cameras will only focus on one point. Distance is also a problem that cannot be avoided, where image processing cannot measure the exact distance rates.

It is difficult for a robot to move in any surface if the robot use wheel because it can move in limited or smooth surface.

1.3

Objectives

The objectives of this project are to design an image recognition system capable of detecting mineral water bottles and to develop a mobile robot equipped with a robot arm and image recognition capability to collect mineral water bottles in landfills.

1.4

Scope of the Project

To make sure the project comes to a success, there are a few scopes and guidelines listed to ensure the project is conducted within its intended boundary. For the first stage, the robot is able to recognize small plastic bottles and has a gripper to pick it up. The robot consists of a tank tire design that is capable of moving on any landfills surface. In addition, the robot will rely on a laptop external camera for image processing to detect bottles and the microcontroller will be used to control the movement. The microcontroller used is PIC18F452 from Microchip as a main board. Two batteries lithium-polymer are used as the main supply to drive the motor and for the main board. Table 1.1 and 1.2 shows the week progress of this project.

Table 1.1 FYP1 Task 1 Literature Review Writing Proposal Design Control System Software Coding Circuit Soldering Hardware Design Thesis Report 2 3 4 5 6 7 Week 8 9 10 11 12 13 14 15

Table 1.2 FYP2 Task 1 Software Coding Hardware Testing Presentation and Demo Thesis Report 2 3 4 5 6 7 8 Week 9 10 11 12 13 14 15 16 17

CHAPTER 2

LITERATURE REVIEW

This chapter includes the study on previous UTM students work, relevant information from technical paper and published journal.

2.1

Introduction

Computer vision is the field concerned with the automated processing of images from the real world to extract and interpret information on a real time basis. It is the science and technology of machines that see. Here see means the machine is able to extract information from an image, to solve some task, or perhaps "understand" the scene in either a broad or limited sense.

2.2

Image Processing

There are several techniques aiming to detect static objects base on the detection of motion, achieved by means of background subtraction, followed by some kind of tracking [2].

Image processing is a physical process used to convert the image signal (either digital or analogue) into the physical image. Actual output itself can be a real physical image characteristic of image examples. The most common types processing is the photographic image. In digital photography, the image is stored as computer files. File translated using photographic software to generate the image. Colour, shading, and nuance that those detained at any time picture taken software translate this information to the image. Figure 2.1 shows the general three steps image processing [3].

By using optical scanner or digital photography, the image is imported.

Manipulate and analyze images using several methods to improve the image and data compression.

Output may change its image. Figure 2.1 Flow Diagram of Image Processing Step

There are many methods to use for detecting the object. Figure 2.2 shows procedure for detecting object using sliding mode [4].

Figure 2.2 Procedures for Detecting Object Using Sliding Mode

Using thresholding method to segment an image processing called heuristic algorithm that consists of the following seven steps [5]: i. ii. iii. Smooth the image by average filtering. Derive the gray-level gradient magnitude. Apply thresholding and a thinning algorithm to the gradient magnitude to find the object boundary points. iv. Sample the smoothed image at the boundary points as the local thresholds. v. vi. vii. Interpolate the threshold surface by the sampled local thresholds. Segment the image by the threshold surface. Remove the ghost objects by a validation process.

2.3

Colour Filter RGB (Red Green Blue)

In colour tracking, standard RGB is used to determine the colour detected. Every RGB colour model is formed by different combination of red, green and blue colour take from Wikipedia which is to represent of additive colour mixing as shown in Figure 2.3.

Figure 2.3 Representative of Addictive Colour Mixing

2.4

Background Subtraction Methods

The moving object is identified by comparing current image frame to background model. Figure 2.4 explain the process of this method. First the background image is set as reference image, after that the current image is capture and compare to the reference image. If any differences colour are found, the differences are set to black and filter colour is set to white spot.

Start Set Background Image

Capture Image

NO

Is It Right Colour YES Set to White Spot

Send Position

FINISH

Figure 2.4 Background Subtraction Methods

2.5

Object Recognition and Orientation

All the images of the object will be passed to a computer for image processing (object recognition). Microcontroller used to perform these calculations for processing. The camera is configured to deliver a grayscale image from the image. Images from the cameras started to be processed by the Canny Edge of the well-

10

known algorithms in image processing. Canny edge image processing algorithms to the image to black and all the contours in colour images white (Figure 2.5). Algorithm by nature can find objects in the size that will make the object away from the walls in the environment. Robot navigation capabilities based on the environment. By knowing this, it can measure the distance and calculate accurately the position. When the robot moves to a predetermined position to decide its start and then calculate the direction and distance of the target position. By using an electronic compass, it turns itself into a right direction for the target position. By calculating the distance of the target position, the robot motor run for a position related to the various targets. When the robot has arrived at the target position, the robot confirmed its position again to see if it is in the right place [6].

Figure 2.5 Canny Edge Processed Template

2.6

Conclusion of Literature Review

For this project, colour filtering is useful to ensure that image processing able to detect the right object. For colour filtering, standard RGB is implemented.

CHAPTER 3

METHODOLOGY

3.1

Introduction

This chapter discusses how the project is done by using certain methods. After that, this chapter will discuss the main components of mechanisms, electronics and software used for this project.

3.2

Robot System

The robot consists of several parts including cameras, computers, electronics, microcontroller, electronics, motor drivers, tires and arms. Image signal obtained from the computer after processed and sent it to the microcontroller to perform the movement of the robot.

12

Figure 3.1 shows the flow of detecting plastic bottles by camera and process use image processing. The signal is sent to microcontroller to pick up the bottle.

There are three main components to complete this project includes hardware development, circuit development and software development. Each of the components is related to each other.

Figure 3.1 Flow of Detecting Plastic Bottles

3.3

Hardware Development

3.3.1

Hardware Design

The robot was designed by using SolidWork2010 software. The structure of the robot shows in Figure 3.2.

13

Figure 3.2 SolidWork Design

3.3.2

Gripper

A gripper is designed such that the robot could grasp and move plastic bottles. Component used in the structure is cheap and affordable hardware. The structure of gripper used aluminium hollow bar because this material is easy to fabricate. Servo motors used to control the gripper either open or retract.

3.3.3

Tank Tire

Robot consists of tank tire design that is capable for moving in any landfills surface. The surface of tank tire is made of rubber to ensure a strong grip between land surface and tire.

14

3.3.4

Power Window Motor

Figure 3.3 Power Window Motor

Power window motors typically used in car industry for controlling the up and down of the car window. The advantage of this motor is that it does not require current for it to hold its load in static because of its internal gear structure. However this type of motor is difficult to be used in servo control mechanism and its relatively large size and large current usage are its downsides. For these project power windows is used for tank tire and arm of the robot because this motor is capable to handle high load materials.

3.3.5

Servo Motor

Figure 3.4 Servo Motor

15

Servo is an automatic device that uses error-sensing feedback to correct performance of a mechanism. For this project, a servo-RC has been selected as an actuator for the gripper. RC servo motors are chosen due to the capacity, reliability, and simplicity of control by the microcontroller, RC Servos are often used in smallscale robotics applications. Moreover, small types of actuators have a very powerful torque to perform heavy lifting tasks. Servos RC is composed of an electric motor mechanically linked to potentiometers. Pulse width modulation (PWM) signal that is sent to the servo translated into position commands by electronics in the servo. When the servo commanded to rotate, the motor power until the potentiometer reaches the value corresponding to the commanded position. Figure 3.4 shows the structure of servo motor.

3.3.6

Camera

Figure 3.5 Logitech Webcam

For this project, Logitech webcam is used to capture the images. It is a CMOS camera with UVC driverless USB 2.0 interface. The camera has 1.3 megapixels for capturing images, and 640x480 pixels for capturing video. Finally, it has a frame rate of up to 30 frames second. The camera is used together with laptop and put in front of the robot.

16

3.4

Software Development

3.4.1

MicroC PRO for PIC

MikroC PRO for PIC is a full-featured ANSI C compiler for PIC devices from Microchip. It is the best solution for developing code for PIC devices. It features intuitive IDE, powerful compiler with advanced optimizations, lots of hardware and software libraries, and additional tools that will help you in your work. Compiler comes with comprehensive help file and lots of ready-to-use examples designed to get you started in no time. Compiler license includes free upgrades and a product lifetime tech support, so you can rely on our help while developing. The mikroC PRO for PIC is a powerful, feature-rich development tool for PIC microcontrollers. C++ language was used to program the robot, this software provide their own library that can make easier for user to use it. It is designed to provide the programmer with the easiest possible solution to developing applications for embedded systems, without compromising performance or control.

3.4.2

Visual Studio 2010

Microsoft Visual Studio 2010 is an integrated development environment (IDE) from Microsoft. It is commercial software that is available in seven languages: English, French, German, Italian, Japanese, Korean, and Spanish. Visual Studio is a popular IDE interface and it is also widely used Windows OS platform. Visual Basic is derived from the C++ language. It comes with very useful functions intellisense and suitable for beginners. Visual Studio is a complete suite of tools for building

17

both desktop and team-based enterprise web applications. In addition to building high-performing desktop applications, Visual Studio's is powerful component-based development tools and other technologies to simplify team-based design, development, and deployment of enterprise solutions. Figure 3.6 shows the layout of visual studio 2010.

Figure 3.6 Layout of Microsoft Visual Studio 2010

3.4.3

PICkit 2 Programmer

PICkit 2 programmer is a programmer from Microchip Technology's PIC microcontroller family. They are used for programming and debugging microcontroller and program EEPROM. Some models also have a logic analyzer and serial communication (UART) tool. PICKit2 Programmer allows user to program all supported devices listed in PICkit 2 Readme file. According to the readme file, it supports family devices of PIC10F, PIC12F, PIC16F, PIC18F, PIC24F, dsPIC30F

18

and dsPIC33F. PICKits2 Programmer is chosen as the programmer in this project as it supports microchip 18F452 that is going to be used in this project.

Figure 3.7 PICkit 2 Programmer

3.4.4

OpenCV

OpenCV means Intel Open Source Computer Vision Library. It is a collection of C functions and a few C++ classes that implement some popular image processing and computer vision algorithms. Cross-Platform API of C functions FREE for commercial and non-commercial uses. Main OpenCV functions are image processing and vision algorithms. The header file should be included in this software

19

during compile is cvaux: auxiliary (experimental) OpenCV functions, cxcore: data structures, linear algebra support, XML support, drawing functions and other algorithms, and the last one is highgui: GUI functions, image and video i/o.

3.4.5

SolidWork 2010

SolidWorks is a 3D mechanical CAD (computer-aided design) program that runs on Microsoft Windows and was developed by Dassault Systmes SolidWorks Corp., a subsidiary of Dassault Systmes, S. A. (Vlizy, France).

Figure 3.8 Front, Side and Top View of SolidWork Design

20

3.4.6

Proteus

Proteus PCB design combines the ISIS schematic capture and ARES PCB layout programs to provide a powerful, integrated and easy to use suite of tools for professional PCB Design. All Proteus PCB design products include an integrated shape based autorouter and a basic SPICE simulation capability as standard. More advanced routing modes are included in Proteus PCB Design Level 2 and higher whilst simulation capabilities can be enhanced by purchasing the Advanced Simulation option and/or micro-controller simulation capabilities. Proteus is used for main circuit board and motor driver circuit PCB designs.

Figure 3.9 PCB Design Layouts

21

3.4.7

Flow Chart of The Robot System

START

SWITCH ON THE CIRCUIT

DETECT PLASTIC BOTTLE

NO

IS IT THE BOTTLE YES SHOW BOTTLE POSITION

ROBOT WILL MOVE

ROBOT PICK UP THE BOTTLE

FINISH

Figure 3.10 Flow Chart for the Robot Recognition

22

3.5

Circuit Development

3.5.1

Microcontroller

Figure 3.11 PIC Microcontroller 18F52 Pin Diagram

PIC 18F452 is used as a controller to control the input output of the robot. PIC is a family of Harvard architecture microcontrollers made by Microchip Technology. The name PIC is comes from "Peripheral Interface Controller". PIC is often used in industry because it has low cost, widespread use and applies basic programming. This microcontroller has a 10bit-flash ADC and 8bit PWM. PIC 18F452 have four port which is port A, port B, port C and port D, this port available as input or output (depend on our declaration in C program). Pins that used for this project are pins RB4 RB7 for LED indicator, RB1 RB3 for push button switch, RB5 RB6 for limit switch, for power window (RA0,RA1,RA2,RA3,RE1,RE2,RC3,RD0), for servo motors (RB0 and RD7). Pin CCP1 and CCP2 used to control speed of power window.

23

3.5.2

Motor Driver

In this project, relays are used as a switching device for motor driver. It can operate in DC or AC high voltages compared to transistor. Relay is not easy to damage because it operates in mechanical movement. The maximum current for this relay is 15A which is suitable to drive the power window motor. Specific circuits (motor drivers) have been developed to supply motors with power and to isolate the other ICs from electrical problems. This circuit are designed such that they can completely separate boards between main board and relays. The input 1 and input 2 are connected with input/output port from microcontroller.

3.5.3

Voltage Regulator

The voltage regulator 7805 will convert the 12V to 5V in order to supply the microcontroller, sensor and motors with the correct voltage. 7805 regulator chip is used to build +5V power supply. In order to get a better voltage regulation, capacitor 10F and 100F was connected as figure3.2. Heat sink is added to 7805 regulator chip so that it does not overheat because of the extra losses in the regulator. Power supply with the specification of 12V and 2A is required for the system to operate normally.

24

3.5.4

USB Programmer (UIC00A)

Figure 3.12 Programmer

Circuit Serial Programming (ICSP) is a device used to connect the computer with the PIC. It is also used to install the program into the PIC and remove programs that have been installed in the PIC. The hex file is needed when to install programs to microcontroller.

3.5.5

Power Supply

Lithium polymer (Li-Po) 12V battery used as a power supply, this battery is often used in mobile phones, laptops and all electronic devices. Lithium polymer has a its own advantage as it have the high energy density, flat voltage curve, no memory affects and low self-discharge. These batteries can be used for a long time. It is suitable for use in this project because we need a durable battery to supply for circuit and motors. There are 2 batteries needed for this project which is for supply to the motors and circuit.

25

3.5.6

USB to UART (UC00A)

Figure 3.13 UC00A

Serial communication is most popular interface between device and this applies to microcontroller and computer. UART is one of those serial interfaces. Classically, most serial interface from microcontroller to computer is done through serial port (DB9). However, since computer serial port used RS232 protocol and microcontroller used TTL UART, a level shifter is needed between these interfaces. Recently, serial port of computer have been phase out, it have been replaced with USB. Of course most developer chooses USB to serial converter to obtain virtual serial port. The level shifter is still necessary for UART interface. Thus, Cytron decided to develop a USB to UART converter which offers USB plug and play, direct interface with microcontroller and it provide low current 5V supply from USB port. UC00A was used for transmission data from computer to microcontroller trough UART programming for Visual Studio 2010 and MicroC Pro for PIC softwares. Data was sent by computer in pixels which is x = 640 pixels and y = 480 pixels, then x and y represent position of plastic bottle need to change values through programming.

26

3.5.7

Circuit Diagram

3.5.7.1 Microcontroller

Power Window Relay

Servo Figure 3.14 Input / Output Connections for PIC18F452

Figure 3.15 Testing Circuit Using Proto Board

27

3.5.7.2 Voltage Regulator

Figure 3.16 Schematic for Voltage Regulator

3.5.7.3 Relay Motor Driver

Figure 3.17 Motor Driver Schematic

CHAPTER 4

RESULT AND DISCUSSION

4.1

Hardware Result

Figure 4.1 and Figure 4.2 shows that the robot structure with a laptop and the circuit placement. In order to mount a laptop, the base is made flat with suitable dimensions.

Gripper System Logitech Camera

Laptop

Figure 4.1 Robot Structure

29

Main Board and Relay Circuit Figure 4.2 Circuit Placement

4.2

Software Result

4.2.1

Colour Tracking

The software implementation is successful and the output result is the desired result. When the desired colour of object was detected (for this example, black), it will be highlighted in a green dot. The position of the bottle is display on the laptop. The position displayed in pixels which are 640x480 pixels. As been mention is previous chapter, this colour tracking is not limited to black colour, it can be adjusted to any colour by changing the value in the filter of image processing programming. Figure 4.3 shows the result of colour tracking, it shows the result of colour tracking, position of the bottle and processed images.

30

Figure 4.3 Image Processing Base on Colour Detection

CHAPTER 5

CONCLUSION AND RECOMMENDATION

This chapter is about the proposed solution, conclusion, limitations, possible application and future development.

5.1

Future Work

5.1.1

Hardware Improvement

For the hardware improvement, the selection of gripper must be suitable with the object that needs to be handled. To ensure that the gripper can grip the plastic bottle, a high torque servo motor is chosen..

32

5.1.2

Software Improvement

For further improvement, colour can be equipped with image recognition function. It can be used for simple tracking such as human faces, vehicle, geometric objects, hand written or printed character. Shape detection has to be implemented to ensure correct detection.

5.2

Conclusion

This project consists of three parts which is hardware, electronics and software part. The robot hardware consists of base platform, tank tire, arm, gripper, camera and laptop. The electronic part consists of microcontroller (main board), relays (motor driver), programmer (UIC00A), and UART (UC00A). Softwares used for this project are MicroC PRO for PIC (microcontroller programming), Visual Studio 2010 (image processing programming), SolidWork 2010 (hardware design), Proteus (electronic PCB design) and OpenCV (library for image processing).

The bottles detection is based on colour detection by filtering the images. Upon detection SCAVOT moves towards the bottle and pick up the bottle based on position as processed by computer.

In conclusion, the development of this robot is very useful due to the function that is capable of autonomous maneuvering in landfills to detect and collect mineral water bottles.

33

REFERENCES

1. Chelsea Robertson, Image Processing, Histogram Equalization, 2006. 2. Ruben Heras Evangelio, et al., Static Object Detection Based on a Dual Background Model and a Finite-State Machine, EURASIP Journal on

Image and Video Processing, vol. 2011, pp. 1-11, 2011. 3. Lim Teik Yee (2011), Object Tracking of Mobile Robot Using Image Processing, Bachelor of Engineering (Electrical - Mechatronics), FKE, UTM Skudai, pages 3-4. 4. N. I. Glumov, et al., Detection of objects on the image using a sliding window mode, Optics & Laser Technology, vol. 27, pp. 241-249, 1995. 5. Francis H. Y., et al., Adaptive Thresholding by Variational Method, IEEE Transactions on Image Processing, vol. 7, no. 3, March 1998. 6. Robin Persson, et al., Concept Model of an Object Detecting Mobile Robot (ODMR) In a Home Indoor Environment, IADIS International Conference Applied Computing, 2006. 7. Hlne Vorobieva, et al., Object Recognition and Ontology for Manipulation with an Assistant Robot, Vision and Content Engineering Laboratory, 2010. 8. http://sourceforge.net/projects/opencvlibrary/ 9. http://opencv.willowgarage.com/wiki/InstallGuide.

34

APPENDICES

APPENDIX A

- Program Codes for Microcontroller - main.c

//Abdul Hafiz bin Aziz //BE090001 //FYP 20112012 //SV: Dr. Kumeresan //input #define #define #define #define #define SW1 SW2 SW3 SLimitA SLimitB portb.f1 portb.f2 portb.f3 portd.f6 portd.f5 portb.f4 portb.f5 portb.f6 portb.f7 porta.f0 porta.f1 porte.f1 porte.f2 porta.f2 porta.f3 portc.f3 portd.f0 ccpr1l ccpr2l portb.f0 portd.f7

//output #define LED1 #define LED2 #define LED3 #define LED4 #define m_arm1 #define m_arm2 #define m_turn1 #define m_turn2 #define m_kiri1 #define m_kiri2 #define m_kanan1 #define m_kanan2 #define ARMSPEED #define TURNSPEED #define gripper #define servo2

//function prototype void init(void); void griper_grip(void); void griper_open(void); void servo_right(void); void servo_middle(void); void servo_left(void); void arm_up(void); void arm_down(void); void arm_upmanual(void); void arm_downmanual(void); void turn_right(void);

35
void void void void void void void void void void void turn_left(void); turn_stop(void); turn_rightmanual(void); turn_leftmanual(void); move_forward(void); move_right(void); move_left(void); move_back(void); move_stop(void); pickup_bottle(void); all_stop(void);

//global variable unsigned char buffer[2],temp, i = 0, mark = 0; // Variable for storing //the data from UART and //array counter //interrupt function void interrupt () { if (PIR1.RCIF) { // test the interrupt for uart rx buffer[i] = UART1_Read(); i++; i %= 2; if(i==0)mark=1; //to tell that buffer is fully received } // end if (PIR1.RCIF) PIR1.RCIF=0; } // end interrupt void main() { unsigned char count,x,y;; init(); INTCON.GIE = 1; INTCON.PEIE = 1; PIE1.RCIE = 1; //enable interrupt. while(1) { if(mark) { //if new buffer is fully received x=buffer[0]; y=buffer[1]; mark=0; //ready for new buffer } if(SW1==0) { delay_ms(5000); turn_right(void); turn_stop(void); delay_ms(1000); turn_left(void); turn_stop(void); delay_ms(1000); turn_left(void); turn_stop(void); delay_ms(1000); turn_right(void); turn_stop(void); delay_ms(1000); move_forward(void); delay_ms(1500); move_stop(void);

36
delay_ms(1000); pickup_bottle(); } else if(SW2==0) { arm_upmanual(void); } else if(SW3==0) { pickup_bottle(); } else if(SLimitA==0) { move_back(void); delay_ms(1000); } else { all_stop(void); } } } void init(void) { unsigned char count; ADCON1 = 6; // Configure analog inputs and Vref //setting for input and output 1=input, 0=output TRISA = 0b00000000; TRISB = 0b00001110; TRISC = 0b10000000; TRISD = 0b01100000; TRISE = 0b01100000; //PWM setting PR2=255; ARMSPEED = 0; TURNSPEED = 0; CCP1CON= 0b00111100; CCP2CON= 0b00111100; T2CON = 0b00000101; //stop all output all_stop(void); //servo initial position servo_middle(void); delay_ms(500); griper_open(void); } //funtion to grip bottle void griper_grip(void) { unsigned char i=0; while(i<50) { gripper=1; delay_us(1670); gripper=0; delay_us(20000-1670); i++; }

//close

min 0.5ms

37
gripper=0; } //function to open griper void griper_open(void) { unsigned char i=0; while(i<50) { gripper=1; delay_us(2100); gripper=0; delay_us(20000-2100); i++; } gripper=0; }

//open griper

max 2.5ms

//function to turn right position griper void servo_right(void) { unsigned char i=0; while(i<50) { servo2=1; //right position delay_us(2100); servo2=0; delay_us(20000-2100); i++; } servo2=0; } //function to turn middle position griper void servo_middle(void) { unsigned char i=0; while(i<50) { servo2=1; delay_us(1530); servo2=0; delay_us(20000-1530); i++; } servo2=0; } //function to turn left position griper void servo_left(void) { unsigned char i=0; while(i<50) { servo2=1; delay_us(1000); servo2=0; delay_us(20000-1000); i++; } servo2=0; } //function to move up of arm robot void arm_up(void)

38
{ while(SLimitA==1) { m_arm1=0; m_arm2=1; ARMSPEED=110; } m_arm1=0; m_arm2=0; ARMSPEED=0; } //function to move up of arm robot void arm_down(void) { while(SLimitB==1) { m_arm1=1; m_arm2=0; ARMSPEED=70; } m_arm1=0; m_arm2=0; ARMSPEED=0; } //funtion to move up of arm robot manually void arm_upmanual(void) { m_arm1=0; m_arm2=1; ARMSPEED=110; } ////funtion to move down of arm robot manually void arm_downmanual(void) { m_arm1=1; m_arm2=0; ARMSPEED=70; } //function to move arm to the right position void turn_right(void) { m_turn1=1; m_turn2=0; TURNSPEED=80; delay_ms(420); } //function to move arm to the left position void turn_left(void) { m_turn1=0; m_turn2=1; TURNSPEED=80; delay_ms(500); } //function to stop turn void turn_stop(void) { m_turn1=0; m_turn2=0;

39
TURNSPEED=0; } //turn right manually void turn_rightmanual(void) { m_turn1=1; m_turn2=0; TURNSPEED=80; } //turn right manually void turn_leftmanual(void) { m_turn1=0; m_turn2=1; TURNSPEED=80; } //move robot forward void move_forward(void) { m_kanan1=0; m_kanan2=1; m_kiri1 =0; m_kiri2 =1; } //move robot to the right void move_right(void) { m_kanan1=1; m_kanan2=0; m_kiri1 =0; m_kiri2 =1; } //move robot to the left void move_left(void) { m_kanan1=0; m_kanan2=1; m_kiri1 =1; m_kiri2 =0; } //move robot to the left void move_back(void) { m_kanan1=1; m_kanan2=0; m_kiri1 =1; m_kiri2 =0; } //stop movement of the robot void move_stop(void) { m_kanan1=0; m_kanan2=0; m_kiri1 =0; m_kiri2 =0; } //function to pickup botle

40
void pickup_bottle(void) { delay_ms(1000); griper_grip(void); delay_ms(1000); arm_up(void); delay_ms(1000); griper_open(void); delay_ms(1000); arm_down(void); delay_ms(1000); } //stop all output void all_stop(void) { LED1=0; LED2=0; LED3=0; LED4=0; m_arm1=0; m_arm2=0; m_turn1=0; m_turn2=0; m_kiri1=0; m_kiri2=0; m_kanan1=0; m_kanan2=0; ARMSPEED=0; TURNSPEED=0; gripper=0; servo2=0; }

41

APPENDIX B

- Program Codes for Image Processing - main.ccp

//track.ccp //Abdul Hafiz bin Aziz //BE090001 //FYP 2011/2011 //SV : Dr. Kumeresan

#include <opencv/cvaux.h> #include <opencv/highgui.h> #include <opencv/cxcore.h> #include<stdio.h> #include<stdlib.h> /////////////////////////////////////////////////// int main(int argc, char* argv[]) { CvSize size640x480 = cvSize(640, 480); CvCapture* hafiz_webcam; IplImage* p_imgOriginal; IplImage* p_imgProcessed; CvMemStorage* p_strStorage; CvSeq* circle; float* bottleposition; int i; unsigned short j; char charCheckForEscKey; hafiz_webcam = cvCaptureFromCAM(0); if(hafiz_webcam == NULL) { printf("No Camera Detected...Please connect your camera \n"); getchar(); return(-1); } cvNamedWindow("Original", CV_WINDOW_AUTOSIZE); cvNamedWindow("Prosessed", CV_WINDOW_AUTOSIZE); p_imgProcessed = cvCreateImage(size640x480,IPL_DEPTH_8U,1); while(1) { p_imgOriginal = cvQueryFrame(hafiz_webcam); if(p_imgOriginal == NULL) { printf("Error: Frame is NULL \n"); getchar(); break; }

42
cvInRangeS(p_imgOriginal, CV_RGB(0,0,0), CV_RGB(20,20,20), p_imgProcessed); p_strStorage = cvCreateMemStorage(0); cvSmooth(p_imgProcessed,p_imgProcessed,CV_GAUSSIAN,9,9); circle = cvHoughCircles(p_imgProcessed, p_strStorage, CV_HOUGH_GRADIENT, 2, p_imgProcessed->height/4, 100, 50, 5, 100); for(i=0; i< circle->total;i++) { bottleposition = (float*)cvGetSeqElem(circle, i); printf("| bottle position\tx = %f\ty = %f\t| Hafiz MIRCED 2012\n", bottleposition[0], bottleposition[1]); cvCircle(p_imgOriginal, cvPoint((bottleposition[0]), cvRound(bottleposition[1])), 20, CV_RGB(255, 0, 0), CV_FILLED); } //end for cvShowImage("Original", p_imgOriginal); cvShowImage("Processed", p_imgProcessed); cvReleaseMemStorage(&p_strStorage); charCheckForEscKey = cvWaitKey(10); if(charCheckForEscKey == 27 ) break; } //end while cvReleaseCapture(&hafiz_webcam); cvDestroyWindow("Original"); cvDestroyWindow("Processed"); return(0); }

43

APPENDIX C

- Program Codes for Image Processing - cvaux.h

#ifndef __OPENCV_OLD_AUX_H__ #define __OPENCV_OLD_AUX_H__ #include #include #include #include #include #include #include #include #include #include #include #include #include #endif "opencv2/core/core_c.h" "opencv2/core/core.hpp" "opencv2/imgproc/imgproc_c.h" "opencv2/imgproc/imgproc.hpp" "opencv2/video/tracking.hpp" "opencv2/video/background_segm.hpp" "opencv2/features2d/features2d.hpp" "opencv2/calib3d/calib3d.hpp" "opencv2/objdetect/objdetect.hpp" "opencv2/legacy/legacy.hpp" "opencv2/legacy/compat.hpp" "opencv2/legacy/blobtrack.hpp" "opencv2/contrib/contrib.hpp"

APPENDIX D

- Program Codes for Image Processing - cxcore.h

#ifndef __OPENCV_OLD_CXCORE_H__ #define __OPENCV_OLD_CXCORE_H__ #include "opencv2/core/core_c.h" #include "opencv2/core/core.hpp" #endif

APPENDIX E

- Program Codes for Image Processing - highgui.h

#ifndef __OPENCV_OLD_HIGHGUI_H__ #define __OPENCV_OLD_HIGHGUI_H__ #include #include #include #include #endif "opencv2/core/core_c.h" "opencv2/core/core.hpp" "opencv2/highgui/highgui_c.h" "opencv2/highgui/highgui.hpp"

Potrebbero piacerti anche