#Cosplay prop testing

1 messages · Page 1 of 1 (latest)

mental elm
#

I'm kind of "abusing" ESPHome for this but it's somewhat easy to do prototyping, so I made a cosplay prop test with an ESP32 and a HUB75 matrix (with an external library) to make this work.
Couldn't figure out the random delay yet but so far it's random enough to not be visible lol

#

Next thing I want to try is to make it entirely usable offline too, with some more faces to choose from. This is supposed to be used on-the-go then and only updated at home, tho no idea where to start with a web interface yet lol.

magic crag
mental elm
magic crag
mental elm
#

Ah, yeah slightly :)
It's an older project already so not sure if it'd still work as it is right now, and it's probably very janky too as I don't know how to code properly.

But here's the script itself:

#
esphome:
  name: esphome-web-xxxxxx
  friendly_name: HUB75Matrix
  platformio_options:
    lib_deps:
      - SPI
      - Wire
      - Adafruit BusIO
      - adafruit/Adafruit GFX Library
      - https://github.com/TillFleisch/ESP32-HUB75-MatrixPanel-DMA#optional_logging

external_components:
  - source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

ota:

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-XXXXXX"
    password: "XXXXXXXXXXXXX"

captive_portal:

# -----------------------------------

globals:
  - id: pixel_x
    type: int
    restore_value: no
    initial_value: '0'
  - id: pixel_y
    type: int
    restore_value: no
    initial_value: '63'

image:
  - file: "blank.jpg"
    id: emptyimage

animation:
  - file: "images/proto_mockup/nose.gif"
    id: proto_nose
    type: RGBA
  - file: "images/proto_mockup/eye_right.gif"
    id: proto_eyeright_static
    type: RGBA
  - file: "images/proto_mockup/mouth.gif"
    id: proto_mouth
    type: RGBA
  # Eye Blink Animation
  - file: "images/proto_mockup/eye_right_blink.gif"
    id: proto_eyeright_blink
    type: RGBA

display:
  - platform: matrix_display
    id: matrix
    brightness: 255
    width: 64
    height: 64
    E_pin: 32
    lambda: |-
      //--- Protogen EYES
      id(proto_eyeright_static).set_frame(0);
      if (id(start_eyesblinkanimation).is_running()) {
        it.image(0, 0, id(proto_eyeright_blink), COLOR_ON);
      } else {
        it.image(0, 0, id(proto_eyeright_static), COLOR_ON);
      }

      //--- Protogen NOSE
      id(proto_nose).set_frame(0);
      it.image(it.get_width() -32, 0, id(proto_nose), COLOR_ON);

      //--- Protogen MOUTH
      id(proto_mouth).set_frame(0);
      it.image(0, 16, id(proto_mouth), COLOR_ON);

button:
  - platform: template
    id: proto_blink
    name: Eyes Blink
    on_press:
      then:
        - script.execute: start_eyesblinkanimation

interval:
  - interval: 10sec
    then:
      - script.execute: start_eyesblinkanimation
  - interval: 14sec
    then:
      - script.execute: start_eyesblinkanimation

script:
  # Starts a one time eye blink animation cycle
  - id: start_eyesblinkanimation
    then:
      - animation.set_frame:
          id: proto_eyeright_blink
          frame: 0
      - component.update: matrix
      - delay: 100ms
      - animation.next_frame: proto_eyeright_blink
      - component.update: matrix
      - delay: 100ms
      - animation.next_frame: proto_eyeright_blink
      - component.update: matrix
      - delay: 100ms
      - animation.set_frame:
          id: proto_eyeright_blink
          frame: 0

switch:
  - platform: matrix_display_switch
    matrix_id: matrix
    restore_mode: ALWAYS_ON
    name: "Power"
    id: power

number:
  - platform: matrix_display_brightness
    matrix_id: matrix
    name: "Brightness"
  - platform: template
    name: Pixel - Left Right
    id: hass_leftright_pixel
    icon: mdi:arrow-left-right
    mode: slider
    step: 1
    min_value: 0
    max_value: 63
    set_action:
      then:
        - globals.set:
            id: pixel_x
            value: !lambda return x;
        - component.update: matrix
  - platform: template
    name: Pixel - Up Down
    id: hass_updown_pixel
    icon: mdi:arrow-up-down
    mode: slider
    step: 1
    min_value: 0
    max_value: 63
    set_action:
      then:
        - globals.set:
            id: pixel_y
            value: !lambda return x;
        - component.update: matrix