Pamoja.Sensors 0.1.17

dotnet add package Pamoja.Sensors --version 0.1.17
                    
NuGet\Install-Package Pamoja.Sensors -Version 0.1.17
                    
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="Pamoja.Sensors" Version="0.1.17" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pamoja.Sensors" Version="0.1.17" />
                    
Directory.Packages.props
<PackageReference Include="Pamoja.Sensors" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pamoja.Sensors --version 0.1.17
                    
#r "nuget: Pamoja.Sensors, 0.1.17"
                    
#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.
#:package Pamoja.Sensors@0.1.17
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pamoja.Sensors&version=0.1.17
                    
Install as a Cake Addin
#tool nuget:?package=Pamoja.Sensors&version=0.1.17
                    
Install as a Cake Tool

Pamoja.Sensors

Datasheet-anchored decoders for the BME280, DS18B20, INA219, and ADS1115. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.

API reference read the guide documentation

Install

dotnet add package Pamoja.Sensors
using Pamoja.Sensors;

This pulls in Pamoja.Native, the compiled engine. dotnet add package Pamoja is the whole framework in one package.

Example

The guide project's example, spliced here as it ran in CI.

From bindings/dotnet/samples/Pamoja.Guides/SensorsGuide.cs:

// Stand-ins for the two parts. On a running node the thermometer's nine bytes
// come off the 1-Wire bus and the monitor's registers off I2C; here the library
// builds what each would send, so the program runs with nothing plugged in.
byte[] thermometer = Ds18b20.BuildScratchpad(25.0625f, 12, 75, -10);

// The monitor is set up for 1 mA per count across a 2 milliohm shunt, the load
// its datasheet's worked design example describes: 11.98 V, 10 A, and 119.8 W.
const uint CurrentLsb = 1_000;
ushort bus = Ina219.BusRegister(11_980);
short current = Ina219.CurrentRegister(10_000_000, CurrentLsb);
ushort power = Ina219.PowerRegister(119_800_000, CurrentLsb);

// Everything below is the node's own code. The thermometer checksums every read,
// so a reading is verified before it is believed.
Ds18b20Reading reading = Ds18b20.ParseScratchpad(thermometer);
Console.WriteLine($"temperature  {reading.Celsius:F4} C");
Console.WriteLine($"resolution   {reading.ResolutionBits} bits");
Console.WriteLine($"alarms       {reading.AlarmHigh} / {reading.AlarmLow} C");

// The monitor computes nothing until it has been told what shunt it is across.
Console.WriteLine($"calibration  0x{Ina219.Calibration(CurrentLsb, 2):X4}");
Console.WriteLine($"bus          {Ina219.BusMillivolts(bus)} mV");
Console.WriteLine($"current      {Ina219.CurrentMicroamps(current, CurrentLsb) / 1_000} mA");
Console.WriteLine($"power        {Ina219.PowerMicrowatts(power, CurrentLsb) / 1_000} mW");

// A bit flipped on a long 1-Wire run fails the checksum, so the node repeats the
// read instead of logging a temperature a couple of degrees off.
byte[] corrupted = [.. thermometer];
corrupted[0] ^= 1;
try
{
    Ds18b20.ParseScratchpad(corrupted);
    Console.WriteLine("corrupt read accepted, which should never happen");
}
catch (PamojaException error)
{
    Console.WriteLine($"corrupt read rejected: {error.Message}");
}

The same capability in every language

Language Package Reference
Rust pamoja-sensors reference, docs.rs, install
TypeScript @pamoja/sensors reference, install
Python pamoja-sensors reference, install
C# Pamoja.Sensors reference, install

Documentation

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Pamoja.Sensors:

Package Downloads
Pamoja

The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones.

Pamoja.Sensing

Sensing and actuation: The parts wired to a board: a thermometer that checks its own bytes, a servo pulse, and a stepper walking its coils.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.17 89 9/6/2026
0.1.16 99 9/5/2026
0.1.15 85 9/5/2026