Introduction: Controlling 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)
Step 1: What You Need
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
(This can be done in other software packages but this instructable is to get people started with arduino)
Step 2: Setting 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.
Step 3: Software
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.
Step 4: Enjoy
Enjoy your new RGB Led. To extend this you could:
-add more leds
-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.
2 People Made This Project!
We have a be nice policy.
Please be positive and constructive.