BTT Panda Touch - espHome HA dashboard conversion

I’m sure most owners of these BTT Panda Touch devices have been looking at other uses after the drama with Bambu Labs. I’ve used espHome to make a dashboard for my HA:

I recommend backing up your BTT firmware using esptool or the recovery software on the Panda Touch github repo before flashing in case something goes horribly wrong. You will need to initially flash esphome using the USB C port that is on the back of the magnetic mounting dock.

Here is a basic config to get you started with making your own dashboard. You can use this to test the display and touch screen as well. You should be presented with this test screen:

Then it’s just a matter of building your own custom LVGL dashboard! With any luck though this will be made easier with ESP Screens, providing its possible to support the board.

esphome:
  name: panda_touch
  friendly_name: Panda Touch HA Dashboard

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
  variant: ESP32S3

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key

ota:
  - platform: esphome
    password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test Fallback Hotspot"
    password: ""

captive_portal:

i2c:
  - id: i2c_0 # this bus is for the touchscreen
    scl: GPIO1
    sda: GPIO2
  - id: i2c_1 # this bus is for the add on connector
    scl: GPIO3
    sda: GPIO4

psram:
  mode: octal
  speed: 80MHZ

display:
  - platform: mipi_rgb
    id: Panda_Touch
    model: RPI
    update_interval: never
    auto_clear_enabled: false
    data_pins:
      blue:
        - 17
        - 18
        - 48
        - 47
        - 39
      green: 
        - 11
        - 12
        - 13
        - 14
        - 15
        - 16
      red: 
        - 6
        - 7
        - 8
        - 9
        - 10
    de_pin:
      number: GPIO38
    dimensions:
      height: 480
      width: 800
    pclk_pin:
      number: GPIO5
    reset_pin: GPIO46
    show_test_card: false
    pclk_frequency: 14800000Hz
    hsync_back_porch: 16
    hsync_front_porch: 16
    vsync_back_porch: 32
    vsync_front_porch: 32
    use_axis_flips: false

touchscreen:
  - platform: gt911
    id: touchscreen_0
    i2c_id: i2c_0
    reset_pin: GPIO41
    interrupt_pin: GPIO40

usb_host:
output: #output pin for the screen backlight
  - platform: ledc
    id: display_backlight
    pin: GPIO21
    max_power: "0.3"
    frequency: 30000Hz

light:
  - platform: monochromatic
    output: display_backlight
    name: Panda Touch Backlight
    restore_mode: ALWAYS_ON

image: #  grab some icons for the test button
  - platform: file
    file: mdi:lightbulb
    id: lightbulb
    type: GRAYSCALE
    transparency: alpha_channel
    resize: 80x80
  - platform: file
    file: mdi:lightbulb-on
    id: lightbulb_on
    type: GRAYSCALE
    transparency: alpha_channel
    resize: 80x80
lvgl:
  pages:
    - id: page_1
      bg_color: 0x111827
      pad_all: 0
      scrollbar_mode: "OFF"
      widgets:
        - obj:
            id: lv_obj_1
            x: 20
            y: 15
            width: 200
            height: 205
            bg_color: 0x000000
            pad_all: 0
            widgets:
              - image:
                  id: light_bulb
                  x: 58
                  y: 20
                  width: 80
                  height: 80
                  pad_all: 0
                  src: lightbulb
                  image_recolor: white
                  on_click:
                    then:
                      - lvgl.image.update: 
                          id: light_bulb
                          src: lightbulb_on
                          # image_recolor: yellow
              - label:
                  id: lv_label_3
                  x: 11
                  y: 120
                  text: "Tap to test Touchscreen"
                  text_color: 0xFFFFFF

        - slider:
            id: lv_slider_4
            x: 30
            y: 175
            width: 180
            height: 10
            value: 50
            min_value: 0
            max_value: 100
            radius: 9999