Which one is common ?

BCJKiwi

Senior Member
No common, Matrix keypad.
Description indicates NC-C2-R1 etc, C for column, R for Row
These keypads need to have row and column monitored to sort out which key(s) is(are) pressed.

See
Program Editor, Help, Picaxe - 28/40 datasheets, Exemplar Projects, Keypad Lock
for ideas.
 
Last edited:

manie

Senior Member
Thanks, got that figured now (sorry), is there a posibility to use the analogue series R system to read voltages here on one input ?
Manie
 

Dippy

Moderator
I'm not sure whether have pictured this correctly Manie.

Take a look at this below.

If you strobe the blues, and scan the yellows you can work out which button has been pressed.
(For the sake of argument assume when you press a button it connects blue track to yellow).

By strobing I mean (ideally) connect the blues to tri-stated pins. Then, one at a time, make them an output, set high, (the other blues as inputs). Then read the yellow channels connected to pins in input mode. Many people play safe and use protection resistors and you really need pull-up/down resistors for the yellows.
Clever people may take adavantage of soft pullups and invert the outputs to blues.

Example, assuming pulldowns on yellows:-
If Blue1 only is high and you press top left key, then yellow 1 goes high, yellow 2&3 low.
As you have set only Blue1 high you know that it can't be the middle-left or bottom-left button that has been pressed.
Bingo, you know its top left.
Then, your programme would (ideally) tristate Blue1 as input, then set Blue2 to Output and set it high.
If top-left button were still pressed then nothing is on Yellows 1-3.

So, your programme 'strobes' the blue ones one-at-a-time and 'scans' the yellow ones.
Because YOUR programme knows which Blue line is high then it will know which button has been pressed.
 

Attachments

manie

Senior Member
Dippy, thanks , that one I worked out (eventually), the posts describe that well. Problem again is that requires 4 ouputs and 3 inputs, 7 pins in total which is a lot ! I will not have that many spare pins to use, even though I'm using a 40x1. I've looked at the matrix intensively and there is NO way that I can see to get R's in series unless you strip and open the keypad. Kinda defeats the object. At this point I think I'll build a matrix of the 6mm mini tactiles (Rev-Ed) with the series R's to read a anal. voltage. I'll cap the tactile switches with the stripped (destroyed) keypad number pads, hell, it ain't easy on an invalid is it ??????
 

eclectic

Moderator
@manie.
Only a possibility, but .....

1.Re-working / rebuilding a keypad could take a lot of time.
How much is your time worth?
2. There are suggestions on the Forum, using 4017 or '165 chips.

Instead, use Dippy's wiring schematic, and, say a Picaxe 14M as your “receiver”

4 outputs and 3 inputs programmed to receive a value 0 – 12
Value passed to your “master” 40X1 by serout.

The 14M sends “high” then Serout
The 40X1 is interrupted, and then Serin's the value.

e
 

Dippy

Moderator
Well, those are the options.
A) A keypad interface with a second PIC. This would be my preference as the Keyboard 'firmware' could send an interrupt (as descibed by eclectic above).
B) The pile of p/buttons + resistor ladder to an ADC.

(A) has a big advantage of being able to buffer keypresses. That is what I have done in the past. (With a bit of skill you can deal with rotary switches too).
But this may not be needed in your app, so maybe keep it simple with separate buttons as you have said.

I'm sure you'll get it sussed so good luck.
 

manie

Senior Member
Here is what I thought might work. Built it (rough) and tested voltages for each keypress.
Circuit:
col1.........col2........col3
+5V.........+5V.........+5V
1k............2k7.........5k6
..................................1k....row1==|
..................................6k8..row2==|==22k==0V
..................................15k..row3==|
..................................22k..row4==|
Voltages measured over 22k to 0V are:
Keys:
1=4.52 2=4.23 3=3.80
4=3.65 5=3.45 6=3.15
7=2.86 8=2.74 9=2.55
*=2.42 0=2.33 #=2.19
Divide by 4.93mV (5.05V/1023) for Readadc10 values
Allowing for +5% up and -5% down on resistors still gives enough leway to read each key voltage within a range that does not overlap with previous/following keys (or very nearly so)....

Comments welcome
 
Last edited:

BCJKiwi

Senior Member
@ Manie
Did you follow through the thread referenced in post #5

All the options, all the work and all the calculations are already done.

Don't understand the comment in your post #7 as the resistors are placed across the row and pin connectors - no access to the individual switches is required (or would work without cutting the traces) on a matrix type keypad.
 

manie

Senior Member
BCJ: That is exactly what I could not yet figure out, how the resistors are placed...
There are 7 pads from L to R = c2-r1-c1-r4-c3-r3-r4. Can't figure how to place resistors so they are in series with each key grounding a resistor like in your excellent example. So, what I came up with is shown above, it will require extra coding to select the keypress from the anal.V value though, but should work. Maybe I've been busy too long and need some sleep ? Its 23h45 here now...
Manie
 

BCJKiwi

Senior Member
The values you have are pretty good.

They could be improved slightly by changing the 2k7 on Col2 to a 3k3 and changing the divider R from 22k to 27k. However the changes are relatively small changing the smallest ReadADC step by 1 from around 4.5 to 5.5

The circuit you have may use 1 or two more resistors than others but is much simpler to calculate as there are only ever two resistors in the path through the matrix for any key.

I see there was not actually a 'one wire' 12 key matrix on the spreadsheet so may add that in due course.
 
Last edited:

manie

Senior Member
BCJ: Thanks for your valued input. For a couple of minutes I was worried that I'm plain dumb, glad to see I'm not totally stupid LOL LOL LOL

Your description of "1-wire row and column" is pretty accurate for this Rev_Ed keypad. Thats why I asked "where is common".....

Think we've contributed smething usefull to the forum ? I'll look at some code to decipher the actual ADC reading into a meaningfull single key press value and post it. Your input will then again be appreciated.
Manie
 

manie

Senior Member
Thanks BCJ, I've downloaed and played with it a bit to resemble my 12 Key keypad. Some good values, some spread a bit close, but can still resolve to "range 6" with readadc10. I can e-mail it to you for your inspection. I think for Noobs (like myself) this one could be easier. I've included both the Vout and the ADC into the keypad layout, makes for easy reading. Say if you're interested.
Manie
 

BCJKiwi

Senior Member
Not clear what you have achieved from your description - email it if you want.

The second example Matrix keypad is the arrangement you described in your earlier post with two values changed to give a slightly better minimum step as advised earlier.

However the first 12 key arrangement in the spreadsheet has a minimum step of >6 on READADC which is == >24 on ReadADC10!

The Spreadsheet may look complicated but you can just use the example R values as they are the best I could find. The critical value is that minumum step as the bigger it is the greater the gap between switches therefore the most reliable.
 
Top