Angled view of the MAX17048 fuel gauge board showing fitted header pins and battery connectors

MAX17048 Pre-Soldered Single-Cell Lithium Battery Fuel Gauge Module | ShillehTek Product Manual

ArduinoESP32Raspberry PiPicomanual-product-10645386330399
$10.35 USD In stock · Order by 3pm ET, ships today

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

Type
Single-cell LiPo / Li-ion fuel gauge
Interface
I2C, address 0x36
Logic Supply
3 V to 5 V on VIN
Reports
Cell voltage and charge in %
Battery Sockets
2 × JST-PH, wired together
Sense Resistor
None needed

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.

MAX17048 battery fuel gauge module pinout diagram showing VIN, GND, SCL, SDA, INT, QStart pins and the JST battery sockets

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
Pull-ups: The board already has 10k pull-ups on SDA and SCL, so no extra resistors are needed.

ESP32 Wiring

Module Pin ESP32 Pin Function
VIN 3V3 Logic power
GND GND Ground
SDA GPIO 21 I2C data
SCL GPIO 22 I2C clock
Logic level: VIN sets the I2C voltage. Use 3V3 here, so SDA and SCL stay at 3.3 V.

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
3.3 V only: Power VIN from 3V3, never from 5V. The pull-ups go to VIN, and 5 V on SDA or SCL can damage the Pi.

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
3.3 V only: Power VIN from 3V3(OUT), not from VBUS or VSYS. The Pico's GPIO pins are not 5 V tolerant.

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_read.ino
// 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)

max17048_read.py
#!/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_pico.py
# 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)

Frequently Asked Questions

Why does the MAX17048 not show up on I2C?
Almost always because no battery is connected. The chip is powered from the battery, not from VIN, so without a cell on one of the JST-PH sockets it does not answer and an I2C scan finds nothing. Plug in a charged battery, then check that VIN, GND, SDA and SCL are wired and that you are looking for address 0x36.
Does it charge or protect the battery?
No, it only measures. Charging needs a separate charger board, and protection needs a protected cell or a protection circuit. The gauge can share the battery circuit with a charger: connect the battery to one JST-PH socket and the charger or load to the other.
Which way round are the battery sockets wired?
The polarity is printed beside each JST-PH socket as − and +. Compare those marks with your battery lead before plugging in, because JST battery plugs from different suppliers are not all wired the same way. A reversed battery can destroy the board. If your lead is the wrong way round, swap the contacts in the plug housing or use a different lead.
How accurate is the percentage?
The MAX17048 estimates charge from the cell voltage with a built-in battery model, without measuring current. That is good enough for a battery meter and low-battery warnings. The first reading after you connect a battery is a quick estimate that improves as the chip watches the cell, so treat the number as an estimate, not a lab measurement.
What are INT and QStart for?
INT is an alert output that the chip can pull low, for example when the charge drops below a threshold you set in its registers. QStart is the quick-start input, which makes the chip restart its estimate from the present cell voltage. Both are optional: basic voltage and percentage readings need only power, ground, SDA and SCL.
Can I use it with a two-cell or three-cell pack?
No. It is built for a single lithium cell: one 3.7 V LiPo or Li-ion cell, or several cells in parallel that behave as one. Packs with cells in series, such as 7.4 V or 11.1 V packs, are above its input range and will damage it.
Do I need a library?
No. The examples on this page read the voltage and charge registers directly with plain I2C calls. If you prefer a library on Arduino, the Adafruit MAX1704X library supports the MAX17048 and adds alerts, sleep mode and other settings.

Related Tutorials

Datasheets & downloads

Reference documents for the MAX17048 Pre-Soldered Single-Cell Lithium Battery Fuel Gauge Module. This manual covers wiring and code; the documents below carry the full electrical specifications.