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

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.

Try use ESPHome

hi! this is one of my first esphome projects so i’m still learning.
i have a HLK sensor connected with a esp8266 and flashed it, it also gives output in the logs when there is movement and occupancy

when i look in HA i only get this and nothing changes and it stays on clearance, also moved the sliders but no change.

do you guys have any idea whats happening? i litterly copied the code from @patrick339 and changed the esp32 things to 8266, would that be a problem?

1 Like

@gerbildral UART no message receive. Check you wire and follow the connection diagram.

4 Likes

Ah yes, it works now. Thanks!
did a rookie mistake as i connected Rx to Rx and Tx to Tx :man_facepalming:

I received my HLK-LD1115H today. Will follow this guide using a D1 Mini. Any using the same the D1 Mini and have figure out a way to stack on top of the sensor?

Anyone here with ceiling fan in your room, are you able to tune the settings so it doesn’t detect the spinning if it’s possible?
Or is blocking it the only solution for now?

When you say hang, you mean the entities get stuck in the detected, movement state after some time?
I am noticing this on a Esp8266 setup. Restarting doesn’t seem to fix it. Removing the power pin from the HLK-LD1115 seems to work only to freeze again.

What does the component do that is mounted on the side of the case?

So I am not sure 100% but it gets really hot. Even my BME680 located near registering 3°C more.
I have tried it with Wemos D1 mini and Adafruit CT PY C3. Wemos D1 works, but C3 is a terrible experience. C3 losses wifi connection, overheats, …

left CO2 sensor MH-Z19C, right BME680

Ah. My bad on this one. Dumb me grabbed the wrong .yaml file not realizing there were different HLK models. It working now with the correct file (HLK -LD1115H).

I am interested in this project and now I am waiting for the delivery of the sensor. Just one question for now: in your experience, how reliable is the presence sensor if it’s properly set up and oriented?
I tried the thermal camera, people count VL53L0X, VL53L1X, but still no reliable detection results.

I have a chance to let the sensor sit with no one in the room (over night) There were a couple of false positive triggers. Anyone experience any false positive?

This is what I came up with. There will be no case as it will be inside an AC cable trough. The loose wires you see will be for DHT22 temp sensor.

Updates: Made some changes to my setup. I have added a photocell light sensor to the esp8266.

@chrisgozd92 - just got one of these to test.

Do you have more datasheet info? The one posted in the OP is missing some parameters and I wonder what they are…

[16:51:56][D][uart_debug:158]: >>> "get_all\n"
[16:51:56][D][uart_debug:158]: <<< "th1 is 130\r\n" 
[16:51:56][D][uart_debug:158]: <<< "th2 is 250\r\n" 
[16:51:56][D][uart_debug:158]: <<< "th3 is 1500\r\n"
[16:51:56][D][uart_debug:158]: <<< "ind_min is 2\r\n"
[16:51:56][D][uart_debug:158]: <<< "ind_max is 32\r\n"
[16:51:56][D][uart_debug:158]: <<< "mov_sn is 3\r\n"
[16:51:56][D][uart_debug:158]: <<< "occ_sn is 5\r\n"
[16:51:56][D][uart_debug:158]: <<< "dtime is 5000 mS\r\n"

Was going to take a stab at building a parser to keep delay/sensitivity/etc settings in sync.

So I don’t know what they all do…

…or what their value ranges are…

…but they sync

After playing around w/ this sensor for a very short period of time, I have a few observations that would benefit others confirming/challenging.

HLK-LD1115H Behavioral Observations

  • the “movement” vs “occupancy/presence” delineation is curious yet harmless as far as I can tell. The benefit of it appears to be the ability to “tune” each detection threshold individually.
  • the detection thresholds appear to be in some form of SNR (signal-to-noise ratio) where higher is better. The con of this is that we don’t have distance or sensitivity. A large target far away is likely the same SNR as a small target up close :confused:
  • the unknown th3 appears to impact th2/occ
  • it is unclear what target index min/max has on detection
  • settings are performed live which is nice compared to Leapmmw sensors
  • there is no way to disable the mov/occ uart output which is very noisy!
  • the sensor allows you to set SNR values “incorrectly”.
    ** eg th1 higher than th2
    ** th1/mov should be a lower SNR than th2/occ in order for the labels to “make sense”

Side-by-side

I temporarily installed the 1115H beside a DFRobot overnight; they appear roughly the same. If not a little more sensitive. Cats are hard to detect. But there isn’t a baseline here so “grain of salt” warning applies.

Settings Update

I heard back from HLK who provided a few more tidbits on info. Such as the max value setting for th1, th2 and th3 is 65536. And that th3 is for “the long distance” setting which is anything over 12M.

Additionally, the ind_min/max “are for engineering” and that you shouldn’t change it… :wink:

2 Likes