9 posts / 0 new
Author
Message

Hi all. I am trying to build a keypad using the AD converter on a ATMega48. I've been doing some research on google and found out that is best achieved using a resistor matrix.

I also found an example of such a matrix and some code examples to help me on my way. I think I understand how it all works, but I am struggling with a very basic question. Why these values?

I can understand that you have different resistance on each key, and that leads to different voltages to be read by the ADC. But why should it be 3K3 ohm and not 3k, why 15K and not 10K. Is there a reason for this, are there best practices for this? Is there a formula or proccess for creating these?

Code, justify, code - Pitr Dubovich

A question contains good portion of answer methinks.
Resistor values should be selected to make voltage readings as evenly distributed as possible. On the other hand, these values shall correspond standard resistor values, on the other hand.
Instead of struggling one may give a try and calculate all voltage readings in this set up and different resistor values.

Quote:

. But why should it be 3K3 ohm and not 3k,

http://en.wikipedia.org/wiki/E48...

Note that in E6/E12/E24 that the value around "3.x" is actually "3.3" (or "33") not "3.0"

Thanks! I knew there was a reason. I will read up some more.

Code, justify, code - Pitr Dubovich

Okay, so the reason is that they are manufactured that way. But there is no reason it should not work if I use slightly different resistors. I'll go try it. Thanks.

Code, justify, code - Pitr Dubovich

Kludge. The keyboard is digital. You need rows x columns of ins and outs. If you dont have enough digital IOs, you need a digital IO expander like an LS165 on the SPI. You dont try to use an analog channel to guess if 3.5V should be the 3V key or the 4V key. Might as well get a big rotary switch with a big resistor ladder and have the dude dial in the number he wants and push an enter key.

Imagecraft compiler user

Bob -

That is a little harsh. While I would not choose this way, it is perfectly valid, if properly designed.

The big short-coming is key-rollover, I think. What does it read if two adjacent keys are pressed at the same time. And, will that be interpreted as a valid key that is NOT one of the single keys? That probably depends on which two are pressed. I am not going to go out of my way to check this, however.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!