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.
Parts
| Part | Cost | Notes |
|---|---|---|
| Waveshare HMMD 24 GHz mmWave radar | $2.99 | Presence 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-KIT | about $10 | Pick the pre-soldered header option unless you want to solder. Any ESP32 with a spare UART works. |
| 4 jumper wires, USB-C cable, phone charger | The 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 pin | ESP32-S3 pin |
|---|---|
| 3V3 | 3V3 |
| GND | GND |
| TX | GPIO 4 |
| RX | GPIO 5 |
| OT2 | not 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.
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
- JSON.
GET http://radar-node.local/api/statereturns presence, distance, counts, and the overnight buckets. Poll it from anything. - MQTT. Set a broker on the page and the node publishes
radar/<name>/stateon 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 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.
Next
- 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)