![]() |
VOOZH | about |
dotnet add package nanoFramework.Iot.Device.Axp2101 --version 1.0.3
NuGet\Install-Package nanoFramework.Iot.Device.Axp2101 -Version 1.0.3
<PackageReference Include="nanoFramework.Iot.Device.Axp2101" Version="1.0.3" />
<PackageVersion Include="nanoFramework.Iot.Device.Axp2101" Version="1.0.3" />Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Axp2101" />Project file
paket add nanoFramework.Iot.Device.Axp2101 --version 1.0.3
#r "nuget: nanoFramework.Iot.Device.Axp2101, 1.0.3"
#:package nanoFramework.Iot.Device.Axp2101@1.0.3
#addin nuget:?package=nanoFramework.Iot.Device.Axp2101&version=1.0.3Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Axp2101&version=1.0.3Install as a Cake Tool
The AXP2101 is an advanced power management IC (PMIC) manufactured by X-Powers, widely used in embedded devices such as the M5Stack CoreS3 (ESP32-S3-based). It provides comprehensive power management with multiple configurable voltage regulators, battery charging control, ADC measurements, fuel gauge, watchdog, and interrupt handling. It communicates over I2C at default address 0x34.
| Feature | Details |
|---|---|
| DCDC Converters | 5 channels (DCDC1-DCDC5) with configurable voltage outputs |
| LDO Regulators | 4x ALDO (1-4), 2x BLDO (1-2), 1x CPUSLDO, 2x DLDO (1-2) |
| Battery Charging | Linear charger with configurable current (0-1000 mA), voltage (4.0-4.44V), and termination settings |
| Fuel Gauge | Built-in battery percentage calculation, gauge data ROM |
| ADC | Battery voltage, VBUS voltage, system voltage, die temperature sensor, TS pin |
| Button Battery | Backup/coin cell battery charging support |
| Interrupts | 3 interrupt status registers supporting ~24 different IRQ sources |
| Watchdog | Configurable timer with multiple reset behaviors |
| Power Control | Power-on/off source detection, shutdown control, sleep/wakeup |
| Data Buffer | 4-byte user data storage |
| Channel | Voltage Range | Step |
|---|---|---|
| DCDC1 | 1500-3400 mV | 100 mV |
| DCDC2 | 500-1200 mV / 1220-1540 mV | 10 mV / 20 mV |
| DCDC3 | 500-1200 mV / 1220-1540 mV / 1600-3400 mV | 10 mV / 20 mV / 100 mV |
| DCDC4 | 500-1200 mV / 1220-1840 mV | 10 mV / 20 mV |
| DCDC5 | 1200 mV (special), 1400-3700 mV | 100 mV |
| ALDO1-4 | 500-3500 mV | 100 mV |
| BLDO1-2 | 500-3500 mV | 100 mV |
| CPUSLDO | 500-1400 mV | 50 mV |
| DLDO1-2 | 500-3400 mV | 100 mV |
// Configure I2C pins for ESP32-S3 (M5Stack CoreS3)
Configuration.SetPinFunction(12, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(11, DeviceFunction.I2C1_CLOCK);
I2cDevice i2cAxp2101 = new(new I2cConnectionSettings(1, Axp2101.I2cDefaultAddress));
Axp2101 power = new Axp2101(i2cAxp2101);
Important: make sure you read the documentation of your battery and set up the proper charging values and stop current. Overcharging your battery may damage it.
Configure DCDC and LDO voltage rails for your board. Example for M5Stack CoreS3:
// DCDC1: ESP32-S3 core — 3.3V (do NOT disable this!)
power.DcDc1Voltage = ElectricPotential.FromVolts(3.3);
power.EnableDcDc1();
// ALDO1: System peripherals — 1.8V
power.Aldo1Voltage = ElectricPotential.FromVolts(1.8);
power.EnableAldo1();
// ALDO2: Display/LCD — 3.3V
power.Aldo2Voltage = ElectricPotential.FromVolts(3.3);
power.EnableAldo2();
Warning: Never disable DCDC1 on a CoreS3 as it powers the ESP32-S3 core. Disabling it will brick the system until the next power cycle.
power.EnableCellBatteryCharge();
power.SetChargeConstantCurrent(ChargingCurrent.Current200mA);
power.SetChargeTargetVoltage(ChargeTargetVoltage.Voltage4V2);
power.SetPrechargeCurrent(PrechargeCurrent.Current25mA);
power.SetChargeTerminationCurrent(ChargeTerminationCurrent.Current25mA);
power.EnableChargeTerminationLimit();
power.SetThermalThreshold(ThermalThreshold.Temperature100C);
int percentage = power.GetBatteryPercentage();
ElectricPotential batteryVoltage = power.GetBatteryVoltage();
ChargingStatus chargeStatus = power.GetChargerStatus();
bool batteryConnected = power.IsBatteryConnected;
Debug.WriteLine($"Battery: {percentage}%, {batteryVoltage.Volts:F2}V, {chargeStatus}");
Debug.WriteLine($" Connected: {batteryConnected}");
if (power.IsVbusGood)
{
ElectricPotential vbusVoltage = power.GetVbusVoltage();
Debug.WriteLine($"VBUS: {vbusVoltage.Volts:F2}V, Connected");
}
The power key supports short and long press detection via interrupts:
power.EnableIrq(Axp2101Irq.PowerKeyShortPress | Axp2101Irq.PowerKeyLongPress);
power.SetPowerKeyPressOnTime(0); // 128 ms
power.SetPowerKeyPressOffTime(0); // 4 s
power.EnableLongPressShutdown();
power.ClearIrqStatus();
// In your main loop:
if (power.IsPowerKeyShortPressIrq())
{
Debug.WriteLine("Short press");
}
if (power.IsPowerKeyLongPressIrq())
{
Debug.WriteLine("Long press");
}
power.ClearIrqStatus();
Enable ADC channels and read measurements:
power.EnableBatteryVoltageMeasure();
power.EnableVbusVoltageMeasure();
power.EnableSystemVoltageMeasure();
power.EnableTemperatureMeasure();
Debug.WriteLine($"Die Temperature: {power.GetInternalTemperature().DegreesCelsius:F1} °C");
Debug.WriteLine($"System Voltage : {power.GetSystemVoltage().Volts:F2} V");
power.SetWatchdogConfig(WatchdogConfig.IrqAndReset);
power.SetWatchdogTimeout(WatchdogTimeout.Timeout8s);
power.EnableWatchdog();
// Feed the watchdog periodically:
power.ClearWatchdog();
The AXP2101 supports many additional features including VBUS input limits, backup battery charging, fast power-on sequencing, fuel gauge ROM programming, sleep/wakeup, and DCDC forced-PWM mode. You can check out the to get more details on how to use these features.
Note: this binding uses UnitsNet for units like Voltage and Temperature.
| Channel | Usage | Voltage |
|---|---|---|
| DCDC1 | ESP32-S3 core | 3.3V |
| ALDO1 | System peripherals | 1.8V |
| ALDO2 | Display/LCD power | 3.3V |
| ALDO3 | Sensor/peripheral power | 3.3V |
| ALDO4 | Camera sensor | 3.3V |
| BLDO1 | I/O level shift | 3.3V |
| BLDO2 | Reserved/peripheral | 3.3V |
If migrating from the binding, note these key differences:
| Feature | AXP192 | AXP2101 |
|---|---|---|
| DCDC channels | DCDC1, DCDC3 | DCDC1-5 |
| LDO channels | LDO2, LDO3 | ALDO1-4, BLDO1-2, CPUSLDO, DLDO1-2 |
| Voltage ranges | Simpler step logic | Multi-range with variable steps (DCDC2-4) |
| ADC | Full coulomb counter, multiple current ADC | Simplified ADC (no coulomb counter) |
| Fuel gauge | Coulomb counter based | Built-in fuel gauge with battery % register |
| GPIO | GPIO0-4 with configurable behavior | No user-accessible GPIO (TS pin is configurable) |
| Interrupt registers | 5 registers | 3 registers (~24 IRQ sources) |
| Watchdog | Not present | Configurable watchdog timer |
| JEITA | Not present | Temperature-compensated charging |
| Data buffer | 6 bytes | 4 bytes |
| Chip ID register | 0x03 (no standard value) | 0x03 → 0x4A |
| Default I2C address | 0x34 | 0x34 (same) |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net net is compatible. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-preview.61 | 49 | 6/1/2026 |
| 2.0.0-preview.56 | 49 | 5/27/2026 |
| 2.0.0-preview.49 | 58 | 5/20/2026 |
| 2.0.0-preview.38 | 55 | 5/13/2026 |
| 2.0.0-preview.25 | 51 | 5/4/2026 |
| 2.0.0-preview.21 | 62 | 4/29/2026 |
| 2.0.0-preview.8 | 54 | 4/20/2026 |
| 2.0.0-preview.3 | 63 | 4/13/2026 |
| 2.0.0-preview.1 | 60 | 4/10/2026 |
| 1.0.3 | 122 | 3/18/2026 |
| 1.0.1 | 107 | 3/18/2026 |