How to work with HLK-LD1115H and Wemos D1 Mini for Human Presence Detection

Thank you for sharing! I am working on it right now. If I make it work I will share it here.

This setup worked a treat, thank you.

This sensor isnā€™t quite sensitive enough though it seems, keeps going in occupied while Iā€™m watching TV. The aqara one setup alongside still has us picked up fine.

1 Like

If you use rosaldahna solutions, then you can adjust the sensitivity from HA and/or the Webportal

2 Likes

You can try my newest YAML. With sensitive adjustable.

3 Likes

Iā€™ve ordered one and will be using a d1 mini as well. Please share images of your setup and your config. Need some ideas.

Here is mine. Its an airquality monitor with presence detection. Will replace D1 mini with ESP32 as these have two UARTs (1 for CO2 sensor 1 for mmWave). For now mmWave connected as binary sensor via GPIO16.


5 Likes

The radar works ok through the plastic?

Yes of course! Why wouldnā€™t it?

1 Like

Because having something in front of radar would cause some interference. But if itā€™s still working fine then all good

plastic is non-conductive and non-magnetic. So everything you mention doesnā€™t apply to it. Its transaprent for radio waves

1 Like

ā€¦ well I feel stupid. This opens up so many possibilities for housing this unit. Iā€™m working on somethingā€¦

Thanks for this, I got it up and working, but it seems to be too sensitive.

Some log output when Iā€™m out of the room:

[10:26:11][D][uart_debug:158]: <<< "mov, 2 1119\r\n"
[10:26:11][D][uart_debug:158]: <<< "mov, 2 1137\r\n"
[10:26:11][D][uart_debug:158]: <<< "mov, 2 1119\r\n"
[10:26:11][D][uart_debug:158]: <<< "mov, 2 1103\r\n"
[10:26:11][D][uart_debug:158]: <<< "mov, 2 1089\r\n"
[10:26:11][D][uart_debug:158]: <<< "mov, 2 1072\r\n"
[10:26:11][D][uart_debug:158]: <<< "mov, 2 1082\r\n"

And when I adjust the sensitivity:

[10:26:12][VV][api.service:548]: on_number_command_request: NumberCommandRequest {
  key: 1816819127
  state: 239
}
[10:26:12][D][number:054]: 'multisensorkitchen_motion_detection_sensitivity' - Setting number value
[10:26:12][D][number:113]:   New number value: 239.000000
[10:26:12][D][uart_debug:158]: >>> "th1=239 \n"
[10:26:12][VV][scheduler:026]: set_timeout(name='', timeout=1000)
[10:26:12][D][number:012]: 'multisensorkitchen_motion_detection_sensitivity': Sending state 239.000000
[10:26:12][VV][api.service:260]: send_number_state_response: NumberStateResponse {
  key: 1816819127
  state: 239
  missing_state: NO
}

So the adjustment commands appear to be getting through, so my UART are the correct way around.

Any other advice? I have it in a housing with a air quality monitor which has a small fan, perhaps the vibration from that is causing issues?

EDIT: So, I found that I had set the upper limits for the sensitivity too low for the sensitivity. So i bumped those up and made the sensor less sensitive. Also added some vibration isolation to the sensor

I have same issue, as you see in my previous post i also have it in a housing with PM Sensor. Fan causes small vibrations and mmWave sensor picks it up as movement. Fixed by reduced sensitivity and dampening pad under sensor

Hey,
your code works great.
Is it possible to ahust it to have to binary sensors for motion and occupancy?
I have tried adding them myself but managed only to get hlaf way. Only set them to ā€œtrueā€, cannot fing the way to clear the status.

binary_sensor:
  - platform: template
    device_class: motion
    name: ${upper_devicename} Movement
    icon: mdi:motion-sensor
    id: LD1115H_Mov
    filters:
      - delayed_off: 2s
  - platform: template
    device_class: occupancy
    name: ${upper_devicename} Occupancy
    id: LD1115H_Occ
    icon: mdi:account
    filters:
      - delayed_off: 2s

I have added two lines hereā€¦

text_sensor:
  - platform: serial
    uart_id: uart_2
    name: ${upper_devicename} LD1115H UART Text
    id: LD1115H_UART_Text
    icon: "mdi:format-text"
    internal: True #If Don't Want to See UART Receive Data, Set To True
    on_value:
      lambda: |-
        if (id(LD1115H_UART_Text).state.substr(0,3) == "occ") {
          id(LD1115H_Signal).publish_state(atof(id(LD1115H_UART_Text).state.substr(7).c_str()));
          id(LD1115H_Direction).publish_state(atof(id(LD1115H_UART_Text).state.substr(5,2).c_str()));
          id(LD1115H_Occupancy).publish_state("Occupancy");
          id(LD1115H_Last_Time) = time(NULL);
          id(LD1115H_Occ).publish_state(true);
          if (id(LD1115H_Clearence_Status) == true) {
            id(LD1115H_Clearence_Status) = false;
          }
        }
        else if (id(LD1115H_UART_Text).state.substr(0,3) == "mov") {
          id(LD1115H_Signal).publish_state(atof(id(LD1115H_UART_Text).state.substr(7).c_str()));
          id(LD1115H_Direction).publish_state(atof(id(LD1115H_UART_Text).state.substr(5,2).c_str()));
          id(LD1115H_Occupancy).publish_state("Movement");
          id(LD1115H_Last_Time) = time(NULL);
          id(LD1115H_Mov).publish_state(true);
          if (id(LD1115H_Clearence_Status) == true) {
            id(LD1115H_Clearence_Status) = false;
          }
        }

I will take your suggestion.
But there is a problem in the code. When disconnect the UART cable, esp32 will reboot and fall into bootloop.
Now have the solution is change the framework to ESP-IDF, it costs less resource than arduino.

But change to ESP-IDF framework. It still have some problem to fix. I will modify the code when i finish current things.

I tried your code on two boards: esp8266 and esp32-c3. onthe first one it works perfec, on the second one it hangs from time to time and data stream breaks.

I also changed your code a bit (simplified for my needs)

text_sensor:
  - platform: serial
    uart_id: uart_bus
    name: LD1115H UART Text
    id: LD1115H_UART_Text
    icon: "mdi:format-text"
    internal: True #If Don't Want to See UART Receive Data, Set To True
    on_value:
      lambda: |-
        if (id(LD1115H_UART_Text).state.substr(0,3) == "mov") {
          id(mov_binary_sensor).publish_state(true);
          id(mov_binary_sensor).publish_state(false);
        }
        else if (id(LD1115H_UART_Text).state.substr(0,3) == "occ") {
          id(occ_binary_sensor).publish_state(true);
          id(occ_binary_sensor).publish_state(false);
        }

binary_sensor:
  - platform: template
    name: "Movement"
    id: mov_binary_sensor
    filters:
      - delayed_off: 3s
  - platform: template
    name: "Presence"
    id: occ_binary_sensor
    filters:
      - delayed_off: 3s
      


number:
  - platform: template
    name: LD1115H TH1 #TH1 is Movement/Motion Sensitivity
    id: LD1115H_TH1
    icon: "mdi:cogs"
    optimistic: true
    initial_value: "120" #Default TH1 Setting
    min_value: 20
    max_value: 1500
    step: 10
    set_action:
      then:
        - uart.write:
            id: uart_bus
            data: !lambda |-
              std::string th1st = "th1=" + to_string(x) +" \n";
              return std::vector<uint8_t>(th1st.begin(), th1st.end());
  - platform: template
    name: LD1115H TH2 #TH2 is Occupancy/Presence Sensitivity
    id: LD1115H_TH2
    icon: "mdi:cogs"
    optimistic: true
    initial_value: "250" #Default TH2 Setting
    min_value: 50
    max_value: 4000
    step: 50
    set_action:
      then:
        - uart.write:
            id: uart_bus
            data: !lambda |-
              std::string th2st = "th2=" + to_string(x) +" \n";
              return std::vector<uint8_t>(th2st.begin(), th2st.end());

Love to see the progress of this ESPHome integration! Really appreciate all your efforts!

Weird question that some might be able to answer; can an exponential increase of sensitivity affect the sensor physically, as in frying a resistor?

The reason Iā€™m asking is that I also have the ā€œlittle brotherā€ sensor (HLK-LD2410) of this one, and I canā€™t get it to work. The datasheet is lacking some information.

Hello, anyone used LD1115H with esp using Arduino IDE, kindly share the code.
Thank you

Just change the framwork from ESP-IDF to arduino.

yes but can you please share the code. I am using Arduion IDE and using C language in it. I donā€™t know how yaml can be used with it. Sorry if I am sounding too naive.