Pages: [1] 2   Go Down
Author Topic: How to connect Arduino Uno to 25 rgb leds?  (Read 2534 times)
0 Members and 1 Guest are viewing this topic.
Ticino (Switzerland)
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, i'm a newby with Arduino and i have a technical problem: i need to connect an Arduino Uno to 25 rgb leds but i don't know how.
I've read that should use a 3 - 8 decoder (is it right?), but if a single rgb led need 4 pins to work, how can i connect the other 24 in 11 pins?
And how can i change the color of a single rgb led?

Thank you everybody! And sorry for my bad english smiley
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 631
Posts: 50166
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need multiplexers. There are a number of ways to control multiple LEDs described on the Playground, under Output.

Quote
but if a single rgb led need 4 pins to work, how can i connect the other 24 in 11 pins?
One of those pins is ground, so you really only need three per LED. All the LEDs are connected to the same ground.

Quote
And how can i change the color of a single rgb led?
Paint?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are many ways to do this.
Here is an example of 8 RGB LEDs. You may be able to expand on the LED numbers.

http://www.elcojacobs.com/using-shiftpwm-to-control-rgb-leds-with-arduino/
Logged

Ticino (Switzerland)
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you all for the answers! You were very fast smiley
I saw that i can use some multiplexers (PaulS) or a shift register (lightUp). Which one is the best solution? And how many multiplexers or shift register i need to light the 25 rgb leds?
Thank you so much! I hope my questions aren't so stupid! smiley-wink
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

25 RGB LEDs will have either:
25 anodes and 75 cathodes to control
or
25 cathodes and 75 anodes to control.

Which kind of LED do you have? That impacts how it can be done.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ShiftPWM can work with Common Anode or Common Cathode LEDS and you'd need 10 x 8 bit shift registers to do 25 RGB LEDs.

It'll involve a lot of resistors though.

Alternatively you can use ShiftPWM with constant current LED drivers, which means you don't need a resistor one every led output.

LED drivers are usually current sinking though, so you'd have to use Common Anode LEDs.
Logged

Pottstown, PA
Offline Offline
Sr. Member
****
Karma: 5
Posts: 323
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The TLC5940 may be a good device to use for this job. About $2.50 per piece on ebay from a US seller offering free shipping. - Scotty
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34518
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Alternatively you can use ShiftPWM with constant current LED drivers, which means you don't need a resistor one every led output.
No you need a constant current drive at each LED output. If you think resistors are expensive at $0.01 to $0.001 I am not sure where you will find a constant current drive cheaper.
There are lots of solutions to this. The TLC5940 will give you 16 outputs so for 25 RGB LEDs you need (25 * 3) / 16 = 5 chips.
The TLC5947 gives you 24 outputs so you only need 4 chips and they are easier to drive.
The humble shift register gives 8 outputs so you need 10 of them for your project.
The PCA9685 is the easiest to drive as it is an I2C device again 16 outputs per chip so 5 chips but you need a resistor on each colour with this and a common anode RGB LED.
Logged

Ticino (Switzerland)
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you again for the answers!
So, i think i will use common anode rgb led.
I'm looking for the TLC5940 and others but i can't find them in my store. I only found the Shift Register 8-Bit (74HC595) and the Shift Register 8-Bit High-Power (TPIC6B595).
I'm reading this article http://www.elcojacobs.com/using-shiftpwm-to-control-rgb-leds-with-arduino/
If i use 10x 74HC595 i will need (per every rgb led): 1x 150ohm resistor (red) and 2x 100ohm resistor (green and red). Is it right?
I also read that with many shift register, my project could become slow (?)

I will post the schematic that i'm trying to make for my project smiley-wink

Thanks everybody! You are great!
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Alternatively you can use ShiftPWM with constant current LED drivers, which means you don't need a resistor one every led output.
No you need a constant current drive at each LED output. If you think resistors are expensive at $0.01 to $0.001 I am not sure where you will find a constant current drive cheaper.
I don't believe I made any reference or implication that it would be a cheaper way of doing it did I? Not sure why you felt the need to pick that up and imply that I was trying to say something that I wasn't.

No-one uses constant current drivers because it's cheaper than using an alternative, like SR, with resistors. It's done because it's more convenient than soldering bucket loads of resistors, and it's a more consistent way to drive them.

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34518
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1x 150ohm resistor (red) and 2x 100ohm resistor (green and red). Is it right?
You mean
(green and red blue).

Yes it sounds typical of the resistors you need for about 20mA per LED. I am making a project at the moment that uses some and I have settled on 91R for the green and blue instead of 100R but it sounds fine.

Quote
I also read that with many shift register, my project could become slow
It depends on what you need to do. As you haven't said what your project is it is hard to say. However, altering the brightness using shift registers is CPU intensive.
Logged

Ticino (Switzerland)
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you smiley-wink My project is a 25 rgb leds single color changer with a random function.
I tried to build a scheme (based on this http://www.elcojacobs.com/wp-content/uploads/2012/08/shiftpwm_74hc595_RGB.png). Practically the 74HC595 shift works with a "data" connection (in 1st pin, out last pin), but in the code how can i control the single led?
I attached the scheme i build (only two shifts), but i think the "shift" has less pin that it should have.

Thank you for the big help!


* Untitled Sketch 3_schem.jpg (1080.75 KB, 3288x2559 - viewed 102 times.)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not take a look at WS2803?
Each can drive 6 RGB LEDs, and they are designed to be daisychained.

http://www.ebay.com/itm/5x-Worldsemi-WS2803SO-18-Channel-RGB-Constant-Current-LED-Driver-SOP-WS2803-PWM-/150721605686?pt=LH_DefaultDomain_0&hash=item2317b53036

* WS2803.pdf (436.67 KB - downloaded 29 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I too am seeking to graduate from controlling several single color LED's to controlling
more than 16 RGB LED's using TLC5940's. But i'm now realizing, the 74HC595 appears to be an interesting choice as well.

Thanks all!

many options, more studying to do.
Logged

Arduino...addicted

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

"more than 16 RGB LEDs" implies more than 48 LED pins to control, unique anodes/cathode, and 16 common cathodes/common anodes.
HC595 has 8 pins.
Are you planning on 6+ 595s, or some  kind of multiplexing scheme?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1] 2   Go Up
Jump to: