nanoFramework.Iot.Device.Am2320 1.2.704

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

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

AM2320 - Temperature and Humidity sensor

AM2320 is a temperature and humidity sensor, sensible to 0.1 degree and 0.1 relative humidity.

Documentation

Usage

Important: make sure you properly setup the I2C pins especially for ESP32 before creating the I2cDevice, make sure you install the nanoFramework.Hardware.ESP32 nuget:

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);

For other devices like STM32, please make sure you're using the pre-set pins for the SPI bus you want to use. The chip select can as well be pre setup.

Here is an example how to use the AM2320:

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

Debug.WriteLine("Hello from AM2320!");

//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);

using Am2320 am2330 = new(new I2cDevice(new I2cConnectionSettings(1, Am2320.DefaultI2cAddress, I2cBusSpeed.StandardMode)));

while(true)
{
    var temp = am2330.Temperature;
    var hum = am2330.Humidity;
    if(am2330.IsLastReadSuccessful)
    {
        Debug.WriteLine($"Temp = {temp.DegreesCelsius} C, Hum = {hum.Percent} %");
    }
    else
    {
        Debug.WriteLine("Not sucessfull read");
    }

    Thread.Sleep(Am2320.MinimumReadPeriod);
}

Device Information

You can read the Device Information.

Note: on some copies, the device information only returns 0.

// On some copies, the device information contains only 0
var deviceInfo = am2330.DeviceInformation;
if (deviceInfo != null)
{
    Debug.WriteLine($"Model: {deviceInfo.Model}");
    Debug.WriteLine($"Version: {deviceInfo.Version}");
    Debug.WriteLine($"Device ID: {deviceInfo.DeviceId}");
}

Limitations

Only the I2C implementation is available, not the 1 wire one.

The user registers and the status register are not implemented. The status register is just a register the user can store data. It is not currently used for any usage according to the documentation.

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.2.704 85 12/18/2024
1.2.696 76 12/16/2024
1.2.673 106 10/23/2024
1.2.656 89 10/3/2024
1.2.639 160 9/6/2024
1.2.631 92 8/28/2024
1.2.613 116 8/9/2024
1.2.601 139 7/26/2024
1.2.590 88 7/17/2024
1.2.573 99 6/19/2024
1.2.570 110 6/14/2024
1.2.536 126 4/15/2024
1.2.514 130 3/22/2024
1.2.494 120 2/28/2024
1.2.474 136 1/24/2024
1.2.462 151 1/5/2024
1.2.458 135 12/20/2023
1.2.436 180 11/10/2023
1.2.416 125 11/8/2023
1.2.403 151 10/6/2023
1.2.396 139 9/27/2023
1.2.384 154 9/6/2023
1.2.378 137 8/16/2023
1.2.369 173 8/2/2023
1.2.363 141 7/28/2023
1.2.357 167 7/19/2023
1.2.354 150 7/14/2023
1.2.345 175 6/21/2023
1.2.341 173 6/14/2023
1.2.337 194 6/7/2023
1.2.335 183 6/2/2023
1.2.329 179 5/26/2023
1.2.313 185 5/12/2023
1.2.302 180 5/10/2023
1.2.297 178 5/3/2023
1.2.273 289 3/17/2023
1.2.267 277 3/10/2023
1.2.263 277 3/8/2023
1.2.259 295 2/27/2023
1.2.256 259 2/24/2023
1.2.253 290 2/22/2023
1.2.222 335 1/9/2023
1.2.217 348 1/6/2023
1.2.212 330 1/5/2023
1.2.208 340 1/3/2023
1.2.203 349 12/28/2022
1.2.159 407 11/14/2022
1.2.153 421 11/5/2022
1.2.141 445 10/25/2022
1.2.87 530 9/15/2022
1.2.63 447 9/3/2022
1.2.47 447 8/15/2022
1.2.40 461 8/6/2022
1.2.38 451 8/5/2022
1.2.28 433 8/1/2022
1.2.13 451 7/24/2022
1.2.10 435 7/23/2022
1.1.145.58726 481 7/7/2022
1.1.133.52556 454 6/30/2022
1.1.121.35854 488 6/26/2022
1.1.116.8772 456 6/24/2022
1.1.113.2032 448 6/23/2022
1.1.102.51394 440 6/15/2022
1.1.99.36719 474 6/14/2022
1.1.97.17326 473 6/13/2022
1.1.92.53000 468 6/8/2022
1.1.72.29765 462 5/31/2022
1.1.64.21380 474 5/26/2022
1.1.54.28879 463 5/23/2022
1.1.40 466 5/5/2022
1.1.3 505 4/15/2022
1.1.1 458 4/14/2022
1.0.300 471 3/31/2022
1.0.288-preview.82 133 3/25/2022
1.0.288-preview.81 126 3/25/2022
1.0.288-preview.72 113 3/22/2022
1.0.288-preview.71 116 3/21/2022
1.0.288-preview.68 124 3/19/2022
1.0.288-preview.67 129 3/18/2022
1.0.288-preview.66 120 3/18/2022
1.0.288-preview.61 121 3/15/2022
1.0.288-preview.54 136 3/8/2022
1.0.288-preview.45 129 2/27/2022
1.0.288-preview.43 125 2/26/2022
1.0.288-preview.33 122 2/18/2022
1.0.288-preview.31 126 2/16/2022
1.0.288-preview.29 134 2/12/2022
1.0.288-preview.26 127 2/10/2022
1.0.288-preview.21 122 2/9/2022
1.0.288-preview.1 140 1/30/2022