Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CHAPTER 1
INTRODUCTION
1.1Hardware specifications:
Parallel port DSUB25M: The Parallel Port is the most commonly used port for interfacing
homemade projects. There may also be a D-Type 25 pin male connector. This will be a serial
RS-232 port and thus, is a totally incompatible port.
L298: The L298 is a Dual Full Bridge driver that can drive up to 2Amps per bridge with
supply voltage up to 46V. It can drive DC motors, stepper motors, relays, solenoids, etc. The
device is TTL compatible. Two H bridges of L298 can be connected in parallel to increase its
current capacity to 4 Amp. It can be used in conjunction with stepper motor controller for
driving one/two phase stepper motor. The device is available in 15- lead Multi watt package.
MC2TE: Optocoupler is a coupling component used commonly in feedback control loop
circuits for power supply equipment The Optocoupler is an optoelectronics component of
high failure risk. It is generally used for conveying analog info. The photo transmitter is light
emitting diode and the phototransistor can be made of different types.
AT89C2051: The AT89C2051 is a low-voltage, high-performance CMOS 8-bit
microcomputer with 2K bytes of Flash programmable and erasable read-only memory
(PEROM). The device is manufactured using Atmels high-density nonvolatile memory
technology 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 AT89C2051 is a
powerful microcomputer which provides a highly-flexible and cost-effective solution to many
embedded control applications.
DC Motor: An electric motor uses electrical energy to produce mechanical energy, very
typically through the interaction of magnetic field and current-carrying conductors. The
reverse process, producing electrical energy from mechanical energy, is accomplished by a
generator or dynamo. Many types of electric motors can be run as generators, and vice versa.
Limit switch: The touch sensor module is based around the limit switch. This module is able
to detect obstacles when it bumps into it. The module gives an active low output when it
detects an obstacle. The output remains low for a time interval determined by IC555 timer.
3.1.2 Base:
A robotic manipulator is a device capable of moving in different directions (base, shoulders,
elbow, yaw, pitch, roll directions) relative to base and controlled by computer. The base is
normally bolted to floor but in our case the base we have designed base that is fixed but can
rotate about vertical axis by 360 degrees. We have constructed base from a Bakelite material,
a turn table of radius 7cm. this base is actuated by a D.C geared motor mounted beneath it.
3.1.3 Arm:
The next important member of the robot is the arm which is the link between shoulder and
elbow. The arm is made up of number of joints and links. One end of the arm is attached to
5
3.1.4 Gripper:
Grippers are the devices which are attached to the end of the robot arm and are used to
grip/pick/grasp an object from one place to another place. There are various types of grippers
out of which we have used parallel jaw gripper. A parallel jaw gripper is one which tool tip
position is fixed and the two finger move parallel to each other. The disadvantage of this
parallel jaw gripper is that it cannot pick up the lengthy objects. It can pick up only those
objects whose sides are parallel in nature such as containers, boxes. So depending upon the
requirement of the industry work floor we can just vary the design of grippers keeping the
entire assembly same.
1. Compatibility Mode.
2. Nibble Mode.
3. Byte Mode.
4. EPP Mode (Enhanced Parallel Port).
5. ECP Mode (Extended Capabilities Port).
The aim was to design new drivers and devices which were compatible with each other and also
backwards compatible with the Standard Parallel Port (SPP). Compatibility, Nibble & Byte modes use
just the standard hardware available on the original Parallel Port cards while EPP & ECP modes
require additional hardware which can run at faster speeds, while still being downwards compatible
with the Standard Parallel Port. Compatibility mode or "Centroids Mode" as it is commonly known,
can only send data in the forward direction at a typical speed of 50 Kbytes per second but can be as
high as 150+ Kbytes a second. In order to receive data, you must change the mode to either Nibble or
Byte mode. Nibble mode can input a nibble (4 bits) in the reverse direction. E.g. from device to
computer. Byte mode uses the Parallel's bi-directional feature (found only on some cards) to input a
byte (8 bits) of data in the reverse direction. Extended and Enhanced Parallel Ports use additional
hardware to generate and manage handshaking. To output a byte to a printer (or anything in that
matter) using compatibility mode, the software must.
1. Write the byte to the Data Port.
2. Check to see is the printer is busy. If the printer is busy, it will not accept any data, thus any data
which is written will be lost.
3. Take the Strobe (Pin1) low. This tells the printer that there is the correct data on the datelines
(Pins2-9)
Fig. 3.2.2
Pin No (D-Type
Pin No
SPP Signal
Direction
In/out
Register
25
(Centronics )
nStrobe
In/Out
Control
Data 0
Out
Data
Data 1
Out
Data
Data 2
Out
Data
Data 3
Out
Data
Data 4
Out
Data
Data 5
Out
Data
Data 6
Out
Data
Data 7
Out
Data
10
10
nAck
In
Status
11
11
Busy
In
Status
12
12
Paper-Out
PaperEnd
In
Status
13
13
Select
In
Status
14
14
nAuto-Linefeed
In/Out
Control
15
15
nError / nFault
In
Status
16
16
nInitialize
In/Out
Control
17
17
nSelect-Printer
nSelect-In
In/Out
Control
18-25
18-25
Ground
Gnd
The above table uses "n" in front of the signal name to denote that the signal is active low. e.g.nError.
if the printer has occurred an error then this line is low. This line normally is high, should the printer
be functioning correctly. The "Hardware Inverted" means the signal is inverted by the Parallel card's
hardware. Such an example is the busy line. If +5v (Logic 1) was applied to this pin and the status
register read, it would return back a 0 in Bit 7 of the Status Register The output of the Parallel Port is
normally TTL logic levels. The voltage levels are the easy part. The current you can sink and source
varies from port to port. Most Parallel Ports implemented in ASIC, can sink and source around 12mA.
However these are just some of the figures taken from Data sheets, Sink/Source 6mA, Source
12mA/Sink 20mA, Sink 16mA/Source 4mA, Sink/Source 12mA. As you can see they vary quite a bit.
The best bet is to use a buffer, so the least current is drawn from the Parallel Port
3.2.3 Centronics
Centronics is an early standard for transferring data from a host to the printer. The majority of printers
use this handshake. This handshake is normally implemented using a Standard Parallel Portunder
software control. Below is a simplified diagram of the Centronics Protocol
Fig. 3.2.3
Data is first applied on the Parallel Port pins 2 to 7. The host then checks to see if the printer is busy.
I.e. the busy line should be low. The program then asserts the strobe, waits a minimum of 1mS, and
then de-asserts the strobe. Data is normally read by the printer/peripheral on the rising edge of the
strobe. The printer will indicate that it is busy processing data via the busy line. Once the printer has
accepted data, it will acknowledge the byte by a negative pulse about 5mS on the nAck line. Quite
often the host will ignore the nAck line to save time. Latter in the Extended Capabilities Port, you will
see a Fast Centronics Mode, which lets the hardware do all the handshaking for you. All the
programmer must do is write the byte of data to the I/O port. The hardware will check to see if the
printer is busy, generate the strobe. Note that this mode commonly doesnt check the nAck either
10
Address
Notes:
Used for Parallel Ports which were incorporated
3BCh - 3BFh
378h - 37Fh
278h - 27Fh
When the computer is first turned on, BIOS (Basic Input/output System) will determine the number of
ports you have and assign device labels LPT1, LPT2 & LPT3 to them. BIOS first looks at address
3BCh. If a Parallel Port is found here, it is assigned as LPT1, then it searches at location 378h. If a
Parallel card is found there, it is assigned the next free device label. This would be LPT1 if a card
wasn't found at 3BCh or LPT2 if a card was found at 3BCh. The last port of call, is 278h and follows
the same procedure than the other two ports. Therefore it is possible to have a LPT2 which is at 378h
and not at the expected address 278h.
What can make this even confusing, is that some manufacturers of Parallel Port Cards, have jumpers
which allow you to set your Port to LPT1, LPT2, and LPT3. Now what address is LPT1? - On the
majority of cards LPT1 is 378h, and LPT2, 278h, but some will use 3BCh as LPT1, 378h as LPT1 and
278h as LPT2. Life wasnt meant to be easy.
The assigned devices LPT1, LPT2 & LPT3 should not be a worry to people wishing to interface
devices to their PC's. Most of the time the base address is used to interface the port rather than LPT1
etc. However should you want to find the address of LPT1 or any of the Line Printer Devices, you can
use a lookup table provided by BIOS. When BIOS assigns addresses to your printer
Devices, it stores the address at specific locations in memory, so we can find them
11
Start Address
Function
0000:0408
0000:040A
0000:040C
0000:040E
The above table, table 3, shows the address at which we can find the Printer Port's addresses in
The BIOS Data Area. Each address will take up 2 bytes
Fig 3.2.5
12
Fig 3.2.6
13
3.3.1 IC L293
The L293D is a quadruple half H-bridge bidirectional motor driver IC that can drive current
of up to 600mA with voltage range of 4.5 to 36 volts. It is suitable to drive small DC-Geared
motors, bipolar stepper motor etc. Rs.84.38
Fig 3.3.1
14
3.3.2 IC L298
L298. Is most commonly used driver circuit in hobby robots? This can control 2 DC Motors,
their direction using control lines and their speed using PWM.
Maximum current rating per channel: 2A
Maximum Supply voltage for Motors: 50V
Maximum Logic Voltage: 7V
15
Fig 3.3.2
16
Fig 3.4.2
17
3.4.4 Operation
Control is accomplished by grounding the control pin(s) for the desired function/motor. This
is usually done by putting a logic LOW (i.e. 0V or ground) on an output pin of your host
microcontroller, which is in turn connected to the appropriate control connection (Fwd. Back,
Enable ). Fwd. To make a motor move forward, ground the Fwd. connection on the
appropriate connector (left / right). To stop, un-ground the connection. The photo below
shows how both motors would be made to go forward. Back (Reverse) to drive the motor in
reverse, ground the appropriate Back connection. To stop, unground the connection. Gnd is a
ground connection. The L298 Controller board and your control circuit must share the same
ground. Enable The Enable connection is an active LOW connection that is pulled HIGH for
you on the circuit board. Ground this connection to disable a motor. Note: While disabled,
commands from the host microcontroller (grounding/un-grounding the control connections)
will have no effect on
That motor. Disabling a motor shuts-down the L298s internal circuits, putting it into a low
current consumption mode (for that channel). When both channels are disabled, the motor
controller will consume approx. 10mA
18
Fig. 3.4.7
You will notice that each time a motor is turned on, current passes through 2 NPN transistors.
Each transistor has (approximately) 0.7 Volt drop across it, so the motor will see about 1.4
Volts LESS than the Motor Battery Voltage across its terminals. This means that if you have
a 12 Volt motor, and you want it to receive maximum power, you should use a 13.4 Volt
battery. Also notice that if transistors Q1 and Q2 (or Q3 and Q4) were turned on, that you
would make a short circuit across the battery. For this reason, the L298N has internal logic
that prevents this from happening.
20
Fig 3.4.8
The L298 Motor Driver has 4 inputs to control the motion of the motors and two enable
inputs which are used for switching the motors on and off. To control the speed of the motors
a PWM waveform with variable duty cycle is applied to the enable pins. Rapidly switching
the voltage between Vs and GND gives an effective voltage between Vs and GND whose
value depends on the duty cycle of PWM. 100% duty cycle corresponds to voltage equal to
Vs, 50 % corresponds to 0.5Vs and so on. The 1N4004 diodes are used to prevent back EMF
of the motors from disturbing the remaining circuit. Many circuits use L293D for motor
control, I chose L298 as it has current capacity of 2A per channel at 45V compared to 0.6 A
at 36 V of a L293D. L293Ds package is not suitable for attaching a good heat sink;
practically you cant use it above 16V without frying it. L298 on the other hand works
happily at 16V without a heat sink, though it is always better to use one.
Fig 3.4.9
In a simple 2-pole DC electric motor, as shown above (here red (right side) represents a
magnet or winding with a "North" polarization, while green (left side) represents a magnet or
winding with a "South" polarization).
Every DC motor has six basic parts axle, rotor (a.k.a., armature), stator, commutator, field
magnet(s), and brushes. In most common DC motors (and all that Beamers will see), the
external magnetic field is produced by high-strength permanent magnets.
The stator is the stationary part of the motor this includes the motor casing, as well as two or
more permanent magnet pole pieces. The rotor (together with the axle and attached
commutator) rotates with respect to the stator. The rotor consists of windings (generally on a
core), the windings being electrically connected to the commutator. The above diagram
shows a common motor layout with the rotor inside the stator (field) magnets.
The geometry of the brushes, commutator contacts, and rotor windings are such that when
power is applied, the polarities of the energized winding and the stator magnet(s) are
misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets.
As the rotor reaches alignment, the brushes move to the next commutator contacts, and
energize the next winding. Given our example two-pole motor, the rotation reverses the
direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field,
driving it to continue rotating.
In real life, though, DC motors will always have more than two poles (three is a very
common number). In particular, this avoids "dead spots" in the commutator. You can imagine
22
3.5 Motors
What is a motor?
An electrical machine that converts electrical energy to mechanical energy is called motor.
[b] Ungeared motors: These motors do not work with gears. The bidirectional rotation is not
possible with these motors. Hence they are generally not preferred for level 1 robots.
Types of geared motors
Geared motors are available in different rpms (rotations per minute)30, 75, 100, 150, 300,
500, 750 and 1000 rpms are the ones which are commonly available in the market. These
motors are rated to withstand upto 12 volts and a current of 5amp.
[c] Selection of motors: Remember that you may have to modify your car for different
events according to the track details and the tasks at hand. This may even include replacing
your motors with different rpm motors.So what are the guidelines while selecting a motor.
To decide which rpm to use for your robot you need to know the principle of torque.
23
3.5.2 Torque:
Torque = power/w, where w=2*pi*n
Using 500 rpm motors gives less torque. Due to this your robot may not be able to climb
inclined slopes very easily above some angle of inclination. It may give you more speed but
the power of the robot decreases. Hence selection of rpm is always a compromise between
speed and torque. Generally for obstacle courses in level 1 robotic races, 300 rpm motors are
used as they provide sufficient torque and speed.
Motors having rpm lower than 300 rpm are generally not used for racing unless there are very
high torque requirements. They are used for performing other tasks in events such as
robowars. Tasks such as picking up heavy objects, using mechanisms like cranes, carriers and
elevating heavy objects involve the use of such lower rpm motors.
In drag races to obtain more speed, higher rpm motors should be used.
While testing the motors at any point of time during construction of the robot make sure that
the positive and negative terminal of the motors are not shorted at any point. If this happens
24
Some of the tracks may have your robot passing through water. Hence your motors should be
properly insulated. Water entering inside the motor will damage it and cause electrical
problems. Hence insulate the parts of the motor which may allow water to seep inside.
Teflon, Mseal or basic insulation tape can be used for insulation purpose.
Geared motors that you use will have several plastic gears inside them. If anyone gear cracks
or breaks your motor will not function satisfactorily. So handle the motors with care.
3.5.5 DC motors
Fig. 3.5.5
25
26
27
28
29
Fig. 3.5.12
33
Fig no 3.5.13
This provides high manoeuvrability as the unit is capable of turning on a fixed point. The
major disadvantage is the power required to perform a turn, especially on a stationary
position, as the wheels must move in a lateral direction as well as moving forward. This
increases power consumption, forces that the design must withstand, and the wear on the
tires/tracks. Skid steering is therefore most suitable for applications involving rough terrain,
and/or terrain with a loose or soft surface. A skid steered vehicle which is symmetric about its
axis has an advantage of equal manoeuvrability in either a forward or reverse direction
3.6 Optocoupler:
Optocoupler is a coupling component used commonly in feedback control loop circuits for
power supply equipment. Its high failure risk causes in most cases the breakdown of the
whole equipment. Different types of accelerated endurance tests samples and order to
determine the best fault signature of the components and accurate analytical model for the
aging of Optocoupler I supposed. The Optocoupler is an optoelectronics component of high
failure risk. It is generally used for conveying analogy info. Across a power supply isolation
barrier. This isolation is assured by an optical coupling between the input and the output
which is necessary for persons safety for example in medical equipment or to avoid
electromagnetic noise disturbance. For example between power electronic and control
circuits. The outer casing is a moulding compound impervious to light. The photo transmitter
is light emitting diode and the phototransistor can be made of different types (photodiode,
34
Fig 3.6
The data received from the parallel port is not connected directly to the motor driver circuit to
avoid loading effect. So to avoid loading, an opt-coupler IC MCT2E is used for each bit of
data. This provides isolation between the computer and the circuit. In this IC, LED is used
with a photo transistor
35
Fig 3.7
36
3.7.2 Features
Output current in excess of 1A
Internal thermal overload protection
No external components required
Output transistor safe area protection
Internal short circuit current limit
Available in the aluminium TO-3 package
Voltage Range
LM7805C 5V
LM7812C 12V
LM7815C 15V
Fig 3.7.3
In our project we require power supply of 5V. From the mains supply we get 230V, 50 Hz.
So to convert that configuration into the required configuration we need to use following
circuits with signal conditioners:
37
Transformer here used is the Centre tapped step down transformer. The primary winding
turns are greater than that of the secondary. Input supply to primary is 230V, 50 Hz that
produces the 0-24V at the secondary. Secondary of the transformer is connected to the full
wave bridge rectifier. It gives unipolar waveform of the transformer output. It converts the
a.c. supply into D.C. voltage.
Output at the bridge rectifier is:
Vdc=2*(Vin)/pi
V (rms) =Vm/2
But output obtained from the rectifier is not complete ripple free and contains the ac nature.
Thus it needs to be smoothened using Filter condenser. Here the capacitor assembly allows
only its rated voltage through it for one cycle. Property of capacitor to be insensitive to the
high frequency at the input side helps to have smooth output. Sometimes, due to mains power
supply fluctuation and the ageing of the circuit components the output fails to remain at
constant level. Thus we need to add the voltage regulators.
Due to the high voltage operating temperatures there may be heat generation, which leads to
the sparks or may even catch fire and damage the whole circuitry. Thus we use heat sink. All
the output is then connected to the connector to provide the supply for remaining circuit.
The space between the conductors must be strictly controlled to avoid the possibility of
electrical discharge or unwanted capacitance. The amount by which the master diagram is to
reduce in size is thus a critical design feature.
2)
The conductor must be wider in those parts of the circuits that are going to handle large
About 1.5mm. This is related to mechanical strength rather than electrical properties and it also
ensures that strips remains securely bounded to the base material.
4)
The points where the component holes for component lead wire occurs must be sited to
suit the dimensions of the component and dimensions between lead-out wires, so that, the
components can be situated correctly on finished board. The conductor is also men large at the
point of holes.
3.8.3 P.C.B.Making:
When the master diagram probable twice the size of real PCB has been evolved, the text major
step consists of etching or dissolving the unwanted metal from copper cladded board to create the
circuit as depicted by master diagram. It must be stressed that very accurate checking of master is
39
3.8.4 In case of simple and need of number of less PCB, economic and
advisable to use the following lab method of PCB making.
1. Planning the circuit:Although this is not particularly difficult. There are several important factors that need not be
taken into account, if the finished device is to work properly we must consider gain factor and
ensure that the input and output parts are sufficiently well isolated to avoid the possibility. We
must also ensure that conductors and components carrying high frequency current are well
separated from these parts of the circuits. We are also to make sure that all components need to
return to earth are properly connected and that possibility of common impedance arising in earth
returned. Circuit is totally eliminated by making all earth as substantial as possible consistent
with nature of design. Other factors that have to successfully studied include availability of
adequate return points on board and its mounting from accessibility of switch connections made
for mechanical fixing ventilation effect of vibration.
2. Cleaning the Board:The copper side of the board must be thoroughly cleaned before Circuit plan is transferred to it.
This is very important because even slightest trace of graze (from figure of instance) will impure
the etching process and when the circuit plan has been neatly transferred to copper in this manner
the board is held under, running tap and the allowed to dry before resist is applied.
3. Transforming the Plan:Now, once cleaning is done plan has to transfer on copper surface of PCB material. A convenient
way to do this is simply put a carbon paper between a copper surface of the board and working
plan and carefully trace the lines of original plan with a ball pen.
40
7. Agitation:Small plastic bath is ideal for storing the etchant process. The Depth of liquid must be sufficient
to completely cover laminate, the laminated board carrying the resist pattern circuit is then
dropped into etchant bath and the gentle agitation takes 5 to 20 minutes to complete depending on
the strength of the enchant temperature and thickness of copper foil.
8. Finishing Off:When all unwanted copper is dissolved from areas between conductors, board should be taken
from an etchant and washed in water. The resist must be removed using proper solvent. After
this the copper surface must be polished with any kind of cleaner. It should be seen that there is
41
Fig 3.9
42
43
44
Fig .4.1.1
45
sass
Fig.4.1.2
RGB COLOR SPACE
RGB Cube
Physical principles for the choice of red, green, and blue
The choice of primary colors is related to the physiology of the human eye; good primaries
are stimuli that maximize the difference between the responses of the cone cells of the human
retina to light of different wavelengths, and that thereby make a large color triangle.
46
Fig no 4.1.3
Color triangle feasible with primary color
47
Fig.4.2
48
Fig no.4.2
Cyan, magenta, yellow, and key (black).
4.3 Conversion
Since RGB and CMYK spaces are both device-dependent spaces, there is no simple or
general conversion formula that converts between them.
6-connected
6-connected pixels are neighbours to every pixel that touches one of their corners (which
includes pixels that touch one of their edges) in a hexagonal grid or stretcher bond
rectangular grid.
There are several ways to map hexagonal tiles to integer pixel coordinates. With one method,
in addition to the 4-connected pixels, the two pixels at coordinates
are connected to the pixel at
and
8-connected
8-connected pixels are neighbours to every pixel that touches one of their edges or corners.
These pixels are connected horizontally, vertically, and diagonally. In addition to 4Connected pixels, each pixel with coordinates
connected to the pixel at
50
or
is
3-dimensional connectivity
6-connected
6-connected pixels are neighbours to every pixel that touches one of their faces. These pixels
are
connected
along
coordinates
at
one
of
the
primary
or
axes.
Each
pixel
with
18-connected
18-connected pixels are neighbours to every pixel that touches one of their faces or edges.
These pixels are connected along either one or two of the primary axes. In addition to 6Connected
pixels,
each
pixel
coordinates
,
at
, or
with
26-connected
26-connected pixels are neighbours to every pixel that touches one of their faces, edges, or
corners. These pixels are connected along either one, two, or all three of the primary axes. In
addition
to
18-Connected
coordinates
pixels,
each
pixel
, or
,
,
51
with
4.5 THRESHOLDING
Thresholding is the simplest method of image segmentation. From a grayscale image,
thresholding can be used to create binary images
Original image.
Thresholded image
Fig 4.5
During the thresholding process, individual pixels in an image are marked as object pixels
if their value is greater than some threshold value (assuming an object to be brighter than the
background) and as background pixels otherwise. This convention is known as threshold
above. Variants include threshold below, which is opposite of threshold above; threshold
inside, where a pixel is labeled "object" if its value is between two thresholds; and threshold
52
2.
G2 = {f(m,n):f(m,n)
m1 = average value of G1
2.
m2 = average value of G2
clustering-based methods, where the gray-level samples are clustered in two parts as
background and foreground (object), or alternately are modeled as a mixture of two
Gaussians
entropy-based methods result in algorithms that use the entropy of the foreground and
background regions, the cross-entropy between the original and binarized image, etc.
Local-methods adapt the threshold value on each pixel to the local image
characteristics."
55
4.7 Flowchart:
Fig .4.7
4.8
ALGORITHM
Step 1: Firstly it initialize the webcam
56
Step 4: Color threshold image as per requirement i.e. Threshold so as to select the target.
Step 5: After color threshold there are various blobs including the target blob which is large is
size. Thus to select the target blob we run the largest blob selection routine.
Step 6: Find the centroid of the target, so as to find the Middle mass.
Step 7: The image is divided into nine sectors. Thus we have to find in which sector the
Centroid lies. If it is centre then no need to track the target but if it is not in centre
Then we have to drive motors so as to bring centroid in centre.
Fig.4.8.1
57
Fig.4.8.2
Fig.4.8.3
58
Fig.4.8.4
Fig.4.8.5
Fig.4.8.6
59
Fig.4.8.7
Thus the Matlab will send the data to the parallel port so as to drive the motor to bring the
centroid into centre sector. In this case motor will be driven to move camera UP.
Fig.4.8.8
As our project is PC controlled there is a 25 Pin Parallel PC port, which is the output
from PC, to which the device is connected.
BUFFER FOR ISSOLATION: - This block is used to isolate micro controller with PC
in order to minimize the loading effect which will take place on the motherboard of
computer and might damage it.
MOTOR DRIVER: - This block takes various commands from the Micro controller
and gives commands to the different motors that will run the device. Basically this
block will drive the whole assembly of motors
60
4.9 Overview
Image Acquisition Toolbox implements an object-oriented approach to image acquisition.
Using toolbox functions, you create an object that represents the connection between
MATLAB and specific image acquisition devices. Using properties of the object you can
control various aspects of the acquisition process, such as the amount of video data you want
to capture. Connecting to Hardware describes how to create objects. Once you establish a
connection to a device, you can acquire image data by executing a trigger.
In the toolbox, all image acquisition is initiated by a trigger. The toolbox supports several
types of triggers that let you control when an acquisition takes place. For example, using
hardware triggers you can synchronize an acquisition with an external device.
Acquiring Image Data describes how to trigger the acquisition of image data. To work with
the data you acquire, you must bring it into the MATLAB workspace. When the frames are
acquired, the toolbox stores them in a memory buffer. The toolbox provides several ways to
bring one or more frames of data into the workspace where you can manipulate it as you
would any other multidimensional numeric array.
Working with Acquired Image Data describes this process. Finally, you can enhance your
image acquisition application by using event call-backs. The toolbox has defined certain
occurrences, such as the triggering of an acquisition, as events. You can associate the
execution of a particular function with a particular event. Using Events and Call-backs
describes this process. Toolbox Components The toolbox uses components called hardware
device adaptors to connect to devices through their drivers. The toolbox includes adaptors
that support devices produced by several vendors of image acquisition equipment. In
addition, the toolbox includes an adaptor for generic Windows video acquisition devices. The
following figure shows these components and their relationship. Image Overview When a
trigger occurs, the toolbox sets the object's Logging property to 'on' and starts storing the
acquired frames in a buffer in memory, a disk file, or both. When the acquisition stops, the
toolbox sets the object's Logging property to 'off'.
61
62
63
2.
Acquisitionstarting the video input object and acquiring and processing data
4.
64
Step 2: Configuration
Next, we open a preview window and adjust the cameras brightness setting. To obtain a
listing of all the configurable properties of a video object, see the tutorial, working with
Properties.
preview(vid);
set(vid.source,Brightness,100);
Fig.4.9.7
Step 3: Acquisition
We use the getsnapshot command to acquire a single video frame from the camera. For
information on how to perform a multiframe acquisition, see the tutorial, Logging Data to
Memory.
data = getsnapshot(vid);
Now, we extract the red color band from the acquired frame and apply a Sobel edge
enhancement filter. The toolbox acquires video frames in RGB format by default, and
represents RGB data as a three-dimensional array consisting of height x width x color band.
For more information on advanced image processing functions, refer to Image Processing
Toolbox Web pages.
65
Here, we visualize the filtered data as a three-dimensional surface and apply various
formatting. For more information on advanced visualization methods, see the documentation
on the MATLAB Web pages.
surf(filtered);
shading(interp);colormap(hot);colorbar;
Fig.4.9.7
Step 4: Clean up
We delete and clear the video input object from the MATLAB workspace to free up memory.
delete(vid);
clear vid;
66
Delete
disp
get
getselectedsource
imaqfind
islogging
isrunning
isvalid
load
obj2mfile
save
set
start
stop
videoinput
wait
Triggering
trigger
triggerconfig
triggerinfo
Data
flushdata
67
getsnapshot
peekdata
Tools
closepreview
imaqhelp
Imaqhwinfo
imaqmem
imaqmontage
imaqreset
imaqtool
preview
Propinfo
Stoppreview
68
function. You get help for the MATLAB version of this function if you type the
following:
help delete
You can determine if a function is overloaded by examining the last section of the help. For
delete,
the help contains the following overloaded versions (not all are shown):
Overloaded methods
help char/delete.m
help scribehandle/delete.m
help scribehgobj/delete.m
.
.
.
help imaqdevice/delete.m
To obtain help on the Image Acquisition Toolbox version of this function, type the following:
help imaqdevice/delete
To avoid having to specify which overloaded version you want to view, use the imaqhelp
function:
imaqhelp delete
69
imaqhwinfo
ans =
The adaptor assigns a unique number to each device with which it can communicate. The
adaptor assigns the first device it detects the device ID 1, the second it detects the device ID
2, and so on. To find the device ID of a particular image acquisition device, call the
imaqhwinfo function, specifying the name of the adaptor as the only argument. When called
with this syntax, imaqhwinfo returns a structure containing information about all the devices
available through the specified adaptor.
info = imaqhwinfo('matrox');
info =
dev_info = imaqhwinfo('matrox',1)
dev_info =
DefaultFormat: 'M_RS170'
DeviceFileSupported: 1
DeviceName: 'Orion'
DeviceID: 1
ObjectConstructor: 'videoinput('matrox', 1)'
SupportedFormats: {1x10 cell}
Most trigger properties can be set using the same methods you use to set any other image
acquisition object property: using the set function or referencing the property as you would a
field in a structure. For example, you can use the set function to specify the value of the
TriggerRepeat property, where vid is a video input object created using the videoinput
function.set(vid,'TriggerRepeat',Inf). Some trigger properties, however, are interrelated and
require the use of the triggerconfig function to set their values. These properties are the
TriggerType, TriggerCondition, and TriggerSource properties. For example, some
TriggerCondition values are only valid when the value of the TriggerType property
Is'hardware'.
Specifying the trigger type
Trigger type value
immediate
Always none
The
trigger
automatically,
occurs
immediately
71
Always none
hardware
Device-specific
Hardware
external
triggers
signals
are
that
are
processed directly
by the hardware. This type of
trigger
is
used
when
4.10 ARENA
Our project comprises of an arena which will be black in colour of dimensions by .
It will have white coloured markings at distances from each other to denote the coordinates at that point. The robot uses these markings to navigate itself on the arena. The coordinates of the destination are pre-fed in the robot memory using a program and the coordinates of the location of the object are calculated by the robot itself on the basis of the coordinates of the centroid of object it gets from image processing.
72
Fig 4.10
The co-ordinates of the object location i.e. the blue block square, is identified by the robotic
arm on its own by image processing depending on the colour of the object.
The co-ordinates of the location are to be fed to the robotic arm by programming. The coordinates of the location are shown by the black square in the above arena.
73
Fig.4.10(a)
Objective
There can be three different shapes of objects: Circle, Square and Equilateral Triangle
The shape of the hoops will be circular annular rings of different colours whose RGB
values will be provided. The RGB values for the single colour used for objects will
also be provided.
The robot has to start from a START point and place the objects in the respective
hoops as per the rules provided below. After completion of task, it has to move
towards the nearest END point corner to exit the arena.
74
The figures in the end indicate the sample arena details the dimensions of the
elements used within the arena.
The arena will be completely plain without hindrance to the movement of the robot
The objects will be of optimum weight so that it can be easily carried away by a robot.
Robot details
The computer will have USB, parallel ports or serial ports for communication.
Preferably, it is advised to use Parallel Port for communication.
Few of the resolutions that the camera will support for image acquisition are 640x480,
800x600 and 1600x1200.
Fig.4.11
75
MIDARS, a four-wheeled robot outfitted with several cameras, radar, and possibly a firearm,
that automatically performs random or preprogramed patrols around a military base or other
government installation. It alerts a human overseer when it detects movement in unauthorized
areas, or other programmed conditions. The operator can then instruct the robot to ignore the
event, or take over remote control to deal with an intruder, or to get better camera views of an
emergency. The robot would also regularly scan radio frequency identification tags (RFID)
placed on stored inventory as it passed and report any missing items.
The Defense Advanced Research Projects Agency (DARPA) is the central research and
development organization for the Dept. of Defense. The DARPA "Distributed Robotics
Program" seeks to work with qualified companies to develop tiny, biologically-inspired robot
designs and new methods of robot control for military applications. DARPA is particularly
interested in micro-miniature robots because they can be produced at relatively low unit cost and
offer unique mission advantages. They can be carried and deployed by individuals and small
teams to augment human capability, perform hazardous missions, and accomplish tasks that
previously could not be the goal is to develop tiny, nimble devices that can, for example,
76
Exploration
Rover
Mission (MER),
is
an
ongoing robotic
space
mission involving two rovers, Spirit and Opportunity, exploring the planet Mars. It began in
2003 with the sending of the two rovers MER-A Spirit and MER-B Opportunity to
explore the Martian surface and geology.
The mission's scientific objective was to search for and characterize a wide range of
rocks and soils that hold clues to past water activity on Mars. The mission was part of
NASA's Mars Exploration Program which includes three previous successful landers: the
two Viking program landers in 1976 and Mars Pathfinder probe in 1997.
77
78
5.2 CONCLUSION
The existing method available for Pick and place is either manually or by using a computer
controlled robot. The setup implemented provides a hassle free method for the job by making
use of image processing implemented using colour detection.
When a computer controlled robot is used it will always have a human engaged to manoeuvre
it. This automation limits the flexibility of Robotics. The flexibility of the robot can be
further increased by inculcating artificial intelligence in it with the help of image processing.
While utilizing this setup in a chemical and fertilizer manufacturing factory, which regularly
deals with various hazardous chemicals, the robot is of great help in managing these and also
in waste management of toxic waste. This can be done without putting human life to risk and
human intervention to control it.
The image processing capability of the robot helps the robot to identify the chemical of
interest as it has been pre-programmed to identify liquid or hazardous materials of a
particular colour.
The project can be further modified by using proper materials for making the body of the
robot so that it does not react with the chemicals to be handled. Also we could mount
appropriate gas sensors on the robot to detect any gas leakage.
79
Appendices
Object detection program based upon colour
a=imread('a.jpg')
g=a(:,:,2);
imview(g);
log=roicolor(g,120,220);
imview(log);
[lab,num]=bwlabel(log,8);
sizeBlob = zeros(1,num);
for i=1:num,
sizeblob(i) = length(find(lab==i));
end
[maxno largestBlobNo] = max(sizeblob);
outim = zeros(size(log),'uint8');
outim(find(lab==largestBlobNo)) = 1;
last=255*outim;
last_bw=bwlabel(last,8);
%%%% largest blob stop %%%%%%%
%imview(log);
imshow(last);
s=sum(sum(last));
cen=regionprops(last_bw,'centroid');
%to find centriod
cent=cen.Centroid;
% to find centriod
cent=round(cent);
%to round the centriod value
80
Microcontroller program
org 0000h
mov p1,#00h
mov p3,#0ffh
mov sp,#50h
ljmp main
main:
lcall bot
lcall motor
sjmp main
bot:
lk1:
lk2:
mov a,p3
anl a,#07h
cjne a,#01h, lk1
setb p1.7
clr p1.6
ret
cjne a,#02h, lk2
setb p1.6
clr p1.7
ret
clr p1.7
clr p1.6
ret
motor:
mov a,p3
anl a,#07h
cjne a,#04h, lk3
lcall down
lcall delay0_5
lcall stop
lcall delay0_5
lcall close
lcall delay0_5
81
clr p1.3
clr p1.2
clr p1.1
clr p1.0
ret
up:
setb p1.1
clr p1.0
82
clr p1.3
clr p1.2
clr p1.1
clr p1.0
ret
delay0_5:
mov tmod,#01
mov r1,#7
back2: mov tl0,#00h
mov th0,#00h
setb tr0
again2:jnb tf0,again2
clr tr0
clr tf0
djnz r1,back2
ret
end
83
Power supply
84
Optocoupler
L298
References:
85
[1] Gonzalez, Rafael C. & Woods, Richard E. (2002). Thresholding. In Digital Image
Processing, pp. 595611. Pearson Education
[2] Introduction to Parallel Ports:
http://www.beyondlogic.org/spp/parallel.html
[3] Parallel port interfacing:
http://logix4u.net/Legacy_Ports/Parallel_Port/A_tutorial_on_Parallel_port_Interfacing.html
[4] Opto isolater:
http://www1.jaycar.com.au/images_uploaded/optocoup.pdf
[5] IC L298:
http://www.st.com/stonline/products/literature/ds/1773.pdf
[6] Voltage regulator:
http://www.national.com/mpf/LM/LM2825.html
[7] Robotic axes:
http://www.societyofrobots.com/robot_arm_tutorial.shtml#DOF
[8] Wikipedia.org
86