Is there a max mA for LEDs on the Arduino UNO?

Is there a max mA for LEDs on the Arduino UNO? Someone told me that there was a max that can be hooked up to the board.

I want to hookup 13 LEDs that run 24mA each. I read that its 300, 250, and also 200 on different sites. What should I do? Use resistors to limit the voltage it gets? Or am I fine how I am now.

PS: Whats the input voltage the USB port gives? 5V?

Oh yeah. Another question (Sorry! 3 total. Halloweens tomorrow!)

Whats the difference between the Analog and Digital Pins? There's three different types in total, right? PWM pins, which can fade/dim LEDs, the regular digital pins, and analog pins. Does one type (besides the PWM which has a lot of features), provide any benefits over the other?

Is there a max mA for LEDs on the Arduino UNO?

Yes.

I want to hookup 13 LEDs that run 24mA each.

13 * 24 = 312 mA

I read that its 300, 250, and also 200 on different sites. What should I do?

Stay away from those other sites.

The absolute maximum current for the processor is 200 mA. There are various other per-pin and per-port limits.

Use resistors to limit the voltage [u]current[/u] it gets?

Yes.

Or am I fine how I am now.

You are fine in the sense that you won't catch anything on fire. Your processor, on the other hand, will be damaged.

PS: Whats the input voltage the USB port gives? 5V?

5 volts at 500 mA [u]maximum[/u] per port.

The datahsheet is where you will find the important details... http://www.google.com/search?q=atmega328+datasheet

Thanks Coding Badly!

This may sound stupid, but when I calculate the resistance for the LEDs, (I change 24 mA to 14mA 14 LEDsx14mA=196mA<200mA), the resistor it tells me to use does not change.

It says I need to usea 1 ohm resistor for 24mA, and a 1 ohm resistor for 14mA. Is that correct? (2 LEDs hooked to one pin). I dont want to hurt the processor by making it use the full 24mA like you said.

(6V input, 3v LED, 24 mA (changed to 14 mA, 14 LEDs total).

Website I use to calculate: http://led.linear1.org/led.wiz

Thanks Coding Badly!

You are welcome!

I change 24 mA to 14mA 14 LEDsx14mA=196mA<200mA

Bear in mind that 200mA is the absolute maximum for the PROCESSOR; not just the things connected to it. That means you need to account for the current the processor itself uses (about 30 mA).

http://led.linear1.org/led.wiz

You're constructing an LED array?

6V input

Anything above 5.5V on a pin is going to damage the processor.

At this point, you need to provide more detail than "hookup 13 LEDs"

Sorry for not providing enough details. I'm making a halloween costume of an arc reactor (from iron man).

It should look something like this when its done: http://fc09.deviantart.net/fs71/i/2010/120/c/d/W_I_P_Mini_arc_reactor_II_by_gunblade84.jpg

I'm waiting for the chrome paint to dry right now, and im planning out my circuit.

From the picture above, the clear parts will have an LED behind it (blue led, 24 mA, 3V, 8000mcd to be exact). I bought my first Arduino UNO and wanted to use it to make my LEDs (10 LEDs in the center making a ring), fade on, and 3 LEDs in the very center. I wanted to be able to use a button I bought to switch modes (One mode dim, one mode bright, one mode pulses, and one mode makes a train of lights).

I have a 4 AA battery pack that should supply 6V (1.5+1.5+1.5+1.5), and I bought a vaiety pack of resistors from Radio Shack as well as a Bread board.

What I thought: Battery->Arduino->Resistor->Breadboard->LED->Ground.

My main problem now is calculating which resistors to use (the wizard tells me the same resistor no matter what mA I put for the LED) and where to put the LEDs (1 LED per resitor, or 2 LED per resistor!! so I can use the 6 PWM (12 LEDs total) (so that it can fade and do the cool stuff).

Should I draw a diagram to help show what I want to do or is that good enough? Im willing to provide whatever necessary to make my Halloween project successful!!

Thanks again! I have a good feeling about this! :D The Resin Parts look pretty cool :P

does that help give a better picture?

scratch the train of lights part. I'll probably do a fake heart beat pulse or something. The train isnt very iron man like.

Thanks coding!

From the picture above, the clear parts will have an LED behind it (blue led, 24 mA, 3V, 8000mcd to be exact).

24 mA is the maximum current. 3 V is the "forward voltage". 8000 mcd is the amount of light the thing produces with 24 mA flowing.

I'll pick an LED resistor calculator at random... http://www.hebeiltd.com.cn/?p=zz.led.resistor.calculator

An Arduino runs on 5 V so this is the "supply voltage". The "voltage drop" (forward voltage) is 3 V. 24 mA is "desired LED current" (maximum current) for the LED. Put those three values into the calculator. The exact resistance is 83.333 ohms; the nearest standard resistor size is 100 ohms so we use that. The actual current is (5 V - 3 V) / 100 ohms = 20 mA. We might get away with driving 8 LEDs.

I suggest trying this setup ... A single LED connected to a 100 ohm resistor connected to an Arduino pin. Get it to blink.

Move to the next calculator on that website: "LEDs in Series". Enter the same information: 5, 3, 24. When you calculate, an error is displayed. This is because you need at least 6V to operate 2 * 3 V LEDs wired in series. You will only be able to have one LED per pin unless you add a bigger power supply (> 6 V) and use a transistor to switch the LEDs.

At this point, you will either have to add more parts to your circuit or plan to have one LED per pin.

I have a 4 AA battery pack that should supply 6V (1.5+1.5+1.5+1.5)

I don't think an Arduino runs reliable at 6 V. I think the minimum is 7 V. Someone with more knowledge than I will have to give you a definitive answer.

Thanks again! I have a good feeling about this! The Resin Parts look pretty cool

Excellent!

does that help give a better picture?

Yes.

what could technically happen if I hooked up 2 LEDs with a 100 ohm resistor on each PWM pin. (12 Total LEDs fill up the 6 PWM pins).

And I hook my 6V battery source into the 5V pin and the ground?

I accidentally hooked up 2 leds to pin 9 with a 100 ohm resistor, and the 6V battery source in and it seemed to work fine (This was before I asked here).

what could technically happen if I hooked up 2 LEDs with a 100 ohm resistor on each PWM pin. (12 Total LEDs fill up the 6 PWM pins).

As far as I know, you will not damage anything. In the worst case, the LEDs will not light.

And I hook my 6V battery source into the 5V pin and the ground?

The worst case is that 5 V won't be available to the processor and it will not run. But, as far as I know, you will not damage anything.

I accidentally hooked up 2 leds to pin 9 with a 100 ohm resistor, and the 6V battery source in and it seemed to work fine (This was before I asked here).

In which case, you should be able to proceed with your orignal plan bearing in mind that the processor may act flaky (in which case you'll need more batteries) or a pair of LEDs may not light (in which case you'll have to go with one per pin or try different combinations).

To start with, calculate the current limiting resistor based on having only one LED per pin at 10 mA per pin. If this works and the LEDs are bright enough, go with that setup. If you can, measure the actual current flowing through the LED pair. This will give you an idea of how much smaller the resistance can be without causing damage.

awesome! yeah, that gives me a better idea of what to do now. I'm going to start on that now. Seems like 10 mA is still plenty bright.

Question: I was testing a 6 LED circuit using both the 5V USB and the 6V batteries, and I came across a problem. Do you know why by any chance? Here's what happened.

I'm making a 'heart beat' using analogwrites with 2 pins (4 leds, 2 led per pin). When I add a third pin to the heart beat program (5 or 6 LEDs), the LEDs start blinking rapidly instead of 'beating'. I found this program on another thread. AGain, it works fine for 2 pins, but the third pin messes it up.

Here's my program: (Uses arrays)

//Heartbeat LED
//elCalvoMike 12-6-2008
#define LED  9 //analog pin location for ArduinoMini - change for other boards
int i = 0;
//int leds[]={9,10,11}; //DOESNT WORK WHEN THE THIRD LED IS ADDED. BLINKS ALL LEDS REAL FAST INSTEAD OF HEART BEATING
int leds[]={10,11}; //WORKS FINE WITH TWO LEDS
int pmw = 255;  //set PWM max - this can differ for other board pins
int rate = 24;  //this is the beats per minute (60000 ms)
               //because there are two beats to simulate the 'lub-dub' of the heart,
               // a 60 beat heart rate is only a value of 30 in the rate variable
               //the delay is the key to this programs realism - divide the rate into a minute, then weight it and divide by the pmw
               //you can modify the weight by changing the fractions (i.e .1, .2, .6) but to keep the timing correct, they should total 1
               //.1+.2+.1+.6 = 1

void setup() {
 pinMode(9, OUTPUT);
 pinMode(10, OUTPUT);
 pinMode(11, OUTPUT);
 pinMode(12, OUTPUT);

}

void loop(){




//Beat
 for(i = 0; i < pmw; i++) 
 {
 for (int l=0;l 0; i--)
 {
  for (int l=0;l 0; i--)
 {
  for (int l=0;l
int leds[]={10,11}; //WORKS FINE WITH TWO LEDS
...
 for (int l=0;l

sizeof(leds) == 2 elements * 2 bytes per element = 4. You only have two elements in the array. Try making leds a byte instead of an int.

I won't be back online until late tomorrow night. If you hit a snag, someone else will have to help. Good luck with your project!

haha, wow. coding error.

thanks Coding! I appreciate all your help! Really! good night!

Quote: And I hook my 6V battery source into the 5V pin and the ground?

The worst case is that 5 V won't be available to the processor and it will not run. But, as far as I know, you will not damage anything.

6V into 5V pin is a very bad idea.

The maximum rated voltage for VCC on the ATmega chip is 5.5v, other components are similar. Any more than that and you risk burning up your processor.

I don't think an Arduino runs reliable at 6 V. I think the minimum is 7 V. Someone with more knowledge than I will have to give you a definitive answer.

The minimum for putting through the regulator is roughly 7v. You get a drop of 0.7v through the polarity protection diode and the regulator then requires 6v ish to work properly. 6v would mean the regulator would not give 5v and then the ATmega chip might not run too reliably. It will probably run fine most of the time but some things might be out and there are limits as to what will work.

Mowcius

Yikes okay. Do you mean a bad idea for that specific pin? Or bad idea for Voltage going into the board in general.

Should I have ran it through the VIN pin instead of the 5V pin? The VIN pin says it supports (6v-20v limit), so im thinking thats it. I just tested it and it still works :P

Yeah through the Vin pin. The Vin pin should work at 6v becuase I don't think it goes through the polarity protection diode. For flashing LEDs you should be fine if the voltage is a little low anyway.

More than 5v (5.5v max) into any pin except Vin is asking for trouble... ;)

Mowcius

I have a minute before we go to agility...

Yikes! When you said you were connecting 6 V to the board I thought you meant to VIN.

DO NOT connect 6 V directly to a pin. 5 V ONLY!

You CAN connect 6 V to VIN and then use the REGULATED 5 V to drive the LEDs. There is a maximum amount of current the regulator can provide. I don't know what that is but do not exceed it.

There is a maximum amount of current the regulator can provide

Well it used to be 400mA but I'm not sure on the Uno.

Mowcius