Adafruit ESP32-S3 Manual page 32

Tft feather
Table of Contents

Advertisement

The LC709203 battery monitor is available over I2C on address 0x0B.
Our Arduino MAX1704x () or CircuitPython/Python
to read the voltage and percentage whenever you like. 
Our Arduino LC709203F () or CircuitPython/Python
you to set the pack size (mAh of the battery which helps tune the calculation), and
read the voltage and percentage whenever you like.
There is no pin on this board that returns battery voltage, but this I2C monitor makes
it super simple to get that data!
In Arduino, you can measure the battery voltage using the following script.
// SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries
//
// SPDX-License-Identifier: MIT
//
// Adafruit Battery Monitor Demo
// Checks for MAX17048 or LC709203F
#include <Wire.h>
#include "Adafruit_MAX1704X.h"
#include "Adafruit_LC709203F.h"
Adafruit_MAX17048 maxlipo;
Adafruit_LC709203F lc;
// MAX17048 i2c address
bool addr0x36 = true;
void setup() {
Serial.begin(115200);
while (!Serial) delay(10);
Serial.println(F("\nAdafruit Battery Monitor simple demo"));
// if no max17048..
if (!maxlipo.begin()) {
Serial.println(F("Couldnt find Adafruit MAX17048, looking for LC709203F.."));
// if no lc709203f..
if (!lc.begin()) {
Serial.println(F("Couldnt find Adafruit MAX17048 or LC709203F."));
while (1) delay(10);
©Adafruit Industries
MAX1704x () library code allows you
LC709203F () library code allows
// wait until serial monitor opens
Page 32 of 263

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S3 and is the answer not in the manual?

Table of Contents

Save PDF