Color Detection Using RGB LED by Kyri
Color_detector.jpg
Have you ever wanted an automated way to detect the color of an object? By shining light of a certain color on the object and looking at how much light is reflected back, you can tell what color the object is. For example, if you shine a red light on a red object, that light will be reflected back. If you shine a blue light on a red object, the object will absorb some of that light and less of it will be reflected back.



 
Remove these adsRemove these ads by Signing Up

Step 1: Parts Needed

G16706B.jpg
I used a PIC 16F887 Microcontroller, but almost any with a pulse-width-modulation capability will work.

1 RGB LED
1 Microcontroller
1 Standard red LED
1 1k ohm resistor
1 Photoresistor (changes resistance depending on the amount of light shone on it)
Some wires

I only need the microcontroller and RGB LED to have a wide range of color detectors, but if you only want a circuit that detects one color, you don't need a microcontroller - you only need a bright LED of the color you want to detect. The standard red LED is the "indicator LED" - it lights up when the right color is detected.
mtaqmilly says: Mar 17, 2013. 10:21 PM
Can i have your full scheme for color detection...
My email mtaqmilly@gmail.com
aimamo says: Aug 9, 2012. 12:25 AM
awsome!
Can i have your full scheme for color detection...
My email : dbestworld90@gmail.com.
thank you..
macxfady says: Jun 25, 2012. 1:58 AM

Thks for the info..recently im doing the colour detection circuit
plz send me a schematic diagrams of full project.
my email: macxfady@gmail.com
thank you
ongjq says: Feb 10, 2012. 7:52 AM
Thks for the info..recently im doing the colour detection circuit..can i have a copy of your schematic diagrams..this is my mail: ongjiaqing@hotmail.com..thks a lot..
naveenraikar says: Feb 26, 2011. 5:10 AM
Plz send me full scheme for color detection...
My email id is: sraikar_naveen@yahoo.com
setu says: Jan 10, 2011. 11:53 PM
its great...but u have to change every time the led light to sense the color ...actually i want to design a color sensor for my project which can sense RGB colors continuously without any need of changing led light every time...if there is a way plz tell me....my id : sunlitesetu@gmail.com
vojkann says: Nov 15, 2010. 9:04 AM
hi.... can you send me full scheme for color detection.. :D
It would be good if you send it to me... :D
here is my email: vojkann@gmail.com
qz9090 says: Aug 12, 2010. 4:01 PM
This is a pretty COOL Instructable and I would like to do the something similar with a project of mine but I am a little confused. 1) Can you provide some more technical details, for example, part numbers and sources to get the parts? 2) Also, you said the RBG LED is powered by an external PWM signal, but in your schematic, it looks like it is connected to a 5V power supply. Thanks.
jsnng00 says: Feb 5, 2010. 11:38 PM
Hi there? can u send me 1

Color Detection Using RGB LED diagram for me?

i need for my study.. grateful 
jun_sheng00@hotmail.com
mattthegamer463 says: May 21, 2009. 6:15 AM
Do you think you could do this with a white LED and 3 photoresistors, one with a red filter, one green filter and one blue filter? Then you could tell if something was say, yellow, because the indicator LEDs on the green and red photoresistors would trigger, or something purple, because the blue and red indicators would trigger, etc. Thoughts?
Arx says: Jun 20, 2009. 5:15 PM
that would work, but the output of white leds isn't that linear. It might be easier to just cycle through the lighting colours quickly, and figure it out from there.
solidacid says: May 22, 2009. 10:43 AM
I think i would work better if you used different colored LEDs and just 1 photoresistor instead, it seems more reliable then using filters.
jamwaffles says: May 21, 2009. 8:40 AM
Possibly, but you need to reflect quite a lot of light off the object to make this work, but this project already requires that so yeah, a really bright white led and 3 filtered photoresistors would be gud hope i helped
draxos says: Jun 5, 2009. 8:06 PM
Very Nice Work Kyri.... Keep it up ..
Skater_j10 says: May 31, 2009. 1:57 PM
Great Idea! I to was wondering how to simplify color detection, and now all the hard work has been done already, a big thank you to Kyri. I will try to use this concept on my next bot!
dark sponge says: May 25, 2009. 7:32 PM
But if you hold up a shiny object, like a white lego or a mirror, wouldn't it say it found the color it was trying to detect?
praetorious says: May 20, 2009. 8:39 AM
Hey Nice work! I've done this before and have a few tips. You need to use a filter of some sort to remove IR radiation. I salvaged one from a camera. This will improve the detection. Also, I added white LEDs to illuminate the object so that the reflected light is then detected.
A guy over at a website called robotroom has done this. On my web page it's.
http://amitnv.solarbotics.net/Colour_Vision.htm
Still under construction and missing a few things...
Kyri (author) says: May 20, 2009. 9:54 AM
Oooh, cool, thanks for the tips! Nice site, I like how you put a lot of the theory behind why this works (I only understand it so-so, mostly I just built the circuit, tried it, and to my surprise it worked!)
praetorious says: May 22, 2009. 2:48 PM
Thank-you. I honestly like what you have come up with. It's simplicity is a very desirable aspect of the design.
praetorious says: May 20, 2009. 9:00 AM
Oh yeah, you can also use the RGB LED itself to detect the light instead of the photoresitor. LEDs have a spectral response which is the same as the frequency of light they emit
nf119 says: May 19, 2009. 9:07 PM
wow, when i was watching the video i was wondering if you were from cmu for some reason, then i looked at your page, go ece! lolz
jeff-o says: May 19, 2009. 8:36 PM
Awesome! I was wondering how this might be accomplished - now I know. Thanks!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!