EspHoMaTriX: A simple clock/status display

Thank you.
Looking forward to 2023.3.5.

Me too, but there is a problem with the 8x32 version and esp8266 boards. I think its a problem with RAM. I have to figure out before the release.

Wemos D1 mini here so let me know if I can help doing some beta testing.

I saw 2023.3.5 is available.
Downloaded and testing.
May I suggest you add to changelog and readme that now services use “lifetime” instead of “duration”?
And it looks “alarm: true” or “alarm: false” is also mandatory.
Thanks!

You’re right, the naming an documentation is a mess. I will streamline it in the 2023.4.0 version. Which will cause a lot of breaking changes. But i thing it is worth it.

1 Like

Hi!

I just noticed “show_seconds” is a service and not a variable you set under “ehmt” section in yaml. I thought it might be worth to say as I initially tried the variable way.

I have also tried to test 8x32 icons with “force_screen” service but it didn’t work. Nevertheless, “add_screen” works if you place a blank space in “text” field.

Any suggestion to make “force_screen” work?

Thanks!

Hi!

i know the documentation and the code is a big patchwork. So i started to clean everything up. In the upcoming release 2023.4.0 there will be a better documentation and a more structured naming scheme.

You can read the documention here: GitHub - lubeda/EsphoMaTrix at 2023.4.0
There is an update section for all users of the actual version till 2023.3.5

or try the new branch “2023.4.0”

The brave and fearless users can try it now.

3 Likes

I like it! Going to wait until I get a new 3-d printer though, my current one is an entry level machine, what i like about the kit is it also comes with the black acrylic, and since I don’t own a laser cutter this is a nice add-on.

You sir are a scholar and a gentleman

I bought one of these pre-made kits off AliExpress and the results are great!

https://www.aliexpress.us/item/3256802826131110.html
Smart Pixel Clock Awtrix Pro Maker Creative Color LED Complete set of finished shell product size 328x88x50mm

The kit comes with a nice PCB, touch sensors, ESP8266 and 8x32 LED matrix and a USB power supply and cord. I already had the matrix so I just bought the shell option which doesn’t include the ESP or LEDs.

One fun feature is the DFPlayer Mini MP3 player which enables limitless possibilities for sound notifications. I tested it and it works great! Here is a mostly complete config for this kit. I don’t yet have the luminosity sensor working, and I didn’t put in a battery or temp/humidity sensor either.

Here is the code in case anyone else gets one of these kits. The build quality is really good, it would be difficult to build this yourself cheaper than what the vendor charges:

esphome:
  name: esphomatrix
  friendly_name: ESPHoMaTrix
  on_boot:
    priority: -100
    # ...
    then:
      # - lambda: !lambda |-
      #     id(rgb8x32)->show_all_icons();
      - ehmtx.text.color:
          id: rgb8x32
          red: !lambda return 200;
          blue: !lambda return 170;
      - ehmtx.today.color:
          id: rgb8x32
          red: !lambda return 10;
          green: !lambda return 250;
      - ehmtx.clock.color:
          id: rgb8x32
          red: !lambda return 50;
          green: !lambda return 150;
          blue: !lambda return 230;
      - ehmtx.weekday.color:
          id: rgb8x32
          red: !lambda return 200;
          green: !lambda return 200;
          blue: !lambda return 200;

substitutions:
  devicename: ehmtx8266
  ledpin: GPIO4
  left_button_pin: GPIO16
  mid_button_pin: GPIO2
  right_button_pin: GPIO15
  dfplayer_tx_pin: GPIO14
  dfplayer_rx_pin: GPIO13
  ldr_pin: A0
  board: esp01_1m
  loglevel: DEBUG

esp8266:
  board: $board

# Enable logging
logger:

# DFPlayer Mini
uart:
  tx_pin: $dfplayer_tx_pin
  rx_pin: $dfplayer_rx_pin
  baud_rate: 9600

dfplayer:
  on_finished_playback:
    then:
      logger.log: 'Playback finished event'

# Enable Home Assistant API
api:
  encryption:
    key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  services:
    - service: alarm
      variables:
        icon_name: string
        text: string
      then:
        lambda: |-
          id(rgb8x32)->add_screen(icon_name,text,7,20,true);
          id(rgb8x32)->force_screen(icon_name);
    - service: screen
      variables:
        icon_name: string
        text: string
      then:
        - ehmtx.add.screen:
            id: rgb8x32
            text: !lambda return text;
            icon_name: !lambda return icon_name;
            alarm: false
    - service: brightness
      variables:
        brightness: int
      then:
        lambda: |-
          id(rgb8x32)->set_brightness(brightness);
    - service: status
      then:
        lambda: |-
          id(rgb8x32)->get_status();
    - service: dfplayer_next
      then:
        - dfplayer.play_next:
    - service: dfplayer_previous
      then:
        - dfplayer.play_previous:
    - service: dfplayer_play
      variables:
        file: int
      then:
        - dfplayer.play: !lambda 'return file;'
    - service: dfplayer_play_loop
      variables:
        file: int
        loop_: bool
      then:
        - dfplayer.play:
            file: !lambda 'return file;'
            loop: !lambda 'return loop_;'
    - service: dfplayer_play_folder
      variables:
        folder: int
        file: int
      then:
        - dfplayer.play_folder:
            folder: !lambda 'return folder;'
            file: !lambda 'return file;'

    - service: dfplayer_play_loop_folder
      variables:
        folder: int
      then:
        - dfplayer.play_folder:
            folder: !lambda 'return folder;'
            loop: true

    - service: dfplayer_set_device_tf
      then:
        - dfplayer.set_device: TF_CARD

    - service: dfplayer_set_device_usb
      then:
        - dfplayer.set_device: USB

    - service: dfplayer_set_volume
      variables:
        volume: int
      then:
        - dfplayer.set_volume: !lambda 'return volume;'
    - service: dfplayer_set_eq
      variables:
        preset: int
      then:
        - dfplayer.set_eq: !lambda 'return static_cast<dfplayer::EqPreset>(preset);'

    - service: dfplayer_sleep
      then:
        - dfplayer.sleep

    - service: dfplayer_reset
      then:
        - dfplayer.reset

    - service: dfplayer_start
      then:
        - dfplayer.start

    - service: dfplayer_pause
      then:
        - dfplayer.pause

    - service: dfplayer_stop
      then:
        - dfplayer.stop

    - service: dfplayer_random
      then:
        - dfplayer.random

    - service: dfplayer_volume_up
      then:
        - dfplayer.volume_up

    - service: dfplayer_volume_down
      then:
        - dfplayer.volume_down

ota:
  password: "XXXXXXXXXXXXXXXXXXXX"

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

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

web_server:
  port: 80

captive_portal:

external_components:
  - source:
      type: git
      url: https://github.com/lubeda/EsphoMaTrix

binary_sensor:
  - platform: status
    name: "$devicename Status"
  - platform: gpio
    pin:
      number: $left_button_pin
      mode:
        input: true
    name: "$devicename left button"
  - platform: gpio
    pin: 
      number: $mid_button_pin
      mode:
        input: true
      inverted: true
    name: "$devicename middle button"
  - platform: gpio
    pin: 
      number: $right_button_pin
      mode:
        input: true
    name: "$devicename right button"

sensor:
  - platform: adc
    id: light_sensor
    name: "$devicename Illuminance"
    pin: $ldr_pin
    update_interval: 10s
    unit_of_measurement: lx
    accuracy_decimals: 0
    filters:
      - lambda: |-
          return (x / 10000.0) * 2000000.0 - 15 ;

font: 
  - file: _fonts/MatrixClock-Light6.bdf
    id: ehmtx_font
    size: 16
    glyphs:  |
      !?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnĂ–Ă„ĂœĂ¶Ă€ĂŒopqrstuvwxyz$@<>/

light:
  - platform: neopixelbus
    id: ehmtx_light
    type: GRB
    variant: WS2812
    pin: $ledpin
    num_leds: 256
    color_correct: [75%, 75%, 75%]
    name: "$devicename Light"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      lambda: |-
         id(ehmtx_display)->set_enabled(false);
    on_turn_off:
       lambda: |-
         id(ehmtx_display)->set_enabled(true);
    effects:
      - addressable_random_twinkle:

number:
  - platform: template
    name: "LED brightness"
    min_value: 0
    max_value: 255
    step: 1
    lambda: |-
      return id(rgb8x32)->get_brightness();
    set_action:
      lambda: |-
        id(rgb8x32)->set_brightness(x);

switch:
  - platform: template
    name: "$devicename Display"
    icon: "mdi:power"
    restore_mode: ALWAYS_ON
    lambda: |-
      return id(rgb8x32)->show_display;
    turn_on_action:
      lambda: |-
        id(rgb8x32)->set_display_on();
    turn_off_action:
      lambda: |-
        id(rgb8x32)->set_display_off();
                
time:
  - platform: homeassistant
    id: ehmtx_time

display:
  - platform: addressable_light
    id: ehmtx_display
    addressable_light_id: ehmtx_light
    width: 32
    height: 8
    pixel_mapper: |-
      if (x % 2 == 0) {
        return (x * 8) + y;
      }
      return (x * 8) + (7 - y);
    rotation: 0°
    update_interval: 16ms
    auto_clear_enabled: true
    lambda: |-
      id(rgb8x32)->tick();
      id(rgb8x32)->draw();

ehmtx:
  id: rgb8x32
  time_component: ehmtx_time
  matrix_component: ehmtx_display
  yoffset: 7
  xoffset: 1
  clock_time:  20      # seconds
  screen_time: 30      # seconds
  font_id: ehmtx_font
  show_dow: true      # day of week
  show_date: true     # also show the date
  icons2html: true    # generate html with con overview
  brightness: 80      # percent
  time_format: "%H:%M"
  date_format: "%m.%d."
  week_start_monday: false # false equals sunday
  scroll_count: 2     # scroll long text at least two times
  scroll_interval: 80 # milliseconds
  frame_interval: 192 # milliseconds
  icons: 
    # UI Elements and Events
    - url: https://developer.lametric.com/content/apps/icon_thumbs/4786
      id: error
    - url: https://developer.lametric.com/content/apps/icon_thumbs/59
      id: check
    - url: https://developer.lametric.com/content/apps/icon_thumbs/270
      id: x

Here is how you play MP3s. The folders and file names all have to be numbers so you might want to keep a spreadsheet to keep track of what your sounds are:

1 Like

Hi, the dfplayer is nice, but with an I2S audio adapter you can play what everyou want, even tts, with your device. By the way, the like does not work in germany.

Greetings.

Thanks @lubeda. Sorry the link doesn’t work in Germany. I can’t get to de.aliexpress.com because it forwards me back to the US site. Here is the vendor’s name and description if you want to try searching:

I’m not sure this device could be altered to support I2S since all the pins are already set on the PCB. You could of course build it without the PCB but it makes setup really easy!

1 Like

Hey,
Has anyone had an issue with EspHoMaTriX bricking the Ulanzi clock.

I flashed and installed on one clock, worked perfectly for 12 hours, then the clock froze and dropped off my network. No response to any button presses until I held the left and right to turn it off. Then wouldn’t turn back on at all. Put it down to hardware failure and ordered another only for exactly the same thing to happen on the replacement clock.
Neither now recognised as serial port on plugging in. Disassembled one to disconnect the battery and power cycle but didn’t help.
Is the power control not the same in the flashed firmware such that it is irretrievably turned off once you power down?
Is there a different way to turn it back on post flashing?
Can’t see otherwise why I would have bricked 2 after they had been working fine.

Thanks!

Hi,
i don’t think that any esphome code is able to brick an ulanzi. With my ulanzi I sometimes have the feeling that there are problems with the ram or flash. I’ve also heard from ulanzis that were defective upon delivery. At the end i flashed my ulanzi more then a hundred times and it is still working.

I’ve had no such issues. But @blakadder also mentioned the quality of the usb cable. He used another one when flashing.

Hey. Is anyone able to advise me how we can change the colour of the displayed text? I’m using the Ulanzi TC001 but i can’t see a way to change colours.

GitHub - lubeda/EspHoMaTriXv2: A simple DIY status display with a 8x32 RGB LED matrix, implemented with esphome.io and Home Assistant. this is the new “work in progress” version. You can even use text with a rainbow effect. See the GitHub page for details.

Let me first say that this is a fantastic project. You clearly have put a lot of effort into this, so thank you very much.

I’ve just started working with this on a Ulanzi clock in hopes that I could make it into a ‘continuous display’ for my daughter’s blood glucose monitor. I’ve had to trouble getting the basic data to display, but I was wondering if a couple of potential ‘enhancements’ to my particular use are possible.

  • Is there any way to add a second icon after the Text? Idealy, I’d like to have an illustration icon | her reading | a directional arrow for trend
  • Is there anyway to have an icon wider that 8x8? 8x12 would allow for some nicer looking icons for her.

Again, these are just ‘nice to have’ requests. I’m very happy with the results regardless. Thanks again.

Hi,
a second icon on the right is a very special request, but what about a font with an up and down arrow? Or in the upcoming version there are two “indicators” on the right side. see image
I will think about other ways to help.
elements

Thanks for the quick response. I had looked at using alt codes, but I couldn’t find angled icons to indicate the slightly increasing or decreasing trends from her monitor.

Again, don’t worry to much about it. For now I have it as the main icon that sometimes gets replaced by event icons. This really meets 95% of our needs. Thanks for looking at it though.