← Back

Room presence sensor

Built on XDAClaude Code taught me ESP32 development, and my smart home projects got way fasterBy Anurag Singh
ESP32 DevKit V1

HLK-LD2410C 24GHz mmWave presence sensor

RXTX2TXRX2GNDGNDVCCVIN

BME280 breakout, 3.3V (GY-BME280-3.3)

SCLD22SDAD21GNDGNDVCC3V3

BH1750 light sensor (GY-302)

SCLD22SDAD21GNDGNDVCC3V3

Compatibility checks

No issues found

  • Use a breadboard: parts share 3V3, D21, D22 and GND.

Wiring steps

  1. 1

    Optional: Solder headers onto BH1750 light sensor.

  2. 2

    Push the board into the breadboard.

  3. 3

    Run a jumper from each of its 3V3 and GND rows to a rail.

  4. 4

    HLK-LD2410C 24GHz mmWave presence sensor

    • GNDtothe GND rail
    • VCCtoVIN
    • TXtoRX2
    • RXtoTX2
  5. 5

    BME280 breakout, 3.3V

    • GNDtothe GND rail
    • VCCtothe 3V3 rail
    • SDAtothe D21 row
    • SCLtothe D22 row
  6. 6

    BH1750 light sensor

    • GNDtothe GND rail
    • VCCtothe 3V3 rail
    • SDAtothe D21 row
    • SCLtothe D22 row
  7. 7

    Plug in the USB cable last.

ESPHome config

Paste into ESPHome Device Builder.

esphome:
  name: room-presence-sensor

esp32:
  board: esp32dev

logger:
api:
  encryption:
    key: !secret api_encryption_key  # make one at esphome.io/components/api
ota:
  - platform: esphome
    password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

uart:
  - id: ld2410c_uart
    tx_pin: GPIO17  # TX2
    rx_pin: GPIO16  # RX2
    baud_rate: 256000

i2c:
  - sda: GPIO21
    scl: GPIO22

ld2410:
  - uart_id: ld2410c_uart

sensor:
  - platform: bme280_i2c
    address: 0x76  # or 0x77
    temperature:
      name: "BME280 Temperature"
      id: reading_1
    pressure:
      name: "BME280 Pressure"
      id: reading_2
    humidity:
      name: "BME280 Humidity"
      id: reading_3
  - platform: bh1750
    name: "BH1750 Illuminance"
    id: reading_4
    address: 0x23  # or 0x5c

binary_sensor:
  - platform: ld2410
    has_target:
      name: "LD2410C Presence"
    has_moving_target:
      name: "LD2410C Moving"
    has_still_target:
      name: "LD2410C Still"

Some board drawings are from Wokwi and Seeed Studio.