Square Displays
"Square" displays are better fit for displaying QR Codes than more common "Rectangular" displays, here we focus on 1.5" 128x128 versions with IIC or SPI interfaces.
Above image shows a display with SH1107 controller and I2C bus.
Some suitable controllers:
1. Waveshare
Waveshare has two 1.5" OLED offering based on different controllers SSD1327 and SH1107.
1.1. SSD1327
- https://www.waveshare.com/1.5inch-oled-module.htm
- https://www.waveshare.com/wiki/1.5inch_OLED_Module
- SSD1327 OLED Display — ESPHome
- SSD1327.pdf (477.0 KB)
1.2. SH1107
- 1.5inch OLED Display Module, 128×128 Resolution, SPI / I2C Communication, Black / White Display Color | 1.5inch OLED Module (B)
- https://www.waveshare.com/wiki/1.5inch_OLED_Module_(B)
- SSD1306 OLED Display — ESPHome
- SH1107.pdf (491.0 KB)
2. QR Code
Displaying QR Code on 128x128 SH1107
2.1. EspHome
- Display Component — ESPHome
- Set a specific size (in pixels) for QR codes · Issue #2349 · esphome/feature-requests · GitHub
- Support for SH1107 · Issue #2913 · esphome/issues · GitHub
- Using Home Assitant sensor state as value for QR - ESPHome - Home Assistant Community
substitutions: #substitute your own values in this section
untappd : sensor.tap_1_untappd #entity from Home Assistant
text_sensor:
- platform: homeassistant
id: beer_untappd
entity_id: $untappd
internal: true
qr_code:
- id: untappd_qr
value: beer_untappd
display:
platform: ssd1306_spi
model: "SH1107 128X128"
spi_id: bus_a
cs_pin: GPIO0
dc_pin: GPIO2
reset_pin: GPIO4
lambda: |-
// Print QR code for Untappd
untappd_qr->set_value(id(beer_untappd).state.c_str()); // <-- this line fills the value from the text sensor
it.qr_code(20, 150, id(untappd_qr), Color(255,255,255), 4);
Note
- i2c - I²C Bus — ESPHome
- spi - SPI Bus — ESPHome