Skip to main content
Any Framework

Iot.Device.Adc128D818 assembly for .NET nanoFramework C# projects

Published
Apr 20, 2026
6mo ago
Total Downloads
2.3K
2,284

Install

dotnet add package nanoFramework.Iot.Device.Adc128D818 --version 2.0.0-preview.32

No framework information available.

README

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

Changes from Previous Version

No structural changes between v2.0.0-preview.16 and v2.0.0-preview.32.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.