Author Options:

How to create an Usb controlled rgb light that changes colour depending on input from pc? Answered

Im trying to create an led array of 30 leds (10 red, 10 green, 10 blue) that recieve an input from the computer and light up accordingly. E.g. 10 Red, 0 Green, 10 blue to make purple I've found several projects that will light up the leds when the usb is plugged in but id like to control which leds are lit. Is anyone able to draw an circuit diagram for me or suggest anything to help me make this project as i can probably program something to send the output from the computer but its the wiring of the controller etc that im not so good at figuring out.


Alternatively, if you want lower-level digital hardware hacking, you could use a USB-to-parallel-port or USB-to-serial-port adapter, feed that into an appropriate set of latch or shift register chips, then take the output of those to control the LEDs. Microcontrollers are good swiss army knives, but sometimes it's worth thinking about a do-only-one-thing screwdriver.

well, I've gotten most of it working now. I've coded an arduino to accept an hex code and translate this back into the color codes for the leds using the pwm connectors to switch the brightness. I've also got an wmp visualization that generates the colors for me based on the frequency range of the playing song. Just need to figure out how to generate an hex code from an colorref in VC++ and then send it down the serial port. Thinking that i might be able to use the Visualization property page to configure which com port to use. If anyone that reads this is any good at VC++ programming i'd really welcome the help as its been 5 years since i did any c++, nevermind using visual studio's implementation of it.

Could you post your code, or make an instructable?  I am trying to do something similar, and I'm sure others would benefit as well! Thanks!

A standard arduino has 3 analogue pwm outputs and can make 8 bit colour changes in each colour channel (256 colours each)... It communicates with a computer via serial over built in usb chip - then you can write programs on the computer to tell it what to do. The arduino itself would need an led driver to have enough power for bigger leds - a few transistors would do the trick.

After an bit of searching ive come up with an video of someone that has done almost exactly what i want to do after frollard's suggestion.


He has written his own program to control it via an colour wheel on the pc and outputs via usb to serial chip.

After an bit of thought i came up with "why not use an xbee rfid module and make it wireless aswell"

I've been looking at some diagrams and it should be possible to communicate it as the arduino has an daughter board for the xbee which would translate the data to serial.
Then as frollard says i could use the pwm outputs to control the leds.

Dont suppose anyone would be willing to work out an wiring diagram from the above video for me so that i can work out an prototype board?
And of course once tested ill put an instructable up crediting them so that others can make one.

Great job searching and getting lots of info - the arduino.cc website has a TONNE of learner scripts to teach you how to turn an led on, and off...with code examples for everything. It just gets more exciting from there what you can do :D

Hi all,
Just more of an update really...... It Lives!
I have an arduino controlled RGB light and have coded an wmp visualization to send colour codes via an Com port.

However, I cant seem to get the below line in VC++ 2008 to take the com port as an variable, Or get the properties box for the visualization to save the Entered Com port text. e.g. "COM5" Help!?

m_hCommPort = CreateFile("COM5",GENERIC_WRITE,

This is old enough it might warrant a new question - noone will be notified that you made the update.