Arduino with multiple RGB LEDs

Hi, I am pretty knew into the Arduino world. My problem is trying to make multiple RGB leds (https://www.banggood.com/10pcs-5mm-RGB-LED-Common-Cathode-4-Pin-Tri-Color-Emitting-Diodes-F5-p-937475.html?p=DQ30066511122014069J&utm_campaign=educ8stv&utm_content=huangwenjie) work with the Arduino. Although it would be be easy enough to use a single RGB led, I want to use multiple RGB leds. My RGB led uses 3 digital pins with pwm but since i am using an arduino pro micro with 5 pwm pins, I can only use 1 led. I have found that the max current per pin is 40ma but shouldn't exceed 20ma so therefore you couldn't put 2 leds. So my question is, how would i power more than 1 RGB led? Any help will be appreciated. Thanks!

sort by: active | newest | oldest
Anshu AR1 month ago

Hi Isaac Emery,

If you are just concerned with the power consumption of LEDs you can use transistors or MOSFETs for powering your LEDs.

I've used transistors for controlling a bunch of LEDs and even motors lately and never had any issues.

You can use this guide to power your LEDs. Just add the LEDs instead of the motor in the schematics. Finally, use PWM pins to control brightness.

Hope that helps :)

Schematics.png

very well explained

Keep in mind the amount of heat that little TO-92 plastic transistor is going to have to reject in less space then your pinky finger nail... And then switch to a cooler MOSFET which can do a better job !

LEDrive5.jpg
Isaac Emery (author)  Anshu AR1 month ago

thanks. This really helped me. Just one more question, what is the max current for the 2N2222 transistor that you used in your motor project. Thanks!

Hi Isaac Emery,

The maximum current that a transistor can withstand can be found in the datasheet.

Now according to the datasheet of 2N2222, the transistor can safely provide a current of 500mA through the collector. (When a 500mA of current is passing through collector the DC current gain factor decreases to 40.) So, a current of 12.5mA is required at the base.(In your case this will be provided by the Arduino.)

Now, although datasheet mentions 500mA usage safe personally I would not use 500mA. So, consider safety gap and use about 400-450mA safely.