Skip to main content

MAX17048-smbus

PyPI Version PyPI Python Version Documentation GitHub License

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. The official package is available on PyPI.

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, or smbus3 backends (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-smbus
    • smbus2
    • smbus3
  • 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.

Metadata

Release files for MAX17048-smbus 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MAX17048-smbus 0.1.1
File Size Uploaded
max17048_smbus-0.1.1.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MAX17048-smbus 0.1.1
File Interpreter ABI Platform
max17048_smbus-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.2 kB

Release files / max17048_smbus-0.1.1.tar.gz

Download URL max17048_smbus-0.1.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a210ed1fc5e93b4ad105bf94d4fd4dd8f02aa983343444d21b08c83ab05250af
BLAKE2b-256 checksum
How to use checksums
a61a73cea0f96d5fe154c39b2db184d7c7b3d717691a55eeeab139b10bca6d6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / max17048_smbus-0.1.1-py3-none-any.whl

Download URL max17048_smbus-0.1.1-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eef5e5be6e86c63d31a73e0a3abd26ad11b49bbc49b1ed91cfa155bbfc55241a
BLAKE2b-256 checksum
How to use checksums
bcbeb2801835f6dd71c678b8688436da9ad129a7e79e8ae29460f1d44c5c4fff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page