Overview
The MAX17048 module is a fuel gauge for a single lithium cell. It measures the battery voltage, estimates the state of charge with a built-in battery model, and reports both over I2C. There is no current-sense resistor in the power path, so the board simply sits beside the battery.
Use it to show a real battery percentage on a LiPo or Li-ion powered Arduino, ESP32, Raspberry Pi or Pico project. The board has two JST-PH sockets for the battery and the load, two 4-pin I2C sockets and a pre-soldered header. It is a monitor only: it does not charge or protect the battery.
At a Glance
Specifications
| Parameter | Value |
| Gauge IC | MAX17048 |
| Battery | One lithium cell (3.7 V nominal, 4.2 V full) |
| Interface | I2C, fixed address 0x36 |
| Logic supply (VIN) | 3 V to 5 V; sets the I2C logic level |
| Chip power | Taken from the battery, not from VIN |
| Voltage reading | 78.125 µV per count (16-bit VCELL register) |
| Charge reading | 1/256 % per count (SOC register) |
| Pull-ups | 10k on SDA, SCL and INT, to VIN |
| Connectors | 2 × JST-PH battery / load, 2 × 4-pin I2C socket, 6-pin header |
| Extra pins | INT (alert output), QStart (quick-start input) |
Pinout Diagram
With the battery sockets at the top, the header reads left to right: VIN, GND, SCL, SDA, INT and QStart. The two JST-PH sockets are wired together, so the battery goes in one and your load or charger in the other. Check the − and + marks beside the sockets against your battery plug before connecting: JST battery leads are not all wired the same way.
Wiring Guide
Plug a battery into one of the JST-PH sockets first: the chip runs from the battery and stays silent on I2C without one. Then connect VIN to your board's logic voltage, plus ground, SDA and SCL. INT and QStart are optional.
Arduino Uno / Nano Wiring
| Module Pin | Arduino Pin | Function |
|---|---|---|
| VIN | 5V | Logic power |
| GND | GND | Ground |
| SDA | A4 | I2C data |
| SCL | A5 | I2C clock |
ESP32 Wiring
| Module Pin | ESP32 Pin | Function |
|---|---|---|
| VIN | 3V3 | Logic power |
| GND | GND | Ground |
| SDA | GPIO 21 | I2C data |
| SCL | GPIO 22 | I2C clock |
Raspberry Pi Wiring
Enable I2C with sudo raspi-config (Interface Options, I2C), then look for the gauge with i2cdetect -y 1. With a battery plugged in, it appears at address 36.
| Module Pin | Pi Pin | Function |
|---|---|---|
| VIN | 3V3 (Pin 1) | Logic power |
| GND | GND (Pin 6) | Ground |
| SDA | GPIO 2 (Pin 3) | I2C data |
| SCL | GPIO 3 (Pin 5) | I2C clock |
Raspberry Pi Pico Wiring
| Module Pin | Pico Pin | Function |
|---|---|---|
| VIN | 3V3(OUT) (Pin 36) | Logic power |
| GND | GND (Pin 38) | Ground |
| SDA | GP4 (Pin 6) | I2C data |
| SCL | GP5 (Pin 7) | I2C clock |
Code Examples
View or download this product's example code on GitHub.
The examples read the two main registers directly, so no library is needed. Each one prints the battery voltage and the estimated charge every two seconds.
Arduino and ESP32 — Voltage and Percentage
// MAX17048 battery fuel gauge - read cell voltage and state of charge over I2C
// Arduino Uno/Nano: VIN = 5V, SDA = A4, SCL = A5. ESP32: VIN = 3V3, SDA = GPIO 21, SCL = GPIO 22.
// GND = GND. A battery must be plugged into the board, or the chip will not answer.
#include <Wire.h>
const uint8_t MAX17048_ADDR = 0x36;
const uint8_t REG_VCELL = 0x02; // cell voltage, 78.125 uV per count
const uint8_t REG_SOC = 0x04; // state of charge, 1/256 % per count
bool readRegister(uint8_t reg, uint16_t &value) {
Wire.beginTransmission(MAX17048_ADDR);
Wire.write(reg);
if (Wire.endTransmission(false) != 0) return false;
if (Wire.requestFrom((int)MAX17048_ADDR, 2) != 2) return false;
uint8_t high = Wire.read();
uint8_t low = Wire.read();
value = ((uint16_t)high << 8) | low;
return true;
}
void setup() {
Serial.begin(115200);
Wire.begin();
}
void loop() {
uint16_t rawVolts, rawPercent;
if (readRegister(REG_VCELL, rawVolts) && readRegister(REG_SOC, rawPercent)) {
Serial.print("Battery: ");
Serial.print(rawVolts * 78.125 / 1000000.0, 3);
Serial.print(" V ");
Serial.print(rawPercent / 256.0, 1);
Serial.println(" %");
} else {
Serial.println("MAX17048 not found - is a battery connected?");
}
delay(2000);
}
Raspberry Pi — Voltage and Percentage (Python)
#!/usr/bin/env python3
# MAX17048 battery fuel gauge on Raspberry Pi - read cell voltage and state of charge
# Enable I2C (sudo raspi-config), then install the library: sudo apt install python3-smbus2
# Wiring: VIN = 3V3 (pin 1), GND = pin 6, SDA = GPIO 2 (pin 3), SCL = GPIO 3 (pin 5)
# A battery must be plugged into the board, or the chip will not answer.
import time
from smbus2 import SMBus
ADDR = 0x36
REG_VCELL = 0x02 # cell voltage, 78.125 uV per count
REG_SOC = 0x04 # state of charge, 1/256 % per count
def read_register(bus, reg):
high, low = bus.read_i2c_block_data(ADDR, reg, 2)
return (high << 8) | low
with SMBus(1) as bus:
while True:
try:
volts = read_register(bus, REG_VCELL) * 78.125 / 1000000
percent = read_register(bus, REG_SOC) / 256
print(f"Battery: {volts:.3f} V {percent:.1f} %")
except OSError:
print("MAX17048 not found - is a battery connected?")
time.sleep(2)
Raspberry Pi Pico — Voltage and Percentage (MicroPython)
# MAX17048 battery fuel gauge on Raspberry Pi Pico (MicroPython)
# Wiring: VIN = 3V3(OUT), GND = GND, SDA = GP4, SCL = GP5
# A battery must be plugged into the board, or the chip will not answer.
from machine import I2C, Pin
import time
ADDR = 0x36
REG_VCELL = 0x02 # cell voltage, 78.125 uV per count
REG_SOC = 0x04 # state of charge, 1/256 % per count
i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=100000)
def read_register(reg):
data = i2c.readfrom_mem(ADDR, reg, 2)
return (data[0] << 8) | data[1]
while True:
try:
volts = read_register(REG_VCELL) * 78.125 / 1000000
percent = read_register(REG_SOC) / 256
print("Battery: {:.3f} V {:.1f} %".format(volts, percent))
except OSError:
print("MAX17048 not found - is a battery connected?")
time.sleep(2)



