nanoFramework.Iot.Device.Mcp3428
1.0.260
Prefix Reserved
See the version list below for details.
Install-Package nanoFramework.Iot.Device.Mcp3428 -Version 1.0.260
dotnet add package nanoFramework.Iot.Device.Mcp3428 --version 1.0.260
<PackageReference Include="nanoFramework.Iot.Device.Mcp3428" Version="1.0.260" />
paket add nanoFramework.Iot.Device.Mcp3428 --version 1.0.260
#r "nuget: nanoFramework.Iot.Device.Mcp3428, 1.0.260"
// Install nanoFramework.Iot.Device.Mcp3428 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Mcp3428&version=1.0.260
// Install nanoFramework.Iot.Device.Mcp3428 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Mcp3428&version=1.0.260
Mcp3428 - Analog to Digital Converter (I2C)
The library implements the Microchip MCP3428 16 bit A/D converter with I2C interface. It has hardware configurable I2C address and software configurable resolution and gain. Can work in continuous and on-demand conversion modes.
Documentation
"The MCP3426, MCP3427 and MCP3428 devices (MCP3426/7/8) are the low noise and high accuracy 16 Bit Delta-Sigma Analog-to-Digital (ΔΣ A/D) Converter family members of the MCP342X series from Microchip Technology Inc. These devices can convert analog inputs to digital codes with up to 16 bits of resolution." - Datasheet
The 3 devices differ only in addressing capability and channel number. The library implements all of them.
- MCP3428 datasheet
Board
Usage
Simple example for measuring LED forward voltage using the MCP3428 ADC and a MCU.
// I2C addres based on pin configuration
var addr = Mcp3428.AddressFromPins(PinState.Low, PinState.Low);
var options = new I2cConnectionSettings(1, addr);
using (var dev = new UnixI2cDevice(options))
using (var adc = new Mcp3428(dev, ModeEnum.OneShot, ResolutionEnum.Bit16, GainEnum.X1))
{
var ch1 = adc.ReadChannel(0);
Debug.WriteLine($"LED forward voltage value: {ch1} V");
}
On the MCP3428 you can select 8 different I2C addresses that the device answers on. It's done by connecting two pins, Adr0 and Adr1 to supply voltage or ground or leaving then floating. The library has a helper method to choose the address based on pin states.
With this instantiating the device and reading the first channel is done like this:
var options = new I2cConnectionSettings(1,
Mcp3428.AddressFromPins(PinState.Low, PinState.Floating));
using (var dev = new UnixI2cDevice(options))
using (var adc = new Mcp3428(dev)) // Default settings
{
var ch1 = adc.ReadChannel(0);
Debug.WriteLine($"ADC Channel value: {ch1} V");
}
The library provides an async API as reading with 16 bit resolution can take up to 60-80ms. It's in a separate class called Mcp3428Async
.
Product | Versions |
---|---|
.NET Framework | net |
-
- nanoFramework.CoreLibrary (>= 1.11.7)
- nanoFramework.System.Buffers.Binary.BinaryPrimitives (>= 1.0.259)
- nanoFramework.System.Device.I2c (>= 1.0.2)
- nanoFramework.System.Threading (>= 1.0.3)
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.1.58.10097 | 0 | 5/23/2022 |
1.1.3 | 62 | 4/15/2022 |
1.1.1 | 53 | 4/14/2022 |
1.0.300 | 65 | 3/31/2022 |
1.0.288-preview.114 | 38 | 3/25/2022 |
1.0.288-preview.113 | 35 | 3/25/2022 |
1.0.288-preview.104 | 25 | 3/22/2022 |
1.0.288-preview.100 | 35 | 3/19/2022 |
1.0.288-preview.98 | 37 | 3/18/2022 |
1.0.288-preview.93 | 37 | 3/15/2022 |
1.0.288-preview.65 | 45 | 2/18/2022 |
1.0.288-preview.48 | 57 | 2/4/2022 |
1.0.288-preview.42 | 56 | 1/31/2022 |
1.0.288-preview.29 | 57 | 1/28/2022 |
1.0.288-preview.22 | 55 | 1/27/2022 |
1.0.288-preview.20 | 56 | 1/27/2022 |
1.0.288-preview.18 | 57 | 1/27/2022 |
1.0.288-preview.1 | 61 | 1/21/2022 |
1.0.260 | 116 | 12/10/2021 |
1.0.259 | 100 | 12/9/2021 |
1.0.258 | 101 | 12/8/2021 |
1.0.189 | 226 | 9/25/2021 |
1.0.155 | 123 | 8/31/2021 |
1.0.138 | 161 | 7/18/2021 |
1.0.136 | 201 | 7/17/2021 |
1.0.135 | 86 | 7/16/2021 |
1.0.134 | 96 | 7/15/2021 |
1.0.133 | 115 | 7/14/2021 |
1.0.130 | 85 | 7/6/2021 |
1.0.125 | 122 | 7/5/2021 |
1.0.121 | 125 | 6/29/2021 |
1.0.119 | 144 | 6/28/2021 |
1.0.112 | 125 | 6/16/2021 |
1.0.105 | 203 | 5/29/2021 |
1.0.55 | 136 | 5/25/2021 |