LTRData.Rinsen.IoT.OneWire 1.0.0

dotnet add package LTRData.Rinsen.IoT.OneWire --version 1.0.0
NuGet\Install-Package LTRData.Rinsen.IoT.OneWire -Version 1.0.0
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="LTRData.Rinsen.IoT.OneWire" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LTRData.Rinsen.IoT.OneWire --version 1.0.0
#r "nuget: LTRData.Rinsen.IoT.OneWire, 1.0.0"
#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 LTRData.Rinsen.IoT.OneWire as a Cake Addin
#addin nuget:?package=LTRData.Rinsen.IoT.OneWire&version=1.0.0

// Install LTRData.Rinsen.IoT.OneWire as a Cake Tool
#tool nuget:?package=LTRData.Rinsen.IoT.OneWire&version=1.0.0

One Wire in .NET C# for Raspberry Pi

via DS2482-100 or DS2482-800 for Windows IoT Core or Linux on Raspberry Pi

A new version built on top of System.Device.Gpio enabling this project to target .NET Standard 2.0

This is made possible by the awesome work done by the ".NET Core IoT Libraries" project https://github.com/dotnet/iot/

Introduction

A powerful library for a simple and easy to use API when communicating with One Wire devices via I2C on Raspberry Pi.

using (var ds2482_800 = await _dS2482DeviceFactory.CreateDS2482_800(false, false, false))
using (var ds2482_100 = await _dS2482DeviceFactory.CreateDS2482_100(true, true))
{
    while (true)
    {
        foreach (var device in ds2482_800.GetDevices<DS18S20>())
        {
            var result = device.GetTemperature();
            var extendedResult = device.GetExtendedTemperature();
            Debug.WriteLine($"DS2482-800, DS18S20 result {result}");
            // Insert code to log result in some way
        }

        foreach (var device in ds2482_800.GetDevices<DS18B20>())
        {
            var result = device.GetTemperature();
            Debug.WriteLine($"DS2482-800, DS18B20 result {result}");

            // Insert code to log result in some way
        }

        foreach (var device in ds2482_100.GetDevices<DS18S20>())
        {
            var result = device.GetTemperature();
            var extendedResult = device.GetExtendedTemperature();
            Debug.WriteLine($"DS2482_100, DS18S20 result {result}");

            // Insert code to log result in some way
        }

        foreach (var device in ds2482_100.GetDevices<DS18B20>())
        {
            var result = device.GetTemperature();
            Debug.WriteLine($"DS2482-100, DS18B20 result {result}");

            // Insert code to log result in some way
        }

        await Task.Delay(5000);
    }
}

And thats all you need to get started with measuring temperatures with a DS18B20 from .NET and C# on Raspberry Pi.

Headed apps

Headed apps do not currently support disposing the DS2482 devices. The instance MUST be reused between measurements.

I2C Address

Multiple DS2482-100 and DS2482-800 are supported at the same time on the same bus, the bus control flags are exposed via IDS2482DeviceFactory CreateDS2482_100(bool ad0, bool ad1) and CreateDS2482_800(bool ad0, bool ad1, bool ad2). True/False is the same as high/low on the AD0, AD1 and AD2 pins on the devices.

If the address is wrong or the device is connected in a bad way there will be a DS2482100DeviceNotFoundException thrown that will indicate that there is no connection to the DS2482 device but it does not know if it is related to addressing problems or physical connection problems, or i there is no device connected at all.

Built in One Wire Device Support

Today:

  1. DS18B20
  2. DS18S20

Extend with your own device

oneWireDeviceHandler.AddDeviceType<MyDeviceType>(OneWireFamilyCode);

Add the type and it´s one wire family code to the device handler, if there is no matching family code when new devices is discovered the will be created as a UnknownOneWireDevice.

The provided type also has to implement the IOneWireDevice interface.

public interface IOneWireDevice
{
    DS2482Channel DS2482Channel { get; }

    byte[] OneWireAddress { get; }

    void Initialize(DS2482Channel ds2482, byte[] oneWireAddress);
}

For more information on how this works check the DS18B20 implementation.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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.0 135 9/21/2023