Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robertdean/1006aa1a5d784d0c5a4067e172fbcd7b to your computer and use it in GitHub Desktop.
Save robertdean/1006aa1a5d784d0c5a4067e172fbcd7b to your computer and use it in GitHub Desktop.
Use this code to make your LD2410 sensor to work with ESP32 or ESP8266 board
esphome:
name: ld2410-esp32
friendly_name: ld2410-esp32
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "IArm3ZGuqL1HLZXXbu4/L0ciw1TDSagu6THKP8LnFdo="
ota:
password: "3373716c7967d461cf4bd0ce1ba42e9a"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Ld2410-Esp32 Fallback Hotspot"
password: "AhxmD317i7r1"
captive_portal:
uart:
tx_pin: RX
rx_pin: TX
baud_rate: 256000
parity: NONE
stop_bits: 1
web_server:
port: 80
ld2410:
timeout: 5s
max_move_distance: 3m
max_still_distance: 3m
g0_move_threshold: 40 # 0m / 0'
g0_still_threshold: 10 # 0m / 0'
g1_move_threshold: 40 # 0 - 0.75m / 0 - 2.46'
g1_still_threshold: 10 # 0 - 0.75m / 0 - 2.46'
g2_move_threshold: 40 # 0.75 - 1.5m / 2.46' - 4.92'
g2_still_threshold: 10 # 0.75 - 1.5m / 2.46' - 4.92'
g3_move_threshold: 40 # 1.5 - 2.25m / 4.92' - 7.38'
g3_still_threshold: 10 # 1.5 - 2.25m / 4.92' - 7.38'
g4_move_threshold: 40 # 2.25 - 3m' / 7.38' - 9.84'
g4_still_threshold: 40 # 2.25 - 3m' / 7.38' - 9.84'
g5_move_threshold: 40 # 3 - 3.75 / 9.84' - 12.30'
g5_still_threshold: 40 # 3 - 3.75 / 9.84' - 12.30'
g6_move_threshold: 30 # 3.75 - 4.5m / 12.30' - 14.76'
g6_still_threshold: 15 # 3.75 - 4.5m / 12.30' - 14.76'
g7_move_threshold: 30 # 4.5 - 5.25m / 14.76' - 17.22'
g7_still_threshold: 15 # 4.5 - 5.25m / 14.76' - 17.22'
g8_move_threshold: 30 # 5.25 - 6m / 17.22' - 19.68'
g8_still_threshold: 15 # 5.25 - 6m / 17.22' - 19.68'
sensor:
- platform: ld2410
moving_distance:
name: Moving Distance
still_distance:
name: Still Distance
moving_energy:
name: Move Energy
still_energy:
name: Still Energy
detection_distance:
name: Detection Distance
binary_sensor:
- platform: ld2410
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment