3

Is it safe to connect a GPIO output to a GPIO input??

For example: Set the GPIO input to GPIO.PUD_UP and connect it to GPIO output. Then when the output is HIGH, then the input is logic 1, and when the output is LOW then the input is logic 0.

Will it work?

8

Yes, that will work.

I suggest you have something like a 1 kΩ resistor in series. That will limit the maximum current to 3.3 mA.

That will save the day when by mistake you set both GPIOs as outputs, one as a 1 and the other as a 0. Without the resistor that would result in a damaging short circuit.

3

It is perfectly ok to do this. After all it does not matter whether two digitial pins (one input, one output) of different devices or the same device are connected to each other.

The one important thing is to consider that the maximum ratings of the GPIO pins are not exceeded - especially the current drawn from the pin. This holds true for any setup but more importantly so for configurable pins (GPIO pins that can be both input and output). As the state of the pin might change either during boot-up or accidentially due to bugged software the series resistor (as mentioned in joan's answer) is important to limit the current if both pins are set as outputs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.