I’m planning to control an 80s electric typewriter via a Raspberry Pi. I want to emulate the keyboard matrix by shorting one of seven 5V pins to another one of nine that feed into a microcontroller. Eg, shorting pin 0 and 16 prints out a full stop; 5 and 12 print ‘w’ etc.

[![pcb](https://i.stack.imgur.com/bEM4D.jpg)](https://i.stack.imgur.com/bEM4D.jpg)

How can I best control this?