pdf-icon

AtomS3R-M12 Home Assistant Integration

Introduction

AtomS3R-M12 is a compact IoT programmable controller (24×24×22.1mm) with an M12 3MP OV3660 wide-angle camera. Powered by ESP32-S3-PICO-1-N8R8 (Wi-Fi, 8MB Flash + 8MB PSRAM), it features a 5V→3.3V power circuit, BMM150 geomagnetic and BMI270 six-axis sensors, UVC driver-free USB camera, infrared control, enhanced 3D antenna for stable connectivity, USB-C for power/firmware, a HY2.0-4P expansion port, and six GPIO/power pins for easy expansion—ideal for IoT monitoring and educational development.

See the latest configuration examples on ESPHome

Preparation

Tip
In this tutorial, the firmware is compiled and uploaded with ESPHome 2025.12.5. If you encounter compile/upload issues, consider switching ESPHome to this version.

Step 1. Create New Device

  • Click the green button in the lower right corner to create a device.

Step 2. Create Device Name

  • Click CONTINUE.

  • Click New Device Setup.

  • Enter the name of the device and Click NEXT.

Step 3. Choose Device Type

  • Click ESP32-S3.

  • Click SKIP.

Step 4. Start Edit YAML File

  • Click EDIT. We can customize device functionality through YAML files.

Device Setup

The following is the core part of the code. Relevant references and explanations are provided below.

Basic Info and Boot Actions

esphome:
  name: atoms3r-m12
  friendly_name: AtomS3R-M12
  on_boot:
    priority: 800
    then:
      - lambda: |-
          gpio_set_direction(GPIO_NUM_18, GPIO_MODE_OUTPUT);
          gpio_set_level(GPIO_NUM_18, 0);  
          vTaskDelay(pdMS_TO_TICKS(1500)); 
Note
Due to the hardware circuit design, the AtomS3R-M12 requires GPIO18 to be pulled low after power-on in order to enable proper I²C communication. If GPIO18 is not set to a low level before the I²C bus is initialized or accessed, I²C communication may fail. Therefore, the GPIO18 control must be assigned the highest priority to ensure it is pulled low at an early stage during system startup.

PSRAM Configuration

psram:
  mode: octal
  speed: 80MHz 

External Components

external_components:
  - source: github://DennisGaida/m5stack-atoms3r-components/components@main
    components: [bmi270_bmm150]
Note
As ESPHome does not yet provide an official BMI270 / BMM150 component, this project uses a third-party component repository contributed by a community developer. We would like to express our sincere thanks to the author for their contribution.

I2C Bus Configuration

  • Add the I2C components

    i2c:
    - id: BMI270_150
      sda: GPIO45
      scl: GPIO0
    - id: camera_i2c
      sda: GPIO12
      scl: GPIO9
      frequency: 100kHz  
      timeout: 10ms

    Sensor Configuration

  • Add the Sensor components

sensor:
  - platform: bmi270_bmm150
    i2c_id: BMI270_150
    address: 0x68
    update_interval: 3s
    acceleration_x:
      name: "BMI270 Accel X"
    acceleration_y:
      name: "BMI270 Accel Y"
    acceleration_z:
      name: "BMI270 Accel Z"
    gyroscope_x:
      name: "BMI270 Gyro X"
    gyroscope_y:
      name: "BMI270 Gyro Y"
    gyroscope_z:
      name: "BMI270 Gyro Z"
    temperature:
      name: "BMI270 Temperature" 

Camera Configuration

esp32_camera:
  name: "OV3660 Camera"
  external_clock:
    pin: GPIO21
    frequency: 20MHz
  i2c_id: camera_i2c
  data_pins: [GPIO3, GPIO42, GPIO46, GPIO48, GPIO4, GPIO17, GPIO11, GPIO13]
  vsync_pin: GPIO10
  href_pin: GPIO14
  pixel_clock_pin: GPIO40
  resolution: 640X480
  jpeg_quality: 10

Firmware Build

  • Click INSTALL again to flash and wait for it to complete.

  • After making changes, click SAVE and INSTALL in the top-right corner, then choose Manual Download in the popup.

  • After the firmware compilation is complete, click Download and select Factory format(Previously Modern)

Tip
Click AtomS3R-M12 to view the complete example configuration. The first build may take a while, depending on the performance of the Home Assistant host and network quality.

Firmware Upload

  • Connect the device to your host via a USB Type‑C cable. Open ESPHome Web and click CONNECT to connect to the device.

  • Locate the corresponding serial port number

  • Click INSTALL

  • Select the previously compiled firmware to upload.

Tip
Please note that after the download is completed, the device must be reset.

Home Assistant Integration

  • Click Settings -> Device & services to check the device.

  • We can find the corresponding device in the Discover section.

  • After adding the device, the data will be displayed correctly.

  • Finally, we add these entities to the Dashboard, and the following shows their display results.

On This Page