VOOZH about

URL: https://www.nuget.org/packages/nanoFramework.Iot.Device.Ip5306/

⇱ NuGet Gallery | nanoFramework.Iot.Device.Ip5306 1.2.952




👁 Image
nanoFramework.Iot.Device.Ip5306 1.2.952

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.Ip5306 --version 1.2.952
 
 
NuGet\Install-Package nanoFramework.Iot.Device.Ip5306 -Version 1.2.952
 
 
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.Ip5306" Version="1.2.952" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Ip5306" Version="1.2.952" />
 
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Ip5306" />
 
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.Ip5306 --version 1.2.952
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: nanoFramework.Iot.Device.Ip5306, 1.2.952"
 
 
#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.Ip5306@1.2.952
 
 
#: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.Ip5306&version=1.2.952
 
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Ip5306&version=1.2.952
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

IP5306 - Power management

This chip is used mainly in power bank and embedded devices as a power management device. It is connected using I2C and allows to adjust the charging current,voltage, cutoff voltage. It has the capacity to light up 4 leds displaying the charge of the battery. This device is used in the M5Stack.

Documentation

The datasheet in Chinese can be found here.

Usage

As always when using I2C, you need to make sure you're using the right pins. En ESP32, you need the register the pins if not using the default one.

Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);

I2cDevice i2c = new(new I2cConnectionSettings(1, Ip5306.SecondaryI2cAddress));
Ip5306 power = new(i2c);

Note the default address of the IP5306 is 0xEA, the address used in M5Stack is 0x75 (here setup as SecondaryI2cAddress).

Getting access to the properties

All properties can be adjusted and changed. He is an example how to display all of them:

Debug.WriteLine($" AutoPowerOnEnabled: {power.AutoPowerOnEnabled}");
Debug.WriteLine($" BoostOutputEnabled: {power.BoostOutputEnabled}");
Debug.WriteLine($" BoostWhenVinUnpluggedEnabled: {power.BoostWhenVinUnpluggedEnabled}");
Debug.WriteLine($" BostEnabled: {power.BoostEnabled}");
Debug.WriteLine($" ButtonOffEnabled: {power.ButtonOffEnabled}");
Debug.WriteLine($" ChargerEnabled: {power.ChargerEnabled}");
Debug.WriteLine($" ChargingBatteryVoltage: {power.ChargingBatteryVoltage}");
Debug.WriteLine($" ChargingCurrent: {power.ChargingCurrent}");
Debug.WriteLine($" ChargingCutOffCurrent: {power.ChargingCutOffCurrent}");
Debug.WriteLine($" ChargingCuttOffVoltage{power.ChargingCuttOffVoltage}");
Debug.WriteLine($" ChargingLoopSelection: {power.ChargingLoopSelection}");
Debug.WriteLine($" ChargingUnderVoltage: {power.ChargingUnderVoltage}");
Debug.WriteLine($" ConstantChargingVoltage: {power.ConstantChargingVoltage}");
Debug.WriteLine($" FlashLightBehavior {power.FlashLightBehavior}");
Debug.WriteLine($" IsBatteryFull: {power.IsBatteryFull}");
Debug.WriteLine($" IsCharging: {power.IsCharging}");
Debug.WriteLine($" IsOutputLoadHigh: {power.IsOutputLoadHigh}");
Debug.WriteLine($" LightDutyShutdownTime: {power.LightDutyShutdownTime}");
Debug.WriteLine($" LowPowerOffEnabled: {power.LowPowerOffEnabled}");
Debug.WriteLine($" ShortPressToSwitchBosst: {power.ShortPressToSwitchBosst}");
Debug.WriteLine($" SwitchOffBoostBehavior: {power.SwitchOffBoostBehavior}");
Debug.WriteLine($" GetButtonStatus: {power.GetButtonStatus()}");

Button status

You can get the button status:

var button = power.GetButtonStatus();
switch (button)
{
 case ButtonPressed.DoubleClicked:
 Debug.WriteLine("double clicked");
 break;
 case ButtonPressed.LongPressed:
 Debug.WriteLine("Long pressed");
 break;
 case ButtonPressed.ShortPressed:
 Debug.WriteLine("Short pressed");
 break;
 case ButtonPressed.NotPressed:
 default:
 break;
}

Important: depending on the behavior you setup for the button, the device may switch off what's connected to it. So be careful on what you setup. Once the I2C connection is broken, you can't adjust the behavior bck.

configuration for M5Stack

The configuration for M5Stack is the following:

// Configuration for M5Stack
power.ButtonOffEnabled = true;
power.BoostOutputEnabled = false;
power.AutoPowerOnEnabled = true;
power.ChargerEnabled = true;
power.BoostEnabled = true;
power.LowPowerOffEnabled = true;
power.FlashLightBehavior = ButtonPress.Doubleclick;
power.SwitchOffBoostBehavior = ButtonPress.LongPress;
power.BoostWhenVinUnpluggedEnabled = true;
power.ChargingUnderVoltage = ChargingUnderVoltage.V4_55;
power.ChargingLoopSelection = ChargingLoopSelection.Vin;
power.ChargingCurrent = ElectricCurrent.FromMilliamperes(2250);
power.ConstantChargingVoltage = ConstantChargingVoltage.Vm28;
power.ChargingCuttOffVoltage = ChargingCutOffVoltage.V4_17;
power.LightDutyShutdownTime = LightDutyShutdownTime.S32;
power.ChargingCutOffCurrent = ChargingCutOffCurrent.C500mA;
power.ChargingCuttOffVoltage = ChargingCutOffVoltage.V4_2;
Product Versions Compatible and additional computed target framework versions.
.NET Framework net net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on nanoFramework.Iot.Device.Ip5306:

Package Downloads
nanoFramework.M5Core

This package includes the nanoFramework.M5Core assembly for .NET nanoFramework C# projects.

nanoFramework.Fire

This package includes the nanoFramework.Fire assembly for .NET nanoFramework C# projects.

nanoFramework.M5Stack

This package includes the nanoFramework.M5Stack assembly for .NET nanoFramework C# projects.

GitHub repositories (1)

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

Repository Stars
nanoframework/nanoFramework.M5Stack
📦 Board support package for M5Stack, M5StickC and M5StickCPlus for .NET nanoFramework
Version Downloads Last Updated
2.0.0-preview.85 52 6/1/2026
2.0.0-preview.80 67 5/27/2026
2.0.0-preview.73 94 5/20/2026
2.0.0-preview.62 69 5/13/2026
2.0.0-preview.45 86 4/29/2026
2.0.0-preview.32 66 4/20/2026
2.0.0-preview.16 90 3/10/2026
1.2.952 228 3/4/2026
1.2.931 509 11/10/2025
1.2.907 372 10/2/2025
1.2.889 350 7/28/2025
1.2.869 598 4/2/2025
1.2.864 415 4/2/2025
1.2.852 523 3/11/2025
1.2.846 445 3/10/2025
1.2.822 864 2/26/2025
1.2.775 992 2/4/2025
1.2.772 302 2/4/2025
1.2.755 602 1/31/2025
1.2.743 422 1/20/2025
Loading failed