Computer Controlled RGB Led

5,865

18

6

Introduction: Computer Controlled RGB Led

Here are some photos of a project I've been working on. Its a RGB Led that can be controlled from my PC. In addition to being able to change its color, I am also able to make it blink at any rate I choose. I started this project a while back but stopped when I got stumped trying to devise a way to send a color over serial connection to my Arduino. I came back to the project after a time and found this article that explained a lot about serial communication. After working out how to send the color to the Arduino I wrote a program in C# so that I wouldn't have to open Serial Monitor and type in a bunch of numbers. All it does is let you select a color and sends it to the Arduino, which updates the LED. Shortly after I made that program, I thought how cool it would be to control the light from my phone! I immediately dived into an ASP.NET web app to do it. That way I could control the LED from a web browser on any computer (or smartphone!) on my home network. This turned out to be way more of an effort than it needed to be, as my inexperience led to all sorts of troubles, but with the help of a friend I was able to get it working. I am very pleased with the result.

If you would like to try this on your own here's how.
-Wire a common anode RGB LED to your arduino by connecting the anode to 3.3V, the red lead to pin 3, the green lead to pin 6, and the red lead to pin 5. Don't forget resistors.
-Open Serial Monitor and type in any of these commands:

0 - Turns the light off
1 - Turns the light on
3xxx/xxx/xxx/ - A three followed by three numbers, each with a slash "/" on the end changes the color of the LED. (Example. 30/255/0/ would turn the light green)
5xxxx/ - A five followed by a number with a slash "/" at the end causes the LED to blink. The interval between blinks is the number after the five (in milliseconds. 1000 = 1 sec).

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Participated in the
LED Contest with Elemental LED

110 15K
240 16K
124 12K

6 Discussions

Here's a .zip with the Visual Studio project. It is not very polished (I didn't originally plan to distribute it), and it assumes your arduino is on serial port COM4, so if that's not the case, you'll need to alter the code. Good luck!

Each of the LEDs colors (Red, Green, Blue) can be adjust between the values of 0 and 255 for 256 intensity levels. Thus, you effectively have 256 * 256 * 256 = 16,777,216 different colors.

The led has leads that control the intensity of the red, green, and blue light it shines. Almost any color can be produced by adjusting these three values.