Matrix keypad library not working

Hey

I can’t seem to get keypad library to work. Pic represents hookup, hellokeypad example configured for my pinout as posted. I have no idea what could be wrong, if i simply write my own code, it works fine. Lib version is 2.0, latest is 2.1 which doesn’t work either. Ow and, i did continuity check on all pins, and everything is as it should. Any help or ideas would be greatly appreciated. Cheers, Val

http://freepicupload.com/images/413keypad_matrix.png

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {29, 34, 33, 31}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {30, 28, 32}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
}
  
void loop(){
  char key = keypad.getKey();
  
  if (key){
    Serial.println(key);
  }
}

Hey

I’m really sorry for misleading, but apparently i’ve made a mistake, my own code doesn’t work either (i only tested one pin before…).

Either way, i’ve tried A LOT of things in the past few days and here is what i’ve diagnosed. If i connect any pin to 5V, ALL the other pins get 5V on them (or a little less due to resistance, less voltage the more the pins are separated). Now the problem is, there is NO short circuits, i’ve checked 10 times. So my question is, how the hell is that possible! Any ideas would be greatly appreciated, since i have NO idea what else could be wrong…

Thank you for any help again. Cheers, Val

I believe the first problem you have is the resistors you added. The keypad is scanned by enabling the internal pullups and thereby creating a logic HIGH on the pins to be read. Then a logic low is output on each column pin (one by one) and the row pins read. If a key is pushed, it should produce a logic LOW on the coresponding row pin. With 8k of resistance and a 20k pullup, that’ll make a tad under 1.5V at the pin … which may not be enough to produce a LOW. Ditch the resistors or at least make them all 1k (if you think you need them).

As for the 5V you read on every pin … I don’t know what to say. What were the test conditions ? Was this with the keypad completely separated from the Arduino ? Or ???

Hey

Thank you for your reply! I’ve tried without the resistors already, same problem… But thank you for explaining.

As for the test conditions. I hooked up one pin on the keyboard to arduino’s Vcc, the rest of the pins were completely disconnected from anything. Then i used my multimeter to measure voltage on pins, and i used arduino’s GND for the other lead. Really, i have no idea either, how the hell is that possible, no short circuits, and if i do a continuity check with my multimeter, everything works as it should…

Idk, i think i’m gonna have to buy a new keypad, cause this is getting pretty lame… Cheers, Val

Hey!

SOLVED!

It was a soldering problem, still no idea where lol. Anyway, i resoldered the header pins and everything is working fine, finally! I think the header pins might have been a bit too short for the protoboard before, causing unreliable connections… Tho that is really weird, since i did continuity checks and everything seemed fine…

Cheers, Val