Arduino and Raspberry Pi sharing INPUT_PULLUP signal

Hey

I just wanted to ask about the general feasability of something.

Lets say I wanted to hook up a button to both the Arduino and Raspberry Pi. I usually run my buttons from GND to button and back to pin, so that it is shorted when the button is pressed. I do this both from Arduino and Raspberry Pi.

Now - what I want to know is. Could I trigger both the Arduino AND the Raspberry Pi with the same wire?
Lets say that I hooked the GND wire up to both the Pi and the Arduino, and then split the return signal in two with a wago-clamp and wire it to both Arduino Pin 9 and Raspberry Pi GPIO18.
I assume that the button press would still me registered on both of them?

Could this be hazardous to any of the microcontrollers, them sharing a signal?

Input pins are typically high impedance, i.e. they don't interfere with each other. Likewise you can attach a DMM to an input pin and find out when the attached pin is pressed.

But that's only half the story. Your button can only pull down the input pin(s) to Gnd, so something is required to pull the pin(s) high when the button is released. As you wrote in the subject, mode INPUT_PULLUP will enable a resistor to pull up the input pin to the Arduino operating voltage Vcc, which is 3.3V or 5V depending on the Arduino model. If the Arduino and RasPi operating voltages differ, the controller with the lower voltage will pull down the input signal to just its own voltage. The button still will work, but the controller with the higher Vcc may not recognize a high state any more. Fortunately that's very unlikely when the input threshold voltage is Vcc/2, or 2.5V for 5V Vcc. If the lower voltage controller limits the signal to 3.3V, this voltage still should be sufficient as a HIGH for the other controller.

The built-in pullup of 20-50k is too high for currents that might be dangerous to the lower voltage input pin. But for safer operation you can use a pullup on each input pin, to the Vcc of the controller, and split the button signal into two (or more) by diodes, with the anodes towards the various input pins. Now each controller has its own VCC at its input pin, as long as the button is not pressed, regardless of the voltages of other connected items. In pressed state the voltage equals the diode forward voltage, about 0.6V for silicon diodes, what's certainly recognized as LOW by any controller. As another goodie such distributed pullup resistors also will make the circuit less susceptible to noise and other pick-up on all the connected wires.

Like this?
schemeit-project.png

schemeit-project.png

Right :slight_smile:

Schottky is not a requirement.
Don't forget the pullups at either input pin!

Junction drop on a silicon diode is about 0.65V, will that be seen by the MCU as a solid LOW? That's the reason for a Schottky, junction drop about 0.3 to 0.4V

JCA34F:
will that be seen by the MCU as a solid LOW?

Yup it will be a solid LOW for both Arduino & Raspberry Pi.