Skip to content

Instantly share code, notes, and snippets.

@bgulla
Created March 1, 2026 03:01
Show Gist options
  • Select an option

  • Save bgulla/116f187d5b39bdd196fab92e74959e9e to your computer and use it in GitHub Desktop.

Select an option

Save bgulla/116f187d5b39bdd196fab92e74959e9e to your computer and use it in GitHub Desktop.
ESP32-c3 SH1106 4-Button Adafruit Keypad
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
output_power: 8.5dB
power_save_mode: none
i2c:
sda: GPIO5
scl: GPIO6
# sda: GPIO6
# scl: GPIO7
scan: true
font:
- file: "gfonts://Roboto"
id: roboto_16
size: 16
- file: "gfonts://Roboto"
id: roboto_12
size: 12
display:
- platform: ssd1306_i2c
model: "SH1106 128x64"
address: 0x3C
update_interval: 1s
lambda: |-
it.printf(0, 0, id(roboto_16), "Hello!");
it.printf(0, 20, id(roboto_12), "IP: %s", id(wifi_ip).state.c_str());
it.printf(0, 40, id(roboto_12), "Uptime: %.0fs", id(uptime_sensor).state);
sensor:
- platform: uptime
name: "Uptime"
id: uptime_sensor
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
text_sensor:
- platform: wifi_info
ip_address:
name: "IP Address"
id: wifi_ip
binary_sensor:
- platform: gpio
pin:
number: GPIO1
mode:
input: true
pullup: true
inverted: true
name: "Button 2"
on_press:
- logger.log: "Button 2 pressed"
on_release:
- logger.log: "Button 2 released"
- platform: gpio
pin:
number: GPIO4
mode:
input: true
pullup: true
inverted: true
name: "Button 1"
on_press:
- logger.log: "Button 1 pressed"
on_release:
- logger.log: "Button 1 released"
- platform: gpio
pin:
number: GPIO3
mode:
input: true
pullup: true
inverted: true
name: "Button 4"
on_press:
- logger.log: "Button 4 pressed"
on_release:
- logger.log: "Button 4 released"
- platform: gpio
pin:
number: GPIO10
mode:
input: true
pullup: true
inverted: true
name: "Button 3"
on_press:
- logger.log: "Button 3 pressed"
on_release:
- logger.log: "Button 3 released"
# USB
# ┌───────────────────┐
# │ GPIO5 ○─SDA(OLED) ○ 5V │
# │ GPIO6 ○─SCL(OLED) ○ GND ○──── Brown (COM/Keypad) + GND(OLED)
# │ GPIO7 ○ ○ 3.3 ○──── VCC (OLED)
# │ GPIO8 ○ ○ GPIO4○──── Gray (Btn1)
# │ GPIO9 ○ ○ GPIO3○──── White (Btn4)
# │ GPIO10○─Black(Btn3)○ GPIO2○──── Purple(Btn2)
# │ GPIO20○ ○ GPIO1│
# │ GPIO21○ ○ GPIO0│
# └───────────────────┘
# OLED
# ┌─────────────────┐
# │ GND SCL SDA VCC │
# └─────────────────┘
# │ │ │ │
# GND GPIO6 GPIO5 3.3V
# KEYPAD CONNECTOR
# ┌────────────────────────────┐
# │ 1 2 3 4 5│
# │Purple Gray White Black Brown
# │ Btn2 Btn1 Btn4 Btn3 COM
# └────────────────────────────┘
# │ │ │ │ │
# GPIO2 GPIO4 GPIO3 GPIO10 GND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment