How many 20mA LEDs can I hook up to Mega 2560

Hey Guys,

Iam about to use the Arduino to control LED outputs for a simulator.

How many LEDs (20mA) can I hook up to the Arduino Mega 2560 out of the box - with an external power-supply (without transistors, etc.)? Is it possible to hook up like 50 LEDs (separate Pins)?

Appreciate every clue and help!

First hint:

Use a MAX7219.

(64 LEDs - don't need a 2560, just a Nano.)

Iam not so sure about that, but this might just be my inexperience.
This 7219 looks like it has to be used with this LED Unit. Iam looking for somthing, where I can place the LEDs wherever I want them. Like in this picture, you can see different buttons which have backlighting (just the buttons - 2 LEDs per Button). Those are the LEDs I have to power and control.

You can use individual LEDs placed where ever you want with a 7219 and is a good way to drive lots of LEDs.

To your original question while it sounds a simple question it is a very complex answer because it depends. It depends on:-
How much current the LEDs draw
How they are wired up
What pins or group of pins they are on and
Where the power is coming from.
The simple answer would be ten, but equally could be twenty or 50 depending on these factors.

florianklappert:
Like in this picture, you can see different buttons which have backlighting (just the buttons - 2 LEDs per Button). Those are the LEDs I have to power and control.


The MAX7219 will be just perfect for that purpose. It will make your wiring a lot simpler.

Ok, way to go.
Can you explain how the LEDs have to be wired? Please no schemes because I can´t understand them at this time. Does every LED has to be wired to all the other LEDs?

Schematics are like the language of electronics. You question is like saying tell me about this band's music, but please do it in mime.

Grumpy_Mike:
Schematics are like the language of electronics. You question is like saying tell me about this band's music, but please do it in mime.

Well, schematics are a professional representation of a certain logic, which is easy to read and understand - for the professional or someone who can read it. What Iam kindly asking is, if someone might explain the logic behind the solution to me instead of "just" posting a scheme that I might not comprehend (Not because I can´t read it, but because I cant image it in a physical form - like the wiring).

Iam not here to offend anyone, I just want to understand and I appreciate all your Inputs.

Grumpy_Mike:
You can use individual LEDs placed where ever you want with a 7219 and is a good way to drive lots of LEDs.

To your original question while it sounds a simple question it is a very complex answer because it depends. It depends on:-
How much current the LEDs draw
How they are wired up
What pins or group of pins they are on and
Where the power is coming from.
The simple answer would be ten, but equally could be twenty or 50 depending on these factors.

The LED draws 20mA (I could use 10mA LEDs too)
They are wired straight to one PIN - Each LED 1 PIN
On what group of PINs they are on - I can´t say -> I want as many as possible (46 would be best)
The Power either comes from the USB Port - or - the Build in DC

What would you say?

As pointed out, a schematic is the essential form of explanation of an electronic circuit. It is virtually impossible to describe the connections otherwise.

Here is a schematic of how you wire LEDs to a MAX7219.
MAX72XX_matrix_Schematic.jpg(Click to view fully.)
The LEDs are in a matrix; that is, each LED has its anode (I hope we do not need to explain what anode and cathode mean) connected to one of eight positive driver pins on the MAX, and its cathode connected to one of eight negative driver pins, but no two LEDs connect to the same combination of these.

Now note that the LEDs are multiplexed which means that not all that need to show, are powered at once, but rather in groups of up to eight, and there are also eight such groups. In fact, any such group will be powered only one eighth of the time or a greater proportion of the time if you do not need all eight groups - for your 46 LEDs, you need only six groups of eight so you can use only three quarters of the matrix and tell the MAX7219 to use only six "digit" rows.

To compensate in part for only lighting each LED for a fraction of the time, it can be driven with more than the DC current rating, 40 mA in fact with Rset as 10k. In practice, with current efficient LEDs, this is almost always more than adequate and the MAX7219 can be instructed to reduce the proportion of the time each LED is powered in further fractions of sixteenths to a comfortable intensity at your choice.

The wiring is actually very simple as you only have - with the reduced matrix - fourteen wires to go from the MAX7219 to all the LEDs, rather than 46, though each wire goes to six or eight separate LEDs.

If you are powering this from a USB port, this will be quite adequate. You should not power it using the regulator on the Arduino.

(Did you notice a connection dot missing on that diagram? :grinning: )

(three dots actually)
This little board I offer breaks out the MAX7219 connections to 64 pairs that can be wired out to individual LEDs.
http://www.crossroadsfencing.com/BobuinoRev17/


Stick male pins with pairs of wires going out to each LED. Or build up with male pins, wirewrap wire out to individual LEDs.

Paul__B:
As pointed out, a schematic is the essential form of explanation of an electronic circuit. It is virtually impossible to describe the connections otherwise.

Here is a schematic of how you wire LEDs to a MAX7219.
MAX72XX_matrix_Schematic.jpg(Click to view fully.)
The LEDs are in a matrix; that is, each LED has its anode (I hope we do not need to explain what anode and cathode mean) connected to one of eight positive driver pins on the MAX, and its cathode connected to one of eight negative driver pins, but no two LEDs connect........

Thank you for the detailed explanation. Schemes are totally fine when they come with an explanation :).
I think I understood the basic principle. How would you wire the LED´s? One piece of wire to the next LED or do you just use one cable for 1 group? Is there any method of easy pluging without soldering?

florianklappert:
Is there any method of easy plugging without soldering?

Not really.