Hello everyone, I need some help
I have 5 RGB LEDs and I want to control them with my arduino board, but I don't want to use 16 pins of it.
Can I use 4 insteed ?
It doesn't matter if they have the same color.
I Just want to power them
Hi and welcome.
5 RBG leds would need 3 x 5 = 15 pins. Why do you think 16?
If all 5 are to display the same colour, 3 outputs are needed. Why do you think 4?
But, to run 5 leds using only 3 pins, you can possibly damage your arduino by sourcing/sinking too much current from the outputs. Each output can source or sink up to 40mA, but this should be kept to around 25mA in practice.
To avoid this damage, you can do 2 things:
-
if it is OK that the leds are not very bright, you can share the 25mA between the 5 leds, so each receives 5mA. This may be bright enough.
-
if you need more brightness, you can use 3 transistors to boost the 25mA limit up to the maximum that the leds can handle.
So, do you have a link to the data sheet for these leds? You need to know the forward voltage for the red, green and blue components, the maximum continuous current and whether they are common anode or common cathode.
Paul
Thank you for your help.
Ok, I thought 16 an 4 because don't they have a GND connection?
This is the same LED
How should I plug the transistor?
"
You need to know the forward voltage for the red, green and blue components, the maximum continuous current and whether they are common anode or common cathode.
"
Never heard about those things, do I have to care a lot about this?
Nairod785:
Ok, I thought 16 an 4 because don't they have a GND connection?
Yes, but they can share the same ground connection. And GND is not really an Arduino output, does not use up one of the Arduino's digital pins.
Nairod785:
Never heard about those things, do I have to care a lot about this?
Yes you do have to care. But all the figures are given on the data sheet link you just posted. The leds are common cathode, the max current is 20mA each for R, G & B, and the forward voltages are 2.0V for R and 3.2V for B and G (those are the typical values). You need those figures to work out what series resistors to use. For the red, use a series resistor of (5.0 - 2.0)/0.020 = 150R. For the blue & green use (5.0 - 3.2) / 0.020 = 100R (actually 90R but 100R is the nearest common value).
Nairod785:
How should I plug the transistor?
See diagram below.