feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Support for M5Stack AtomS3

Open wildekek opened this issue 2 years ago • 22 comments

Describe the problem you have/What new integration you would like

I would like the m5stack-atoms3 to be supported as a board, so I can easily create a config for it in ESPHome.

Please describe your use case for this integration and alternatives you've tried:

I have tried using esp32-s3-devkitc-1, but I'm running into warnings and issues that I think would be moot if we can support the proper board config.

Additional context

From platform-espressif32 6.1.0 there is support for M5Stack AtomS3 and we'll get support for many other boards too if ESPHome is updated to this version.

wildekek avatar Jul 29 '23 13:07 wildekek

We are on platformio 5.3.0, so nope. Maybe next year once we move to 6.... Anyway, how it will help you that you can select that board? There is no special pin mapping, board templates are basically the same https://github.com/platformio/platform-espressif32/blob/master/boards/esp32-s3-devkitc-1.json <> https://github.com/platformio/platform-espressif32/blob/master/boards/m5stack-atoms3.json , so there is no benefit of selecting "the right" board. I have that AtomS5 (well, the other with a display) on my desk and surprisingly I am running it with esp32-s3-devkitc-1 without any issue.

randybb avatar Jul 29 '23 20:07 randybb

The issues I experienced were unrelated and were gone after clearing the build cache. However! When the docs say ‘select a board from the following list’ and they don’t work, that’s a waste of time. Either they should link to the actual list, or better, a shim list could be in place with compatible boards.

wildekek avatar Jul 29 '23 22:07 wildekek

Here's my config for other people that have issues: https://github.com/wildekek/ESPHome-M5Stack-Atom-S3-Lite/blob/main/M5Stack-AtomS3-Lite.yaml

wildekek avatar Jul 30 '23 13:07 wildekek

Working config:

esphome:
  name: atom-s3
  friendly_name: atom-s3
  name_add_mac_suffix: false

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: esp-idf
    version: 4.4.5
    platform_version: 5.4.0

Another working config with m5stack-atoms3 board and newest libraries, but RMT LED doesn't work:

esphome:
  name: atom-s3
  friendly_name: atom-s3
  name_add_mac_suffix: false

esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.0.2
    platform_version: 6.3.2

Anonym-tsk avatar Aug 21 '23 10:08 Anonym-tsk

Tried this, didnt work for me...

Linking .pioenvs/atom-s3/firmware.elf
RAM:   [=         ]   9.6% (used 31420 bytes from 327680 bytes)
Flash: [====      ]  42.9% (used 786577 bytes from 1835008 bytes)
Building .pioenvs/atom-s3/firmware.bin
Creating esp32s3 image...
Successfully created esp32s3 image.
esp32_create_combined_bin([".pioenvs/atom-s3/firmware.bin"], [".pioenvs/atom-s3/firmware.elf"])
Wrote 0xd0200 bytes to file /Users/jdyer/.esphome/build/atom-s3/.pioenvs/atom-s3/firmware-factory.bin, ready to flash to offset 0x0
======================================================================================================== [SUCCESS] Took 58.90 seconds ========================================================================================================
INFO Successfully compiled program.
Found multiple options for uploading, please choose one:
  [1] /dev/cu.usbmodem1101 (USB JTAG/serial debug unit)
  [2] Over The Air (atom-s3.local)
(number): 1
esptool.py v4.6.2
Serial port /dev/cu.usbmodem1101
Connecting...
Chip is ESP32-S3 (revision v0.1)
Features: WiFi, BLE
Crystal is 40MHz
MAC: f4:12:fa:9e:2e:94
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 8MB
Flash will be erased from 0x00010000 to 0x000d0fff...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00009000 to 0x0000afff...
Compressed 786944 bytes to 517484...
Wrote 786944 bytes (517484 compressed) at 0x00010000 in 5.4 seconds (effective 1174.8 kbit/s)...
Hash of data verified.
Compressed 20528 bytes to 13054...
Wrote 20528 bytes (13054 compressed) at 0x00000000 in 0.4 seconds (effective 465.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 134...
Wrote 3072 bytes (134 compressed) at 0x00008000 in 0.1 seconds (effective 390.2 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 31...
Wrote 8192 bytes (31 compressed) at 0x00009000 in 0.1 seconds (effective 668.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/cu.usbmodem1101 with baud rate 115200
[13:35:41]I (139) esp_image: segment 1: paddr=00035610 vaddr=3fc95d00 size=03da4h ( 15780) load
[13:35:41]I (143) esp_image: segment 2: paddr=000393bc vaddr=40374000 size=06c5ch ( 27740) load
[13:35:41]I (151) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=8516ch (545132) map
[13:35:41]I (251) esp_image: segment 4: paddr=000c5194 vaddr=4037ac5c size=0b040h ( 45120) load
[13:35:41]I (269) boot: Loaded app from partition at offset 0x10000
[13:35:41]I (297) boot: Set actual ota_seq=1 in otadata[0]
[13:35:41]I (297) boot: Disabling RNG early entropy source...
[13:35:41]I (308) cpu_start: Pro cpu up.
[13:35:41]I (308) cpu_start: Starting app cpu, entry point is 0x40375bfc
[13:35:41]I (0) cpu_start: App cpu up.
[13:35:41]I (322) cpu_start: Pro cpu start user code
[13:35:41]I (322) cpu_start: cpu freq: 160000000 Hz
[13:35:41]I (323) cpu_start: Application information:
[13:35:41]I (325) cpu_start: Project name:     atom-s3
[13:35:41]I (330) cpu_start: App version:      2023.8.2
[13:35:41]I (335) cpu_start: Compile time:     Aug 22 2023 13:34:48
[13:35:41]I (342) cpu_start: ELF file SHA256:  15d9f173b8c4ecc1...
[13:35:41]I (348) cpu_start: ESP-IDF:          5.0.2
[13:35:41]I (352) cpu_start: Min chip rev:     v0.0
[13:35:41]I (357) cpu_start: Max chip rev:     v0.99
[13:35:41]I (362) cpu_start: Chip rev:         v0.1
[13:35:41]I (367) heap_init: Initializing. RAM available for dynamic allocation:
[13:35:41]I (374) heap_init: At 3FC9D7C0 len 0004BF50 (303 KiB): DRAM
[13:35:41]I (380) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
[13:35:41]I (387) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
[13:35:41]I (393) heap_init: At 600FE010 len 00001FF0 (7 KiB): RTCRAM
[13:35:41]I (400) spi_flash: detected chip: gd
[13:35:41]I (404) spi_flash: flash io: dio
[13:35:41]I (408) cpu_start: Starting scheduler on PRO CPU.
[13:35:41]I (0) cpu_start: Starting scheduler on APP CPU.
[13:35:41]E (174) uart: uart_param_config(726): Invalid src_clk

and here is my config

esphome:
  name: atom-s3
  friendly_name: atom-s3
  name_add_mac_suffix: false


esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.0.2
    platform_version: 6.3.2


# Enable logging
logger:
api:
ota:

wifi:
  ssid: "xxxxxx.xxxxxx"
  password: "xxxxxx"

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

captive_portal:

johntdyer avatar Aug 22 '23 17:08 johntdyer

People, no need to post broken configs, this one works fine:

Here's my config for other people that have issues: https://github.com/wildekek/ESPHome-M5Stack-Atom-S3-Lite/blob/main/M5Stack-AtomS3-Lite.yaml

wildekek avatar Aug 22 '23 22:08 wildekek

There is nothing special on this config - just the default one for s3 and settings for the peripherals/components. But you can make lazy people happy (who don't want to read documentation) and post it to https://devices.esphome.io/

Btw, a board can be selected by unchecking "Use recommended settings" in the wizard, but as I have mentioned - this board is not on the list and in many cases there is no need to select a board - the default one is enough (because platformio needs that), only selecting the right mcu (device) type matters.

randybb avatar Aug 22 '23 22:08 randybb

People, no need to post broken configs, this one works fine:

Try to build this "fine" config with esp-idf framework %)

Anonym-tsk avatar Aug 23 '23 13:08 Anonym-tsk

Just got this one working on the AtomS3 (with the lcd), running on the esp-idf framework. It's a mix of the AtomS3 Lite from @wildekek with some modifications

substitutions:
  name: "atoms3"
  device_name: "AtomS3"

esphome:
  name: atoms3
  friendly_name: AtomS3
  on_boot:
    - priority: 800
      then:
        - lambda: |-
            id(disp).enable();
            id(disp).transfer_byte(0x11);
            id(disp).disable();

esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.1.1
    platform_version: 6.4.0

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret wifi_fallback_password
    ap_timeout: 15s
 
captive_portal:
 
# Enable logging
logger:
 level: DEBUG

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

ota:
  password: "USE_YOUR_OWN"


esp32_ble_tracker:

bluetooth_proxy:
  active: true


#G4=IR
# remote_transmitter:
#   pin: GPIO4
#   carrier_duty_percent: 50%


i2c:
  - id: bus_a
    sda: GPIO38
    scl: GPIO39

sensor:
  - platform: mpu6886
    address: 0x68
    accel_x:
      name: "$device_name MPU6886 Accel X"
    accel_y:
      name: "$device_name MPU6886 Accel Y"
    accel_z:
      name: "$device_name MPU6886 Accel z"
    gyro_x:
      name: "$device_name MPU6886 Gyro X"
    gyro_y:
      name: "$device_name MPU6886 Gyro Y"
    gyro_z:
      name: "$device_name MPU6886 Gyro z"
    temperature:
      name: "$device_name MPU6886 Temperature"

spi:
  clk_pin: GPIO17
  mosi_pin: GPIO21

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_gray
    red: 50%
    green: 50%
    blue: 50%

font:
  - file: "gfonts://Roboto"
    id: roboto_32
    size: 32
  - file: "gfonts://Roboto"
    id: roboto_24
    size: 24
  - file: "gfonts://Roboto"
    id: roboto_12
    size: 12

time:
  - platform: homeassistant
    id: esptime

display:
  - platform: st7789v # https://esphome.io/components/display/st7789v.html
    id: disp
    model: Custom
    backlight_pin: GPIO16
    cs_pin: GPIO15
    dc_pin: GPIO33
    reset_pin: GPIO34
    height: 128
    width: 128
    offset_height: 2
    offset_width: 1
    eightbitcolor: true
    update_interval: 3s
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_blue));
      it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue));   // header bar

      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(roboto_24), id(my_gray), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%H:%M:%S", id(esptime).now());
      it.print(5, 5, id(roboto_12), id(my_yellow), TextAlign::TOP_LEFT, "ESPHome");

      // Comment out the above lines to see the image without text overlaid
      // it.image(0, 0, id(my_image));

      if (id(system_status).state) {
        it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "Online");
      }
      else {
        it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "Offline");
      }
    

#G41=Button
binary_sensor:
  - platform: status
    name: "Node Status"
    id: system_status
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

morhimi avatar Sep 10 '23 20:09 morhimi

Thank you, @morhimi , your config works well: display, button and sensors!

One question: how to get accel_x value in lambda? I can see values in Home assistant, I can get instance of class esphome::mpu6886::MPU6886Component, but I have no idea how to get value.

popstas avatar Oct 24 '23 16:10 popstas

so does anybody have working m5stack atom s3 light config that works with bluetooth proxy? my config based on arduino not worked with proxy (but m5stack booted)

#https://docs.m5stack.com/en/core/AtomS3%20Lite
substitutions:
  device_name: "esphome-ceaa8c"
  device_friendly_name: "esphome-ceaa8c"
  device_description: "esphome-ceaa8c"
  time_timezone: "Europe/Moscow"
       
esphome:
  name: ${device_name}
  friendly_name: $device_friendly_name
  comment: "${device_description}"
  name_add_mac_suffix: false

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: arduino
    #version: 4.4.5
    platform_version: 5.4.0
    
#esp32:
#  board: m5stack-atoms3
  #board: esp32-s3-devkitc-1
#  variant: esp32s3
#  framework:
#    type: esp-idf
#    platform_version: 6.1.0
#    version: 5.0.1
    #platform_version: 5.4.0
#    sdkconfig_options:
#      COMPILER_OPTIMIZATION_SIZE: y
#      CONFIG_COMPILER_DISABLE_GCC12_WARNINGS: y
#      CONFIG_COMPILER_DISABLE_GCC13_WARNINGS: y
#      CONFIG_RMT_SUPPRESS_DEPRECATE_WARN: y
      

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

spi:
  clk_pin: GPIO17
  mosi_pin: GPIO21

bluetooth_proxy:
  active: true

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  fast_connect: false

captive_portal:

logger:
  baud_rate: 115200
  level: DEBUG

api:
  encryption:
    key: !secret hass_key
  reboot_timeout: 2min
 
ota:
   password: !secret ota_password 

# Output that blinks the LED
output:
  - platform: template
    id: status_output
    type: binary
    write_action:
    - if:
        condition:
          lambda: return (state);
        then:
          - light.turn_on:
              id: led
              brightness: 70%
              red: 100%
              green: 0%
              blue: 0%
        else:
          - light.turn_off: led

#G4=IR
remote_transmitter:
  pin: GPIO4
  carrier_duty_percent: 50%

light:
  # Enable status LED
  - platform: status_led
    output: status_output
    name: "Status Led"
    internal: True

  #G35=RGB WS2812C-2020
  - platform: esp32_rmt_led_strip
    rgb_order: GRB
    pin: 35
    num_leds: 4
    # RMT 0 channels will be occupied by IR
    rmt_channel: 2
    chipset: ws2812
    id: led
    name: "Led"

#G41=Button
binary_sensor:
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

with esp-idf it cont boot or failes to configure firmware as have errors

vtolstov avatar Jan 12 '24 00:01 vtolstov

so does anybody have working m5stack atom s3 light config that works with bluetooth proxy? my config based on arduino not worked with proxy (but m5stack booted)

@vtolstov this one works for me on M5Stack Atom S3 Lite

#https://docs.m5stack.com/en/core/AtomS3%20Lite
substitutions:
  device_name: "atoms3-lite-1"
  device_friendly_name: "AtomS3 Lite"
  device_description: "M5Stack AtomS3 Lite"
  time_timezone: "Asia/Jerusalem"
       
esphome:
  name: ${device_name}
  friendly_name: $device_friendly_name
  comment: "${device_description}"
  name_add_mac_suffix: false

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
    version: 2.0.14
    platform_version: 6.5.0
  variant: esp32s3

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret wifi_fallback_password
    ap_timeout: 15s
 
captive_portal:
 
# Enable logging
logger:
  baud_rate: 0
  level: VERBOSE

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

ota:
  password: "yourpwd"


esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true

# Output that blinks the LED
output:
  - platform: template
    id: status_output
    type: binary
    write_action:
    - if:
        condition:
          lambda: return (state);
        then:
          - light.turn_on:
              id: led
              brightness: 70%
              red: 100%
              green: 0%
              blue: 0%
        else:
          - light.turn_off: led

#G4=IR
remote_transmitter:
  pin: GPIO4
  carrier_duty_percent: 50%

light:
  # Enable status LED
  - platform: status_led
    output: status_output
    name: "Status Led"
    internal: True

  #G35=RGB WS2812C-2020
  - platform: esp32_rmt_led_strip
    rgb_order: GRB
    pin: 35
    num_leds: 4
    # RMT 0 channels will be occupied by IR
    rmt_channel: 1
    chipset: ws2812
    id: led
    name: "Led"

#G41=Button
binary_sensor:
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

morhimi avatar Jan 12 '24 02:01 morhimi

@morhimi thanks! it booted and connected!

vtolstov avatar Jan 12 '24 20:01 vtolstov

Any ideas on how to use the grove connected 4 relay board? Shopping cart Product image Description Quantity Price 4-Relay Unit - m5stack-store 1 4-Relay Unit 1 $12.95

rlust avatar Feb 02 '24 03:02 rlust

Just got this one working on the AtomS3 (with the lcd), running on the esp-idf framework. It's a mix of the AtomS3 Lite from @wildekek with some modifications

substitutions:
  name: "atoms3"
  device_name: "AtomS3"

esphome:
  name: atoms3
  friendly_name: AtomS3
  on_boot:
    - priority: 800
      then:
        - lambda: |-
            id(disp).enable();
            id(disp).transfer_byte(0x11);
            id(disp).disable();

esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.1.1
    platform_version: 6.4.0

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret wifi_fallback_password
    ap_timeout: 15s
 
captive_portal:
 
# Enable logging
logger:
 level: DEBUG

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

ota:
  password: "USE_YOUR_OWN"


esp32_ble_tracker:

bluetooth_proxy:
  active: true


#G4=IR
# remote_transmitter:
#   pin: GPIO4
#   carrier_duty_percent: 50%


i2c:
  - id: bus_a
    sda: GPIO38
    scl: GPIO39

sensor:
  - platform: mpu6886
    address: 0x68
    accel_x:
      name: "$device_name MPU6886 Accel X"
    accel_y:
      name: "$device_name MPU6886 Accel Y"
    accel_z:
      name: "$device_name MPU6886 Accel z"
    gyro_x:
      name: "$device_name MPU6886 Gyro X"
    gyro_y:
      name: "$device_name MPU6886 Gyro Y"
    gyro_z:
      name: "$device_name MPU6886 Gyro z"
    temperature:
      name: "$device_name MPU6886 Temperature"

spi:
  clk_pin: GPIO17
  mosi_pin: GPIO21

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_gray
    red: 50%
    green: 50%
    blue: 50%

font:
  - file: "gfonts://Roboto"
    id: roboto_32
    size: 32
  - file: "gfonts://Roboto"
    id: roboto_24
    size: 24
  - file: "gfonts://Roboto"
    id: roboto_12
    size: 12

time:
  - platform: homeassistant
    id: esptime

display:
  - platform: st7789v # https://esphome.io/components/display/st7789v.html
    id: disp
    model: Custom
    backlight_pin: GPIO16
    cs_pin: GPIO15
    dc_pin: GPIO33
    reset_pin: GPIO34
    height: 128
    width: 128
    offset_height: 2
    offset_width: 1
    eightbitcolor: true
    update_interval: 3s
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_blue));
      it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue));   // header bar

      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(roboto_24), id(my_gray), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%H:%M:%S", id(esptime).now());
      it.print(5, 5, id(roboto_12), id(my_yellow), TextAlign::TOP_LEFT, "ESPHome");

      // Comment out the above lines to see the image without text overlaid
      // it.image(0, 0, id(my_image));

      if (id(system_status).state) {
        it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "Online");
      }
      else {
        it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "Offline");
      }
    

#G41=Button
binary_sensor:
  - platform: status
    name: "Node Status"
    id: system_status
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

Great work here on the Atom S3 config! Well done just what I was looking for. Just need to get the 4 relay board working!

rlust avatar Feb 02 '24 03:02 rlust

Warning This component has been made redundant since the ST7789V is now supported by the ILI9XXX component. It is recommended that you use the ili9xxx component as it will be maintained, whereas this component may not be, or may be removed completely in the future.

from https://esphome.io/components/display/st7789v

Here its work well on my AtomS3.

# SPI pin
spi:
  clk_pin: 17
  mosi_pin: 21

# GPIO pin of the display backlight
switch:
  - platform: gpio
    pin: 16
    name: "Backlight"
    id: backlight
    restore_mode: ALWAYS_ON

display:
  - platform: ili9xxx
    model: ST7789V
    cs_pin: 15
    dc_pin: 33
    reset_pin: 34
    rotation: 180
    invert_colors: true
    update_interval: 1s
    dimensions:
      height: 128
      width: 128
      offset_height: 1
      offset_width: 2
    lambda: |-
      auto red = Color(255, 0, 0);
      auto green = Color(0, 255, 0);
      auto blue = Color(0, 0, 255);
      auto white = Color(255, 255, 255);
      // Draw a line from [0,0] to [100,50]
      it.line(0, 0, 0, it.get_height(), red);
      it.line(0, 0, it.get_width(), 0, green);
      it.line(0, it.get_height()-1, it.get_width(), it.get_height()-1, blue);
      it.line(it.get_width()-1, 0, it.get_width()-1, it.get_height(), white);

k1asa avatar Feb 03 '24 04:02 k1asa

Can anyone help a novice with a working atom s3 lite as bluetooth proxy to just add config for the LED to light up on activity? Most of the config here seems to be for ones with the display.

optimus1509 avatar Feb 06 '24 18:02 optimus1509

Can anyone help a novice with a working atom s3 lite as bluetooth proxy to just add config for the LED to light up on activity? Most of the config here seems to be for ones with the display.

See here https://github.com/esphome/feature-requests/issues/2332#issuecomment-1888347255

morhimi avatar Feb 06 '24 18:02 morhimi

Can anyone help a novice with a working atom s3 lite as bluetooth proxy to just add config for the LED to light up on activity? Most of the config here seems to be for ones with the display.

See here #2332 (comment)

Does this also work with esp-idf or are there some changes required?

optimus1509 avatar Feb 06 '24 20:02 optimus1509

We are on platformio 5.3.0, so nope. Maybe next year once we move to 6....

It seems that esphome is now using platformio 6.1, so maybe official support for the Atom S3 could be added?

dbrgn avatar Jun 12 '24 20:06 dbrgn

These lines make the Atom S3 go into a boot loop. I think they were originally included as some kind of workaround, but are no longer needed.

  on_boot:
    - priority: 800
      then:
        - lambda: |-
            id(disp).enable();
            id(disp).transfer_byte(0x11);
            id(disp).disable();

After I removed them, my config started working again.

This is working for me on ESPHome 2024.9.2, and I tried it with both 'arduino' and 'esp-idf' as the framework.

esphome:
  name: atoms3
  friendly_name: AtomS3

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: arduino

scarolan avatar Oct 04 '24 13:10 scarolan

I updated full config while implementing comments from @scarolan & @k1asa It's now working with ESP-IDF v5.3.1

AtomS3 yaml:

substitutions:
  name: "atoms3"
  device_name: "AtomS3"

esphome:
  name: atoms3
  friendly_name: AtomS3
  platformio_options:
    build_flags:
      - "-w" # https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html


esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.3.1
    platform_version: 6.9.0
    # Custom sdkconfig options
    sdkconfig_options: # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html#config-compiler-disable-gcc12-warnings
      CONFIG_SPIFFS_DBG: n

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  enable_btm: true
  enable_rrm: true
  reboot_timeout: 7min
  id: wifi_id

 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret wifi_fallback_password
    ap_timeout: 15s
 
captive_portal:
 
# Enable logging
logger:
#  baud_rate: 0
 level: VERBOSE

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

ota:
  platform: esphome
  password: "YourPassowrd"


esp32_ble_tracker:

bluetooth_proxy:
  active: true


i2c:
  - id: bus_a
    sda: GPIO38
    scl: GPIO39

sensor:
  - platform: mpu6886
    address: 0x68
    accel_x:
      name: "$device_name MPU6886 Accel X"
    accel_y:
      name: "$device_name MPU6886 Accel Y"
    accel_z:
      name: "$device_name MPU6886 Accel z"
    gyro_x:
      name: "$device_name MPU6886 Gyro X"
    gyro_y:
      name: "$device_name MPU6886 Gyro Y"
    gyro_z:
      name: "$device_name MPU6886 Gyro z"
    temperature:
      name: "$device_name MPU6886 Temperature"
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 120s


spi:
  clk_pin: GPIO17
  mosi_pin: GPIO21

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_gray
    red: 50%
    green: 50%
    blue: 50%

font:
  - file: "gfonts://Roboto"
    id: roboto_32
    size: 32
  - file: "gfonts://Roboto"
    id: roboto_24
    size: 24
  - file: "gfonts://Roboto"
    id: roboto_12
    size: 12

time:
  - platform: homeassistant
    id: esptime

# GPIO pin of the display backlight
switch:
  - platform: gpio
    pin: 16
    name: "Backlight"
    id: backlight
    restore_mode: ALWAYS_ON

display:
  - platform: ili9xxx
    model: ST7789V
    id: disp
    cs_pin: 15
    dc_pin: 33
    reset_pin: 34
    rotation: 180
    invert_colors: true
    update_interval: 1s
    dimensions:
      height: 128
      width: 128
      offset_height: 1
      offset_width: 2
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_blue));
      it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue));   // header bar

      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(roboto_24), id(my_gray), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%H:%M:%S", id(esptime).now());
      it.print(5, 5, id(roboto_12), id(my_yellow), TextAlign::TOP_LEFT, "ESPHome");

      // Comment out the above lines to see the image without text overlaid
      // it.image(0, 0, id(my_image));

      // if (id(system_status).state) {.   // depends in binary sensor :( 
      if (id(wifi_id).is_connected()) {
        it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "Online");
      }
      else {
        it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "Offline");
      }


#G41=Button
binary_sensor:
  - platform: status
    name: "Node Status"
    id: system_status
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
    ssid:
      name: ESP Connected SSID
    bssid:
      name: ESP Connected BSSID
    mac_address:
      name: ESP Mac Wifi Address
    scan_results:
      name: ESP Latest Scan Results
    dns_address:
      name: ESP DNS Address

morhimi avatar Oct 22 '24 13:10 morhimi

Anyone got the config working for the AtomS3R (with TFT)? PIN info is available on M5Docs but no luck until now. Example config below has been taken from last poster, morhimi but modified for AtomS3R.

substitutions:
  ipnum: 192.168.2.94
  device_name: "AtomS3R"

esphome:
  name: "94e-atom-s3r"
  friendly_name: AtomS3
  platformio_options:
    build_flags:
      - "-w" # https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html
  
esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.3.1
    platform_version: 6.9.0
    # Custom sdkconfig options
    sdkconfig_options: # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html#config-compiler-disable-gcc12-warnings
      CONFIG_SPIFFS_DBG: n

# Include WIFI details
<<: !include details/wifi.yaml
 
# Enable logging
logger:
 level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "[Your Value]"

ota:
  - platform: esphome
    password: "[Your Value]"


esp32_ble_tracker:

bluetooth_proxy:
  active: true

spi:
  clk_pin: GPIO15 #AtomS3: GPIO17
  mosi_pin: GPIO21 #AtomS3: GPIO21

color:
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  
font:
  - file: "gfonts://Roboto"
    id: roboto_24
    size: 24
  
time:
  - platform: homeassistant
    id: esptime

# GPIO pin of the display backlight

display:
  - platform: st7789v
    model: CUSTOM
    id: disp
    cs_pin: GPIO14 #AtomS3: GPIO15
    dc_pin: GPIO42 #AtomS3: GPIO33
    reset_pin: GPIO48 #AtomS3: GPIO34
    rotation: 180
    update_interval: 1s
    height: 128
    width: 128
    offset_height: 1
    offset_width: 2
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_yellow));      
      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(roboto_24), id(my_yellow), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(roboto_24), id(my_yellow), TextAlign::CENTER, "%H:%M:%S", id(esptime).now());

binary_sensor:
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address

RuudNetideas avatar Nov 14 '24 09:11 RuudNetideas

@RuudNetideas I received my AtomS3R and I have been fiddling with it to make the display work, and managed it today. This is my config:

substitutions:
  name: "atoms3r"
  device_name: "AtomS3R"

esphome:
  name: ${name}
  friendly_name: ${device_name}
  platformio_options:
    build_flags:
      - "-w" # https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html


esp32:
  board: m5stack-atoms3
  variant: esp32s3
  framework:
    type: esp-idf
    version: 5.3.1
    platform_version: 6.9.0
    # Custom sdkconfig options
    sdkconfig_options: # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html#config-compiler-disable-gcc12-warnings
      CONFIG_SPIFFS_DBG: n

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password
  enable_btm: true
  enable_rrm: true
  reboot_timeout: 7min
  id: wifi_id
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: MANUAL_IP    # Set this to the IP address of the router. Often ends with .1
    gateway: MANUAL_GATEWAY
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret wifi_fallback_password
    ap_timeout: 15s
 
captive_portal:
 
# Enable logging
logger:
#  baud_rate: 0
 level: VERBOSE

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

ota:
  platform: esphome
  password: !secret ota_password

esp32_ble_tracker:

bluetooth_proxy:
  active: true


i2c:
  - id: bus_a
    sda: GPIO38
    scl: GPIO39

sensor:
  - platform: mpu6886
    address: 0x68
    accel_x:
      name: "$device_name MPU6886 Accel X"
    accel_y:
      name: "$device_name MPU6886 Accel Y"
    accel_z:
      name: "$device_name MPU6886 Accel z"
    gyro_x:
      name: "$device_name MPU6886 Gyro X"
    gyro_y:
      name: "$device_name MPU6886 Gyro Y"
    gyro_z:
      name: "$device_name MPU6886 Gyro z"
    temperature:
      name: "$device_name MPU6886 Temperature"
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 120s


spi:
  clk_pin: GPIO15
  mosi_pin: GPIO21

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_gray
    red: 50%
    green: 50%
    blue: 50%

font:
  - file: "gfonts://Roboto"
    id: roboto_32
    size: 32
  - file: "gfonts://Roboto"
    id: roboto_24
    size: 24
  - file: "gfonts://Roboto"
    id: roboto_12
    size: 12

time:
  - platform: homeassistant
    id: esptime

# GPIO pin of the display backlight
switch:
  - platform: gpio
    pin: 16
    name: "Backlight"
    id: backlight
    restore_mode: ALWAYS_ON

display:
  - platform: ili9xxx
    model: ST7789V
    id: disp
    cs_pin: GPIO14
    dc_pin: GPIO42
    reset_pin: GPIO48
    rotation: 180
    invert_colors: true
    update_interval: 1s
    dimensions:
      height: 128
      width: 128
      offset_height: 1
      offset_width: 2
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_blue));
      it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue));   // header bar

      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(roboto_24), id(my_gray), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%H:%M:%S", id(esptime).now());
      it.print(5, 5, id(roboto_12), id(my_yellow), TextAlign::TOP_LEFT, "ESPHome");

      // Comment out the above lines to see the image without text overlaid
      // it.image(0, 0, id(my_image));

      // if (id(system_status).state) {.   // depends in binary sensor :( 
      if (id(wifi_id).is_connected()) {
        it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "Online");
      }
      else {
        it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "Offline");
      }


#G41=Button
binary_sensor:
  - platform: status
    name: "Node Status"
    id: system_status
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
    ssid:
      name: ESP Connected SSID
    bssid:
      name: ESP Connected BSSID
    mac_address:
      name: ESP Mac Wifi Address
    scan_results:
      name: ESP Latest Scan Results
    dns_address:
      name: ESP DNS Address

thanasis00 avatar Mar 11 '25 13:03 thanasis00

@thanasis00 Did you mean Atom S3? That config does not work on the S3R. It has an i2c backlight (LP5562) and a different accelerometer sensor (BMI270 & BMM150).

@RuudNetideas This works for the S3R, still missing the accelerometer/gyro

external_components:
  - source:
      type: git
      url: https://github.com/ssieb/esphome
      ref: lp5562
    components: [ lp5562 ]

# https://www.reddit.com/r/Esphome/comments/1geelgf/what_would_it_take_to_port_led_driver_lp5562/
lp5562:
  # SCL GPIO0 & SDA GPIO45
  - i2c_id: i2c_internal
 
output:
  - platform: lp5562
    id: backlight_red
    channel: 0
  - platform: lp5562
    id: backlight_green
    channel: 1
  - platform: lp5562
    id: backlight_blue
    channel: 2
  - platform: lp5562
    id: backlight_white
    channel: 3

light:
  # White
  - platform: monochromatic
    id: backlight_light
    output: backlight_white
    default_transition_length: 100ms
    restore_mode: ALWAYS_ON
    name: "Backlight"
    entity_category: config
  # RGBW - This does not work for RGB, just the white channel, so it's pointless for now
#  - platform: rgbw
#    id: backlight_light
#    red: backlight_red
#    green: backlight_green
#    blue: backlight_blue
#    white: backlight_white
#    color_interlock: true
#    default_transition_length: 100ms
#    restore_mode: ALWAYS_ON
#    name: "Backlight"
#    entity_category: config

Some other things in my yaml

esphome:
  comment: "M5Stack Atom S3R"
  name: $devicename
  friendly_name: $devicename
  platformio_options:
    board_build.arduino.memory_type: qio_opi
    build_flags:
      - "-w" # https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"
      - "-mfix-esp32-psram-cache-issue"

psram:
  mode: octal
  speed: 80MHz

display:
  - platform: ili9xxx
    model: st7789v
    id: display_ips
    cs_pin: $spi_cs_pin
    dc_pin: $spi_dc_pin
    reset_pin: $spi_reset_pin
#    data_rate: 40Mhz
    invert_colors: true
    update_interval: 1s
    dimensions:
      height: 128
      width: 128
      offset_height: 1
      offset_width: 2
    # Rotate 180deg
#    transform:
#      mirror_x: true
#      mirror_y: true
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(c_yellow));      
      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(f24), id(c_red), TextAlign::CENTER, "%Y-%m-%d", id(time_homeassistant).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(f24), id(c_blue), TextAlign::CENTER, "%H:%M", id(time_homeassistant).now());

simenopsahl avatar Mar 16 '25 00:03 simenopsahl

@simenopsahl: Thanks for your example code.

I finally got the thing working. I 'missed' the backlight settings. I enclose my working yaml code for anyone looking for some answers!

substitutions:
  ipnum: [DEVICE_IP]
  name: "atoms3r"
  device_name: "AtomS3R"

external_components:
  - source:
      type: git
      url: https://github.com/ssieb/esphome
      ref: lp5562
    components: [ lp5562 ]

esphome:
  comment: "M5Stack Atom S3R"
  name: ${name}
  friendly_name: ${device_name}
  platformio_options:
    board_build.arduino.memory_type: qio_opi
    build_flags:
      - "-w" # https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html
      - "-DBOARD_HAS_PSRAM"
      - "-DARDUINO_USB_CDC_ON_BOOT=1"
      - "-mfix-esp32-psram-cache-issue"

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
    sdkconfig_options: # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html#config-compiler-disable-gcc12-warnings
      CONFIG_SPIFFS_DBG: n

psram:
  mode: octal
  speed: 80MHz

i2c:
  - id: i2c_internal
    sda: GPIO45
    scl: GPIO0

# https://www.reddit.com/r/Esphome/comments/1geelgf/what_would_it_take_to_port_led_driver_lp5562/
lp5562:
  # SCL GPIO0 & SDA GPIO45
  - i2c_id: i2c_internal
 
output:
  - platform: lp5562
    id: backlight_red
    channel: 0
  - platform: lp5562
    id: backlight_green
    channel: 1
  - platform: lp5562
    id: backlight_blue
    channel: 2
  - platform: lp5562
    id: backlight_white
    channel: 3

# Include WIFI details
<<: !include details/wifi.yaml
 
# Enable logging
logger:
#  baud_rate: 0
 level: DEBUG

api:
  encryption:
    key: "[YOUR KEY]"

ota:
  - platform: esphome
    password: "[YOUR PASSWORD]"


esp32_ble_tracker:

bluetooth_proxy:
  active: true

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 120s

light:
  # White
  - platform: monochromatic
    id: backlight_light
    output: backlight_white
    default_transition_length: 100ms
    restore_mode: ALWAYS_ON
    name: "Backlight"
    entity_category: config

spi:
  clk_pin: GPIO15
  mosi_pin: GPIO21

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%
  - id: my_yellow
    red: 100%
    green: 100%
    blue: 0%
  - id: my_green
    red: 0%
    green: 100%
    blue: 0%
  - id: my_blue
    red: 0%
    green: 0%
    blue: 100%
  - id: my_gray
    red: 50%
    green: 50%
    blue: 50%

font:
  - file: "gfonts://Roboto"
    id: roboto_24
    size: 24

time:
  - platform: homeassistant
    id: esptime

display:
  - platform: ili9xxx
    model: st7789v
    id: display_ips
    cs_pin: GPIO14
    dc_pin: GPIO42
    reset_pin: GPIO48
    invert_colors: true
    update_interval: 1s
    #show_test_card: true
    dimensions:
      height: 128
      width: 128
      offset_height: 1
      offset_width: 2
    rotation: 270
    lambda: |-
      it.rectangle(0,  0, it.get_width(), it.get_height(), id(my_yellow));      
      it.strftime((128 / 2), (128 / 3) * 1 + 5, id(roboto_24), id(my_red), TextAlign::CENTER, "%Y-%m-%d", id(esptime).now());
      it.strftime((128 / 2), (128 / 3) * 2 + 5, id(roboto_24), id(my_green), TextAlign::CENTER, "%H:%M:%S", id(esptime).now())

#G41=Button
binary_sensor:
  - platform: gpio
    name: Button
    pin:
      number: GPIO41
      inverted: true
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 10ms
    on_press:
      then:
        - logger.log: Button Pressed

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
    ssid:
      name: ESP Connected SSID

RuudNetideas avatar Mar 18 '25 16:03 RuudNetideas