File Exchange

image thumbnail

Color Follower Robot

version 1.2 (2.77 KB) by

Code detects the red object in the image captured by webcam and communicates with micro-controller

9 Ratings



View License

I had written this code for my mechatronics course project: Color Following Robot/Image Processing Robot. It follows object of any particular color (red in this case).
1) The robot (RC car) has a webcam mounted on top of it which captures images continuously. (Image Acquisition Toolbox)
2) Image processing toolbox helps to process these images to detect red pixels in the image. It finds area and centroid position of red object.
3) External Interfaces feature helps to set up a serial port object which send appropriate output to the microcontroller (PIC16F690 in this case) which controls RC servo & DC motor.
4) C code for PIC microcontroller available upon the request.
5) This code can be helpful to people who want to use image processing/ serial port communication for their projects.


Comments and Ratings (15)

bharath N

hi i'am working on the same project so please send the matlab code for it

yasin arafat

I'm interested in implement this project.Plz give me its C code and Ckt .... its will be helpful for me to make this project
here is my E-mail address



I saw your color follower robot file and its great. I am working on a similar project to detect red coloured balls and track them. I am confused by one part of your code. Say when you give the output to the microcontroller you are sometimes sending the small alphabets.There you have commented that say"Turn left with DC motor off". My question is how will the robot turn if the DC motor is off. And please send the microcontroller code if you can.
Thank you

Uday Sharma

please send me ckt desing and other details of this project


bayan (view profile)

Awesome ,
Can you please send me the C code for the project ?!


hi,interesting project...would u mind sending your project C code to

tq for sharing.

its really nice tejas sir
i m working on a robot for home automation so i want to study the project thoroughly if u dont mind..
plz sent me the code for micro.
if else if u have any supplementary document plz knowledge worth sharing


Yiu (view profile)

I am also interested in the C code for the microprocessor. Would you mind send to Thanks for sharing!

aditya gosain

Can you please send C code for microcontroller to

Thanks in advance


JAIRO (view profile)

thank you so much, I will prove it

Yogesh Patil

Can u please send me the C code for PIC microcontroller in your Colour following robot project to u.

Yogesh Patil



Added an image (flowchart), file remains same.



MATLAB Release
MATLAB 7 (R14)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video