Max simultaneity leds can Mega support?

Hey,
I have a project that will have:

  1. 150 buttons.
  2. 15 - 7 segments display
  3. 3 rotatory encoders
  4. 15 servos.
  5. 200 leds (100 pins , 2 leds chain for each pin )

For that I will use 7 Arduino mega boards.
Servos will be connected to external 5v power supply.

My question is regarding the leds. In some scenarios 50% of the leds can be powered in the same time. I am not sure how many 5v leds the Mega can support simultaneity??

I can try to spread them around the 7 Mega board which will make around 30 leds per board. Again each two leds are chained together into one pin(~15 pins per Mega for 30 leds ).

I prefer to have two Mega boars that will managed all leds but I am not sure Mega can support leds on all pins turned on in the same time.

Those are the leds I have Link

Why not a single Mega, addressable LEDS and an external power supply ?

"Can be supported" are you talking about current, through number of pins, or logical (programming).

Nevermind, I see the answer to that. So find out how many IO pins a Mega got and with simple math (200/30) you'll see the answer.

Unless explicitly required for any reason I don't know about, using 7 Mega to do that is just a waste of hardware and an increase in software complexity, there are some well known solutions to this kind of I/O based on what your real needs are.

For example, the 150 buttons could be arranged in a 10x15 matrix so you just need to identify row and column of the button to be read by using 25 pins (you can find tons of button matrix examples, starting from simple 4x4 dials).
For the LEDs you just need to find which addressable type meets your requirements, starting from either stripes or matrix.

From the question, it seems you are wondering if the Mega can supply current to all the LEDs. This is the wrong approach to design. You should not consider the Mega as a power source for the LEDs, the power supply should be external anyway. The same applies to seven-segment displays and servo motors.

Can you share with me an example how led can be powered by external source?
The led has only 2 wires, how can I bridge it with external power?

There is Mosefet that can control large number of leds?

Each box led has two leds chained together.

I need the ability to control each led box separately.

That link shows a large number of LEDs with and without flashing, what have you actually got?

I can't see how you would need 7 boards.
But the real answer will be found in the data sheet for the Mega.
It will be complicated by the restrictions on the limits for pins.
The data sheet is too large to post but search for
atmega640-1280-1281-2560-2561_datasheet

look at page 355, note the restrictions on what pins can be used on what ports.

Notes:

  1. "Max" means the highest value where the pin is guaranteed to be read as low.
  2. "Min" means the lowest value where the pin is guaranteed to be read as high.
  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:
ATmega1281/2561:
1.)The sum of all IOL, for ports A0-A7, G2, C4-C7 should not exceed 100mA.
2.)The sum of all IOL, for ports C0-C3, G0-G1, D0-D7 should not exceed 100mA.
3.)The sum of all IOL, for ports G3-G5, B0-B7, E0-E7 should not exceed 100mA.
4.)The sum of all IOL, for ports F0-F7 should not exceed 100mA.
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.

  1. 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:
    ATmega1281/2561:
    1)The sum of all IOH, for ports A0-A7, G2, C4-C7 should not exceed 100mA.

2)The sum of all IOH, for ports C0-C3, G0-G1, D0-D7 should not exceed 100mA. 3)The sum of all IOH, for ports G3-G5, B0-B7, E0-E7 should not exceed 100mA. 4)The sum of all IOH, for ports F0-F7 should not exceed 100mA. 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 you need to control each LED separately, you need a mosfet for each.

For small LEDs you can power an anode with an external power and switch the LED by GND. Foe the power LEDs you need a mosfet to switch ether on high or lower side.

I know how to do it for the servo and 7 segment as they have 1 wire for 5v and other wires to control the unit(that connected to the Arduino). But for a led there are only two wires. So what is connected to the Arduino and what to the external power supply?

Using a N-mosfet to switch a LED by lower side:

(GPIO is an Arduino pin, +12v just an example)

What is the LED current range? Do you have a datasheet for it?

I have 5v white/yellow led.

1 Like

So having 100 mosfets?

To be able to answer this I need a LED specs as asked you in #12

I think it 20MA .
Does it make sense?

20 mA * 200 LEDS = 4000 mA = 4A

According to the specs of the different arduino boards posted above, the total current across all pins should not exceed 700mA, so your setup exceeds that by about 6 times.
So you need mosfets for each pair of diodes.

By the way, have you considered the addressable led strip? You can connect all 100 diodes to one pin and you won't need mosfets

However you look at it, 200 LEDs is a lot of LEDs. This is a job for at least ULN2803, or if you want to reduce IO pins TPIC6B595. You will need 25 such devices (25x8 = 200).

It appears the LEDs you bought have a series resistor in the leads, so if you drive 2 in series you will get half the current, and probably less than half the brightness. It would be better to use 2 regular LEDs in series with a single resistor in series. I guess you could still remove the resistor from the leads.

To make your life slightly easier, there are breakout boards for TPIC6B595 available (bare PCB, so get ready for some soldering).

The TPIC6B595 could easily handle two in parallel with a 5V power supply, or two in series with a 10V power supply.

An HT16K33 could be used for the 15 7-segment LEDs, if multiplexing is acceptable, or just use more TPIC6B595s to reduce the pin usage. Depending on what this is all for, the Mega may not be the best choice anyway.

Not really.
The LED specification says 0.1W. At 5V that would be 100mA.
The only way to know for sure is to the measure the current.