If you’re just getting started with Home Assistant, one of the easiest and most fun projects to try is smart lighting. This guide walks through how to set up the M5Atom Lite—a compact ESP32-based module—as a smart RGB light controller, fully integrated with Home Assistant using ESPHome.
What You’ll Need
- M5Atom Lite (ESP32-based)
- Home Assistant installed and running
- A stable Wi-Fi connection
- A USB data cable to connect with computer
1. Environment Setup
Before we begin, make sure you have Home Assistant installed. You can follow the official documentation for your preferred platform.
Once Home Assistant is up and running:
- 
Go to Settings → Add-ons → Add-on Store
 
- 
Search for and install the ESPHome add-on
 
- 
After installation, enable Show in sidebar for quick access
 
 
2. Adding the Device
1. Open the ESPHome sidebar and click NEW DEVICE in the lower right corner.

2. Click CONTINUE when the setup screen appears.

3. Name your device (e.g., Atom-Lite), then proceed.

4. On the device type screen:
o Uncheck Use recommended settings
o Select ESP32 → choose M5Stack-ATOM

5. Click NEXT and copy the encryption key that appears.


6. Choose Manual download to begin compiling the firmware.

3. Firmware Setup & Compilation
Back on the ESPHome dashboard, you’ll now see your new Atom-Lite device listed.
1. Click EDIT to open the YAML configuration editor

2. Replace the content with the following configuration (update your Wi-Fi credentials!):
esphome:
  name: atom-lite
  friendly_name: Atom-Lite
esp32:
  board: m5stack-atom
  framework:
    type: arduino
logger:
api:
  encryption:
    key: "*********"
ota:
  - platform: esphome
    password: "*****************"
wifi:
  ssid: "*********"
  password: "***********"
  ap:
    ssid: "Atom-Lite Fallback Hotspot"
    password: "jFsIc2XGuKRe"
captive_portal:
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      mode: INPUT
      inverted: true
    name: "Atom Button"
    id: atom_button
    filters:
      - delayed_on: 50ms
      - delayed_off: 50ms
    on_multi_click:
      - timing:
          - ON for at most 0.8s
          - OFF for at most 0.5s
          - ON for at most 0.8s
          - OFF for at least 0.2s
        then:
          - logger.log: "Double Clicked"
          - light.turn_on:
              id: atom_light
              red: 100%
              blue: 50%
              green: 20%
              brightness: 50%
      - timing:
          - ON for at least 0.8s
        then:
          - logger.log: "Single Long Clicked"
          - light.turn_on:
              id: atom_light
              green: 100%
              blue: 50%
              red: 30%
              brightness: 100%
light:
  - platform: neopixelbus
    type: GRB
    pin: GPIO27
    num_leds: 1
    variant: sk6812
    name: "Atom RGB Light"
    id: atom_light
    restore_mode: RESTORE_DEFAULT_OFF
    effects:
      - random:
          name: "Random"
          transition_length: 1s
          update_interval: 1s 
    

3. Click SAVE, then INSTALL → Manual download to compile

Note: The first compilation may take several minutes, depending on your setup and network.
4. Flash the Firmware to M5Atom Lite
After compiling the firmware:
1. Click DOWNLOAD, and choose Factory format

2. Connect the M5Atom Lite to your computer using a USB-C data cable
3. Back in ESPHome, select INSTALL → Plug into this computer

4. Click Open ESPHome Web

5. Press CONNECT, then select the detected serial port

6. Click INSTALL and wait for the firmware installation to complete.

Once flashing is complete, the device will restart and attempt to connect to your Wi-Fi.
5. Add the Device to Home Assistant
Once Atom Lite is online:
1. Open Settings → Integrations in Home Assistant

2. Under Discovered, click ADD and follow the prompts to integrate it
6. Create an Automation
You can now set up a basic automation using the button to control the light:
1. In the Home Assistant page, go to Settings → Device& Service

2. Locate ESPHome → hit Atom-Lite → click Automations

3. Select Create new automation → ADD TRIGGER → Entity → State → Atom Button

4. In the When section, change the status from Off to On

5. In the Then do section, select ADD ACTION → Light → Toggle → + Choose entity → Atom-Lite RGB Light → Save
This simple setup turns the button into a light switch for the RGB LED.
7. Add Atom RGB Light to Your Dashboard
To control the RGB light from the Home Assistant interface:
1. Go to Overview → Edit

2. In the By card page, input Light on the search cards Select the Light card type

3. Choose the Atom RGB Light entity

4. Save the changes
The light can now be toggled and color-adjusted directly from the dashboard.
8. Demo & Behavior
Here’s how your new Atom-Lite smart RGB light behaves:
- 
Single Click → RGB light toggles pink
 
- 
Long Press (2+ seconds) → RGB light switches to green
 
- 
Light state updates in real-time and can also be controlled via the Home Assistant dashboard
 
Conclusion
Home Assistant makes smart home control simple, with M5Stack Atom-Lite and ESPHome, setting up RGB lighting is just the start. With the same process, you can go further by adding mode device like a human presence sensor to detect movement, turn on lights automatically, or turn on the AC and set it to the optimal temperature when someone enters the room.

