Asyncio LD2410 Library¶
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.
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)
if __name__ == '__main__':
asyncio.run(main())