nanoFramework.Iot.Device.Am2320 1.2.889

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

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.889 121 7/28/2025
1.2.869 276 4/2/2025
1.2.864 183 4/2/2025
1.2.852 244 3/11/2025
1.2.846 213 3/10/2025
1.2.822 204 2/26/2025
1.2.775 187 2/4/2025
1.2.772 132 2/4/2025
1.2.755 154 1/31/2025
1.2.743 179 1/20/2025
1.2.737 156 1/13/2025
1.2.718 200 12/30/2024
1.2.704 179 12/18/2024
1.2.696 144 12/16/2024
1.2.673 162 10/23/2024
1.2.656 144 10/3/2024
1.2.639 222 9/6/2024
1.2.631 139 8/28/2024
1.2.613 163 8/9/2024
1.2.601 183 7/26/2024
1.2.590 142 7/17/2024
1.2.573 145 6/19/2024
1.2.570 159 6/14/2024
1.2.536 171 4/15/2024
1.2.514 174 3/22/2024
1.2.494 164 2/28/2024
1.2.474 178 1/24/2024
1.2.462 197 1/5/2024
1.2.458 186 12/20/2023
1.2.436 205 11/10/2023
1.2.416 148 11/8/2023
1.2.403 183 10/6/2023
1.2.396 172 9/27/2023
1.2.384 203 9/6/2023
1.2.378 178 8/16/2023
1.2.369 226 8/2/2023
1.2.363 202 7/28/2023
1.2.357 227 7/19/2023
1.2.354 200 7/14/2023
1.2.345 220 6/21/2023
1.2.341 225 6/14/2023
1.2.337 249 6/7/2023
1.2.335 246 6/2/2023
1.2.329 229 5/26/2023
1.2.313 241 5/12/2023
1.2.302 236 5/10/2023
1.2.297 231 5/3/2023
1.2.273 338 3/17/2023
1.2.267 331 3/10/2023
1.2.263 330 3/8/2023
1.2.259 349 2/27/2023
1.2.256 317 2/24/2023
1.2.253 354 2/22/2023
1.2.222 404 1/9/2023
1.2.217 411 1/6/2023
1.2.212 391 1/5/2023
1.2.208 407 1/3/2023
1.2.203 404 12/28/2022
1.2.159 466 11/14/2022
1.2.153 487 11/5/2022
1.2.141 508 10/25/2022
1.2.87 599 9/15/2022
1.2.63 509 9/3/2022
1.2.47 524 8/15/2022
1.2.40 531 8/6/2022
1.2.38 517 8/5/2022
1.2.28 499 8/1/2022
1.2.13 528 7/24/2022
1.2.10 505 7/23/2022
1.1.145.58726 549 7/7/2022
1.1.133.52556 524 6/30/2022
1.1.121.35854 568 6/26/2022
1.1.116.8772 524 6/24/2022
1.1.113.2032 530 6/23/2022
1.1.102.51394 522 6/15/2022
1.1.99.36719 543 6/14/2022
1.1.97.17326 551 6/13/2022
1.1.92.53000 539 6/8/2022
1.1.72.29765 534 5/31/2022
1.1.64.21380 559 5/26/2022
1.1.54.28879 537 5/23/2022
1.1.40 539 5/5/2022
1.1.3 581 4/15/2022
1.1.1 538 4/14/2022
1.0.300 558 3/31/2022
1.0.288-preview.82 208 3/25/2022
1.0.288-preview.81 213 3/25/2022
1.0.288-preview.72 188 3/22/2022
1.0.288-preview.71 192 3/21/2022
1.0.288-preview.68 199 3/19/2022
1.0.288-preview.67 208 3/18/2022
1.0.288-preview.66 197 3/18/2022
1.0.288-preview.61 209 3/15/2022
1.0.288-preview.54 221 3/8/2022
1.0.288-preview.45 232 2/27/2022
1.0.288-preview.43 209 2/26/2022
1.0.288-preview.33 200 2/18/2022
1.0.288-preview.31 209 2/16/2022
1.0.288-preview.29 213 2/12/2022
1.0.288-preview.26 210 2/10/2022
1.0.288-preview.21 215 2/9/2022
1.0.288-preview.1 227 1/30/2022