Isolating GPIO’s using diodes

diodesgpiopulldown

Schematic
enter image description here
The arrows are GPIO's

I want to be able to close multiple switches at once in any particular order in order to manipulate GPIO's manually. I could give each GPIO its own resistor, but when I close multiple switches the current will increase (by 2, 3, 4 times) reducing battery life. I tried to find a way where each GPIO would share the same resistor and be properly pulled down, while still remaining isolated by the switches. Would the above circuit work?

In particular, when the switch is open will the GPIO be at ground as I want it to be, and when the switch is closed will only the specified GPIO be high?

Best Answer

No, your circuit won't work as you want.

When any switch is closed, the associated diode will pull the junction between the diodes and the resistor up to about Vcc - 0.7 volts, leaving the unselected GPIO inputs in an unknown state (but perhaps, due to leakage in the diodes, the unselected inputs may appear as Highs.)

Related Topic