MAX17048/49 battery fuel gauge driver using SMBus
Project description
MAX17048-smbus
A lightweight Python library for communicating with MAX17048 (and likely compatible MAX17049) battery fuel gauge sensors over the I²C/SMBus interface.
This package provides a simple and dependency-minimal interface designed for environments like Raspberry Pi or other Linux-based systems with native SMBus support.
Overview
MAX17048-smbus provides a straightforward and lightweight way to communicate with the MAX17048/MAX17049 battery fuel gauge sensors over SMBus/I²C.
It is especially suited for Raspberry Pi and other Linux systems with native SMBus support.
This library is designed to work directly with standard SMBus backends (smbus, smbus2, or smbus3), automatically selecting the first available one.
It aims to remain minimal, easy to integrate, and dependency-minimal across typical Linux environments, making it ideal for embedded systems like Raspberry Pi, Orange Pi, or other Linux-based boards.
Features
- Read battery State of Charge (SoC), voltage, and charge/discharge rate
- Access alert status and configure alert thresholds
- Control sleep and hibernation modes
- Read and reset configuration registers
- Support for MAX17048 (and likely compatible MAX17049) devices
- Works with
smbus,smbus2, orsmbus3backends (auto-detected) - Designed for Raspberry Pi and other Linux-based systems
- No external dependencies beyond the SMBus backend
Installation
Basic installation
Install the library directly from PyPI:
pip install MAX17048-smbus
This install only the core library, assuming you already have an SMBus-compatible backend available on your system (such as smbus, smbus2, or smbus3).
On most Raspberry Pi systems, the smbus package is already available via APT:
sudo apt install python3-smbus
With optional backend
If you don’t have any SMBus backend installed, you can install one together with the library:
pip install MAX17048-smbus[smbus3]
# or
pip install MAX17048-smbus[smbus2]
# or
pip install MAX17048-smbus[smbus]
Only one backend is needed — the library will automatically detect and use whichever is available.
Quick Example
A minimal example showing how to read the battery state of charge and voltage:
from max1704x_smbus import MAX17048
# Create device instance
device = MAX17048()
# Read battery information
soc = device.cell_percent # %
voltage = device.cell_voltage # V
print(f"SoC: {soc:.2f}% | Voltage: {voltage:.3f} V")
For more detailed usage examples, configuration options, and advanced features, see the documentation on Read the Docs.
Documentation
Comprehensive documentation is available online, including full API reference, configuration details, and usage examples:
👉 https://max17048-smbus.readthedocs.io
Requirements
- Python 3.8 or newer
- One of the following SMBus-compatible backends:
smbus|python3-smbussmbus2smbus3
- An I²C-capable system (e.g. Raspberry Pi, or any Linux board with
/dev/i2c-*support)
License
This project is licensed under the MIT License — see the LICENSE file for details.
Acknowledgements
This library was inspired by Adafruit_CircuitPython_MAX1704x, but was reimplemented from scratch to work with smbus/smbus2/smbus3 backends without external dependencies.
Disclaimer
This library was inspired by Adafruit_CircuitPython_MAX1704x but was written from scratch and is not API-compatible with it.
Support for the MAX17049 device is theoretical — it has not been tested, though it is expected to work due to its register-level compatibility with the MAX17048.
This software is provided “as is”, without warranty of any kind, express or implied.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file max17048_smbus-0.1.0.tar.gz.
File metadata
- Download URL: max17048_smbus-0.1.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ff80e2033f8b137f2fbe7f62d0e309b8c978f462137333e503d86324b36bba0
|
|
| MD5 |
158c0ed61de79fb4420f71deb5eb5fd4
|
|
| BLAKE2b-256 |
236241efb7ed4f25f91d195a95254583f2f1d934f5bf0a8a1ffb2e8f0e65fa18
|
File details
Details for the file max17048_smbus-0.1.0-py3-none-any.whl.
File metadata
- Download URL: max17048_smbus-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9c3cabfd604fba4a7e2dbd8088d6bf8696756a064a62c0e38cb83dbe0c349d4
|
|
| MD5 |
aa3657df9c259d7d67ae53be8c705c09
|
|
| BLAKE2b-256 |
3d6fdc473799304de31b0152465d60b4bd4c8d060ce73bdf25a2711a09c011e1
|