So, here’s a simple concept I modified to be a lower pin count and fewer processor cycles less. The original example I found here used a 74hc595, which is an 8-bit shift register) to scan one bit through the register and through some clever trickery with pull ups and pull downs read out serially what row and column that button is in. My modification did away with the shift register (which you have to prime with one bit every time you scan) and replace it with a decade counter. The decade counter does just what we’re using the shift register to do, scans one bit out many outputs. The decade counter can start in an unknown position, but the start up reset circuit (a diode, capacitor, and resistor to temporarily pull the line high until the cap is charged, then pull it low always after that) sets it back to a known state.
I haven’t seen anyone else try this particular setup before, partially because if through some cosmic radiation (or something more likely) and a bit gets flipped then you’ll be off-by-one for the rest of your days. This can be gotten around by triggering the reset line before every read, but I’ll try my hardest to keep the pin count down. The next problem is that the decade counter resets after ten cycles, not eight. This should be able to be remedied by tying the reset line to the 9th output, but I haven’t had much luck making that work. The solution I came up with is to manually clock the device twice after every shiftIn(). My code here makes it easy to implement the keypad polling in whatever code you’d want. This could be expanded to a 4×4 matrix with minimal modification (it was originally designed for such, but I’m not using one).
The circuit is fantastically simple to wire and to code for. I didn’t have any circuit board I was willing to sacrifice to this temporary setup so this is some old wire wrap board (no copper).
This was to be used in the OpenAccess system, but it was abandoned like lots of other parts.