Ganging arduino pins together for increased output

I know that putting I/O pins into the output state makes them low resistance and that you can burn out the board easily while they are in this state but hear me out.

I have a small relay… it’s a rather good one for arduinos because it requires 17mA to toggle and I’ve tested it on a pathetic tiny board and it works just fine. Any I/O pin will flip it on and off.

Now I have a version of this relay that has 2 relays on 1 board and a pin header for 2 I/O inputs. I am using this setup to simulate a DPDT relay by activating both relays at the same time.

Now I could take 1 I/O and just split it to both inputs but that will over-draw on current so I want to use 2 I/O pins to do it. However I have only 1 wire with which I can do this. I don’t want to get into the reasons why I can’t use 2 wires. I just have to use 1. So the question is, can I gang 2 I/O pins together and run them through this 1 wire and then split again at the relay to the 2 inputs so that I get 2x the current? I will never be toggling the I/O pins separately. They will always turn on and off at the same time (within clock cycle execution time that is) and I will never hold them on for more than about 20 seconds.

I figure, as long as the pins are at the same voltage and the load is drawing current, the arduino shouldn’t be able to short out for more than a couple hundred nS or however long it takes between turn-on signals, right?

From your description, the pins are connected in parallel, the relay coils are connected in parallel, how do you see either pin only energizing one relay when the output is driven?

Like this:


17mA or less, do not drive the relay from the controller pin directly.

Always use a transistor, SOT23 MOSFETs are inexpensive.

Remember, relays produce a high kickback voltage, use a kickback diode.

How will you be turning on the outputs at the same time ?

Either way, with a transistor buffer or not, one output wil end up turning on both relays, unless some smarts are added at the relay end to receive a message indicating which relay is to turn on.

Which seems to be exactly what the OP wanted anyways.

Just use a transistor controlled by a single pin to drive both relays.

If 1 pin turns on both relays, good for me I guess. The point of using 2 pins is to prevent either unreliable functionality or drawing too much current from a single pin.

The only thing that concerns me is whether or not ganging 2 pins to a single line will burn out the board because of 1 pin feeding into the other instead of into the relay.

From your description and diagram I’m guessing this is a relay module with opto couplers. 17ma is quite high for a trigger current. You may be able to use a single transistor to simultaneously switch both pins (IN1 and IN2) and Vin to minimize the number of connections if that is your goal. You may be able to experiment with series resistors to reduce the current and still get clean switching.
If, however, you want to tie output pins together, you can get some ideas from this: power - Can I use two Arduino digital pins in parallel to keep a higher voltage? - Electrical Engineering Stack Exchange

Use direct port manipulation to ensure simultaneous switching.

Aha! Use 2 pins on the same port and command the entire port hi / low to ensure the switching is simultaneous. That should work! Thanks dude.

I was thinking also putting a small capacitor between pins would prevent transients from spilling over to the other pin before the voltages have had a chance to equilibrate.

. . . yet another alternative is to modify the relay module to put both relay coils on parallel.

Assuming we’re talking about an ATMega328, the absolute maximum current to/from I/O pins is 40mA and a total of 100mA for the chip as a whole. Staying below 25% of that absolute maximum is probably safe. Two pins sharing 20mA or 10mA on each pin is probably going to be okay. 3 or 4 pins would definitely be fine.

If you are going to do it this way, there should be a small resistance between the pins and the load – so-called “current sharing resistor ballast”. This is needed because the output impedance of the ATMega chip is very very low – a few milliohms – and very slight differences in the impedance of the two pins will cause the current to concentrate on one pin or the other, resulting in one pin carrying most of the current and spoiling the load-sharing goal. A two-ohm resistor between each of the pins and the load will do the job.

I would double down on the other’s recommendation to just use a switching transistor though. A 2N3904 would be fine.

Where are you getting this figure from ?

A simple calculation for 20mA out yields ~25 Ω for a LOW output.

Similar for a HIGH output.


i.e. 25Ω at 25°C.

Incorrect. It is 200mA per VCC pin and Gnd pin.
Thus 200mA for DIP package, and 350mA for a SMD part.
There is a table around section 30 or 31 of the datasheet, if you add up the totals per port (and there are per port limitations) it adds up to 350mA total.
I personally confirmed this with Atmel tech support many years ago.

1 Like

I know we’re talking about the 328 here but on this site it shows all the ports and pins for a mega, some of which have 8 pins a piece:

If each pin supplied 20mA that would seem to exceed the budget of the port unless the chip’s total was much higher than it seems to be. Is there a rule of thumb for how much current a given port should draw? LEDs draw about 20mA don’t they? I’ve seem some projects where they connect LEDs to every pin on the board. Maybe the board won’t live long doing that.

No more than 20mA per pin.

Many modern LEDs are bright enough @ 5mA.

Mega has 8 VCC pins, 800mA total. Port limits:

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 one wants an LED per pin, then current limit resistors to meet the port limits are needed to avoid overstressing the chip.

The output impedance of the pin is not the total impedance of the circuit. If a pin were directly shorted to ground and then set to “high” the current that would try to flow is bound by the output impedance of the pin (and the source impedance of the power supply). It would be much higher than 20mA. Perhaps as much as an amp would flow before the chip died.

You are a wealth of information. This info seems too important to be so obscure.

But it’s not obscure. It’s right in the datasheet. People just don’t know to look for it.

Let’s say it was 1 amp, that’s still 5 ohms, not milli ohms.

We must remember for very short periods of time inductance and ESR in the cct. we will not see damage if an output is connected to GND.

Anyway, the OP would be using port switching to get simultaneously control of parallel outputs.

If not on the same port then they can switch the outputs as if they were open drain. i.e. modulate between input to output with pinMode.