MAX10748 Lipo Fuel Gauge not working  - Page 1
Forum section: electronics / projects

author: Mojies
author_rank: Newbie
timestamp: February 10, 2024, 07:35:29 pm
content: Hi all,I'm trying to monitor my state of charge SOC percentage of my lipo battery (3.7V 2000mah) with the use of a MAX10748-G Fuel Gauge connected via I2C. Custom PCB with ESP32-Wroom module.When using a simple example script to print voltage and SOC% in serial (Arduino IDE) i'm getting a strange constant voltage of appr. 3.33V and a SOC% of 0.06% while Lipo is fully charged.Any thoughts what might be wrong or causing this issue? (e.g. bad soldering?, I already tried 2 PCBs resulting in same issue).I would expect a voltage around 4.2V and appr 100% SOC.PCB Schematic (part of it) attached.I'm printing the example ino file below.Thanks for your help.KRMojiesCode:/******************************************************************************Example1_SimpleBy: Paul ClarkDate: October 23rd 2020Based extensively on:MAX17043_Simple_Serial.cppSparkFun MAX17043 Example CodeJim Lindblom @ SparkFun ElectronicsOriginal Creation Date: June 22, 2015This file demonstrates the simple API of the SparkFun MAX17043 Arduino library.This example will print the gauge's voltage and state-of-charge (SOC) readingsto Serial (115200 baud)This code is released under the MIT license.Distributed as-is; no warranty is given.******************************************************************************/#include <Wire.h> // Needed for I2C#include <SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.h> // Click here to get the library: http://librarymanager/All#SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library//SFE_MAX1704X lipo; // Defaults to the MAX17043//SFE_MAX1704X lipo(MAX1704X_MAX17043); // Create a MAX17043//SFE_MAX1704X lipo(MAX1704X_MAX17044); // Create a MAX17044SFE_MAX1704X lipo(MAX1704X_MAX17048); // Create a MAX17048//SFE_MAX1704X lipo(MAX1704X_MAX17049); // Create a MAX17049double voltage = 0; // Variable to keep track of LiPo voltagedouble soc = 0; // Variable to keep track of LiPo state-of-charge (SOC)bool alert; // Variable to keep track of whether alert has been triggeredvoid setup(){Serial.begin(115200); // Start serial, to output debug datawhile (!Serial); //Wait for user to open terminalSerial.println(F("MAX17043 Example"));Wire.begin();lipo.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial// Set up the MAX17043 LiPo fuel gauge:if (lipo.begin() == false) // Connect to the MAX17043 using the default wire port{Serial.println(F("MAX17043 not detected. Please check wiring. Freezing."));while (1);}// Quick start restarts the MAX17043 in hopes of getting a more accurate// guess for the SOC.lipo.quickStart();// We can set an interrupt to alert when the battery SoC gets too low.// We can alert at anywhere between 1% - 32%:lipo.setThreshold(20); // Set alert threshold to 20%.}void loop(){// lipo.getVoltage() returns a voltage value (e.g. 3.93)voltage = lipo.getVoltage();// lipo.getSOC() returns the estimated state of charge (e.g. 79%)soc = lipo.getSOC();// lipo.getAlert() returns a 0 or 1 (0=alert not triggered)alert = lipo.getAlert();// Print the variables:Serial.print("Voltage: ");Serial.print(voltage); // Print the battery voltageSerial.println(" V");Serial.print("Percentage: ");Serial.print(soc); // Print the battery state of chargeSerial.println(" %");Serial.print("Alert: ");Serial.println(alert);Serial.println();delay(500);}

author: Kalvin
author_rank: Super Contributor
timestamp: February 10, 2024, 08:46:31 pm
content: Read the datasheet, especially check the pin functionality. You are measuring 3.3V power rail now.