chris.builds.stuff
home / builds / presence-sensor

A presence sensor that doesn't think I'm a cat

PIR sensors turn the lights off while I'm sitting still at my desk. An mmWave radar doesn't. Here is the whole build, from parts to automation.

Build time
3 h
Cost
$14
Filament
22 g PETG
Difficulty
Easy
The finished presence sensor mounted on a desk shelf
On the shelf. The finished sensor, about 40 cm from where I sit.

Parts

Everything here is a few dollars on its own. The radar is the only part that matters, so buy a genuine LD2410 and not a lookalike.

Part Notes Cost
ESP32 DevKit C Any 30-pin board works $6.00
HLK-LD2410C 24 GHz mmWave radar $5.50
Dupont wires, 4× Female to female $0.50
USB cable and charger From the drawer $2.00

Print the base and lid in PETG at 0.2 mm. Radar passes through plastic well, but keep the wall in front of the sensor at 1.2 mm or thinner and avoid metallic filament.

The printed PETG case, open, showing where the radar sits
The case, open. PETG, 0.2 mm layers, 3 perimeters. The radar sits behind the thin front wall.

Assemble

Seat the radar, push on the four wires, then close the lid. It takes about ten minutes, and nothing is soldered.

ESP32DevKit CLD2410mmWave radar3V3 → VCCGND → GNDGPIO16 → TXGPIO17 → RX
Wiring. TX on the radar goes to RX on the board, and the other way round.

Flash with ESPHome

Create a new device in the ESPHome dashboard and replace its config with this. The uart block matches the wiring above.

desk-presence.yaml
esphome:
  name: desk-presence

esp32:
  board: esp32dev

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

uart:
  tx_pin: GPIO17
  rx_pin: GPIO16
  baud_rate: 256000

ld2410:

binary_sensor:
  - platform: ld2410
    has_target:
      name: Desk Presence

Home Assistant

Once the node is online, Home Assistant discovers it automatically. Add it, then use binary_sensor.desk_presence as the trigger for your lights. Set a 2 minute delay on the off side so a quick trip to the kitchen doesn’t plunge you into darkness.

Home Assistant history graph of the desk presence sensor over one workday
One workday. The sensor holds "on" while I sit still, and drops about a minute after I leave.

That’s the whole build. Next up: adding a second sensor and averaging them, so a ceiling fan stops counting as a person.