As of June 14, 2023, the now-discontinued LC709203 battery monitor chip has been replaced with the MAX17048. Unsure which one you have? Check the silk on the back of the board. If your board does NOT have "MAX17048 Monitor" in the upper left corner, then you have the LC709203 version.

Your microcontroller board comes with an LC709203 lithium ion polymer (lipoly) battery monitor built right onto the board. The LC709203 is available over I2C.

The LC709203 comes with its own Adafruit CircuitPython library that makes it simple to write code to read data from it. This example will be using, among other things, the Adafruit CircuitPython LC709203F library.

The example simply reads data from the battery monitor and prints it to the serial console. It is designed to show you how to get data from the battery monitor.

LC709203 Location

The LC709203 battery monitor (highlighted in red) is located towards the top of the board, near the center, below the USB and 13 pin labels on the silk. Its I2C address is 0x0B. (0xb, which is returned by I2C scan, is the same as 0x0B, which simply has leading zeros.)

LC709203 Simple Data Example

To run this example, you need to first install the LC709203F library into the lib folder on your CIRCUITPY drive. Then you need to update with the example script.

Thankfully, we can do this in one go. In the example below, click the Download Project Bundle button below to download the necessary libraries and the file in a zip file. Extract the contents of the zip file, and copy the entire lib folder and the file to your CIRCUITPY drive.

Your CIRCUITPY/lib folder should contain at least the following folder and file:

  • adafruit_register/
  • adafruit_lc709203f.mpy
# SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
CircuitPython Simple Example for LC709203 Sensor
import time
import board
from adafruit_lc709203f import LC709203F, PackSize

# Create sensor object, using the board's default I2C bus.
i2c = board.I2C()  # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller
battery_monitor = LC709203F(i2c)

# Update to match the mAh of your battery for more accurate readings.
# Can be MAH100, MAH200, MAH400, MAH500, MAH1000, MAH2000, MAH3000.
# Choose the closest match. Include "PackSize." before it, as shown.
battery_monitor.pack_size = PackSize.MAH400

while True:
    print("Battery Percent: {:.2f} %".format(battery_monitor.cell_percent))
    print("Battery Voltage: {:.2f} V".format(battery_monitor.cell_voltage))
This code will run without a battery plugged in, and voltage and charge level will be printed to the serial console, but this data does not correlate to anything. Plug in a battery to get useful data!

Now, connect to the serial console to see the battery data printed out!

That's all there is to reading the LC709203 data using CircuitPython!

For more details, check out the guide for the LC709203.

This guide was first published on Nov 25, 2021. It was last updated on May 26, 2024.

This page (LC709203 Battery Monitor) was last updated on Mar 08, 2024.

Text editor powered by tinymce.