Reusing a 18 key keypad driven by PCF8574T - how can it be possible?

Hello!

I have used some I2C matrix keypads before on the Arduino with I2C. But now, I’m trying to reuse an old piece of hardware which I would like to conserve the front panel for aesthetics.

The problem is, looking at the schematics, it seems to be 17 (+1 unused) keys in total, all of them connected to a PCF8574T chip. I tried to use the keypad_I2C library to no avail, since I get strange behaviour like misaligned rows.

The schematic of the keypad is as follows:

So, I understand that the matrix should be as this:

As you can see, there is a column that doesn’t have a pin connected. I suppose that maybe that row is triggered with a LOW input since instead of having a common input to the IC, it has a ground. But how can I implement this to the code? Any idea that could guide me would be appreciated :slight_smile:

Thank you very much!

1.png

It do not look that hard the PCF8574T had pullup on all signals.
Something like a 5 phase scan:

  1. All pins high, check p0-p3 (The grounded row)
  2. p4 Low all other high, check p0-p3
  3. p5 Low all other high, check p0-p3
  4. p6 Low all other high, check p0-p3
  5. p7 Low all other high, check p0-p3

Hi HKJ-lygte,

Thank you for your answer! I thought the same, but then that excludes using the keypad_i2c library right? Or is there a way?

Regards

DaniTD:
I thought the same, but then that excludes using the keypad_i2c library right? Or is there a way?

I do not know that library, I would just code it myself. It is not that hard to do.

Well, I think this maybe goes beyond my actual knowledge. Do you know what resources can I see to learn or some detailed example code of a similar work?

Thanks!

At the moment I’m using (although wrong, I know) the following code:

/*Probando Teclado I2C con integrado PCF8574 y Arduino UNO*/

//Añadimos las librerias
#include <Wire.h>
#include <Keypad_I2C.h>
#include <Keypad.h>

//Indicamos el numero de filas
const byte FILAS = 4;
//Indicamos el numero de columnas
const byte COLUMNAS = 5; 

//Indicamos como queremos que nos devuelva el valor de la tecla pulsada
char teclas[FILAS][COLUMNAS] = {
{'D','*','1','V','*'},
{'U','*','2','U','B'},
{'d','-','3','M','L'},
{'u','+','4','K','D'}
};

//Indicamos los pines de configuracion de filas y columnas
byte PinsFilas[FILAS] = {0,1,2,3}; 
byte PinsColumnas[COLUMNAS] = {7,7,6,5,4};

//Indicamos la direccion I2C de nuestro dispositivo, se puede modificar dependiendo de las conexiones A0,A1 y A2
//Mirar datasheet PCF8574
int i2caddress = 0x20;

Keypad_I2C kpd = Keypad_I2C( makeKeymap(teclas), PinsFilas, PinsColumnas, FILAS, COLUMNAS, i2caddress );

void setup()
{
  Serial.begin(9600); //Iniciamos configuracion serie para ver las teclas pulsadas
  kpd.begin();  //Iniciamos el teclado
}

void loop()
{
  char tecla = kpd.getKey();  //Asignamos el valor devuelto por el teclado a la variable tecla
  //Mostramos el valor por el monitor serie
  if (tecla)
  {
    Serial.println(tecla);
  }
}

It works reasonably but the problem comes with the buttons of the first column. The most part of time they work, but sometimes they show another of the keys of the same file I’m pressing. For example, if I press “D”, most of times it will show me on the serial port “D”, but sometimes it will show instead “1”, “V” or “*”.

Regards

Please go back to that last post and correct the “quote” of the code to “code” (the “</>” widget or just re-write the tags) using the “modify” option.

Paul__B:
Please go back to that last post and correct the “quote” of the code to “code” (the “</>” widget or just re-write the tags) using the “modify” option.

Solved, sorry!