Atom Lite RGB LED turns on by itself

Wondering if anyone else has observed this. I have one of these M5stack Atom Lite devices that I use as a BLE receiver. I’ve configured the RGB LED and notice that sometimes it comes on by itself, even though I haven’t pressed the button or triggered any automations. Here is the relevant config section:

light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: 27
    num_leds: 1
    rgb_order: GRB
    id: status_led
    name: ${friendly_name} RGB LED
    effects:
      - random:
      - flicker:
      - addressable_rainbow:

binary_sensor:
  - platform: gpio
    pin:
      number: 39
      inverted: true
    name: ${friendly_name} Button
    on_press:
      then:
        - light.toggle: status_led

Could it be that GPIO39 is somehow getting triggered on its own?

The toggling on and off seems somewhat random and it does appear to be triggered by the button

image

I tried adding some debounce configs, will see how it goes…

    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms

With the M5 Atom Lite
I couldn’t get fastled_clockless with chipset: WS2812B or SK6812 to get red and turn off properly / at all

I switched to using the neopixelbus with SK6812 and its behaving much better

light:
  - platform: neopixelbus
    type: GRB
    variant: SK6812
    pin: 27
    num_leds: 1
    id: status_led
    internal: true
3 Likes

Good to know. These m5atom lite are great little devices but I’ve found that sometimes with the FastLED driver they get wedged and the LED won’t turn off. Thanks for the tip.

For those coming here from a Google search, like me, I was unable to publish the button and LED on the M5Stack Atom Lite using the configuration above.

Neither neopixelbus nor fastled_clockless worked in my case, because I was using ESPHome Bluetooth Proxy and those libraries require the arduino framework. This config didn’t work, too.

I was able to solve with this:

light:
  - platform: esp32_rmt_led_strip
    rgb_order: GRB
    pin: 27
    num_leds: 1
    rmt_channel: 0
    chipset: SK6812
    id: status_led
    name: ${name} Light
    effects:
      - random:
      - flicker:
      - addressable_rainbow:

binary_sensor:
  - platform: gpio
    pin:
      number: 39
      inverted: true
    name: ${name} Button
3 Likes

Hi, all my M5 Atom’s are (now) built with the Ardunio frame work and Neopixel bus:

Current configs:

esp32:
board: m5stack-atom
framework:
type: arduino

I’m also using the bluetooth frame work and the Neopixelbus config is working with that too.
(I shows Red, Blue, Green on boot and I just power cycled it to check for you.)

1 Like

I did some digging because I also had this issue.
Looks like there’s a hardware bug on the ESP32 that’ll make GPIO39 (which the button on the Atom Lite uses) trigger randomly:

The note about this in the Espressif docs: Analog to Digital Converter (ADC) - ESP32 - — ESP-IDF Programming Guide v4.4 documentation

2 Likes

sub’d to this… hoping this bug gets resolved and can enable leds for bluetooth proxy (AtomU and Atom Lite)

thank you, i finally feel some closure.

1 Like

By the way, the way I solved it was to implement the suggestion from the official docs I linked above (i.e. calling adc_power_acquire()).

The way I did it:

  1. Create a file /config/esphome/m5stack-atom-lite.h with just the following line:

    #include <driver/adc.h>
    
  2. In the device’s YAML config:

    esphome:
      # Workaround for Button (GPIO39) randomly triggering
      # Increases power usage slightly (~1mA)
      # https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-reference/peripherals/adc.html#_CPPv412adc1_get_raw14adc1_channel_t
      includes:
        - m5stack-atom-lite.h
      on_boot:
        then:
          - lambda: "adc_power_acquire();"
    

Works perfectly, no more phantom button presses.
I don’t mind the 1mA of extra power usage as the device is not connected to a battery, where that sort of thing would matter to any reasonable degree.

2 Likes

I can confirm that my “phantom presses” (assuming that was what previously turned on my light randomly) have vanished with this fix. Thanks a lot everyone for figuring this out!