Triggering connections in circuit-bent instruments

Hi,

I'm working on a system that uses the Arduino Mega to trigger connections in other circuits, via an array of optocouplers. I was nearly about to buy the LEDs and perfboard and whatnot, but the more I thought about it, the more I became concerned that if multiple digital pins were HIGH at once, it would fry the Arduino or simply not work. So I'm here to get advice from people who actually know what they're doing (I am just an enthusiastic amateur who hasn't had any formal electronics education).

Here is a simplified version of the circuit; just imagine 10 to 50 resistor/optocoupler/LED assemblies running concurrently (with, say, 1 to 20 digital pins set to HIGH at any given time):

The sort of electronics I'm triggering connections in are circuit-bent instruments: old battery-powered toy keyboards and audio-producing things like that. For each connection, the transistor side of a given optocoupler will be hooked up to a set of terminals in the instrument; said terminals are originally only linked when a button is pushed, to produce a sound.

This circuit is meant to be used alongside SerialMIDI, so there's no MIDI jack involved in the circuit.

Note: I've tested this system, but without the LEDs, and with only one digital-out pin set HIGH at a time. Those are the concerns I have, which caused me to make this post: I've read that if you have many digital pins set to HIGH, and they're powering LEDs with any considerable operating current, then it will fry the Arduino. But I don't have the electronics knowledge to put this in context.

Well, I hope that made sense. I'd appreciate any help or opinions.

The external LEDs will probably stop it working as you only get about 4.5V as a voltage high from an arduino pin.
You shouldn't have any trouble frying the arduino as you can draw about 35mA from each pin safely and an LED should need no more than 20mA and most likely 15mA. The total current from all pins can't exceed 200mA so at 15mA per LED that's 13 LEDs you can drive directly at the same time.

I would leave out the extra LEDs an put the resistors to about 200R.

Oh excellent!

Yeah, the extra LEDs aren't necessary, so I'll just leave them out.

I may be misunderstanding Ohm's law, here (I am really, really an amateur), but-- if I raise the values of the resistors slightly, then would that make less mA go through the optocouplers' internal LEDs, and thus into the Arduino's ground, thus allowing for more pins to safely be HIGH at once?

then would that make less mA go through the optocouplers' internal LEDs

yes that's right. Just make sure you have enough current to operate the opto isolator.

Look at this to help you with your resistor calculation:- LED Resistor Calculator

Ah, I see. That resistor calculator is convenient..

Well, I think my doubts about this project are all resolved now... I now feel secure in purchasing the perfboard and whatnot.

Thanks for the advice.