nanoFramework.Iot.Device.Adc128D818 1.0.56

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

ADC128D818 - Analog to Digital Converter

ADC128D818 is an Analog-to-Digital converter (ADC) 12-Bit, 8-Channel, ADC system monitor with temperature sensor and internal/external reference.

Documentation

Product datasheet can be found at the manufacturer website here.

Usage

Important: make sure you properly setup the I2C pins especially for ESP32 before creating the I2cDevice. For this you have to install the nanoFramework.Hardware.ESP32 NuGet package. Please note that the I2C pin in your device can be different from the ones in the code snippet.

//////////////////////////////////////////////////////////////////////
// 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 I2C bus you want to use.

// set I2C bus ID: 1
// ADC128D818 A0 and A1 pins connected to GND
I2cConnectionSettings settings = new I2cConnectionSettings(1, (int)I2cAddress.Low_Low);
I2cDevice device = I2cDevice.Create(settings);

// pass in I2cDevice
using (Adc128D818 adc = new Adc128D818(device))
{
    // set device to mode 0
    adc.Mode = Mode.Mode0;

    // enable internal voltage reference
    adc.VoltageReference = VoltageReference.Internal2_56;

    // set conversion mode to continuous
    adc.ConversionRate = ConversionRate.Continuous;

    // start conversion
    adc.Start();

    // read raw data from channel IN0
    int channelIn0 = adc.ReadChannel(Channel.In0);

    // output reading
    Console.WriteLine($"Channel IN0 reading: {channelIn0}");

    // read local temperature
    int localTemp = adc.ReadChannel(Channel.Temperature);)

    // convert temperature reading 
    Temperature temperature = Adc128D818.ConvertLocalTemperatureReading(localTemp);

    // output temperature
    Console.WriteLine($"Local temperature: {temperature.DegreesCelsius} °C");

    // shutdown the device
    adc.DeepShutdown();
}

Acknowledgments

The development of this library was kindly sponsored by OrgPal.IoT!

orgpallogo.png

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
2.0.0-preview.32 43 4/20/2026
2.0.0-preview.16 52 3/10/2026
1.0.56 103 3/4/2026
1.0.35 259 11/10/2025
1.0.13 206 10/6/2025
1.0.11 224 10/2/2025
1.0.1 239 9/1/2025