Author Options:

Controling 10 RGB LEDS with an arduino. Answered

I had an idea to build a mood light colum of 10 rgb leds. I have established that each rgb led needs 3 digital pins on the arduino.
one program I would like it to do would be to respond to sounds around it. I have this one covered programming wise but i am struggling to work out how to program the mood light settign where each led scrolls through the colour spectrum.
Any ideas?
thanks, Joe, 16, England


Senator Penguin

7 years ago

Controlling 10 RGB LEDs independently using 3 pins for each would require 30 digital pins, which is a bit much for your average Arduino. You can reduce the number of pins you need by "charlieplexing" http://en.wikipedia.org/wiki/Charlieplexing

As far as scrolling through the color spectrum (for just one LED), you need a way to control brightness. The best way to do that is using PWM (pulse width modulation). For example, for 50% brightness, you turn on the LED, wait 50 microseconds, turn it off, wait 50 microseconds, repeat. For 25% brightness, you do turn it on for 25 microseconds, and off for 75 microseconds. I think Arduino has an "analog write" command that does this for you

To scroll through the colors, slowly increase the brightness on one color, and slowly decrease the brightness on another. Rotate between all three (R, G, B) and you can display the whole spectrum.


7 years ago

10 independent colour changing LED ?