I’ve been studying this circuit for almost two weeks but it still got me no where, can someone please share their opinion on:

1. detect each button unique signal.
2. detect each button on multiple key press.

Maybe someone could be a piece of advice/tips/sample or even anything on how to do either of the task.

This is part of my assignment and its almost due. So this is my last resort on passing this subject…

is there any thing else we need to know

is the foil in the keypad joining 2 points or is it pos/negative?

are there any other components being used like diodes ?

Its a key matrix - using 'dome' or carbon-pad switches. *Note - the keys are not physically aligned as they appear in the I/O rows & columns Connect it up just like any other matrix. Use the keypad library and examples - voila.

Pin 1: AG Pin 2: CADE Pin 3: CF Pin 4: B Pin 5: BH Pin 6: H Pin 7: IEF Pin 8: IGD

If you drive pin 2 LOW you can use INPUT_PULLUP on 1, 3, 7, and 8 to detect A,C,D,and E. If you drive pin 5 LOW you can use INPUT_PULLUP on 4 and 6 to detect B and H. That leave you needing F and G. Pull pin 3 or 7 LOW to sense F on the other. Pull pin 1 or 8 LOW to sense G on the other.

There will be some combinations that can't be distinguished. For example: C+F shorts 2 to 3 and 3 to 7. 2 and 7 shorted together looks just like E. For the same reason C+E looks like C+E+F and F+E looks like F+E+C. That's why you need diodes for an N-key rollover key matrix.

gpop1: is there any thing else we need to know

is the foil in the keypad joining 2 points or is it pos/negative?

are there any other components being used like diodes ?

theres nothing that we can add to the current circuit only beyond the circuit(at their pin maybe). fell free to add anything (ic,diodes ,etc)

lastchancename: Its a key matrix - using 'dome' or carbon-pad switches. *Note - the keys are not physically aligned as they appear in the I/O rows & columns Connect it up just like any other matrix. Use the keypad library and examples - voila.

that's what i thought at first, but why don't you try identified which are the row and column. i tried that in the first few days, but then i cant't do it.

i think this is not 'like any other matrix keypad', in my opinion it used some other ways. Try looking at the circuit here(http://forum.arduino.cc/index.php?action=dlattach;topic=498909.0;attach=225120), i think the designer used this basic. just maybe...

johnwasser: Pin 1: AG Pin 2: CADE Pin 3: CF Pin 4: B Pin 5: BH Pin 6: H Pin 7: IEF Pin 8: IGD

If you drive pin 2 LOW you can use INPUT_PULLUP on 1, 3, 7, and 8 to detect A,C,D,and E. If you drive pin 5 LOW you can use INPUT_PULLUP on 4 and 6 to detect B and H. That leave you needing F and G. Pull pin 3 or 7 LOW to sense F on the other. Pull pin 1 or 8 LOW to sense G on the other.

There will be some combinations that can't be distinguished. For example: C+F shorts 2 to 3 and 3 to 7. 2 and 7 shorted together looks just like E. For the same reason C+E looks like C+E+F and F+E looks like F+E+C. That's why you need diodes for an N-key rollover key matrix.

Yes, from my study what you're saying is correct, we need to put diodes at each switch to distinguished them. but we cant add anything to the current circuit, only what beyond the circuit(at the pin).

here what i got so far,

there are 2 main circuit:

one that connect button (A,C,D,E,F,G,I)- pin 1,2,3,7,8

another that connect button (B,H)- pin 4,5,6

i don't know why the designer of this circuit make it that way for sure, my best guess is button B and H are for power/navigation in their menu. and the others button for function selection, just maybe. But that doesn't matter. My task was only to use arduino and register each button in uniquely to (lcd or Led). All my effort so far leads to nothing worthy. I hope you can help me.

//thank you so much for putting effort to study the circuit!!

johnwasser: Pin 1: AG Pin 2: CADE Pin 3: CF Pin 4: B Pin 5: BH Pin 6: H Pin 7: IEF Pin 8: IGD

If you drive pin 2 LOW you can use INPUT_PULLUP on 1, 3, 7, and 8 to detect A,C,D,and E. If you drive pin 5 LOW you can use INPUT_PULLUP on 4 and 6 to detect B and H. That leave you needing F and G. Pull pin 3 or 7 LOW to sense F on the other. Pull pin 1 or 8 LOW to sense G on the other.

There will be some combinations that can't be distinguished. For example: C+F shorts 2 to 3 and 3 to 7. 2 and 7 shorted together looks just like E. For the same reason C+E looks like C+E+F and F+E looks like F+E+C. That's why you need diodes for an N-key rollover key matrix.

Is there a way you can code a pin as a sink.(analog?) Then you could scan the other inputs. switch which pin you sink then scan again.

gpop1: Is there a way you can code a pin as a sink.(analog?) Then you could scan the other inputs. switch which pin you sink then scan again.

It doesn't help. When you press C+E, C+F, E+F, or C+E+F you are shorting pins 2, 3, and 7 together. How do you propose determining which of the four cases are true? You could try to use contact resistance but I don't think that will be reliable.

Have you tried drawing it out yet? @johnwasser is right on the money. Not all rows/columns have a full complement of buttons, and FG are outliers with some special functionality... perhaps 'shift/alt' functionality on a small keypad. If you want to press two or more buttons at a time, that requires diodes or a different key sensing arrangement. F & G are a bit odd, but as you say, that may well be a consequence of the intended application.

johnwasser: It doesn't help. When you press C+E, C+F, E+F, or C+E+F you are shorting pins 2, 3, and 7 together. How do you propose determining which of the four cases are true? You could try to use contact resistance but I don't think that will be reliable.

A little of topic but I was thinking more along the lines of

if you could turn on the pullup resistor on pin 1 or change it to a output then quickly check the other 7 input pins then return pin 1 to a input. Now repeat with pin2 and check the other 7 input pins. repeat until you have test enoght possibility to figure out every key. I figured that from there you could work out each button except arduino pins float. (I don't truly understand all the pin options that are available outside of the arduino environment which is why I was asking)

im not sure if this would damage the board but it seems to works with 10k resistors on each pin (resistors are pull down)

``````#define  pin1 2//had to move for serial monitor
#define  pin2 3
#define  pin3 4
#define  pin4 5
#define  pin5 6
#define  pin6 7
#define  pin7 8
#define  pin8 9

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (pin1, INPUT);
pinMode (pin2, INPUT);
pinMode (pin3, INPUT);
pinMode (pin4, INPUT);
pinMode (pin5, INPUT);
pinMode (pin6, INPUT);
pinMode (pin7, INPUT);
pinMode (pin8, INPUT);
}

void loop() {
// put your main code here, to run repeatedly
int letter = 0;
pinMode (pin2, OUTPUT);
digitalWrite(pin2,HIGH);
if (digitalRead (pin1) == HIGH) {
letter = letter + 1;
}
if (digitalRead (pin3) == HIGH) {
letter = letter + 8;
}
if (digitalRead (pin8) == HIGH) {
letter = letter + 512;
}
if (digitalRead (pin7) == HIGH) {
letter = letter + 256;
}
Serial.println(letter);
pinMode (pin2, INPUT);
pinMode (pin7, OUTPUT);
digitalWrite(pin7,HIGH);
if (digitalRead (pin2) == HIGH) {
letter = letter + 2;
}
Serial.println(letter);
pinMode (pin7, INPUT);
}
``````

with a little skill you could work out how many keys to repeat this to get all the needed inputs.

Someone who understand char and how to assemble a string might be able to serial print the keys pressed.

oh to save anyone having to test this the results on serial print with 2 and 7 joined (both have 10k external pull down resistors) was

256 258 256 258 etc

Turning this into code should work (I think)

8 pins indicated by 00000000 with pin 1 on the left

``````//a 11000000
//b 00011000//+5v on pin 5 hardwired
//c 01100000
//d 01000001
//e 01000010
//f 00100010
//g 10000001
//h 00001100
//i 00000011

//if 1 high when 2 output theres a A
//if 4 high theres a B
//if 3 high when 2 output theres a c
//if 8 high when 2 output theres a d
//if 7 high when 2 output theres a e
//if 7 high when 3 output theres a f
//if 1 high when 8 output theres a g
//if 6 high theres a H
//if 7 high when 8 output theres a i

pins 1,2,3,4,6,7,8 all need pull downs
pin 5 is =5vdc (not a input)
``````

gpop1: A little of topic but I was thinking more along the lines of

if you could turn on the pullup resistor on pin 1 or change it to a output then quickly check the other 7 input pins then return pin 1 to a input. Now repeat with pin2 and check the other 7 input pins. repeat until you have test enoght possibility to figure out every key.

Again, you will get the exact same results for C+E, C+F, E+F, and C+E+F. Unless you can explain how to tell the difference you will not be able to implement N-key rollover on this keyboard.

johnwasser: Again, you will get the exact same results for C+E, C+F, E+F, and C+E+F. Unless you can explain how to tell the difference you will not be able to implement N-key rollover on this keyboard.

The way im looking at scanning it and changing pins from inputs to outputs I can see the difference between c and e and f.

//if 1 high when 2 output theres a A //if 4 high theres a B //if 3 high when 2 output theres a c //if 8 high when 2 output theres a d //if 7 high when 2 output theres a e //if 7 high when 3 output theres a f //if 1 high when 8 output theres a g //if 6 high theres a H //if 7 high when 8 output theres a I

so in one loop I would have to set pin 2 then 3 then 8 between inputs, output then back to input

op if you have the keypad and some 10k resistors to make pulldowns on the 7 input pins can you run this and see what happens please.

``````//a 11000000
//b 00011000//+5v on pin 5 hardwired
//c 01100000
//d 01000001
//e 01000010
//f 00100010
//g 10000001
//h 00001100
//i 00000011

//if 1 high when 2 output theres a A
//if 4 high theres a B
//if 3 high when 2 output theres a c
//if 8 high when 2 output theres a d
//if 7 high when 2 output theres a e
//if 7 high when 3 output theres a f
//if 1 high when 8 output theres a g
//if 6 high theres a H
//if 7 high when 8 output theres a i

//pins 1, 2, 3, 4, 6, 7, 8 all need pull downs
//pin 5 is = 5vdc (not a input)

#define  pin1 2
#define  pin2 3
#define  pin3 4
#define  pin4 5

#define  pin6 7
#define  pin7 8
#define  pin8 9

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (pin1, INPUT);
pinMode (pin2, INPUT);
pinMode (pin3, INPUT);
pinMode (pin4, INPUT);
pinMode (pin6, INPUT);
pinMode (pin7, INPUT);
pinMode (pin8, INPUT);
}

void loop() {
// put your main code here, to run repeatedly
Serial.println("start of key scan");
pinMode (pin2, OUTPUT);
digitalWrite(pin2, HIGH);
if (digitalRead (pin1) == HIGH) {
Serial.println("letter a is pressed");
}
if (digitalRead (pin2) == HIGH) {
Serial.println("letter b is pressed");
}
if (digitalRead (pin3) == HIGH) {
Serial.println("letter c is pressed");
}
if (digitalRead (pin8) == HIGH) {
Serial.println("letter d is pressed");
}
if (digitalRead (pin7) == HIGH) {
Serial.println("letter e is pressed");
}
pinMode (pin2, INPUT);

pinMode (pin3, OUTPUT);
digitalWrite(pin3, HIGH);
if (digitalRead (pin7) == HIGH) {
Serial.println("letter f is pressed");
}
pinMode (pin2, INPUT);

pinMode (pin8, OUTPUT);
digitalWrite(pin8, HIGH);
if (digitalRead (pin1) == HIGH) {
Serial.println("letter g is pressed");
}
if (digitalRead (pin6) == HIGH) {
Serial.println("letter h is pressed");
}
if (digitalRead (pin7) == HIGH) {
Serial.println("letter i is pressed");
}
pinMode (pin8, INPUT);
Serial.println("end of key scan");
}
``````

bored waiting on the hurricane so I proto typed the circuit and john is spot on when it comes to certain combinations of keys leading to a key showing up as pressed when its not. Now I see what john was pointing out I can see no way to deal with it with out adding more hardware.

gpop1: op if you have the keypad and some 10k resistors to make pulldowns on the 7 input pins can you run this and see what happens please.

``````//a 11000000
//b 00011000//+5v on pin 5 hardwired
//c 01100000
//d 01000001
//e 01000010
//f 00100010
//g 10000001
//h 00001100
//i 00000011
``````

//if 1 high when 2 output theres a A //if 4 high theres a B //if 3 high when 2 output theres a c //if 8 high when 2 output theres a d //if 7 high when 2 output theres a e //if 7 high when 3 output theres a f //if 1 high when 8 output theres a g //if 6 high theres a H //if 7 high when 8 output theres a i

//pins 1, 2, 3, 4, 6, 7, 8 all need pull downs //pin 5 is = 5vdc (not a input)

define  pin8 9

void setup() {   // put your setup code here, to run once:   Serial.begin(9600);   pinMode (pin1, INPUT);   pinMode (pin2, INPUT);   pinMode (pin3, INPUT);   pinMode (pin4, INPUT);   pinMode (pin6, INPUT);   pinMode (pin7, INPUT);   pinMode (pin8, INPUT); }

void loop() {   // put your main code here, to run repeatedly   Serial.println("start of key scan");   pinMode (pin2, OUTPUT);   digitalWrite(pin2, HIGH);   if (digitalRead (pin1) == HIGH) {     Serial.println("letter a is pressed");   }   if (digitalRead (pin2) == HIGH) {     Serial.println("letter b is pressed");   }   if (digitalRead (pin3) == HIGH) {     Serial.println("letter c is pressed");   }   if (digitalRead (pin8) == HIGH) {     Serial.println("letter d is pressed");   }   if (digitalRead (pin7) == HIGH) {     Serial.println("letter e is pressed");   }   pinMode (pin2, INPUT);

pinMode (pin3, OUTPUT);   digitalWrite(pin3, HIGH);   if (digitalRead (pin7) == HIGH) {     Serial.println("letter f is pressed");   }   pinMode (pin2, INPUT);

pinMode (pin8, OUTPUT);   digitalWrite(pin8, HIGH);   if (digitalRead (pin1) == HIGH) {     Serial.println("letter g is pressed");   }   if (digitalRead (pin6) == HIGH) {     Serial.println("letter h is pressed");   }   if (digitalRead (pin7) == HIGH) {     Serial.println("letter i is pressed");   }   pinMode (pin8, INPUT);   Serial.println("end of key scan"); }

i will get to this back on monday, (there's only 1 keypad for available for testing and we take turns on having it,). Thank you soo much for your time, really much appreciated.

Hi, Where did the keypad come from?

Tom.. :)

TomGeorge: Hi, Where did the keypad come from?

Tom.. :)

I believe it was a device used in the construction field. It was salvaged from the device, why? Does it seem familiar to you?