Electronic – How to 16 buttons be connected with only 8 wires


Here is the product. I understand the idea: these 16 buttons use a 4×4 matrix. 4 lines for rows, 4 lines for columns, and we have 8 cables.

enter image description here


  1. How can this work without any multiplexer ?

  2. Can this detect accurately presses of multiple buttons? Even if buttons use same row or same column? Example: buttons at position (2,2) (2,3), (3,2), and (3,3) pressed at the same time.

  3. How does it work?

Best Answer

How can this work without any multiplexer?

It doesn't. The keypad board seems to have just switches, with maybe some diodes we can't see. However, the left board looks like it has a processor on it. Almost certainly, multiplexing is being done in firmware.

The multiplexing algorithm works something like this:

  1. Drive one row high, the others low.

  2. Enable passive pulldowns on the column lines.

  3. See which column lines are high. The buttons at the intersections of those column lines with the one asserted row line are pressed. The other buttons on that row are released.

  4. Repeat back to step one, asserting the next row in sequence.

The above process is repeated fast enough so that all the buttons are checked within a time that still feels instantaneous to a human observer. The human limit of "instantaneous" in this context is about 50 ms. Even a low end microcontroller can scan a 4x4 keypad in much less time than that.

Can this detect accurately presses of multiple buttons?

Probably yes. One way is to put a diode in series with each button. Those could be on the bottom side of the board you show. With the diodes, the algorithm described above just works.

Another way is by putting resistors in series with lines and measuring their analog voltage. Even with multiple buttons shorting multiple row/column lines together, you can eventually figure out which buttons are pressed. This requires A/D inputs in the micro, not just digital inputs as when diodes are used.