nanoFramework.Iot.Device.Ld2410
1.0.105
Prefix Reserved
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Ld2410 --version 1.0.105
NuGet\Install-Package nanoFramework.Iot.Device.Ld2410 -Version 1.0.105
<PackageReference Include="nanoFramework.Iot.Device.Ld2410" Version="1.0.105" />
paket add nanoFramework.Iot.Device.Ld2410 --version 1.0.105
#r "nuget: nanoFramework.Iot.Device.Ld2410, 1.0.105"
// Install nanoFramework.Iot.Device.Ld2410 as a Cake Addin #addin nuget:?package=nanoFramework.Iot.Device.Ld2410&version=1.0.105 // Install nanoFramework.Iot.Device.Ld2410 as a Cake Tool #tool nuget:?package=nanoFramework.Iot.Device.Ld2410&version=1.0.105
HLK-LD2410 24Ghz Human Presence Radar Sensor Module
Documentation
- Product Page
- Manual - English
- Manual - Chinese
- Communication Protocol - English
- Communication Protocol - Chinese
Usage
Initialize the radar module:
var radar = new Radar("COM2");
radar.OnMeasurementReceived += OnMeasurement;
radar.Connect();
The OnMeasurement
event handler is responsible for receiving measurement reports from the radar. The report object instance contains distance and energy measurements for targets within the detection range of the radar.
An example on how to print out some of this data to the console through the event handler:
private static void OnMeasurement(object sender, ReportFrame e)
{
if (e is EngineeringModeReportFrame engineeringModeReportFrame)
{
Debug.WriteLine($"Target State (Engineering Mode): {engineeringModeReportFrame.TargetState} | Movement Target Distance (CM): {engineeringModeReportFrame.MovementTargetDistance.Centimeters} | " +
$"Movement Target Energy: {engineeringModeReportFrame.MovementTargetEnergy} | Stationary Target Distance (CM): {engineeringModeReportFrame.StationaryTargetDistance.Centimeters} | " +
$"Stationary Target Energy: {engineeringModeReportFrame.StationaryTargetEnergy} | Detection Distance (CM): {engineeringModeReportFrame.DetectionDistance.Centimeters}");
var gateNumber = 0;
foreach (var gate in engineeringModeReportFrame.GateData)
{
Debug.WriteLine($"Gate: {gateNumber} - Movement Energy: {gate.MovementEnergy} - Static Energy: {gate.StaticEnergy}");
gateNumber++;
}
}
else if (e is BasicReportFrame basicReportFrame)
{
Debug.WriteLine($"Target State: {basicReportFrame.TargetState} | Movement Target Distance (CM): {basicReportFrame.MovementTargetDistance.Centimeters} | " +
$"Movement Target Energy: {basicReportFrame.MovementTargetEnergy} | Stationary Target Distance (CM): {basicReportFrame.StationaryTargetDistance.Centimeters} | " +
$"Stationary Target Energy: {basicReportFrame.StationaryTargetEnergy} | Detection Distance (CM): {basicReportFrame.DetectionDistance.Centimeters}");
}
}
Calling Connect()
on an instance of the radar object will initialize a new SerialPort
(or use the SerialPort
instance passed to the Radar
constructor) and open a serial connection with the radar module. The radar will immediately start reporting measurements which are received in the event handler detailed above.
Issuing commands to the radar to read or change configurations requires the radar to be put into Configuration
mode. This can be achieved by calling Radar.EnterConfigurationMode()
. The following example shows how to enable the engineering mode on the radar to receive target energy levels at every supported distance gate:
radar.EnterConfigurationMode();
radar.SetEngineeringMode(true);
radar.ExitConfigurationMode();
Additionally, when Radar.Connect()
is executed successfully, the Radar
class will read the current configurations stored on the module. This data will be available through Radar.Configuration
and Radar.FirmwareVersion
.
To change the configuration on the radar, make the changes directly to Radar.Configuration
and then call Radar.CommitConfigurations()
to store them on the radar module.
The radar module can be restored to factory settings using Radar.RestoreFactorySettings()
and restarted (power-cycled) using Radar.Restart()
.
For more information on what this radar can do, please refer to the documentation listed above.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.15.5)
- nanoFramework.Runtime.Events (>= 1.11.15)
- nanoFramework.System.Buffers.Binary.BinaryPrimitives (>= 1.2.418)
- nanoFramework.System.IO.Ports (>= 1.1.78)
- UnitsNet.nanoFramework.Length (>= 5.49.0)
- UnitsNet.nanoFramework.Ratio (>= 5.49.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.264 | 88 | 10/23/2024 |
1.0.247 | 85 | 10/3/2024 |
1.0.230 | 105 | 9/6/2024 |
1.0.222 | 97 | 8/28/2024 |
1.0.204 | 111 | 8/9/2024 |
1.0.192 | 72 | 7/26/2024 |
1.0.181 | 95 | 7/17/2024 |
1.0.164 | 103 | 6/19/2024 |
1.0.161 | 109 | 6/14/2024 |
1.0.139 | 88 | 5/15/2024 |
1.0.127 | 128 | 4/15/2024 |
1.0.105 | 125 | 3/22/2024 |
1.0.85 | 118 | 2/28/2024 |
1.0.65 | 142 | 1/24/2024 |
1.0.53 | 166 | 1/5/2024 |
1.0.49 | 129 | 12/20/2023 |
1.0.27 | 158 | 11/10/2023 |
1.0.7 | 110 | 11/8/2023 |
1.0.2 | 113 | 11/1/2023 |