I want to build a 7 Rows x 15 Columns keyboard from scratch, thus I have started from the theoretical design of the matrix. The classic way should be to assign directly the Rows and Columns to (7+15) I/O of a microcontroller and also connect 7X15 diodes to every each switch in order to prevent the "ghost" effect.
Yet, I redesigned a matrix using multiplexers - demultiplexers as follows:
Just to keep it simple, let's say that I have a 8x4 matrix, the columns connected to a demultiplexer and the rows connected to a multiplexer. That should work with the pseudocode:
for each output of the demux:
for each input of the mux:
check if a individual button has been pressed, else \\
send HIGH due to pull up resistors
Since in every each loop only one switch can be inspected and there is not any physical connection to other switches, I think I could prevent the "ghost effect" without the need for any diode component.
Also, for a 15x7 matrix, instead of using (15+7) pins, I could use a 16:4 demux and a 8:3 mux, thus only 4+3 = 7 pins.
Please, tell me your opinion, or point any flaws of the design.
