nanoFramework.Iot.Device.Ld2410 1.0.127

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Ld2410 --version 1.0.127
NuGet\Install-Package nanoFramework.Iot.Device.Ld2410 -Version 1.0.127
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Ld2410" Version="1.0.127" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.Ld2410 --version 1.0.127
#r "nuget: nanoFramework.Iot.Device.Ld2410, 1.0.127"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install nanoFramework.Iot.Device.Ld2410 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Ld2410&version=1.0.127

// Install nanoFramework.Iot.Device.Ld2410 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Ld2410&version=1.0.127

HLK-LD2410 24Ghz Human Presence Radar Sensor Module

Documentation


Radar Module


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 Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.127 88 4/15/2024
1.0.105 94 3/22/2024
1.0.85 93 2/28/2024
1.0.65 107 1/24/2024
1.0.53 142 1/5/2024
1.0.49 102 12/20/2023
1.0.27 126 11/10/2023
1.0.7 82 11/8/2023
1.0.2 91 11/1/2023