Using an RGB LED to Detect Colours by fjordcarver
Contest WinnerFeatured

Step 6: Verify Colours With Processing

At this point you should have Red, Green and Blue values coming up on your screen via the Arduino serial monitor. Entering these values by hand in is tedious and slow.

Sure it proves the point, but we really need a better way to play with this don`t we.

Have no fear, I have included a small Processing sketch to get you started.

Copy and paste the code in the included text file into a new sketch in Processing. Save it as whatever you like, start up your Arduino, being sure that the Serial Monitor in the Arduino environment is no longer running, and enjoy the color changing light show.

The sketch doesn't do much, it just updates the background with the colour being sent out from the sensor. Make sure that you set the com Port correctly.

In the pictures, you can see me scanning each side of a four coloured juggling ball, and the output on the screen. 

I hope that this Instructable has proved interesting to you. If you want to have a look at one of the ways I have used this type of sensor, check out my Magical Chameleon Lamp Instructable.

Support a fellow maker, vote for me often. Share and enjoy.
 
Remove these adsRemove these ads by Signing Up
shooper3 says: Aug 2, 2012. 2:58 PM
My son is color blind. Often times he'll ask us what color something is. Could this help with that. Is it able to detect colors that are not real brigh, such as in clothing?
_SarahC_ says: Apr 25, 2012. 6:29 AM
This is excellent!

Have you seen any problems with the red color - due to the spike in sensitivity that the LDR has?
fjordcarver (author) says: Apr 25, 2012. 7:35 AM
Not so much, balancing against the white and black is important. Basically you are subtracting the reflection recieved from the black (theoretically 'no reflection') before deciding what colour you are seeing. each colour is flashed seperate and has its own balancing value. This does a fairly decent job at correction.
If you are having difficulty with a certain range, you can 'trick' it to perform better by changing your black balance. Might have been a good idea to add a pot for fine tuning without rescanning. Thanks for the compliment. Not much to it, throw one together and play. Cheers.
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!