Thursday, October 7, 2010

Controlling an RGB Led with Arduino and Processing

introControlling an RGB Led with Arduino and Processing

This instructable (my first no less) shows how to control an RGB led using processing and arduino.

The key feature being the colour is selected by clicking on an image, the RGB value of the pixel you click on is processed and sent to the audrino which then outputs that same value.

Obviously the match isn't perfect especially at darker colours as I'm yet to see any LED do black very well, but the project should hopefully provide some insight to those of you starting with arduino and other microcontrollers.

Feel free to ask any questions in the comments and I'll answer them as best i can.

Also as i am new to instructable publishing let me know any improvements i could make on this or future instructables.

Video below shows the final result: (if it wont play right click and go to watch in youtube)
DSC_6858.jpgDSC_6882.jpgDSC_6878.jpgDSC_6881.jpg

step 1What You Need

Hardware:
Arduino or similar
1 x RGB led (Dispersed, i used some super fine sand paper as the one i had was water clear)
4 x Connection Wires
1 x Breadboard

3 x Resistors if you plan to leave this on for extended periods.

use this tool to calculate resistors specific to your LED led.linear1.org/led.wiz

Software:
Arduino
Processing

(This can be done in other software packages but this instructable is to get people started with arduino)
What You Need

step 2Setting Up the Hardware

Refer to the images below for how the equipment is set up.

Note: My RGB Led is common cathode, if yours is common anode the second pin should be connected to a voltage supply not ground.


Setting Up the Hardware

step 3Software

So whats going on. basically we've set the arduino up to respond to a particular message. this message consists of a header (the letter "C") a dud byte (some strange serial problems caused this to be implemented) and the bytes of data (R G B respectively)

All processing is doing is generating these messages based on a pixel in an image, when we click the mose location is recorded and the message is built and sent to the audrino over a serial connection.



See the attached files for the software for this project, hitting run in processing should bring up a screen like the one below, although it will depend on what image you choose to load.

ColourMap goes in processing

RGB_LED_arduino_code goes in (you guessed it) arduino.

Make sure you load this onto the arduino before you run the processing file or it wont do anything.

if you having trouble check the following:

Is the arduino plugged in
is the arduino power light on
have you wired the led correctly
have you chosen the correct serial port in processing

if your still having trouble post a comment below and I'll do my best to answer it.
Screen shot 2010-02-11 at 10.06.50 PM.jpgRGBR.png
colourMap.pde719 bytes

step 4Enjoy

Enjoy your new RGB Led. To extend this you could:

-add more leds
-add xBees
-Add some nice fading effects between colours

the options are limitless.

hopefully this has helped some people to understand arduino and processing a little better.
DSC_6882.jpgDSC_6878.jpgDSC_6881.jpg
Related Posts Plugin for WordPress, Blogger...
Disclaimer: All the information in this blog is just gathered from different sites in the web and placed here and I am not the owner for these content

Popular Projects

Followers

My Blog List

Give Support

Give Support
Encourage me Through Comments & by Following