Pin Outputs In Parallel/Disabling Pins?

I have a board that uses pins 3,5, and 6 on a Nano for PWM intensity control of red, green and blue LED's.

I'd like to have an option of controlling the LED's from another Arduino on a different board.
Can I wire the two sets of Arduino PWM outputs in parallel (without using a TTL source switching circuit) and disable the pins on one processor at any given time so that processor will not interfere with the signal?

Yes you can, but you have to be very careful to make sure both Arduinos are not driving at the same time, so you will need some mechanism for each to tell the other that it wants control.


Rob

What's wrong with an AND gste ?

If you set the pins on one Arduino and INPUT and on the other as OUTPUT it should work as intended. As @Graynomad said, you want to ensure that both sets of pins are not set as OUTPUT at the same time or the smoke may escape.

I suspect it would be unwise to have one Arduino unpowered while the other is working. If you need to do that you should probably have some external logic gates as @raschemmel has suggested.

...R

Thanks for you responses. I know this basically an electrical engineering question.

The AND gate would require me to redesign the board. I don’t think I have an extra square millimeter on it, and I’m out of holes for the cheap board price.

It would not be a problem to change the pins to inputs at runtime, as I have ethernet interfaces to both Arduinos.

I am worried about the smoke. If I accidentally connected two outputs together, would the board short, or would it just not work?

If two pins of opposite voltage levels get connected you will likely blow the circuitry behind the pins and maybe other stuff in the chip as well.

The diodes need a current-limiting resistor right? How about you use two, one on each Arduino pin, that way if your code stuffs up you are only sinking 1/2 the LED current through each pin as the current path is through the two resistors.


Rob

Great ideas, Rob. I think take the earlier advice and add some TTL switching stuff to the second board, since I have to make changes to it anyway. I’m just lazy about rerouting and adding new traces to an existing board! Rather be watching baseball.

If you wind up using TTL , one of these gates with an ENable && PWM as input for each gate
http://www.cs.smith.edu/~thiebaut/270/datasheets/sn74ls08rev5.pdf

to AND the three outputs of the 2-input AND gates.
To disable the inputs from the second arduino , pull the ENable LOW on the 2-input AND gate.
Then AND the outputs from those two AND gate and you have your 2-IN/1-OUT PWM mixer.

Why not a diode on each of the output pins before connecting them together? That way, even if one pin is INPUT and the other is OUTPUT, the diodes will protect them. You'll lose about 0.7V, but that can be taken into account when calculating the dropping resistors for the LEDs. If both processors are on at the same time, all that'll happen is the current drawn will be split between them. Old fashioned Diode Diode Logic.

Diodes for 40mA @ 5V are tiny. Fitting 3 onto each of your boards shouldn't be too difficult. You could always use SMD diodes to save space.

If you are driving your LEDs in "sink" mode, you can connect the cathode of the diodes to each Arduino. Connect the anodes together and to the C/L resistor for the LED.

If you are driving them in "source" mode, connect the anode of each diode to the Arduino and the cathode to the C/L resistor.

Before there were OR gates, an OR gate was built using diodes or transistors.

Appears Henry_Best has the same idea. We both posted at the same time.

rmetzner49:
If you are driving your LEDs in "sink" mode, you can connect the cathode of the diodes to each Arduino. Connect the anodes together and to the C/L resistor for the LED.

If you are driving them in "source" mode, connect the anode of each diode to the Arduino and the cathode to the C/L resistor.

Before there were OR gates, an OR gate was built using diodes or transistors.

To be exact, before there were TTL logic ICs there were DTL logic ICs. Before there were DTL logic ICs there were DDL logic ICs. Before there were DDL logic ICs the logic was built out of separate components.

Appears Henry_Best has the same idea. We both posted at the same time.

Great minds think alike :slight_smile:
And, as I pointed out, using diodes will protect the pins on both Arduinos, whatever states they are in.