Hi everyone. I’ve been struggling with an issue for a few days and I can’t seem to figure it out. I’m trying to connect a 3×4 membrane keypad to a PCF8574 IO expander, which is connected to my LilyGo T7 S3 via Stemma QT.
The keypad wiring is correct — if I connect the keypad directly to the board, it works without any problems. However, when I connect it through the PCF8574 over I2C, nothing happens. The I2C address is set correctly, but I don’t see any logs or key events when I press the keypad buttons. I’m still very new to this, so please bear with me. (I know nothing about pullups, pulldowns for example?)
I can confirm that the PCF8574 itself is working, because if I connect a simple button to one of its pins, I do get logs when pressing it. Does anyone have an idea of what I might be missing?
Here is my minimal YAML which I use for testing.
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
esphome:
name: testingKeyboard
name_add_mac_suffix: true
logger:
level: DEBUG
matrix_keypad:
id: mykeypad
rows:
- pin:
pcf8574: expander_keypad
number: 1
- pin:
pcf8574: expander_keypad
number: 6
- pin:
pcf8574: expander_keypad
number: 5
- pin:
pcf8574: expander_keypad
number: 3
columns:
- pin:
pcf8574: expander_keypad
number: 2
- pin:
pcf8574: expander_keypad
number: 0
- pin:
pcf8574: expander_keypad
number: 4
keys: "123456789*0#"
has_diodes: false
on_key:
- lambda: |-
ESP_LOGI("Keypad", "Key pressed: %c", x);
i2c:
- id: bus_a
sda: GPIO14
scl: GPIO13
frequency: 100kHz
scan: true
pcf8574:
- id: expander_keypad
address: 0x24
i2c_id: bus_a
pcf8575: false