Skip to content

LD2410 mmwave Motion detection in ESPHome for Home Assistant, Homey etc. Can be combined with temperature, humidity and lux sensor.

Notifications You must be signed in to change notification settings

PeterKawa/esp_motion_mmwave

 
 

Repository files navigation

Forked from kippesikgithub (thanks!) Added some links and info, and adjusted to my needs

LD2410B mmwave Presence & Motion detection with temperature, humidity, (lux) sensors for ~€9,- (housing: ~€6,-)

LD2410B mmwave Presence & Motion detection + ESP8266 (Wemos d1 mini) / ESP32-S2 mini Board in ESPHome for Home Assistant, Homey etc. Can be combined with temperature, humidity and lux sensor, but I don't use lux sensor here. The LD2410B can be updated to measure luminance as well (I've read somewhere)

Shopping list

Boards
Sensors
Only for ESP32-S2:
Housing

signal-2023-04-07-165048_002

Step 1

Download this repository: https://github.com/PeterKawa/esp_motion_mmwave/archive/refs/heads/main.zip

Step 2

A.

copy the code from the downloaded file uart_read_line_sensor_ld2410v3.h into a new file in the /config/esphome directory, using for example 'Studio Code server';

Do the same with the downloaded file esp8266-template.yaml and/or esp32-S2-template.yaml

Or B.

use the 'File editor' and upload those 2 files to /config/esphome

Step 3

In HA, install the ESPhome add-on;

Extended ESPhome how-to: https://esphome.io/guides/getting_started_hassio.html

Pin outs

How to connect the stuff

Pinout ESP8266 (Wemos d1 mini) Board

image

ESP8266 | LD2410B

5V <-> VCC
GND <-> GND
TX <-> RX
RX <-> TX
D7 <-> OUT
(ESPHome example code: esp8266-template.yaml)

Pinout ESP32-S2 mini Board

ESP32_S2_mini pinout

ESP32-S2 | LD2410B

5V <-> VCC
GND <-> GND
GPIO18 <-> RX
GPIO33 <-> TX
GPIO5 <-> OUT
(ESPHome example code: esp32-S2-template.yaml)

Step 4

Connect the LD2410B cable:

image

Step 5

Solder three wires to the DHT11:

signal-2023-03-03-023238_002

ESP8266 | DHT11

3.3V <-> VDD
GND <-> GND
D2 <-> DATA

ESP32-S2 | DHT11

3V3 <-> VDD
GND <-> GND
GPIO9 <-> DATA

LUMI sensor KY-018 3pin

Screenshot from 2023-06-28 17-03-35

ESP32-S2 | LUMI sensor KY-018 3pin

3V3 <-> Middle pin
GND <-> - (minus sign)
GPIO3 <-> S

Something like this: signal-2023-03-03-023401_002

Step 6

Make sure you change all the !secret values, or create them in your /config/esphome/secrets.yaml

Step 7

Merge (do NOT overwrite), so MERGE the example yaml code (esp8266-template.yaml or esp32-S2-template.yaml) to the yaml code of a new device in ESPhome. You should keep the unique device keys and password stuff; In the end, the new device yaml should look the same as the example yaml, except from these details:

# Enable Home Assistant API
api:
  encryption:
    key: "KeepTheGeneratedKey"

ota:
  password: "KeepOtaPassword"
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "KeepDeviceNameAsSsid"
    password: "KeepGeneratedPassword"

Home Assistant

Once finished and sensor is online, you can add it to Home assistant. Often it is recognized already by the ESPHome integration

Screenshot from 2023-07-06 12-05-55

Dashboard example:

Screenshot from 2023-07-06 12-00-59

Web Config

You can monitor the distance & sensitivity by temporary enabling show_target_stats Screenshot from 2023-03-03 03-30-41

Impression

Still quite small: 20230530_200249~01

And hidden from view inside a (fake) flower pot ;-) 20230601_235500

HLKRadarTool app for configuring LD2410B sensor via Ble

Other sources used

https://community.home-assistant.io/t/mmwave-wars-one-sensor-module-to-rule-them-all/453260/2

https://github.com/rain931215/ESPHome-LD2410

About

LD2410 mmwave Motion detection in ESPHome for Home Assistant, Homey etc. Can be combined with temperature, humidity and lux sensor.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%