matrix keyboard ADC

Hi.
I'm going to use 16 key matrix keyboard with resistor to use only one analog pin ...Which library I have to use?
Thank you

I'm going to use 16 key matrix keyboard with resistor to use only one analog pin

If you are wanting to detect any combination of keys being pressed then you can't do this:-

  1. The A/D in the arduino is only 10 bits, giving you a theoretical maximum of 10 keys. In practice 4 to 6 keys is the maximum.

  2. You would require a 16 bit D/A and it is quite unfeasible to do this with simple resistors because of the tolerances you would need.

Hi.
Not combinations...Only one button at time...
Can I have it?

Only one button at time

Yes then like this:-

Not shown all the switches but you get the idea. No libraries needed.

Switch input.pdf (19.6 KB)

Somebody missed the 'MATRIX' part....
Matrix is a combination of col.s and rows. An R/2R ladder on each col, with the rows connected to the junctions in each ladder (top of each ladder connected to +5V), will give unique voltage readings on each col for any row button pushed on that row (a single ladder will also work, if you insure that only one button is pushed at a time). Tie the bottom of the ladders to an analog input and compart the voltage read to determine which button on that col was pushed....

Good luck and have fun.

Somebody missed the 'MATRIX' part....

No we did not, please read the post again.

An R/2R ladder on each col,

This is not an R/2R ladder either.

It as an A/D based on a flash converter. The other two methods will not work with one pin.

Mike,
I did, and I fail to see your 9+, or so, resistor ladder feeding ONE analog input can be related to a matrix keypad. Yours is not an R/2R, agreed. And, an R/2R is not actually needed, but the OP's request CAN be solved using a resistive ladder connected to each coll and voltage applied via each row, to feed the outout of the ladder into one analog input for each row and decoding the foltage sensed. The big requirement is to keep the total resistance of the ladder below 10K,or so, so you feed the A/D enough current to keep track of what's going on.

But then I am, admittedly just a newbie, and you are more experienced than I.

Simulatorhck,
the point is to get some ideas and try them out until you get something that works for what you want to do with the hardware on hand. Again, have fun and best of luck!

to feed the outout of the ladder into one analog input for each row and decoding the foltage sensed

The point is that the OP has only one analogue input, that technique would need one input per row not one input in total.

My bad and my apologies, Mike. I missed the "use only one analog pin" part. Got so tangled up in my solution that I failed to see all of the OP's problem.

Open mouth, step on the gas, and 'brain fart'......
Sorry.

My bad and my apologies,

No problem. :slight_smile:

I have been having more thoughts about it and have come up with this solution in case the OP doesn't want to dismantle the keys from his matrix.

Switch Matrix.pdf (23.5 KB)