Multiplexing Raspberry Pi GPIO Pins for Probes Detection

How can we logically allow raspberry pi to read sensor status from multiple devices?

The GPIO Pins can be set to OUTPUT or INPUT modes and this can be set programatically. There are 17 GPIO Pins available, and hence, you can have following combinations.

OUT IN Total Sensors
1 + 16 = 16
2 + 15 = 30
3 + 14 = 42
4 + 13 = 52
5 + 12 = 60
6 + 11 = 66
7 + 10 = 70
8 + 9 = 72

The math is:

Look into the first combination: Pin 1 is set to OUT mode, and we now have 16 pins remaining to read as sensor’s feedback. In this case, we can read 16 sensors. By multiplexing 2 GPIO pins as output and 15 input pins, we can read 30 digital sensors, and so on… In each settings, the role of a GPIO pin is consistent. A pin does not behave as both input and output for a reading.

An OUT pin activates all of the remaining INPUT pins through external opto-isolated interface.

Raspberry Pi 3 Model B seems to have 28 GPIO Pins.

OUT IN Total Sensors
1 + 27 = 27
2 + 26 = 52
3 + 25 = 75
4 + 24 = 96
5 + 23 = 115
6 + 22 = 132
7 + 21 = 147
8 + 20 = 160
9 + 19 = 171
10 + 18 = 180
11 + 17 = 187
12 + 16 = 192
13 + 15 = 195
14 + 14 = 196

Disclaimers:

  1. This is non-proven idea and under write-ups and further consideration. Do not trust this article right now.
  2. You may damage your device permanently if you source or sink more current than the specified limits.
  3. This is a software driven concept with opto-couplers in consideration (as an additional reader hardware).
  4. Software concept to be updated.