Adding LD2410 Motion Sensor to Sonoff S26 Smart Plug running ESPHome

The HLK-LD2410C module is a human presence, distance and motion detection sensor using 24GHz millimeter wave radar. The boards I found are so small (22mm wide by 16mm high) that I wondered if I could add one to a wifi smart plug. That turned out to be easy, follow along for step by step instructions.

The HLK-LD2410C by Hi-Link is a human presence detector that detects movement up to 6 meters but also can detect people sitting still up to 4 meters. That can be an advantage compared to passive infrared sensors (PIR).

I am running ESPHome firmware on the Sonoff S26 Smart Plug. Blakadder’s website has very good instruction on how to connect to the Sonoff S26 for flashing.

First, let’s take apart the Sonoff S26 Smart Plug. Easy after you remove 3 screws in the back.

The HLK-LD2410C board comes with a 5-pin header on the back. Desolder and remove the header pins:

Solder 4 thin wires to the ESP8266 in the S26 and the LD2410 sensor board:

  • ESP8266 GND to LD2410 GND
  • ESP8266 3V3 to LD2410 VCC
  • ESP8266 ERX to LD2410 TX
  • ESP8266 TRX to LD2410 RX
  • You do not have to connect the OUT of the LD2410.
Sonoff S26 with LD2410 radardetection

Protect the back of the sensor PCB with insulating tape, but do not cover the antenna on the front:

I added some glue to the top of the black relay and put the sensor PCB on it. Make sure the antenna is facing up and there is enough room left above the button on the S26 PCB:

Also check that the sensor PCB back does not touch the other components:

After the glue has dried, it is time to put the PCB back in the case and close it:

Add this to your existing ESPHome configuration for the Sonoff S26. I specified UART1 for the logger because UART0 is used by the LD2410 sensor. I am not sure if this is necessary.

  hardware_uart: UART1 # UART0 used by ld2410

  tx_pin: 1
  rx_pin: 3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

  timeout: 150s
  max_move_distance : 6m
  max_still_distance: 0.75m
  g0_move_threshold: 10
  g0_still_threshold: 20
  g1_move_threshold: 10
  g1_still_threshold: 20
  g2_move_threshold: 20
  g2_still_threshold: 21
  g3_move_threshold: 30
  g3_still_threshold: 31
  g4_move_threshold: 40
  g4_still_threshold: 41
  g5_move_threshold: 50
  g5_still_threshold: 51
  g6_move_threshold: 60
  g6_still_threshold: 61
  g7_move_threshold: 70
  g7_still_threshold: 71
  g8_move_threshold: 80
  g8_still_threshold: 81

  - platform: ld2410
      name : Moving Distance
      name: Still Distance
      name: Move Energy
      name: Still Energy
      name: Detection Distance

After uploading the ESPHome firmware, this is the result in Home Assistant:

Leave a Reply

Your email address will not be published. Required fields are marked *