Vous êtes sur la page 1sur 26

DESIGN AND CONSTRUCTION OF AN AUTONOMOUS COLOUR DETECTION MOBILE ROBOT USING VISION SYSTEM

Maslan ZAINON

Project Report submitted in partial fulfilment of the requirement for the degree of Master by Advanced Study in Electrical Engineering with Power Electronics

Supervisor: Dr. 0. J. Downing

School of Engineering, Design & Technology

University of Bradford

16'~ September 2005

ABSTRACT

This project involves the design and construction of an autonomous colour detection mobile robot using LEG0 Technics bricks as its construction tools, with several sensors and controller attached in order to perform its specified tasks. The robot navigates through an open space white structure bounded by walls to search and detect a red coloured ball after successfully track a black line in specified width and length. The robot is a combination of Handy Board microcontroller, two DC motors, one servo motor, and several types of sensors such as CMUcam vision system (image sensor), touch sensor, optical sensor, and sonar sensor. DC and servo motors are used for robot's motion, speed and cruise control with suitable gears and actuators whilst the Handy Board microcontroller is used as the robot's main controlling tool and programmed using Interactive-C, a high level programming language. This project involves with an extensive robot construction works with different types of algorithms such as line tracking, object colour detection, and navigation. The mobile robot is successhlly constructed, which capable to track a specified black line, search and detect a red ball as well as navigates through an open space white structure but still requires improvement when operational in a maze structure.

Keywords: Mobile robot, Colour detection, CMUcam vision system, Handy Board

microcontroller, Interactive-C.

CHAPTER 1 INTRODUCTION

The word 'robot' comes fiom the Czech word, robata, meaning drudgery or servitude, which first appeared in the English language in 1923 [4]. Robot was introduced into human culture in this early 1920s in a play by Karel Capek about mechanical men that rebel against their human masters [5]. By definition, robot is a mechanical device that is designed and programmed to carry out instruction and perform particular duties automatically, with speed and precision [lo]. Robots are reprogrammable devices and best suited in sensing, gripping, and moving objects or in performing repetitive tasks such as pick and place, welding, handling radioactive elements and exploration tasks.

The word robotics was coined by the renowned science fiction writer, Isaac Asimov, in the 1942 science fiction story, "Runabout" [5]. Robotics field is a branch of engineering that involves the conception, design, manufacture, and operation of robots. It overlaps with electronics, computer science, artificial intelligence, mechatronics, nanotechnology, and bioengineering [lo]. Robotics is about building systems, which involves with designing and constructing of robots either mobile or stationary, which can be considered as much an art as a science [2]. Since there are always tasks for robots to perform, therefore there are many different types of robots that could be designed.

In recent years, the rise of popularity of the single-chip microcomputer and the drastic reductions in size and cost of integrated circuits have opened up wide field areas of creating intelligent systems [2]. However, building a robot requires more expertise than simple programming where the designers should own compendium of basic skills fiom various fields such as mechanical

engineering, electrical and electronics engineering, computer engineering, and artificial intelligence, which could be definitely enhanced in near future from time to time through more sophisticated robotics works.

An autonomous robot such as presented in this report acts as a stand-alone system, complete with its own computer that called Handy Board microcontroller, a microprocessor based control board [1][13]. The robot mechanical structures are based on LEG0 Technicss [6][15][18] as the main construction tools. This robot, which is controlled by Handy Board microcontroller, is designed to track a black line, search and detect a red coloured ball in a white maze structure. Control of the motion and the behaviour of the robot are achieved using combinations of several sensors such as CMUCam camera module or vision system as colour sensor module for objects colour sensing, IR photo-reflective sensors for line tracking, and wall distance sensing in both sides (obstacles avoidance), touch sensor as an extra sensor for wall and obstacles detection located in both sides of front comers as to ensure the robot would not destroy itself if the optical sensors are not properly hnctioning, Handy Board microcontroller board [7] as the systems brain, and pre-programmed algorithms (software).

This project involves with three main tasks, which are line tracking, coloured object search and detection, and navigation. This project is undertaken in order to demonstrate the ability of a robot to be designed, constructed and pre-programmed in such a way to be mobile and autonomous, which capable to detect and track a predefined black line, capable to search and detect a red coloured ball using a vision system without confusing with other colours such as blue for example and the ability to navigate throughout a predefined workplace such as in an open space or maze structures that bounded by walls. The following chapters will describe in more details the design and construction of each robot subsystem.

1.1 Theoretical Background and Feasibility Study


Autonomous devices have a long and checkered past in legend and literature. From ancient legends to modem films and literature, many different robots and robot like devices have been constructed in extending the will of their creator or owner [5].Much of the fictional literature on autonomous system is cautionary; where the robot may follow its instruction too literally, or it may grow to have a will o f its own and not following its instruction at all.

Mobile robotics is a relatively new research area, which deals with the control of autonomous and semiautonomous vehicles. The thing that sets the mobile robotics field apart fiom other research areas such as conventional manipulator robotics, computer vision, and artificial intelligence is the emphasis on problems related to the understanding of large-scale space; the regions of space substantially larger than those that can be observed fiom a single vantage view
171.

Although most of the mobile robot systems currently in operation are experimental, some mobile robot systems are beginning to be deployed in industrial settings. Successful industrial applications for mobile robots typically involve more than one of the following characteristics [71:
A remote environment into which sending a human operator would be too difficult or

would take too long. An extreme instance is domains completely inaccessible to humans such as microscopic environments. An inhospitable environment into which sending a human being would be either very costly or very dangerous. A task that is highly disagreeable to a human. A task with a very demanding duty cycle or a very high fatigue factor.

A long history of research predates nouvelle of artificial intelligent. Some of the early ideas from

cybernetics can be found in Norbert Wiener's works. One example of a simple mobile robot, TuteBot, [2], exemplify how a robot as a system; a collection of sensors, actuators and computational elements, can be organized in such a way that intelligent actions result in response to certain stimuli. TuteBot is a robot that consists of a minimal amount of hardware; an analogue circuit, a chassis a sensor, a battery, and two DC motors. It can explore its surroundings, escape fiom collisions with obstacles, and be programmed to follow walls. However, it is really difficult to manage the complexity of large numbers of sensors and actuators for more complex behaviours control since TuteBot uses only analogue circuitry to achieve its behaviours that is programmed by adjusting two potentiometers.

Rather than pursuing on analogue brains and hard-wired logic for more intelligence system that would be too complex and difficult in trouble-shooting and debugging processes,

microprocessor-based device (i.e. microcontroller) is introduced [2]. This more sophisticated control element has a number of advantages over hard-wired logic in terms of versatility, power consumption, size, and ease of use. However, most importantly, it introduces a significant new tool in solving robots control problems, which is sofmare. In order to change TuteBot7s behaviour, potentiometers must be adjusted, circuits need to be rewired, and components need to be added or altered. In contrast, however, the behaviour of software-based robot can be changed only by typing at a keyboard. Hardware determines a robot's ultimate potential but in order to realize that potential is the job of software.

In recent years, there are many kinds of microcontrollers with reasonable prices in the market due to increasing interests in single-chip device (i.e. microcontroller), drastic reductions in size

and cost for integrated circuits [2]. An 8-bit Handy Board microcontroller developed since 1995 by Fred G. Martin is one of an ideal microprocessor-based robot control board for personal and educational robotics projects [I]. It ha.s variety of features that suited for controlling small and mobile robots including outputs for DC and servo motors, inputs for various types of sensors, an LCD screen, and an integrated battery pack. In addition, a custom software environment has been developed for the Handy Board microcontroller, called Interactive C; a multitasking implementation of the C programming language that allows users to interact with the robot while it is executing programs.

On robots vision side, there are many examples in the literature of simple computer vision algorithms that are truly usehl in a variety of applications as stated in the references of [8][9]. However, cost and complexity of the hardware needed to implement them have often limited the usehlness of these algorithms. Traditionally, such systems consist of a camera, a fiame grabber, and an associated computer for interfacing to the fiame grabber and execute the algorithms. However, recent developments in hardware have greatly simplify and reduce the cost of these systems such as by taking the developments advantage in using a low cost Complementary Metal Oxide Semiconductor (CMOS) colour camera modules and a high speed, low cost microcontroller. These two developments have led to a low cost embedded colour vision system called the CMUCam camera module, an image sensor module for performing basic blob colour tracking 131.

CMOS major advantage over Charged-Couple Device (CCD) technology is the ability to integrate additional circuitry on the same die as the sensor itself [2]. The vision system is designed to provide high-level information extracted fiom a camera image to an external processor such as Handy Board microcontroller, which is ideal for controlling mobile robots

Other camera modules that have similar functionality to CMUCam such as Cognachrome Vision System [I91 and the MIT Cheap Vision Machine [20], are more capable systems but CMUCam is significantly less complex with much smaller physical, making it more attractive for applications like on board vision for small mobile robots [3]. There are number of systems as in [2], [3] and [6] consisting of highly optimized software systems that fully depend on standard desktop computer systems to process image data. Unlike CMUCam, it does not totally rely on standard computers for the image data processing. The system targets applications where including the capabilities of standard desktop computer would be prohibitive due to size, cost, or power requirements [2].

In structural and mechanism aspects of the robot design such as the structure and body for examples, LEGO Technics System is used in this project. LEGO Technics is the extension of renowned LEGO building brick system. The word Technic is actually the brand name of mechanized section of the LEGO product line. LEGO Technics is a great building system since it combines the playful appeal of basic LEGO brick with a sophisticated and powerful set of mechanical design components. It includes motors, gears, axles, and other parts that allow users to construct complex and functional mechanical systems. Rapid ideas generation, prototyping, and evaluation can be done with this system and as a brand name in building brick system; Lego

Technics is satisfactory in many robotics projects as final building materials [I]. This means that
any robot prototype built from this system can also serve as a valid experimental platform. Lego

Technics is ideal to be used not only for building a fiame or other supporting elements of
robotics projects but also for gear reduction and power transmission mechanism. For this reasons, Lego Technics can be used to design and create a various types of different mechanism and mechanical systems from scratch.

However, other high grade building system such as Fischertechnik [21] can also be used in this project. Fischertechnik is the flexible construction system for young and older system designers alike. This product is produced in Germany that allows a multitude of systems and 3D models to be created by slotting precision-engineered parts together [21]. These robot kits can also be utilized in learning and teaching advanced concepts in engineering, robotics, programmable logic control (PLC)or computer control [21]. Apart fiom being flexible and easy to use features, one of the main reasons why Lego Technics is used in this project rather than Fischertechnik is simply because it is already available for use in the university's laboratories, which enable cost and time saving in designing and constructing the mobile robot.

CHAPTER 2 DESIGN AND CONSTRUCTION

Design and construction of a mobile robot in this project consists of two main parts which are the hardware and software. In the hardware side, it can be hrther divided into six sections, which are Handy Board microcontroller, CMUcam vision system, and several different types of sensors, motors, robot chassis and workplace structure. The software used is Interactive C programming language with dedicated drivers.

2.1 Hardware 2.1.1 Handy Board Microcontroller

Figure 2.1 : Handy Board Microcontroller

The Handy Board as shown in Figure 2.1 above is a hand-held, battery powered microcontroller board that is ideal for personal and educational robotics projects [I]. It is based on 52-pin 8-bit Motorola 68HCll microprocessor with system clock at 2 MHz that includes 32 Kbytes of battery-backed CMOS static M M , four DC motors output, digital and analogue inputs for variety types of sensors, and a 16 x 2 character LCD screen. The microcontroller runs Interactive

C programming language, a cross-platform, multitasking version of the C programming


language.

The Handy Board can also drive up to six servo motors with the expansion board. With this board as shown in Figure 2.2, a dedicated port for sonar sensor such as Polaroid 6500 or XRF04 ultrasonic ranging system can be implemented for the mobile robots. The Handy Board that being used in this project is Version 1.2 1, released in July, 1999. Shown in Figure 2 is a labelled view of Handy Board diagram consisting of ports, connectors, inputs and outputs.

(18)piezo

beeper

(17) LCD screen

Figure 2.2: Handy Board Diagram

LCD Connector

External Servo Power \ Servo Outputs

7 6 5 4 3 2 1 0
6-

Sonar Ranging Sensor Connector

Digital LEGO Analog Outputs Sensor Sensor lnputs lnputs

+ + -

Figure 2.3: Handy Board's Expansion Board

Handy Board Expansion Board 1 1 0


w

-1 0Wnal -+5v - Gnd


31302928272625242322212019181716

Digital Outputs

Gnd Sem, Control


Power

Signal

LEG0 Sensor Inputs

General-Purpose Sensor Inputs

Figure 2.4: Handy Board Expansion Board InputIOutput (110)

2.1.2 CMUcam Vision System

The CMUcam is a new low-power image sensor for mobile robots, developed by CarnegieMellon University, which capable to do different types of on-board, real-time vision processing. It uses a serial port and can be directly interfaced to other low-power processors such as Handy Board, Basic Stamps or PIC chips. The CMUcam consists of SX28 microcontroller, interfaced with an OV6620 Omnivision CMOS camera on a chip that allows simple high level data to be extracted fiom the camera's streaming video.

module Board

Figure 2.5: CMUcam Camera Module (Front View)

Switch

r
Microcontroller Servo Motor

Oscillator

1
Power Switch Connector Figure 2.6: CMUcam Microcontroller Board

Power Switch

S n v o Pmt

Fig~re 2.7: CMUcam Board Layout

The board communicates via a RS-232 or a TTL serial port and has the following functionality as listed below [22]: Track user defined colour blobs at 17 Frames per Second Find the centred of the blob Gather mean colour and variance data Transfer a real-time binary bitmap of the tracked pixels in an image Arbitrary image windowing Adjust the camera's image properties Dump a raw image

80x143 Resolution 115,200 / 38,400 / 19,200 / 9600 baud serial communication Slave parallel image processing mode off a single camera bus Automatically detect a colour and drive a servo to track an object upon start-up Ability to control 1 servo or have 1 digital 110 pin

2.1.2.1 CMUcam Adapter Dongle

Figure 2.8: CMUcam Adapter Dongle

This adapter dongle is quite important in this project as it allows the Handy Board microcontroller to be charged and zap charge while the CMUcam is connected. Since the CMUcam supply can be taken fiom any of regulated 5V digital or analogue output fiom the Handy Board, power supply problem could be avoided if there is sufficient continuous charging to the microcontroller whilst using the camera. Details on how to use the adapter dongle and CMUcam vision system with the Handy Board microcontroller will be discussed in Chapter 4.

2.1.3 Touch Sensors

The touch sensor (bump sensor) is a mechanical switch that requires an external contact for its actuation. It operates exactly like a normal switch, which usually in normally open condition and the circuit will be activated once the contact is closed. Lego Touch Sensor Block
r-------

Button

500Q I
I _-______I

(a)

(b)

Figure 2.9: LEG0 Technic's Touch sensor (a) Image (b) Circuit Diagram
2.1.4 Optical Sensor (Sharp GP2D12)

In this project; five GP2D12 have been implemented where three are used to track a black line for right, middle and left movement control while another two used to detect wall on each side. This infrared distance measuring sensor used to detect an object at a longer range, which has better performance to measure distance and immune to light intensity. It is accurately determines range to target between lOcm arid 80cm. It also can be used as a proximity detector to detect objects between Ocm and 130cm.

Figure 2.10: Optical (IR) sensor (Sharp GP2D12)

The sensor is the combination of a modulated Infrared (IR) emitter, a position-sensitive detector (PSD) and a focusing lens, which operates by emitting a pulse of IR light that travels until it hits an object.

,
Connect to HandyBoard 'Signal' line Black wire

White wire

Ycc

+5V
\

Red wire

Figure 2.1 1: Sharp GP2D12 distance sensor connection diagram

The GP2D12 sensor used Japan Solderless Terminal (JST) connector with three wires and connected as shown in Figure 2.1 1. The red wire is for the power (5V) and black wire is for the ground (GND). The white wire provides an output signal to the Handy Board pin. Additional circuit is not required for this sensor, thus easier to work with.

A pulse of IR light is emitted by the emitter and it travels out in the field of view and either hits
an object or just carry on going. The light is not reflected in the case of absence of objects that will be showed in its reading. If the light reflects off an object, it returns to the detector, reaches the receiver lens, concentrates the light beams pointed in PSD and creates a triangle between the reflection point, the emitter, and the detector as can be shown below.

Object

Reflection Point

K
Object

Figure 2.12: Different Angles with Different Distance

The angles in this triangle vary based on the distance of the object. As illustrated in Fig. 11, the close object creates a large angle compared to far objects. This angle determines where the light beam will be pointed in PSD array inside the receiver. The voltage output varies !?om 0 to 5V depending on the location of the light beam hitting PSD array.

The choice of which detector to use is depends on several factors such as types of application, method of writing an algorithm, and microcontroller capabilities (i.e. how many of analogue input pins provided). These types of distance sensor are suitable for mobile robotics application as have been demonstrated in this project but quite inexpensive, however, that valued around 13 to 15 per unit. It utilizes relatively little power, and is relatively small in size with a unique range that is ideally suited in human spaces such as rooms, hallways and maze structure. While these do not give absolute range accuracy, they offer rich information for a robot that typically deals with noisy information.

Figure 2.13: Sonar Sensor (Devantech SRF04) (a) Front View (b) Rear View Sonar SRF04 sensor designed by Devantech is an ultrasonic ranger, which has an approximate wide range measuring capability between 3cm to 3m. It has a logic line used to trigger a pulse (trigger pulse input) and the echo is returned on another line (echo pulse output). Its compact design and minimal power requirements makes the sensor is user fiiendly and among the most popular ranging sensor used in robotics projects. This sensor is a perfect for mobile robots, or any other projects requiring accurate ranging information. It connects to the digital I10 lines of microcontroller.
2.1.5.1 Beam Pattern

Figure: Sonar sensor beam pattern

In this project, a Handy Board rnicrocontroller uses a Devantech SRF04 Ultrasonic Range Finder to measures distances to obstacles. The sensor works by measuring the time it takes to receive an echo following a 'ping' signal that will be emitted once the sensor received an activation signal fiom the Handy Board microcontroller. This sensor can be programmed to displays the echo return time (in clock ticks) using Handy Board built-in LCD display and to make a tone sound proportional to each measurement.

2.1.5.2 Circuit Connection

Figure 2.14 depicts the connections between the Handy Board microcontroller and SRF04 Sonar Sensor in this project. The Handy Board microcontroller supplies power to the SRF04 fiom its own regulated 5V power supply and according to the Devantech specifications, the SRF04 sonar module may require up to 50rnA of current, which can easily be supplied by the Handy Board microcontroller for the sensor to operate.

Echo Puke Output TriggerPulse Input


Do Not Connect

Figure 2.14: Sonar Sensor (Devantech SRF04) - Handy Board Connection

2.1.6 Motor 2.1.6.1 DC Motor In this project, two DC motors (9V Model 43362) from Lego Technics have been used for the robots movement, speed and cruise control as shown in Figure below. DC motor is a machine that converts electrical energy into mechanical energy to produce motion.

Figure 2.1 5: Lego Technics DC motor (9V Model DC motor has two terminals for input voltage and ground. When the voltage is applied to these terminals, the motor will starts spinning in one direction. This direction can be simply turned to the opposite way by changing the voltage polarity. DC motor usually operates at high speed and low torque and generates the highest power level when performing at middle range.

Figure 2.16: Lego Technics DC motor (9V Model 43362) - Internal Parts

19

Table 2.1 : Lego Technics DC motor - Characteristics comparison for Mode1 43362 2.1.6.2 Sewo motor Servo motor is a type of motor that can turn to a specific position, which consists of a DC motor, a gear reduction unit, a shaft position st:nsor, and an electronic circuit that used to control the operation of the motor. Servo motor operation is based on feedback control where when the measured position is different fiom the desired position, an error signal will be produced and feedback signal is then returned to the control circuit for positioning correction. The servo motor is used in this project for CMUcam positioning for pan movement with the capability to turn up to 180 degrees. The servo motor (Futaba model S3003) used in this project can be shown as in

Figure 2.17: Futaba 5 ' 3 0 0 3 servo motor

20

2.1.7 ~ o b o Chassis t

Chassis is a structure used to support the fitting of microcontroller board, drivers, sensors,
batteries and other relevant additional parts whilst mechanism can be defined as a part of a machine, or a set of parts that work together.

AS being

mentioned earlier in this report, Lego Technic's system is used for the structural body

and mechanical aspects for the robot. Lego Technic's system is an extension of the widely known and popular LEG0 building brick system. Besides various types of building bricks, this system includes motors, wheels, axles, gears, and other parts in order to facilitate the construction and hnctional mechanical systems, which includes robot movement drive trains and other effectors. Because of Lego Technics is ideal for both structural purposes; building the fiame or other supporting elements as well as gear reduction and power transmission mechanism, this system can be used to design and create huge variety of different mechanism fiom ground up. With Lego Technics, process of designing, constructing and debugging a mechanical device that performed as intended could be done in a creative, flexible and ways.

In this project, the size of a mobile robot that has been constructed is 14.5cm, 23cm and 15cm in width, length and height respectively. This can be best viewed by referring to the robot images in Figures below.

Figure 2.18: Constructed mobile robot - 3D view (right side)

Figure 2.19: Constructed mobile robot - 3D view (left side)

2.1.8 Workplace Structure

In this project, the workplace structure of maze is made up of wood with size of 181cm in length, 179cm in width and 16.5cm in height. The idea of the project is to make the robot search and detect black line first then follow by a red ball of 14cm in diameter, which is located at the centre of workplace structure near to blue ball. The shapes of the obstacles can be varied either L or T shape with can be fieely removed or relocated. Each size of the maze or obstacle is 7cm in length, 0.7cm in width and 5cm in height. The workplace structure plans are shown in below figures, with and without maze structure.

Figure 2.20: Workplace structure without maze

Figure 2.2 1: Workplace structure with maze

1
1

2.2 Software
2.2.1

Interactive-C Programming Language

The Handy Board can be programmed by using a variety of standard 68HC11 development tools. This is including C-language compilers and assemblers for writing directly in 68HCll code. Interactive C (IC) programming language is used in this project since it is developed specifically

for educational robotics applications, which are interactive, stable and capable in multitasking. Interactive C is a C programming language that consists of a compiler and a run-time machine language module. The compiler has an interactive command-line compilation and debugging for dynamic expression compilation and evaluation. Interactive C was created by Randy Sargent who used it originally for MIT Robot Design project. There are a few considerations of Interactive C that make it ideal for robotics projects:

1) Interactivity: It is difficult to interact with conventional C-language compiler whilst it is running. In Interactive C, however, it provides a command-line console that allows user to type expression and function calls interactively, even whilst other programs are running. 2) Stability: In conventional C-language system, the programmer does not protected by the compiler fiom making mistakes that eventually will crash the computer. In Interactive C, it is designed to report a runtime error for common programming problems rather than crashing the system. In this case, debugging process can be done immediately in order to correct any fatal programming errors that would crash the whole system.

3) Multitasking: The capability by having multiple programs running simultaneously is


important in building robotics projects. Interactive C has been designed to have the ability to multitask up to a dozen of user programs. In this case, they could further

Vous aimerez peut-être aussi