nanoFramework.Iot.Device.Am2320 1.2.337

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Am2320 --version 1.2.337                
NuGet\Install-Package nanoFramework.Iot.Device.Am2320 -Version 1.2.337                
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.337" />                
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.337                
#r "nuget: nanoFramework.Iot.Device.Am2320, 1.2.337"                
#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.337

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

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.673 84 10/23/2024
1.2.656 77 10/3/2024
1.2.639 118 9/6/2024
1.2.631 82 8/28/2024
1.2.613 107 8/9/2024
1.2.601 130 7/26/2024
1.2.590 79 7/17/2024
1.2.573 91 6/19/2024
1.2.570 99 6/14/2024
1.2.536 120 4/15/2024
1.2.514 121 3/22/2024
1.2.494 115 2/28/2024
1.2.474 129 1/24/2024
1.2.462 146 1/5/2024
1.2.458 128 12/20/2023
1.2.436 175 11/10/2023
1.2.416 119 11/8/2023
1.2.403 146 10/6/2023
1.2.396 131 9/27/2023
1.2.384 147 9/6/2023
1.2.378 132 8/16/2023
1.2.369 168 8/2/2023
1.2.363 136 7/28/2023
1.2.357 160 7/19/2023
1.2.354 143 7/14/2023
1.2.345 169 6/21/2023
1.2.341 168 6/14/2023
1.2.337 188 6/7/2023
1.2.335 178 6/2/2023
1.2.329 173 5/26/2023
1.2.313 180 5/12/2023
1.2.302 173 5/10/2023
1.2.297 173 5/3/2023
1.2.273 280 3/17/2023
1.2.267 270 3/10/2023
1.2.263 272 3/8/2023
1.2.259 287 2/27/2023
1.2.256 254 2/24/2023
1.2.253 285 2/22/2023
1.2.222 329 1/9/2023
1.2.217 342 1/6/2023
1.2.212 323 1/5/2023
1.2.208 334 1/3/2023
1.2.203 343 12/28/2022
1.2.159 399 11/14/2022
1.2.153 413 11/5/2022
1.2.141 437 10/25/2022
1.2.87 523 9/15/2022
1.2.63 438 9/3/2022
1.2.47 440 8/15/2022
1.2.40 454 8/6/2022
1.2.38 444 8/5/2022
1.2.28 423 8/1/2022
1.2.13 444 7/24/2022
1.2.10 421 7/23/2022
1.1.145.58726 473 7/7/2022
1.1.133.52556 446 6/30/2022
1.1.121.35854 479 6/26/2022
1.1.116.8772 448 6/24/2022
1.1.113.2032 441 6/23/2022
1.1.102.51394 433 6/15/2022
1.1.99.36719 467 6/14/2022
1.1.97.17326 465 6/13/2022
1.1.92.53000 460 6/8/2022
1.1.72.29765 454 5/31/2022
1.1.64.21380 465 5/26/2022
1.1.54.28879 455 5/23/2022
1.1.40 459 5/5/2022
1.1.3 498 4/15/2022
1.1.1 450 4/14/2022
1.0.300 464 3/31/2022
1.0.288-preview.82 128 3/25/2022
1.0.288-preview.81 123 3/25/2022
1.0.288-preview.72 107 3/22/2022
1.0.288-preview.71 113 3/21/2022
1.0.288-preview.68 121 3/19/2022
1.0.288-preview.67 126 3/18/2022
1.0.288-preview.66 115 3/18/2022
1.0.288-preview.61 116 3/15/2022
1.0.288-preview.54 133 3/8/2022
1.0.288-preview.45 125 2/27/2022
1.0.288-preview.43 119 2/26/2022
1.0.288-preview.33 119 2/18/2022
1.0.288-preview.31 123 2/16/2022
1.0.288-preview.29 131 2/12/2022
1.0.288-preview.26 123 2/10/2022
1.0.288-preview.21 119 2/9/2022
1.0.288-preview.1 137 1/30/2022