shorting across analog channels on adafruit board with keypad?

my 4 row by 3 column i2c keypad works 100% fine on a test adalogger board but on my main unit (which has lots of wiring added) when I press a '6' I read a '3' nb the keypad layout is 123 456 789 *0#

my mapping is as follows:

byte colPins[COLS] = {A1, A2, A3}; 
byte rowPins[ROWS] = {A4, A5, 5,6};

so a keypad '#6' should be registered by column 3 + row 2 however it's registering as column 3 + row 1

interestingly '#4' and '#5' on row 2 register fine.

I'm guessing my soldering wasn't great (this is my first arduino project)

I don't want to start from scratch (don't have time) so I was hoping someone might be able to suggest a workaround?

Can I insert a component (resistor?) somewhere to stop the 6 being read as a 3?

Digital channel 9 is free - am I best to switch to using that?

I'd have to deconstruct the unit to do so so I'd rather try something at the keypad end rather than on the adalogger if possible !

Many thanks, John

What happens when pressing #3 and #9?

You’re going to have to dig into the problem further to make sure the solution does not move the problem to make it worse.

and please post the full code

Thanks for the responses and sorry for not being clearer. All other keypresses work (so 3 is 3 and 9 is 9)

Occassionally 6 correctly yields a 6 but more commonly it incorrectly gives a 3.

This code snippet replicates the problem

#include "Arduino.h"
#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 colPins[COLS] = {A1, A2, A3}; //connect to the column pinouts of the keypad
byte rowPins[ROWS] = {A4, A5, 5,6}; //connect to the row pinouts of the keypad: r1, r2, r3,r4


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

void setup(){
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);  // 3rd column (3,6,9,#)
  pinMode(A4, INPUT);
  pinMode(A5, INPUT);
  Serial.begin(38400);
  while (!Serial){
    ;   // wait for USB to Serial chip to be ready
  }
}

  
void loop(){
  char key = keypad.getKey();

  if (key != NO_KEY){
    Serial.println(key);
    delay(200);
  }
}

I should also say that I did clean flux residue off with IPA.

Thanks again,
John

Hey John, could you post a picture of the soldering you did ?

Deva_Rishi:
Hey John, could you post a picture of the soldering you did ?

That would be tricky - its a three layer unit, adalogger base, then an adafeather proto with an OLED unit on top. - I think the problem may be that there is residual flux under the female headers that I put on the adalogger. I used IPA to clean up the parts of the PCB I could access.

The resistance between all the keyboard pins is in the 400ko to 600ko for all combinatinos except to the column3 x row 1 pair which is down at 250ko so I’m thinking that sometimes the col3 x row2 pairing (ie for #6) is being detected as col3 x row 1 (ie for #3)

So I was wondering if I just a ~100ko resistor inline on the column 3 terminal whether that might fix it?

Any thoughts?

Thanks,
John

The problem with fixing it the way you suggest is that the cause might not be what you think it is and it might not remain the same over time. A partial short might become a complete short or might go away completely. There might be a badly soldered connection. I understand why you don't want to take your project apart to fox this, but really, that's what you must do to get a reliable fix.

PerryBebbington:
The problem with fixing it the way you suggest is that the cause might not be what you think it is and it might not remain the same over time. A partial short might become a complete short or might go away completely. There might be a badly soldered connection. I understand why you don't want to take your project apart to fox this, but really, that's what you must do to get a reliable fix.

Thanks for your feedback Perry. That seems reasonable and was what I feared however I wondered/hoped that there might have been a workaround that might have helped by reducing the chances of it happening.