Arduino Mega and driving LEDs, help please

I'm ordering a Arduino Mega 2560 Rev3 for a project I'm working on. I will be using it to power 18 LED for a visual indication of some type. I just don't know what resistors or cable I will be needing. Any feedback will or input will be greatly appreciated. Thanks in advance.

To connect the LEDs and limit the current from the output pins, you need to have series resistors. A value of 220 ohms or more should be ok.

Weedpharma

@Weedpharma Thanks for the input and does any type of wire will work as well or do I need anything specific?

Hi,
How are you aiming to connect the 18 LEDs?
What sort of configuration and what do you want to do with them.
The arduino will not probably be able to POWER the LEDs, but it can control them.
Each output of the arduino is not to exceed 40mA.

Tom… :slight_smile:
PS. You can go back and edit your topic, to " Arduino Mega and driving LEDs, help please"
this way you will get more forum members looking at your thread, the only reason I looked in was because of the one and only response you had.

Tom, you are right, I forgot the total current if many on together.

Weedpharma

For a Mega, the total current allowed is 800mA, 4 VCC pins at 200mA each. LEDs generally have a max continuous of 20mA, 18 x 20mA = 360mA. The LEDs would need to be spread across the ports per Notes 3 and 4 in 31.1 of the datasheet:

3. Although each I/O port can sink more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

ATmega640/1280/2560:
1.)The sum of all IOL, for ports J0-J7, A0-A7, G2 should not exceed 200mA.
2.)The sum of all IOL, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200mA.
3.)The sum of all IOL, for ports G3-G4, B0-B7, H0-B7 should not exceed 200mA.
4.)The sum of all IOL, for ports E0-E7, G5 should not exceed 100mA.
5.)The sum of all IOL, for ports F0-F7, K0-K7 should not exceed 100mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.

4. Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:

ATmega640/1280/2560:
1)The sum of all IOH, for ports J0-J7, G2, A0-A7 should not exceed 200mA.
2)The sum of all IOH, for ports C0-C7, G0-G1, D0-D7, L0-L7 should not exceed 200mA.
3)The sum of all IOH, for ports G3-G4, B0-B7, H0-H7 should not exceed 200mA.
4)The sum of all IOH, for ports E0-E7, G5 should not exceed 100mA.
5)The sum of all IOH, for ports F0-F7, K0-K7 should not exceed 100mA.
If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.

@TomGeorge @CrossRoads

Im connecting all 18 of them but will only going to fire one of the output for the LED at the time. Im fairly new with these Arduino but still doing some research on how im going to get them configure. Will I still need another type of power supply to power the LED or if im only powering one at a time will the Adruino be able to power the LED?

Use a higher value current limiting resistor, e.g. 330ohm or 470ohm, and you can power all your LEDs at once.

Calculate your LED current. Arduino supply is 5volt. Working voltage of a normal LED is ~1.8-2.2volt. So ~3volt falls across the current limiting resistor. A=Volt/ohm e.g. 3/330 = ~0.009A = ~9mA

USB tops at 500mA. Mega uses ~75mA.

Best to supply a Mega with a 9volt/1A regulated/switchmode plugin wall supply. Leo..