aio-ld2410
is a python library that allows interacting with the Hi-Link LD2410 sensors
using asyncio.
Such radar sensor would typically require an USB-UART adapter on most computers but is natively included on most embedded platforms such as the Raspberry Pi.
This library supports a wide range of variants in terms of models and firmware versions,
but was mostly tested on LD2410C with firmware v2.04.23022511
.
It features comprehensible methods to get and set various configuration parameters, as well as dataclasses for output results and sensor reports.
This package requires Python ≥ 3.9 and pulls a few other packages as dependencies.
To install aio-ld2410
, simply run the following command:
python -m pip install aio-ld2410
Here's how you can start reading sensor reports from a few lines of python:
#!/usr/bin/env python
import asyncio
from aio_ld2410 import LD2410
async def main():
async with LD2410('/dev/ttyUSB0') as device:
async with device.configure():
ver = await device.get_firmware_version()
print(f'[+] Running with firmware v{ver}')
# Reports are typically generated every 100ms.
async for report in device.get_reports():
print(report)
asyncio.run(main())
For further details, please refer to the documentation.
Contributions, bug reports and feedbacks are very welcome, feel free to open an issue, send a pull request. or start a discussion.
Participants must uphold the code of conduct.
aio-ld2410
is released under the MIT license.