May 1, 2025
Description
I had a PIR movement sensor in the basement controlling the light, but it sucked pretty bad and I had an LD2450 mmWave sensor lying around. I also found the relay board relatively cheap and just combined both things in a compact(ish) case.
Connect the LD2450 to the relay board. Use 5v as the power supply and choose any of the GPIO pins to connect with the RX and TX pins from the sensor. Soldering the serial header on also makes sense to flash the esp with ESPhome for initial setup.
Print the 2 parts how you want, but I'd recommend to face the vent holes up. The sensor can be slid into the lid.
esphome:
name: device_name
friendly_name: DeviceName
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "SOMETHING"
ota:
- platform: esphome
password: "SOMETHING"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "DeviceName Fallback Hotspot"
password: "SOMETHING"
captive_portal:
uart:
- baud_rate: 256000
rx_pin: GPIO32 # Adjust these pins (RX on ESP to TX on sensor)
tx_pin: GPIO25 # Adjust these pins (TX on ESP to RX on sensor)
parity: NONE
stop_bits: 1
ld2450:
- id: radar
throttle: 500ms
binary_sensor:
- platform: ld2450
ld2450_id: radar
has_target:
id: has_target
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
- platform: copy
source_id: has_target
id: light_on
filters:
- delayed_off: 0s # Adjust here for off delay
on_press:
then:
- switch.turn_on: light_relay
on_release:
then:
- switch.turn_off: light_relay
switch:
- platform: gpio
pin: GPIO16
name: "Light"
id: light_relay
- platform: ld2450
ld2450_id: radar
bluetooth:
name: "Bluetooth"
multi_target:
name: Multi Target Tracking"
button:
- platform: ld2450
ld2450_id: radar
factory_reset:
name: "LD2450 Factory Reset"
entity_category: "config"
restart:
name: "LD2450 Restart"
entity_category: "config"
text_sensor:
- platform: ld2450
ld2450_id: radar
version:
name: "LD2450 Firmware"
mac_address:
name: "LD2450 BT MAC"
target_1:
direction:
name: "Target-1 Direction"
target_2:
direction:
name: "Target-2 Direction"
target_3:
direction:
name: "Target-3 Direction"
sensor:
- platform: ld2450
ld2450_id: radar
target_count:
name: Presence Target Count
- platform: ld2450
ld2450_id: radar
still_target_count:
name: Still Target Count
- platform: ld2450
ld2450_id: radar
moving_target_count:
name: Moving Target Count
- platform: ld2450
ld2450_id: radar
target_1:
x:
name: Target-1 X
y:
name: Target-1 Y
speed:
name: Target-1 Speed
angle:
name: Target-1 Angle
distance:
name: Target-1 Distance
resolution:
name: Target-1 Resolution
License:
Creative Commons — Attribution — Share Alike
10