nanoFramework.Iot.Device.Am2320 1.2.775

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Am2320 --version 1.2.775                
NuGet\Install-Package nanoFramework.Iot.Device.Am2320 -Version 1.2.775                
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.775" />                
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.775                
#r "nuget: nanoFramework.Iot.Device.Am2320, 1.2.775"                
#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.775

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

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 (1)

Showing the top 1 popular GitHub repositories that depend on nanoFramework.Iot.Device.Am2320:

Repository Stars
nanoframework/Samples
🍬 Code samples from the nanoFramework team used in testing, proof of concepts and other explorational endeavours
Version Downloads Last updated
1.2.775 99 2/4/2025
1.2.772 65 2/4/2025
1.2.755 82 1/31/2025
1.2.743 98 1/20/2025
1.2.737 67 1/13/2025
1.2.718 146 12/30/2024
1.2.704 118 12/18/2024
1.2.696 91 12/16/2024
1.2.673 111 10/23/2024
1.2.656 94 10/3/2024
1.2.639 167 9/6/2024
1.2.631 93 8/28/2024
1.2.613 119 8/9/2024
1.2.601 142 7/26/2024
1.2.590 91 7/17/2024
1.2.573 103 6/19/2024
1.2.570 115 6/14/2024
1.2.536 128 4/15/2024
1.2.514 132 3/22/2024
1.2.494 122 2/28/2024
1.2.474 138 1/24/2024
1.2.462 153 1/5/2024
1.2.458 137 12/20/2023
1.2.436 182 11/10/2023
1.2.416 127 11/8/2023
1.2.403 153 10/6/2023
1.2.396 141 9/27/2023
1.2.384 156 9/6/2023
1.2.378 139 8/16/2023
1.2.369 175 8/2/2023
1.2.363 144 7/28/2023
1.2.357 171 7/19/2023
1.2.354 152 7/14/2023
1.2.345 177 6/21/2023
1.2.341 175 6/14/2023
1.2.337 196 6/7/2023
1.2.335 185 6/2/2023
1.2.329 181 5/26/2023
1.2.313 187 5/12/2023
1.2.302 182 5/10/2023
1.2.297 180 5/3/2023
1.2.273 290 3/17/2023
1.2.267 278 3/10/2023
1.2.263 279 3/8/2023
1.2.259 296 2/27/2023
1.2.256 261 2/24/2023
1.2.253 292 2/22/2023
1.2.222 337 1/9/2023
1.2.217 350 1/6/2023
1.2.212 332 1/5/2023
1.2.208 342 1/3/2023
1.2.203 351 12/28/2022
1.2.159 409 11/14/2022
1.2.153 423 11/5/2022
1.2.141 447 10/25/2022
1.2.87 532 9/15/2022
1.2.63 449 9/3/2022
1.2.47 449 8/15/2022
1.2.40 463 8/6/2022
1.2.38 453 8/5/2022
1.2.28 435 8/1/2022
1.2.13 453 7/24/2022
1.2.10 437 7/23/2022
1.1.145.58726 483 7/7/2022
1.1.133.52556 456 6/30/2022
1.1.121.35854 490 6/26/2022
1.1.116.8772 458 6/24/2022
1.1.113.2032 450 6/23/2022
1.1.102.51394 442 6/15/2022
1.1.99.36719 476 6/14/2022
1.1.97.17326 475 6/13/2022
1.1.92.53000 470 6/8/2022
1.1.72.29765 464 5/31/2022
1.1.64.21380 476 5/26/2022
1.1.54.28879 465 5/23/2022
1.1.40 468 5/5/2022
1.1.3 509 4/15/2022
1.1.1 460 4/14/2022
1.0.300 473 3/31/2022
1.0.288-preview.82 135 3/25/2022
1.0.288-preview.81 128 3/25/2022
1.0.288-preview.72 115 3/22/2022
1.0.288-preview.71 118 3/21/2022
1.0.288-preview.68 126 3/19/2022
1.0.288-preview.67 131 3/18/2022
1.0.288-preview.66 122 3/18/2022
1.0.288-preview.61 123 3/15/2022
1.0.288-preview.54 138 3/8/2022
1.0.288-preview.45 131 2/27/2022
1.0.288-preview.43 127 2/26/2022
1.0.288-preview.33 124 2/18/2022
1.0.288-preview.31 128 2/16/2022
1.0.288-preview.29 136 2/12/2022
1.0.288-preview.26 129 2/10/2022
1.0.288-preview.21 124 2/9/2022
1.0.288-preview.1 142 1/30/2022