Arduino Mega PWM LEDS: Resistors?


for a quick project I need to use these leds ( hooked up with the 12 PWM mega pins.

the leds are 20mA 3.2 Volt

the sketch will fade all the leds at the same time using various durations for each of them

What kind of resistors I need to use? Please I need to buy them tomorrow, let me know if you have any idea..

I tried without resistors and they all work fine, but the Mega chip is burning hot so I guess I need to do something different. I have no time to use IC chips at the moment..


resistor is calculated as follows:

(source voltage 5vdc - led Vf drop 3.2) / .02 amps = 90 ohms

I think 100 ohms should be the closest standard resistor size and would work fine.


So how many LEDs do you have? There is a current limit on the chip of 200mA. You defiantly have already damaged your arduino by not using resistors, I hope it continues to work for you.

I got lots, but I will use the correct number for each arduino if you could tell me exactly which resistors and how many of them..

My guess is 10 leds (200mA) with 90 ohm resistors if powered by 5volts

or 300 ohm resistors if powered by 9 volts adapter, right?

No powering them from an adaptor makes no difference, if directly connected to the arduino (through a resistor) the output voltage is always 5volts because it is the chip that is providing the power. I would use 220R resistors but if you want to push the current then 100R resistors would be right. As it is 200mA for each power pin you can have half of them being powered by sourcing the current and the other half by sinking the current. That way you can get twice as many LEDs powered.