4x4 keypad giving false readings on standalone 644P board

Hi all,
I made my own Atmega644P board. It has a USB port with a CH340G and everything. I'm trying to test out a 4x4 keypad with it. The fancy kind with a black case and actual buttons, not the flimsy membrane kind. Anyways, I tested it out with a small piece of test code given by Adafruit. The code reads inputs from the keypad and spits it out on the serial monitor. It worked properly, except the "A" key kept giving false readings even when I wasn't pressing it. Like, the serial monitor would print "A pressed" or "A released" like 10 times a second. Also, keys sharing the same row or column would also get A key readings mixed in with theirs. Meaning, if I pressed 2, which shares the same row as A, it would print out

2 pressed
A pressed
2 released
A released

or something like that in a different order. So, I thought my keypad was faulty.

However, testing out the exact same code on an Arduino Uno gives me perfect results. Obviously, since the Uno and 644P are different chips, I had to re-#define the pins in the code. I also had a 16x2 LCD connected as well, if that matters at all. I would like to know why, and how I can solve the issue on my DIY 644P board. I assume it has something to do with floating pins and internal pullup resistors?

Thanks everyone! Here's the test code I used. Pins are #defined for use on the Uno.

EDIT: the keypad now has the same issue on the Uno as well...

// Use this example with the Adafruit Keypad products.
// You'll need to know the Product ID for your keypad.
// Here's a summary:
//   * PID3844 4x4 Matrix Keypad
//   * PID3845 3x4 Matrix Keypad
//   * PID1824 3x4 Phone-style Matrix Keypad
//   * PID1332 Membrane 1x4 Keypad
//   * PID419  Membrane 3x4 Matrix Keypad

#include "Adafruit_Keypad.h"

// define your specific keypad here via PID
#define KEYPAD_PID3844
// define your pins here
// can ignore ones that don't apply
#define R1    2
#define R2    3
#define R3    4
#define R4    5
#define C1    8
#define C2    9
#define C3    10
#define C4    11
// leave this import after the above configuration
#include "keypad_config.h"

//initialize an instance of class NewKeypad
Adafruit_Keypad customKeypad = Adafruit_Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup() {

void loop() {
  // put your main code here, to run repeatedly:

    keypadEvent e = customKeypad.read();
    if(e.bit.EVENT == KEY_JUST_PRESSED) Serial.println(" pressed");
    else if(e.bit.EVENT == KEY_JUST_RELEASED) Serial.println(" released");


Maybe try with

I actually tried that version of the program as well, with no luck unfortunately. I think the problem's in my 644P board, not the code.

Now the keypad isn't working on the Uno as well... Same code, didn't change anything.

Aaaand now it's working again, on both devices. I think the keypad I bought is a little flaky.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.