Build guide

A $13 radar trip wire for your hallway

Count people walking in and out of a room, and log how restless you were overnight. One radar, one ESP32, four wires.

Not a camera. It works in the dark, sees through drywall and doors, and has no idea who you are. It is not exact either: two people walking side by side count as one. That is good enough for “did anyone come home” and “how badly did I sleep”, which is what this is for.

Video coming soon.

Parts

PartCostNotes
Waveshare HMMD 24 GHz mmWave radar$2.99Presence and distance out of a serial port, all signal processing on board. Breadboard header pins. The firmware also supports the HLK-LD2410 if you already have one.
Waveshare ESP32-S3-DEV-KITabout $10Pick the pre-soldered header option unless you want to solder. Any ESP32 with a spare UART works.
4 jumper wires, USB-C cable, phone chargerThe node runs from any 5 V USB adapter.

Waveshare links are affiliate links; you pay the same price. Get two radars if you want the front-door pair at the end.

Wiring

Four wires. The radar is 3.3 V for supply and logic, same as the ESP32, so there is no level shifting. Its header is labeled 3V3, GND, TX, RX, OT2.

Radar pinESP32-S3 pin
3V33V3
GNDGND
TXGPIO 4
RXGPIO 5
OT2not connected

Radar TX goes to the ESP’s RX pin and radar RX goes to the ESP’s TX pin. Crossed. This is the wiring mistake everyone makes once. OT2 is the module’s own presence flag; we read the serial stream instead because it also carries the distance, which is what direction detection needs. If you are using an HLK-LD2410, its supply pin goes to 5V and the rest is the same.

Flash

The firmware is at github.com/AllanBinder/radar-tripwire. It is a PlatformIO project.

git clone https://github.com/AllanBinder/radar-tripwire
cd radar-tripwire
cp include/wifi_secrets.example.h include/wifi_secrets.h   # put your WiFi name and password in it
pio run -t upload

Hold BOOT while plugging in the USB cable if the board does not drop into the bootloader on its own. Once it boots, the node joins your WiFi and serves a page at http://radar-node.local with live distance, the in/out tally, and a mode switch between hallway and overnight.

How it counts

The radar reports the distance to the nearest moving thing ten times a second. Distance falling means someone is walking toward it. Rising means walking away. The node tracks each person from appearing to disappearing and counts one in or one out if they moved at least 1.5 m. Turn around halfway and it ignores you.

HALLWAY, FROM ABOVE radar approaching, distance falling IN leaving, distance rising OUT
Mount it at the far end of the hall, pointing down its length, about chest height. The walls contain the beam so all it sees is people passing through.

Overnight mode

Flip the switch on the page and stand the node on the nightstand pointing at the bed. The radar can see a chest breathing, so it knows you are there even when you are still, and it catches rolling over and getting up. In the morning you get a bar chart of movement per five minutes. Movement log, not sleep stages.

Getting the data out

If you run something other than Home Assistant, the manual sensor block looks like this:

mqtt:
  sensor:
    - name: "Hallway in"
      state_topic: "radar/hallway/state"
      value_template: "{{ value_json.count_in }}"
    - name: "Hallway out"
      state_topic: "radar/hallway/state"
      value_template: "{{ value_json.count_out }}"

Gotchas

Next

Parts: radar, ESP32-S3.