HLK-LD2412 sensor ESPHome support

Hi,

I ordered a few HLK-LD2412 sensors as I am using the LD2410 in a ceiling mount and my initial testing was very positive.

Is there anyone working on supporting this for Homeassistant? I haven’t seen anything so I have adapted the LD2410 codebase to support the various sensors via UART and the sensor works really well according to some initial tests.

I’d be happy to help support this officially, but I haven’t really any knowledge in official development practices, so if this codebase can help anyone, I’m very happy :slight_smile:

The code is available here: GitHub - abaumhof/homeassistant_public

Please note that this only supports the sensor values. All configuration needs to be done via the HLKRadarTool app via bluetooth at this stage.

I know that screekworkshop has been posting about it… If anyone has any help optimmizing this and share tips and tricks, that’d be awesome.

Cheers
Andreas

1 Like

Thanks @abaumhof I was able to get LD2412 module to work with ESP32 C3. However, it seems to generate a lot of false positives in a complete empty room. Do you experience this issue?

I was sidetracked a bit and just got back to testing them again. There is a new firmware out, make sure you use that. That will improve static detection.

I’m having some trouble with moving detection - both from a false positive point of view but also not detecting movement in gate 5-6 (my use case is ceiling-mount, so gate 5-6 are pretty much my last ones). Basically if I stand there, I can see that static detection detects me, but when I move my arms, moving energy levels wont move much.

I just reached out to them… Hopefully they optimise move detection after they optimised static detection in a new firmware. For me, static detection is much more accurate and better than the LD2410C

There is a new firmware available (1.24.24080517) which dramatically reduces false positives… For me a little bit too much as now it doesn’t detect presence in certain circumstances that it did before, BUT this firmware seems to be a massive step in the right direction. Detection accuracy still isn’t available, so I’m hopeful once that is available, this is the perfect presence sensor for me.

Glad to see your research, we did a similar DIY sensor based on the LD2412 and likewise noticed the recent firmware update.
Regarding the distance issue shown by the LD2412, we know from the HLK developers that this is an expected behaviour, it’s terrible at accurate ranging, but in exchange for better detection. It seems hardly something that can be improved in the future.

Thanks for your comprehensive reply… That sounds very interesting… I’m actively testing too and if you don’t mind sharing the yaml, I’d be more than happy to look at it - even in a beta state…

As you can see I have tweaked the LD2410 C++ code to support whatever I needed, but I need to clean this up anyways.

Cheers
Andreas

1 Like

We used an earlier component library from ld2410, retooled it, and it’s very similar to your approach, you can even see the similarity in the code. We’ll share them as soon as we can, but for now we’ll make a few more changes and it’s full of miscellaneous debugging code, so it’s not fit to be shared yet (I think).

One of the things about the CRC bytes is that in the LD2412’s Motion Mode (which has become 0x03 Mixed Mode), they will not always be 00, but actually represent the speed of motion (which is interesting).
Meanwhile the simple 0x01 motion mode no longer appears

2 Likes