Has anyone managed to get ESPHOME to work successfully with a Pimoroni Badger 2040W? And able to give me some pointers?
I’ve got some basic code working with the Pi Pico but I haven’t found a combination to make the display work yet.
# Display is 296 x 128 pixels
substitutions:
board: "rpipicow"
name: "pitest"
friendly_name: "Pi Test"
default_state: "RESTORE_DEFAULT_OFF"
ssid: "Pi Test Fallback"
clk_pin: GPIO18
mosi_pin: GPIO19
miso_pin: GPIO16 # Not required? see https://github.com/esphome/issues/issues/1462
cs_pin: GPIO17
dc_pin: GPIO20
busy_pin: GPIO26
reset_pin: GPIO21
model: "2.90inv2" #2.90in 2.90inv2 2.90inv2-r2 2.90in-b 2.90in-bV3
screen_refresh: "30" # This per screen update NOT a timer!
#full_update_every: "30"
update_interval: 10s
button_a: GPIO12
button_b: GPIO13
button_c: GPIO14
button_down: GPIO11
button_up: GPIO15
badger_led: GPIO22
pico_led: GPIO32 # ???Report of Pico LED being tied to WiFi???
esphome:
name: ${name}
friendly_name: ${friendly_name}
rp2040:
board: ${board}
framework:
# Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
logger:
packages:
api: !include ./common/api.yaml
ota: !include ./common/ota.yaml
wifi: !include ./common/wifi.yaml
time: !include ./common/time.yaml
common: !include ./common/globals.yaml
text_sensor:
- platform: homeassistant
name: "House state From Home Assistant"
entity_id: sensor.house_state
id: ha_house_state
spi:
clk_pin: ${clk_pin}
mosi_pin: ${mosi_pin}
miso_pin: ${miso_pin}
color:
- id: color_bg
red: 0%
green: 0%
blue: 0%
white: 0%
- id: color_text
red: 0%
green: 0%
blue: 0%
white: 100%
display:
- platform: waveshare_epaper
id: badger_w
cs_pin:
number: ${cs_pin}
inverted: true
dc_pin: ${dc_pin}
busy_pin:
number: ${busy_pin}
inverted: true
reset_pin:
number: ${reset_pin}
inverted: true
rotation: 270
model: ${model}
update_interval: ${update_interval}
# full_update_every: ${screen_refresh}
lambda: |-
it.fill(COLOR_ON);
char str[17];
time_t currTime = id(homeassistant_time).now().timestamp;
strftime(str, sizeof(str), "%H:%M", localtime(&currTime));
it.printf(20, 50, id(comic_sans), COLOR_OFF, "Time: %s", str);
font:
- file: 'fonts/Comic Sans.ttf'
id: comic_sans
size: 8
binary_sensor:
- platform: status
name: "Status"
id: device_status
- platform: gpio
pin:
number: ${button_a}
inverted: false
mode:
input: true
pulldown: true
name: "Button a"
on_press:
then:
- output.turn_on: badger_led
- component.update: badger_w
- delay: 0.5s
on_release:
then:
- output.turn_off: badger_led
- platform: gpio
pin:
number: ${button_b}
inverted: false
mode:
input: true
pulldown: true
name: "Button b"
on_press:
then:
- component.update: badger_w
- platform: gpio
pin:
number: ${button_c}
inverted: false
mode:
input: true
pulldown: true
name: "Button c"
on_press:
then:
- component.update: badger_w
- platform: gpio
pin:
number: ${button_up}
inverted: false
mode:
input: true
pulldown: true
name: "Button up"
on_press:
then:
- component.update: badger_w
- platform: gpio
pin:
number: ${button_down}
inverted: false
mode:
input: true
pulldown: true
name: "Button down"
on_press:
then:
- component.update: badger_w
output:
- platform: rp2040_pwm
pin: ${badger_led}
id: badger_led
- platform: gpio
pin: ${pico_led}
id: pico_led
light:
- platform: monochromatic
name: "Badger LED"
output: badger_led
- platform: binary
name: "Pico LED"
id: picow_led
output: pico_led
sensor:
- platform: internal_temperature
name: "Internal Temperature"
update_interval: 300s
id: processor_internal_temperature
button:
- platform: shutdown
name: "Shutdown"
- platform: restart
name: "Restart"
This is my current code, it’s been through a few changes but it’s where I am now. I’ve tried different display versions and pin inversions (from looking at the circuit diagram).
As it stands I do not any screen updates at all, the display remains as the Pimoroni examples. All the Pico inputs and outputs work as expected.
I get this error but I cannot find a solution despite reading a number of post referencing the error.
[10:14:00][E][waveshare_epaper:159]: Timeout while displaying image!
[10:14:00][W][component:237]: Component display took a long time for an operation (1015 ms).
[10:14:00][W][component:238]: Components should block for at most 30 ms.