Matlab Based Autonomous Ball Searching Robot Using Image Processing
Matlab Based Autonomous Ball Searching Robot Using Image Processing
Serial Port
LCD Right
MAX 232 Motor
Microcontroller
Motor
Battery Power
Supply
Driver Left
Motor
HARDWARE
MAX 232
MICROCONTROLLER
L293D
MOTORS
LCD
PASSIVE COMPONENTS
89S51
FEATURES OF 89S51
• 4K Bytes of In-System
Programmable (ISP) Flash Memory
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33
MHz
• Three-level Program Memory Lock
• 128 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Two 16-bit Timer/Counters
• Six Interrupt Sources
• Full Duplex UART Serial Channel
VOLTAGE REGULATOR 7805
7805 is a three terminal
positive voltage regulator.
Input, Ground ,Output
It is used to provide regulated
volts
LCD 16x2
RS(REGISTER SELECTION)
RS=0;COMMAND REGISTER
RS=1;DATA REGISTER
R/W(READ/WRITE)
R/W=1:MUC WANTS TO READ
R/W=0; MUC WANTS TO
WRITE
E=USED TO LATCH DATA
PRESENT ON DATA
PINS.HIGH TO LOW SIGNAL
INFORM LCD THAT WE HAVE
PLACED OUR DATA ON
DATA PINSAND ACCEPT IT.
LOGIC TABLE
LOGIC RS232 TTL
1 Forward 1 0 1 0 1 1
2 Backward 0 1 1 1 0 1
3 Right 1 0 1 1 0 1
4 Left 0 1 1 0 1 1
5 stop 0 0 0 0 0 0
Setting SCON and TMOD registers
SCON register
TMOD register
9600 -3 FD
4800 -6 FA
2400 -12 F4
1200 -24 E8
In our project we decided to use the serial
mode 1 at baud rate of 9600.For serial
communication we need to program the
timer1 in mode Auto reload mode i.e. mode
2.
Thus we obtained the following value to be
loaded in SCON and TMOD register.
TMOD=’0010 0000’=0x20
SCON=’0101 0000’=0x50
TR=1
Development of MATLAB code
START
CAPTURE FRAME
[L no_of_connected_objects]= bwlabel(imgray,8);
area_of_largest_object=0;
[L no_of_connected_objects]= bwlabel(imgray,8);
area_of_largest_object=0
X=0
Y=0;
if(no_of_connected_objects~=0
STATS = regionprops(L,'Area');
for i = 1:no_of_connected_objects
if STATS(i).Area > area_of_largest_object;
index_of_largest_object=i;
area_of_largest_object=STATS(i).Area;
end
end
imgray=(L==index_of_largest_object);
[r c] = find(L==index_of_largest_object
X=round(mean(r))
Y=round(mean(c))
Sending command serially
Direction Data send
serially
Forward 1
Right 3
Left 4
Stop 5
ser= serial('COM3','BaudRate',9600,'DataBits',8);
fopen(ser);
fwrite(ser,1,'async');
APPLICATIONS
Industrial robots
Using Robotic arm and modification as per the industrial
requirement and specification it can made most useful for various
operations like pick and place, loading-unloading etc.It can be
used for conveyer tracking.
Various military applications
In military application field, for some unfeasible circumstances
where need of robot or robot based application can be substituted
for humans.
Medical application
It can be used for calculation of RBC’s in blood testing
Miscellaneous
For shape identification, error and abnormality detection
CONCLUSIONS
Processing speed augments if we increase the size of the
capturing image frame.
Our robot is subjective to environmental conditions, plus
limitation over power supply
It is wired due to which it has limited range of mobility.
It is highly dependent on the processing power of the
computer
Also dependent on the resolution of the camera used.
Future Scope
It can be made wireless, hence increasing the mobility
range and maneuvered with the help of wireless media
such as RF module, Bluetooth etc.
In built system for video analysis
Robotic arm can be added in the hardware thus increasing
the overall system performance and efficiency
Shape identification can also be included.
Processing can be done without computer
REFERENCES
• Muhammad Ali Mazidi, Janice Gillispie Mazidi,8051
Microcontroller and Embedded Systems, Prentice-Hall.
• The documentation and demos provided in the Help section
of MATLAB
• http://www.mathworks.com/MATLABcentral/fileexchange/
• http://www.embedautomation.com/content/i-see-video-
geometric-shape-detection-using-image-processing-
MATLAB
• Chapman, Stephen J., MATLAB Programming for Engineers,
Brooks Cole, 2001.
• http://blogs.mathworks.com/videos/2010/12/10/how-to-
save-and-restore-state-of-a-gui-in-MATLAB/
• http://blinkdagger.com/MATLAB/MATLAB-gui-graphical-
user-interface-tutorial-for-beginners/
• http://blinkdagger.com/MATLAB/how-long-does-it-take-
to-run-your-code/