# Is this connection for the MEGA 2560 okay?

Hi guys,

I cam controlling 36 LEDs on the Arduino MEGA 2560. The maximum current for each pin is 40 mA. Most of the LEDs are connected to the 1.5Kohm resistors and 7 of them are connected to the 220 ohm resistors.

Is it okay I connect two LEDs each with 220 ohm resistors in parallel on the pin? This will draw 27.3 mA from the pin. I know that the limit is 40 mA. I also saw that the recommended is 20mA.

I have a picture attached. The total current over the MEGA is about 195.9 mA.

I want to make sure I am doing the right thing.

There are also current limits per port that have to be considered.
40mA is an absolute max, above 20mA the output voltage may sag.

above 20mA the output voltage may sag.

Not "may" but inevitably will, at any current.

The driver has an effective internal resistance of about 25 Ohms - the voltage drops by 0.5 V per 20 mA (Figure 35-24 of the datasheet).

Thank you. I knew I would get this kind of response. But, before that I was deciding on using MOSFET 30N06L transistors to control the two LEDs in parallel for safety or have all of them connected without MOSFETs since the total current draw is less than 200 mA. Now that you guys have mentioned about the voltage sag when the digital pin is drawn more than 20 mA of current, the other option is the best.

When the digital pin is connected to the MOSFET, how much current does the MOSFET draw from the digital pin, including the resistor on it?

I am also going to be using a MOSFET to control two DC motors connected in parallel.

I have attached a picture. See if these connections are okay.

Your MOSFET is overkill for a couple of LEDs. You could use a smaller MOSFET like 2N7000. But 30N06L is a good choice for you motors.

In your diagrams, the 12K pull-down is connected in the wrong place. It should be connected between the Arduino pin and ground, not the MOSFET gate and ground.

Also it would be better to have one series resistor per led, compared to one resistor shared between them. If the two LEDs are identical and were manufactured in the same batch at the same factory, then using one resistor might be ok, but otherwise you may get uneven brightness, leading to early failure of one led, which could then cause the other to fail after some time.

instead of lof of mosfets (and resistors) for the LEDs I recommend a smaller amount of dedicated LED driver ic's

LEDs in a matrix:
up to 64 LEDs on one MAX7219, (even usable with SPI). Premade modules come so ridiculous cheap, and will give you a quick start with the max7219. If you are fine with your programming, remove the LED module and connect your own LEDs (usually the LED Modules are on sockets and can be removed).

up to 128 LEDs on one HT16K33 (I2C)
only in SMD, but there are several breackout boards available

discrete:
3 SX1509 (i2c) - each ic for 16 LEDs including PWM/blinking/breathing for each LED individually.

So I made some revisions. At the same time, I am also using one Arduino MEGA 2560 to signal the other Arduino MEGA 2560 to control the behavior of the LEDs. Check to see if the connections are correct.

math2000:

Why not use 38 mega, one for each motor and one for each led? Maybe a 49th mega to make it look even more impressive?

I'm being sarcastic, of course. Even one mega is wasted here, a nano or micro would be plenty.

So looks like everything looks good. The reason why I am using the MEGA 2560 is because I have a lot of electronic components to control. Thank you guys. This is just one of the electronic components I am asking about to see if the connections are correct.

The point remains. A Mega 2560 is most likely way overkill. A Nano is a more practical form factor to work with.

math2000:
So looks like everything looks good.

Didn't say that!

What is the circuit between the two arduino for?

PaulRB:
What is the circuit between the two Arduino for?

Clearly a misunderstanding.

Along with the expectation that a Mega 2560 is desirable. Or multiple processors.

And the airy-fairy assertion that "I have a lot of electronic components to control".