Go Down

Topic: Keypad (Read 414 times) previous topic - next topic

Jobi-Wan

I guess this is not really a question, more just rambling, so hopefully this is the correct forum for it...


I have a 12 key keypad. It is not a matrix. Each key has its own pin. There is one common pin. The keys are normally open.
It's this one: https://www.vellemanusa.com/products/view/?id=349955 


Just to test it, I wired up a bunch of keys to Arduino pins. Common pin to ground, Arduino pins INPUT_PULLUP.
This works well, but it would consume most of the precious pins, so there has to be a nicer way.

Then I wired up the keys to the inputs of 2 74HC165 (par-in/ser-out) chips.  This works well, with only 3 pins, but the inputs are not pulled up or down, so I put in place pull-up resistors. 12 of them. Which is a lot.

Then it dawned on me that it is in fact a matrix: a 12x1 matrix.
So I wired up the keys to the outputs of 2 74HC595 (ser-in/par-out) chips. I use those to run a zero across the keys. The common pin of the keypad is wired to an Arduino INPUT_PULLUP pin. So I use 4 pins.
So now I need only one resistor, and it is provided by the Arduino pin.

This works .. well .. except that I can not press more than one button at a time. That would d a) not make the input low enough, and b) short a low output to high outputs.

To fix this, I'd have to put diodes between the output pins of the 595's and the keys. 12 of them. Again, a lot. (Besides, I only have 6 of them that came in the starter kit. I will get some more; they are about 10 cents at my shop.)

While I'm at the shop, I might as well get a 4-to-16 line decoder too, so I can use that to run a zero (or one?) across the keys. That will use 5 pins total.

It is not for anything important. I just enjoy playing around.

Go Up