Presence detection using mmWave radar is the most accurate occupancy sensing technology available for Indian home automation. Unlike PIR sensors that miss stationary people (common false-negative when reading quietly, meditating, or sleeping), mmWave radar detects micro-movements like chest breathing at distances up to 5 metres. This guide covers LD2410/LD2420 mmWave modules from Hi-Link Electronics, integration with ESP8266/ESP32, and Home Assistant automation for Indian homes.
Table of Contents
- Why mmWave Radar Over PIR for Indian Homes?
- mmWave Modules: LD2410, LD2420, and HLK-LD1115H
- Wiring LD2410 to ESP8266/ESP32
- Firmware: Reading LD2410 UART Data
- MQTT Integration with Home Assistant
- Presence-Based Automations for Indian Homes
- ESPHome Configuration for mmWave
- Frequently Asked Questions
Why mmWave Radar Over PIR for Indian Homes?
| Feature | PIR Sensor (HC-SR501) | mmWave Radar (LD2410) |
|---|---|---|
| Detects stationary person | No – stops after 1-2min | Yes – breathing motion detected |
| Range | 3-7m motion only | 0.5-5m (stationary+moving) |
| Through-wall detection | No | No (by design) |
| Pet immunity | Possible with tilt | Height filtering available |
| India price | Rs 60 | Rs 350-500 |
| Use case | Intrusion, corridor | Occupancy, energy saving |
For Indian homes where energy saving is the primary goal (fan/AC auto-off when room is empty, geyser auto-off when bathroom is vacant), mmWave radar eliminates the false-negative problem of PIR sensors – no more lights staying off because you were watching TV without moving.
Recommended: UNO WiFi R3 (ATmega328P + ESP8266)
Combine the UNO WiFi R3 with an LD2410 mmWave sensor for a powerful room presence node. The board’s ESP8266 sends occupancy MQTT updates to Home Assistant while the ATmega328P handles sensor polling and filtering.
mmWave Modules: LD2410, LD2420, and HLK-LD1115H
LD2410 (Hi-Link): Most popular mmWave module for DIY home automation. 24GHz FMCW radar, detects both moving and stationary targets. Configurable sensitivity, gate distances, and output mode. UART interface at 256000 baud. India price: Rs 350-400 (Robu.in, Cytron).
LD2410B: Bluetooth variant of LD2410. Configure via phone using Hi-Link’s app. No need to connect to ESP8266 during setup. Same detection capability.
LD2420: Larger format, 24GHz, 20-zone range gates (vs 8 in LD2410). Better for large rooms (>15 sq m, common in Indian independent houses).
HLK-LD1115H: 5.8GHz, lower cost (Rs 280), simpler UART output (presence/absence string only). Less configurable but easiest to integrate.
Wiring LD2410 to ESP8266/ESP32
LD2410 -> ESP8266 NodeMCU
VCC -> 3.3V
GND -> GND
TX -> GPIO D7 (RX - SoftwareSerial)
RX -> GPIO D8 (TX - SoftwareSerial)
OUT -> GPIO D5 (digital output: HIGH=presence, LOW=empty)
// OUT pin provides simple digital presence signal
// No UART parsing needed for basic on/off automation
// UART gives detailed data: target distance, movement speed, signal strength
For ESP32, use hardware UART2 (GPIO16 RX, GPIO17 TX) for more reliable high-baud-rate communication with LD2410’s 256000 baud.
Firmware: Reading LD2410 UART Data
#include <Arduino.h>
#include "ld2410.h" // https://github.com/ncmreynolds/ld2410
ld2410 radar;
SoftwareSerial radarSerial(D7, D8);
void setup() {
radarSerial.begin(256000);
radar.begin(radarSerial);
radar.requestFirmwareVersion();
}
void loop() {
if (radar.read()) {
if (radar.presenceDetected()) {
float movDist = radar.movingTargetDistance(); // cm
float movEnergy = radar.movingTargetEnergy(); // 0-100
float statDist = radar.stationaryTargetDistance(); // cm
float statEnergy = radar.stationaryTargetEnergy(); // 0-100
Serial.printf("PRESENT: moving @%dcm e=%d, static @%dcm e=%dn",
(int)movDist, (int)movEnergy, (int)statDist, (int)statEnergy);
} else {
Serial.println("EMPTY");
}
}
}
Recommended: Mega WiFi R3 (ATmega2560 + ESP8266)
Deploy mmWave presence sensors across every room with the Mega WiFi R3 as the central hub. Its 54 I/O pins can monitor the digital OUT pin from 20+ LD2410 sensors simultaneously for whole-home occupancy mapping.
MQTT Integration with Home Assistant
// Publish occupancy to MQTT
void publishPresence(bool occupied, int distance) {
StaticJsonDocument<128> doc;
doc["occupancy"] = occupied;
doc["distance_cm"] = distance;
doc["energy"] = radar.stationaryTargetEnergy();
char buf[128];
serializeJson(doc, buf);
mqtt.publish("home/bedroom/presence", buf);
}
// Home Assistant configuration.yaml
// mqtt:
// binary_sensor:
// - name: Bedroom Occupancy
// state_topic: home/bedroom/presence
// value_template: "{{ value_json.occupancy }}"
// device_class: occupancy
// payload_on: "true"
// payload_off: "false"
Presence-Based Automations for Indian Homes
Once every room has an mmWave presence sensor, powerful energy-saving automations become possible:
- Fan auto-off: If bedroom is empty for 5 minutes (sleep indicator: stationary presence detected but low movement energy), step fan down to speed 1. If empty for 30 minutes, switch off.
- AC temperature adjustment: When room occupancy count goes from 1 person to 2 people (two stationary targets in LD2420 multi-target mode), drop AC setpoint by 1 degree C.
- Bathroom geyser: When someone enters bathroom (mmWave detects presence), auto-on geyser if temperature below 40 degrees C. Auto-off 10 minutes after bathroom is empty.
- Good night trigger: When all bedrooms show stationary presence and living room is empty after 10 PM IST, trigger “night mode” (lock main door, arm perimeter PIRs, dim corridor lights to 10%).
- MSEDCL off-peak usage: Combine whole-home occupancy (all rooms empty = family out) with scheduled timer to run washing machine during MSEDCL off-peak hours (11 PM – 6 AM).
ESPHome Configuration for mmWave
uart:
id: radar_uart
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
id: my_ld2410
uart_id: radar_uart
binary_sensor:
- platform: ld2410
has_target:
name: Bedroom Presence
device_class: occupancy
has_moving_target:
name: Bedroom Movement
has_still_target:
name: Bedroom Still Presence
sensor:
- platform: ld2410
moving_distance:
name: Moving Target Distance
still_distance:
name: Still Target Distance
moving_energy:
name: Moving Target Energy
still_energy:
name: Still Target Energy
This ESPHome YAML creates fully functional presence detection that auto-appears in Home Assistant as named entities. ESPHome is the recommended integration method for HA users.
Recommended: 12V 1-Channel Relay Module (RS485/Modbus)
Complete presence-triggered home automation with this relay module. When mmWave detects an empty room, the relay cuts power to fan, lights, and AC – automatically. No false positives, no wasted electricity.
Frequently Asked Questions
- Does mmWave radar work through plywood wardrobes or plastic partitions?
- LD2410 (24GHz) can penetrate thin plywood (3-6mm) and plastic, but with reduced accuracy. Glass and concrete walls block it. Mount the sensor in the open room, not inside wardrobes or behind walls.
- Will the radar trigger on ceiling fans?
- Yes, a ceiling fan’s blade movement can trigger the moving target detection. Use the stationary target output only for occupancy automation (human breathing detected when still). Configure the radar’s angle to avoid the fan blades using horizontal angle filtering in LD2410’s configuration tool.
- What is the power consumption of LD2410?
- LD2410 consumes 50-100mA at 3.3V (0.165-0.33W). For battery-powered nodes, use the HLK-LD1115H (30mA) or put the radar in low-power mode with periodic sampling (1-second polling reduces average current to ~20mA).
- Can it distinguish between one person vs two people?
- LD2410 reports one target (closest/strongest). LD2420 with multi-target mode can report up to 3 simultaneous targets. For precise person counting (useful for meeting rooms or family occupancy), use a dedicated people-counting sensor like the Hi-Link HLK-LD2450 (Rs 1,200).
- Where should I mount it in an Indian bedroom?
- Corner of the ceiling, angled toward the bed centre, 2.5-3m height. Ensure it covers the sleeping area (where stationary detection matters most). Avoid pointing directly at AC units or ceiling fans to reduce false triggers.
Add comment