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

About $13: a $3 radar, a $10 ESP32-S3 board, and four jumper wires.
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, all 3.3 V. Radar TX goes to ESP RX, and the other way round.

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

Clone the repo, add your WiFi name and password, upload with PlatformIO.

The firmware is at github.com/AllanBinder/radar-tripwire. It is a PlatformIO project. Questions while you build? Ask in the _stition Discord.

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

Distance falling counts as in, rising as out. Mount it at the end of the hall.

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

On the nightstand it logs movement per five minutes. Not sleep stages.

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

JSON, MQTT, and Home Assistant discovery. Multiple nodes add up on your server.
  • JSON. GET http://radar-node.local/api/state returns presence, distance, counts, and the overnight buckets. Poll it from anything.
  • MQTT. Set a broker on the page and the node publishes radar/<name>/state on every change. It also sends Home Assistant discovery, so the sensors appear on their own.
  • Multiple nodes. They do not talk to each other. Your server does the math: people in the house is ins minus outs across the doorways you covered.

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

Fans, metal, radars facing each other, and a weak 5 V pin.
  • Fans and curtains trigger it. Turn off the gate the fan sits in, on the settings page.
  • Metal and mirrors block it. Foil on a wall stops it seeing into the next room. (video coming soon)
  • Two radars pointed at each other interfere. Angle them.
  • The 5 V pin. Only matters for the LD2410 version, but check that your ESP32 board actually has 5 V on that pin. Mine read 2.8 V and the radar sat silent for an hour. The 3.3 V pin does not have this problem.

Still stuck? Post in #help on the Discord.

Next

A front-door pair, and a different module for breathing and heart rate.
  • Front-door pair. Two nodes, far fewer false counts. Same firmware. (video coming soon)
  • Breathing and heart rate need a different module. (video coming soon)

Parts: radar, ESP32-S3.

Built one? Show it off in #general on the _stition Discord.