Sie sind auf Seite 1von 56

Robo-soccer

Guided by: Submitted by :

Ruchi sharma Tushar singh parmar


Ankit rathore
Pratik mota
1 Introduction

In this section, an overview of vision controlled motion (VCM) as a


system is explained.

1.1 System Description : -

The system for VCM consists of:

1. Image acquisition setup: It consists of a video camera, web camera, or an


analogue camera with suitable interface for connecting it to processor.

2. Processor: It consists of either a personal computer or a dedicated image


processing unit.

3. Image analysis: Certain tools are used to analyze the content in the image
captured and derive conclusions e.g. locating position of an object.

4. Machine control: After making the conclusion, mechanical action is to be taken


e.g. Using serial or parallel port of a PC to control left and right motors of a
robot to direct it towards the ball
Image Acquisition Device
e.g. CCD camera

Image Processor
e.g. PC, DSP

Image Analysis Tool


e.g. MATLAB

Machine Control
e.g. Using parallel port to control
motors
System Overview
1. Image capturing can be done using video camera available in various resolutions
e.g. 640 x 480 pixels. There are two types of cameras generally available: Digital
cameras (CCD – charge coupled device and CMOS sensor based) and analogue
cameras. Digital cameras generally have a direct interface with computer (USB
port),but analogue cameras require suitable grabbing card or TV tuner card for
interfacingwith PC.Power requirements: CCD cameras give high quality, low-noise
images. It generates an analog signal and uses analog to digital converter (ADC)
and thus consumes high power. CMOS cameras have lesser sensitivity resulting
in poor image quality but consume lesser power resulting in more battery life.

2. Image analysis consists of extracting useful information from the captured


images.We first decide the characteristics of the object to look for, in the image.
This characteristic of the object must be as robust as possible.
Generally, for the purpose of tracking or identifying the object we utilize:

i. Color
ii. Intensity
iii. Texture or pattern
iv. Edges – circular, straight, vertical stripes
v. Structure – Arrangement of objects in a specific manner

Quantitative/ Statistical analysis of image:

i. Center of gravity - point where the desired pixels can be balanced


ii. Pixel count – a high pixel count indicates presence of object
iii. Blob – an area of connected pixels
3. Machine control consists of controlling a robot based on the
conclusion derived from image analysis.

To achieve this using PC, its parallel port or serial port can be used for
driving the robot. For e.g. H-bridge, PWM control can be extensively
used for right and left motor movement of a robot. Serial-port can be
used for transferring data, which necessitates a micro-controller on the
robot to interpret the data.

Tools for Image Processing :

Once the image acquisition setup is ready, the captured images need to be
stored in suitable format to process them. Generally, a raw image is stored
as a matrix of color intensities.
MATLAB provides a very easy platform for image acquisition and
processing. Even serial and parallel ports can be directly accessed using
MATLAB. It serves as a handy tool for beginner level VCM. It provides a
powerful built-in library of many useful functions for image processing.
An Open source equivalent of MATLAB is SCILAB (can be downloaded
from http://www.scilab.org for free) and Scilab Image Processing (SIP)
toolbox (http://siptoolbox.sourceforge.net). However, support available in
SIP is limited as there are a few developers who contribute to this toolbox.
Approach:

1. Interfacing with PC ports

MATLAB provides support to access serial port (also called as COM port) and
parallel port (also called as printer port or LPT port) of a PC.
Note: If you are using a desktop PC or an old laptop, you will most probably have
both, parallel and serial ports. However in newer laptops parallel port may not be
available.

Parallel Port

Parallel port has 25 pins as shown in figure below. Parallel port cables are locally
available (commonly referred as printer port cables). These cables are handy to
connect port pins with your circuit. Pins 2-9 are bi-directional data pins (pin 9
gives the most significant bit (MSB)), pins 10-13 and 15 are output pins (status
pins), pins 1,14,16,17 are input pins (control pins), while pins 18-25 are Ground
pins.

MATLAB has an adaptor to access the parallel port (similar to adaptor for image
acquisition). To access the parallel port in MATLAB, define an object .
b. Serial Port :

If you have to transmit one byte of data, the serial


port will transmit 8 bits as one bit at a time. The
advantage is that a serial port needs only one wire to
transmit the 8 bits (while a parallel port needs 8).
Camera Mounting System:

1. For the clamping of the hanging plate to the mounting


plate there will be 4 screws of 2in length (5cm) and
5mm diameter inserted and bolted on the mounting
plate.

2. You should keep a clearance of 4cm for the screws and


bolt to fit in.

3. Materials suggested :

Plywood - 6mm
Acrylic - 4mm to 8mm
Aluminum - 2mm onwards
SOFTWARE COMPONENTS DESCRIPTION

1. Eagle Software:

The use of Eagle (Easily Applicable Graphical Layout


Editor) PCB design software to design an electronic
schematic and lay out a printed circuitboard(PCB) Eagle
is a PCB design software package consisting of a
schematics editor, a PCB editor and an autorouter
module. The software comes with an extensive library of
components, but a library editor is also available to
design new parts or modify existing ones.

Eagle is made by CadSoft and is available in three versions.


The light-version is limited to one sheet of schematics
and half euro-card format (80x100 mm), but can be used
under the terms of the freeware licence for non-
commercial use
2. Keil Software:

μVision, the popular IDE from Keil Software, combines Project


management, Source Code Editing, Program Debugging, and Flash
Programming in a single, powerful environment
+ Project Management, Device Setup, and Tool Configuration.
+ Editor facilities for Creating, Modifying, and Correcting Programs.
+ Target Debugging or CPU & Peripheral Simulation.
MATLAB(Tool for image processing) :-

 MATLAB is a numerical computing environment and programming language.


Created by The MathWorks, MATLAB allows easy matrix manipulation, plotting of
functions and data, implementation of algorithms, creation of user interfaces, and
interfacing with programs in other languages.

MATLAB is built around the MATLAB language, sometimes called M-code or simply
M. The simplest way to execute M-code is to type it in at the prompt, >> , in the
Command Window, one of the elements of the MATLAB Desktop. In this way, MATLAB
can be used as an interactive mathematical shell. Sequences of commands can be
saved in a text file, typically using the MATLAB Editor, as a script or encapsulated into a
function, extending the commands available.

MATLAB is a "Matrix Laboratory", and as such it provides many convenient ways for
creating matrices of various dimensions.. A matrix generally refers to a multi-dimensional
matrix, that is, a matrix with more than one dimension, for instance, an N×M, an N×M×L,
etc., where N, M, and L are greater than 1.

Once the image acquisition setup is ready, the captured images need to be stored in
suitable format to process them. Generally, a raw image is stored as a matrix of color
intensities.
.
Working with Images
 Let us begin with the basic instructions to read
and display an image in MATLAB.

Reading an image
 Once you have started MATLAB, type the
following in the Command Window
>> im=imread(‘imagename.jpg');
 This command stores the image imagename.jpg
in a variable with name im.
Displaying an image :-

You can display the image in another window by using imshow command

>>figure,imshow(im);

This pops up another window (called as figure window), and displays the
image im

M-files :-

MATLAB provides a facility to execute multiple command statements with a


single command. This is done by writing a .m file. Goto File > New > M-file
Function p= coutpix(im);
f=0;
for i=1:240
for j=1:320
if im(i,j,1)>250
a=[i,j];
f=1;
break;
end
end
If f==1
break;
end
end
Hardware Components Description:-

1. Hall effect sensor :

A Hall effect sensor is a transducer that varies its output voltage in response
to changes in magnetic field. Hall sensors are used for proximity switching,
positioning, speed detection, and current sensing applications.In its simplest
form, the sensor operates as an analogue transducer, directly returning a
voltage. With a known magnetic field, its distance from the Hall plate can be
determined. Using groups of sensors, the relative position of the magnet can be
deduced.
Electricity carried through a conductor will produce a magnetic field that varies
with current, and a Hall sensor can be used to measure the current without
interrupting the circuit. Typically, the sensor is integrated with a wound core or
permanent magnet that surrounds the conductor to be measured. Hall sensors
are commonly used to time the speed of wheels and shafts, such as for
internal combustion engine ignition timing or tachometers. They are used in
brushless DC electric motors to detect the position of the permanent magnet.
In the pictured wheel carrying two equally
spaced magnets, the voltage from the
sensor will peak twice for each revolution.
This arrangement is commonly used to
regulate the speed of disc drives.
2. 8051 Microcontroller :

The Intel 8051 is a single chip microcontroller (µC) . Intel's original 8051 family was
developed using NMOS technology, but later versions, identified by a letter "C" in their
name, e.g. 80C51, used CMOS technology and were less power-hungry than their
NMOS predecessors - this made them eminently more suitable for battery-powered
devices.
A particularly useful feature of the 8051 core is the inclusion of a boolean processing
engine which allows bit-level boolean logic operations to be carried out directly and
efficiently on internal registers and RAM. This feature helped to cement the 8051's
popularity in industrial control applications. Another valued feature is that it has four
separate register sets, which can be used to greatly reduce interrupt latency
compared to the more common method of storing interrupt context on a stack. 8051
based microcontrollers typically include one or two UARTs, two or three timers, 128 or
256 bytes of internal data RAM (16 bytes of which are bit-addressable), up to 128
bytes of I/O, 512 bytes to 64 kB of internal program memory, and sometimes a
quantity of extended data RAM (ERAM) located in the external data space.
Important features of 8051

1. It provides many functions (CPU, RAM, ROM, I/O, interrupt logic, timer, etc.) in a
single package

2. 8-bit data bus - It can access 8 bits of data in one operation (hence it is an 8-bit
microcontroller)

3. 16-bit address bus - It can access 216 memory locations - 64 kB each of RAM and
ROM

4. On-chip RAM - 128 bytes ("Data Memory")

5. On-chip ROM - 4 kB ("Program Memory")

6. Four byte bi-directional input/output port


7. UART (serial port)

8. Two 16-bit Counter/timers

9. Two-level interrupt priority

10. Power saving mode


3. 2051 Microcontroller(20-pin) :-

The 2051 is a 20 pin version of the 8051. It is a low-voltage,


high-performance CMOS 8-bit microcomputer with 2K bytes of
Flash programmable and erasable read only memory. Atmel
manufactures the chip using high-density nonvolatile memory
technology. The 2051 and is compatible with the industry-
standard MCS-51 instruction set. By combining a versatile 8-bit
CPU with Flash on a monolithic chip, the Atmel 2051 is a
powerful microcontroller. It provides a very flexible, cost-
effective solution to many embedded control applications.
Operational features of the 2051 :-

The 2051 features Compatibility with MCS-51 ™ Products, 2K Bytes of


Reprogrammable Flash Memory with 1,000 Write/Erase Cycles. The
operating range of the 2051 is 2.7V to 6V

The 2051 also contains the following features:

•Fully Static Operation: 0 Hz to 24 MHz


•Two-level Program Memory Lock
•128 x 8-bit Internal RAM
•15 Programmable I/O Lines
•Two 16-bit Timer/Counters
•Six Interrupt Sources
•Programmable Serial UART Channel
•Direct LED Drive Outputs
•On-chip Analog Comparator
•Low-power Idle and Power-down Modes
4. D.C. Servomotor :-

Dc servo motors are normally used as prime movers in computers, numerically


controlled machinery, or other applications where starts and stops are made quickly
and accurately. Servo motors have lightweight, low-inertia armatures that respond
quickly to excitation-voltage changes. In addition, very low armature inductance in
these servo motors results in a low electrical time constant (typically 0.05 to 1.5 msec)
that further sharpens servo motor response to command signals. Servo motors
include permanent-magnetic, printed-circuit, and moving-coil (or shell) dc servo
motors. The rotor of a shell dc servo motor consists of a cylindrical shell of copper or
aluminum wire coils which rotate in a magnetic field in the annular space between
magnetic pole pieces and a stationary iron core. The servo motor features a field,
which is provided by cast AlNiCo magnets whose magnetic axis is radial. Servo
motors usually have two, four, or six poles.

Dc servo motor characteristics include inertia, physical shape, costs, shaft resonance,
shaft configuration, speed, and weight. Although these dc servo motors have similar
torque ratings, their physical and electrical constants vary.
5. Proximity Sensor :-

Proximity sensors are sensors able to detect the presence of nearby objects
without any physical contact. A proximity sensor often emits an
electromagnetic or electrostatic field, or a beam of electromagnetic radiation
(infrared, for instance), and looks for changes in the field or return signal. The
object being sensed is often referred to as the proximity sensor's target.
Different proximity sensor targets demand different sensors. For example, a
capacitive or photoelectric sensor might be suitable for a plastic target; an
inductive proximity sensor requires a metal target.
The maximum distance that this sensor can detect is defined "nominal range".
Some sensors have adjustments of the nominal range or means to report a
graduated detection distance.

Proximity sensors can have a high reliability and long functional life because of
the absence of mechanical parts and lack of physical contact between sensor
and the sensed object. A proximity sensor adjusted to a very short range is
often used as a touch switch.
5. DRIVING A MOTOR USING H-BRIDGE :-

Physical motion of some form helps differentiate a robot from a computer. It


would be nice if a motor could be attached directly to a chip that controlled the
movement. But, most chips can't pass enough current or voltage to spin a motor.
Also, motors tend to be electrically noisy (spikes) and can slam power back into
the control lines when the motor direction or speed is changed.

Specialized circuits (motor drivers) have been developed to supply motors with
power and to isolate the other ICs from electrical problems. These circuits can be
designed such that they can be completely separate boards, reusable from project
to project.

A very popular circuit for driving DC motors (ordinary or gear head) is called an H-
bridge.
An H-bridge is an electronic circuit which enables DC electric motors to be run
forwards or backwards. These circuits are often used in robotics. H-bridges are
available as integrated circuits, or can be built from separate components.
Structure of an H-bridge (highlighted in red)

The term "H-bridge" is derived from the typical graphical representation of


such a circuit. An H-bridge is built with four switches. When the switches S1
and S4 (according to the first figure) are closed (and S2 and S3 are open) a
positive voltage will be applied across the motor. By opening S1 and S4
switches and closing S2 and S3 switches, this voltage is reversed, allowing
reverse operation of the motor.
Using the nomenclature above, the switches S1 and S2 should never be
closed at the same time, as this would cause a short circuit on the input
voltage source. The same applies to the switches S3 and S4. This condition is
known as shoot-through
Image Processing
Digital image –
 representation of a two-dimensional image using
ones and zeros .
 Digital images can be classified according to the
number and nature of those samples:
1. binary
2. Grayscale
3. color
4. false-color
5. multi-spectral
6. thematic
7. picture function
Digital image processing –

 It is the use of computer algorithms to


perform image processing on digital images.
 It is advantageous over analog image
processing
 allows a much wider range of algorithms to be
applied to the input data .
 avoid problems such as the build-up of noise
and signal distortion during processing.
Distance transform –
 Also known as distance map or distance field .

 It is a representation of a digital image .

 It supplies each pixel of the image with the distance


to the nearest obstacle pixel.
How are digital images stored?
 Each pixel is stored as a numerical value in a matrix.

Columns

Rows
How are digital images stored?

1 0

0 1

 Black – Absence of all color; 0


 White – Presence of all colors; 1
What about color images?
 Composed of mainly three basic colors: Red,
Green and Blue.
 colored image is represented as 3D array with

3rd dimension used for indexing the color


componets.
>> size(imRGB)
ans =
384 512 3
 1 stands for RED.

 2 stands for GREEN.

 3 stands for BLUE.


Some operations on image
 Images in standard formats such as gif, tiff,
and jpeg are stored so that each pixel
value lies in the range [0 .. 255].
 The range [0 .. 255] is chosen so that each
pixel can be represented by 8 bits (one byte).
0: Black
128: Grey
255: White
Approach
 For detection of a ball
Hough Transform
 for the detection of features of a particular
shape like lines or circles in digitalized
images.
 main advantage of the Hough transform

technique is that it is tolerant of gaps in feature


boundary descriptions and is relatively
unaffected by image noise, unlike edge
detectors.
 any kind of curve can be expressed as a
function of the form
f(a1, a2, . . . , an, x, y) = 0.
 For example a circle can be represented as

(x − a)2 + (y − b)2 − r2 = 0
 It has three parameters: two parameters for the
centre of the circle and one for the radius of
the circle.
Disadvantage :
 Here only one circle can be detected.

 large amount of storage and computing power


required by the HT.
Fast Circle Detection Using Gradient
Pair Vectors
 Suppose that we have a circle in a brighter
background
 The first step is calculating the gradient of
image
 The vectors’ directions are outward the circle
 Because of center symmetry of circle, for each vector
there will be a pair of vectors in opposite directions.
 second step of algorithm is applied to find all pair
vectors according to the above conditions in the
gradient space of image.
 In the third step, a candidate circle is considered for
each pair of vectors. Such a circle has its center, at
midpoint of P1 and P2, and its radius is equal to half
of the distance between P1 and P2.
 then the desired circles are extracted from the
candidate circles produced in previous step by
employing a 3-dimensional accumulator matrix to
count the occurrence of quantized circles.
Our Approach
Our Approach
Rectangle detection
Shape identification
Shape identification
Given Condition
Tilted position of robot
Which ball to pick ???
Euclidean distance –
 It is the distance between two points .

 The Euclidean distance between points

P = (p1,p2,------p3) and Q = (q1,q2,------q3).


is defined as:
HARDWARE COMPONENTS ESTIMATED COST

8051 Microcontroller 1 x 50/-


DC Servomoter (freedom - 360 degree ) 2 x 1200/-
Analog Servometer (freedom – 180 degree) 2 x 1000/-
Webcam or digital camera 1 x 500-700/- or 5000/-
H-bridge 2 x 200/-
2051 Microcontroller(20-pin) 1 x 30/-
Hall Effect sensor 2 x 90/-
Proximity Sensor 4 x 150/-
Battery 8 x 150/-
Mechanical Hardware Kit 1500/-
RF receiver 3800/-
Other Minor Components 500/-

Total 17460/-
Bibliography
 Wikipedia
 Google
 Techfest.org
 Books :-
Getting started with Matlab-7 by R.P. Singh
Mohammad Mazidi -8051 microcontroller
Thank you !!!!!

Das könnte Ihnen auch gefallen