For my home automation project I use an old CD-Player case with its original front making 15 Buttons available. While I control 5 Buttons over I²C Bus with an Adafruit display, I needed the possibility to connect 10 other buttons to as less GPIO pins as possible. So code them in binary!

The Buttons are connected by jumper wires because I use the original board of the CD player.

Four GPIOs are listening on interrupts with binary values 1, 2, 4 and 8 and are activated by button press.

Example:

Press Button 5: GPIO 4 and 1 are activated

...

Optimization has only been possible for No. 7, because it uses 3 Pins: 4, 2, 1. I saved one diode by simulating pressing of Button 3 (2+1).

 

I use it with Raspberry Pi, but I think it's possible with any other device offering GPIOs.

 

Second Image is a three button to two GPIO Prototype for my proof of concept.

 

Feel free to ask questions if you have one!

 

[UPDATE 1] My Item has been produced and I finished the soldering (see Images). For testing I set up some LEDs and next step will be integration to my main system.