nanoFramework.Iot.Device.Ds1621 1.0.831

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Ds1621 --version 1.0.831
                    
NuGet\Install-Package nanoFramework.Iot.Device.Ds1621 -Version 1.0.831
                    
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.Ds1621" Version="1.0.831" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Ds1621" Version="1.0.831" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Ds1621" />
                    
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 nanoFramework.Iot.Device.Ds1621 --version 1.0.831
                    
#r "nuget: nanoFramework.Iot.Device.Ds1621, 1.0.831"
                    
#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 nanoFramework.Iot.Device.Ds1621@1.0.831
                    
#: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=nanoFramework.Iot.Device.Ds1621&version=1.0.831
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Ds1621&version=1.0.831
                    
Install as a Cake Tool

Ds1621 - 1-Wire Digital Thermometer with Programmable Resolution

The Ds1621 digital thermometer provides 9-bit to 12-bit temperature measurements in Celsius and has an alarm function with nonvolatile user-programmable upper and lower trigger points.

Documentation

Datasheet

Original code was written for ESP32

Usage

Important: Make sure you properly setup the I2C pins for ESP32 before creating the I2cDevice. For this, make sure you install the nanoFramework.Hardware.Esp32 NuGet and use the Configuration class to configure the pins:

// When connecting to an ESP32 device you will need to configure the I2C GPIOs used for the bus.
Configuration.SetPinFunction(Gpio.IO21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(Gpio.IO22, DeviceFunction.I2C1_CLOCK);

For other devices like STM32, please make sure you're using the preset pins for the I2C bus you want to use.

The following example demonstrates using the temperature and alarm functions of the Ds1621.

using System;
using System.Device.I2c;
using System.Diagnostics;
using System.Threading;
using Iot.Device.Ds1621;
using nanoFramework.Hardware.Esp32;
using UnitsNet;

string alarmState;

// Setup ESP32 I2C port.
Configuration.SetPinFunction(Gpio.IO21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(Gpio.IO22, DeviceFunction.I2C1_CLOCK);

// Setup Ds1621 device.
I2cConnectionSettings i2cSettings = new I2cConnectionSettings(1, Ds1621.DefaultI2cAddress);
I2cDevice i2cDevice = new I2cDevice(i2cSettings);

Ds1621 thermometer = new Ds1621(i2cDevice, MeasurementMode.Single);

// Set temperature alarms.
thermometer.LowTemperatureAlarm = Temperature.FromDegreesFahrenheit(65);
thermometer.HighTemperatureAlarm = Temperature.FromDegreesFahrenheit(80);

while (true)
{
    // Start temperature conversion.
    thermometer.MeasureTemperature();

    // Wait for temperature conversion to complete.
    while (thermometer.IsMeasuringTemperature)
    {
        Thread.Sleep(10);
    }

    Temperature temperature = thermometer.GetTemperature();

    // Check temperature alarm states.
    if (thermometer.HasLowTemperatureAlarm)
    {
        alarmState = "[Low Temperature]";
    }
    else if (thermometer.HasHighTemperatureAlarm)
    {
        alarmState = "[High Temperature]";
    }
    else
    {
        alarmState = string.Empty;
    }

    Debug.WriteLine($"{DateTime.UtcNow} : {temperature.DegreesCelsius:F1}�C / {temperature.DegreesFahrenheit:F1}�F {alarmState}");

    Thread.Sleep(1000);
}
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.831 93 7/28/2025
1.0.811 197 4/2/2025
1.0.806 186 4/2/2025
1.0.794 201 3/11/2025
1.0.788 195 3/10/2025
1.0.764 143 2/26/2025
1.0.717 136 2/4/2025
1.0.714 140 2/4/2025
1.0.697 133 1/31/2025
1.0.685 134 1/20/2025
1.0.679 112 1/13/2025
1.0.660 134 12/30/2024
1.0.638 135 12/16/2024
1.0.627 132 12/4/2024
1.0.615 146 10/23/2024
1.0.598 136 10/3/2024
1.0.581 156 9/6/2024
1.0.573 146 8/28/2024
1.0.555 156 8/9/2024
1.0.543 119 7/26/2024
1.0.537 129 7/24/2024
1.0.532 140 7/17/2024
1.0.515 156 6/19/2024
1.0.512 153 6/14/2024
1.0.502 150 5/29/2024
1.0.494 141 5/17/2024
1.0.490 118 5/15/2024
1.0.478 164 4/15/2024
1.0.456 163 3/22/2024
1.0.436 157 2/28/2024
1.0.416 173 1/24/2024
1.0.404 191 1/5/2024
1.0.400 184 12/20/2023
1.0.378 196 11/10/2023
1.0.345 184 10/6/2023
1.0.338 176 9/27/2023
1.0.326 181 9/6/2023
1.0.320 203 8/16/2023
1.0.311 207 8/2/2023
1.0.305 200 7/28/2023
1.0.299 212 7/19/2023
1.0.296 198 7/14/2023
1.0.287 191 6/21/2023
1.0.283 195 6/14/2023
1.0.279 198 6/7/2023
1.0.277 201 6/2/2023
1.0.271 194 5/26/2023
1.0.255 194 5/12/2023
1.0.250 196 5/11/2023
1.0.244 205 5/10/2023
1.0.239 208 5/3/2023
1.0.215 273 3/17/2023
1.0.209 286 3/10/2023
1.0.205 280 3/8/2023
1.0.201 291 2/27/2023
1.0.198 293 2/24/2023
1.0.195 309 2/22/2023
1.0.164 354 1/9/2023
1.0.154 367 1/5/2023
1.0.150 373 1/3/2023
1.0.145 352 12/28/2022
1.0.95 433 11/5/2022
1.0.83 436 10/25/2022
1.0.70 439 10/22/2022
1.0.64 479 10/12/2022
1.0.56 435 10/8/2022
1.0.37 478 9/22/2022
1.0.29 538 9/15/2022
1.0.15 461 9/8/2022
1.0.5 464 9/3/2022
1.0.3 454 8/27/2022
1.0.1 454 8/26/2022