I thought it was about time I tried out ESPHome, and this is my experience so far with m5stack products. I have uploaded it on a m5stick-c and five m5stamp-c3u’s. I’m using a Windows laptop for the install, whereas I’ve seen others have issues with a Pi or Ubuntu; so ymmv. I also have a Core 2 and v1 Paper, but ESPHome doesn’t (yet) support the displays, so I will skip them for now.
For the m5stick-c, once I clicked connect, it was there, but it would not install. I found I needed to press the middle button (below the screen) for the install to work. I’m not sure how long you have to keep it pressed, so I did so for the whole process of several minutes. I understand there’s more editing required to get the screen working with the m5stick-c, but this will come later.
For the m5stamp, you have to hold the middle button down while inserting the usb plug into the laptop. If you don’t, it won’t show up in the connection dialog. I have the c3u, and it’s possibly different for the c3, because I think that connects with an adapter rather than via the inbuilt usb. It sits on “Preparing install” for several minutes. After the install is complete, it will try to connect, and you will get “Configuration created but unable to detect the device on the network”, but don’t unplug! If you do, you’ll notice it keeps connecting and disconnecting from USB because it isn’t working. Plug it back in, remembering to hold the middle button. Then edit the config and change the top to match the code below (3 lines to be inserted). After installing this, and unplugging/re-plugging, you should be good to go.
As a noob, I found out the hard way you shouldn’t navigate away from the page while it’s “Preparing installation”, or it will (probably) fail. The other first-timer experience is that it’s probably not a good idea to rename the device once installed. Initially it won’t work unless you power cycle, because it will still be connected to wifi with the old name. But even after that, it appears that the yaml file maintains the original name, which might cause confusion later on.
the m5stack core module has the best compatibility because of the buttons and display.
i have the m5stamp-c3 too, but also didn’t get it to work.
if one compares the pin assignments of the devkit-c3 and the stamp-c3, he finds differences.
i think the stamp must be supported by platformio by itself, not as the devkit from espressif
I have the m5stamp-c3u working with ESPHome and esp32_ble_tracker tracker. At first it seemed to be switching the antenna between BT and wifi, so it would miss BT broadcasts. OTA updates were also not working. However, when changing the config to that below, it is now working as expected. Having said that, when I move it to where its to belong, it’s not working properly - it doesn’t connect to wifi. If I plug it into my laptop at the same location, it works, so I’m still troubeshooting what’s going on. Consequently, I have not yet tried ESPresence.
board: esp32-c3-devkitm-1
variant: ESP32C3
framework:
type: esp-idf
sdkconfig_options:
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
UPDATE: It seems it was working all along. With esp32_ble_tracker it seems to take a minute or two to connect to wifi, and I interpreted this as not working at all. Having the LED go from red (on_boot priority 600), to yellow (priority 260, Wifi connected) to green (once api is connected) made it a lot easier to see what was happening.
And then the includes are along the lines of the code below. I’ve put it in a dummy repeat at the moment because I was thinking of adding more, but haven’t as yet.
Thanks for the guide, this helped a lot! My own notes: I had to use the Arduino framework with a recent version because esphome (installed on HA) complained that neopixelbus is not supported on esp-idf
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: arduino
# See https://github.com/espressif/arduino-esp32/releases for available versions
version: 2.0.2
platform_version: 5.2.0
Also: the built-in RGB LED is not working great, lots of issues controlling the color, sometimes it works, most of the time it renders a wrong color or does not react… Config is:
light:
# Note: the built-in LED doesn't seem to behave correctly, and color control is flaky...
- platform: neopixelbus
type: GRB
variant: SK6812
pin: 2
num_leds: 1
id: "builtin_led"
name: "Built-in LED"
method:
type: esp32_rmt
channel: 0
(I set the channel on esp32_rmt so that I can have a separate neopixelbus on another GPIO, but the behavior is also flaky when only the built-in LED is enabled).
I’m trying to add a ‘M5Stack Stamp C3U’ in HA ESP Home.
I’m new with ESP32 but I’ve try to read / test as much as possible without success.
The board is shown in windows 10 : USB JTAG/ serial debug unit.
Product sheet :
the main tests I’ve done was around those 2 parameters :
esp32: board: esp32-c3-devkitm-1
framework: type: esp-idf
I’ve also tryed :
flash_mode: dio
sdkconfig_options
framework:
type: arduino
version: 2.0.2
When I do this change :
type: arduino > type : esp-idf … it seem my first and last line have a error (1- esphome: 30- captive_portal:)
If I remove captive_portal … first line is accepted.
When having a correct syntax yaml i try to install it and error seem to be with the C compiler :
– Check for working C compiler: /data/cache/platformio/packages/toolchain-riscv32-esp/bin/riscv32-esp-elf-gcc – broken
– Configuring incomplete, errors occurred!
A fatal error occurred: Failed to connect to ESP32-C3: No serial data received.
For troubleshooting steps visit: Troubleshooting - ESP32 - — esptool.py latest documentation
INFO Upload with baud rate 460800 failed. Trying again with baud rate 115200.
esptool.py v3.3.1
Serial port /dev/ttyUSB0
I then saw :
using https://web.esphome.io
install works
but I have a pairing error message saying ‘only SP32 and esp8266’ supported.
Here is what is working perfect for me on current ESPHome installed as a HA Add-on (2022.11.4). In my experience, what’s critical is to explicitly set the various versions, because 2022.11.4 does not support those boards at all by default.
The code below should get you started, it will turn the M5 Stamp into the most basic RGB light imaginable, and as a bonus will also drive (as a second light) a small strip of neopixels, to demo how to do this without crashing the ESP32 at startup:
esphome:
name: rbg-light2
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: arduino
# See https://github.com/espressif/arduino-esp32/releases for available versions
version: 2.0.2
platform_version: 5.2.0
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "XXXXXXXXXXXXXXX"
ota:
password: "XXXXXXXXXXX"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: True
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rbg-Light2 Fallback Hotspot"
password: "XXXXXXXXXX"
light:
# Note: the built-in LED doesn't seem to behave correctly, and color control is flaky...
- platform: neopixelbus
type: GRB
variant: SK6812
pin: 2
num_leds: 1
id: "builtin_led"
name: "Built-in LED"
method:
type: esp32_rmt
channel: 0
# Adafruit "Jewel" neopixel with RBG + Warm White
- platform: neopixelbus
type: GRBW
variant: WS2812
pin: 3
num_leds: 7
id: "led_ring"
name: "LED Ring"
default_transition_length: 250ms
restore_mode: RESTORE_DEFAULT_ON # Attempt to restore, and default to ON if restore fails
method:
type: esp32_rmt
channel: 1
I had a few issues trying to get my Stamp C3U up and running a few months ago, but tried adding it to esphome today, and the automatic detection of device worked for it today. I plugged it into the laptop and flashed locally, shortly afterwards I got a notification on my phone that a new device had connected to my network.
I’m using the M5Stamp and an M5 relay module as a garage door opener. It’s also BT proxying the Yale lock in the garage. Works great with good response time.