Safe to connect outputs to outputs and inputs to inputs?

I'm planning to build a toy where the kids have to connect one row of plugs to another row of plugs in the correct order using short patch cables. (A colored led on each side will let them know which ones to connect together)

My plan is to send different pwm signals out of the first row and connect the second row to analog inputs, so I'll know which output is connected to which input.

Now my question is: what happens when the kids connect an output to an output or an input to an input? Is it safe? Well the arduino nano / uno / mega (or whatever I end up using) be damaged?

Connecting outputs to outputs directly can damage the controller.

You could use series resistors to protect the pins. .

This may be an option. http://www.rugged-circuits.com/ruggeduino/

Ruggeduino sounds good, but if I can get this done with all the stuff I already have it would of course be best…

How do I use series resistors to protect the pins? Where do I put the resistors?

You put them in series with the output pins. Even 100R should cover it. If two outputs are connected together, the total resistance is 200R, so the current would be around 25mA, which is OK for the Arduino.

Paul

col000r: My plan is to send different pwm signals out of the first row and connect the second row to analog inputs, so I'll know which output is connected to which input.

So, you actually have no idea what "PWM" means then? :grinning:

{The correct answer is - yes, you can in fact use any output, not PWM as such, and any input. Since "analog" inputs are in fact, digital inputs, you actually can use them, but there is no particular reason to do so.}

Just use a 1k resistor in series with every pin. Plenty of protection.

Paul__B: So, you actually have no idea what "PWM" means then? :grinning:

Haha. Well. I do in principle, but it appears I didn't think about it enough in this case... :) But thanks for pointing this out! I can of course use a digital pin as input, since I need to measure the length of the signals and not the strength of the signals!

Thanks everyone!

Ah! You’re back!

My point was, you were going about it in a ridiculous fashion. Using analog functions for this function is just asking for trouble for a variety of reasons.

You have a digital device. You just poll your output pins sequentially with a logic zero, and read your input pins (using INPUT_PULLUP) to see which ones have the corresponding logic level. It is dead simple and has nothing whatsoever to do with PWM.

You can use even shift registers to do this and execute the whole interface through four pins in total on the MCU, no matter how many patch cables you need.

col000r:
How do I use series resistors to protect the pins? Where do I put the resistors?

The clue is in the name series.

Forget PWM, just put one output low and see if any of the inputs go low.
The inputs do not need series resistors but they will need their internal pullups enabling.
When you are not putting a test zero on an output then make it an input.