4x3 Telephone keypad repurposing

Extracted this keypad from a landline phone, found a schematic and wired it to an ESP8266. These are DTMF matrix keypads and they are usually wired like this


Example ESPhome YAML using as alarm keypad, seems to work well. still need to figure out waking up from deep sleep for battery-powered applications.

matrix_keypad:
  id: mykeypad
  rows:
    - pin: D1 #row 1
    - pin: D6 #row 2
    - pin: D5 #row 3
    - pin: D3 #row 4
  columns:
    - pin: D2 #col 1
    - pin: D0 #col 2
    - pin: D4 #col 3
  #keys: "56890#"
  keys: "123456789*0#"
  has_diodes: false
  on_key:
    - lambda: ESP_LOGI("KEY", "key %d pressed", x);

key_collector:
  - id: pincode_reader
    source_id: mykeypad
    min_length: 4
    max_length: 4
    end_keys: "#"
    end_key_required: true
    back_keys: "*"
    clear_keys: "C"
    allowed_keys: "0123456789"
    timeout: 5s
    on_progress:
      - if: 
          condition: 
            lambda: 'return x == "0";'
          then:
            - homeassistant.service:
                  service: alarmo.arm
                  data:
                    entity_id: alarm_control_panel.alarmo
                    force: 'true'

    on_result:
      - logger.log:
          format: "input result: '%s', started by '%c', ended by '%c'"
          args: [ 'x.c_str()', "(start == 0 ? '~' : start)", "(end == 0 ? '~' : end)" ]
      - homeassistant.action:
          action: alarmo.disarm
          data:
            entity_id: alarm_control_panel.alarmo
            code: !lambda 'return x.c_str();'
1 Like

I used a couple of 4x3 keypads for a Halloween prop, but you would be disappointed with deep sleep. When waking from deep sleep, the ESP has to reconnect with your WiFi, which could take a few seconds. My keyboard was powered for the whole event. A 9V battery went into a 3.3V regulator which powered a Wemos D1 Mini. It lasted for the three-hour event.

I think it maybe okay for an alarm keypad, especially if I make it beep when connected to wifi, but even with fast_connect for wifi, it takes 2 seconds.