MAX17043 Fuel Gauge Incorrect Readings

Hello All, I have been working with a pro mini 3.3v and a small oled screen. I am powering this from an 18650 2500mAh battery. Working great. I've now added a fuel gauge (http://www.ebay.com/itm/5pcs-LiPo-Fuel-Gauge-battery-detection-A-D-conversion-IIC-MAX17043-/201430080384) and the library by Luca Dentella (http://www.lucadentella.it/en/max17043-libreria-per-arduino/)

I have followed this exactly (https://www.youtube.com/watch?v=3yHRrPDczK4) , I also have the charger board used in the youtube tutorial.

Whether I use the charger board or not, batteryMonitor.getVCell(); returns 5V and batteryMonitor.getSoC(); returns 256.00%. My battery is actually charged to 4.12v.

Why is this happening? How can it be resolved? Please and Thank You.

John

I’ve been over the datasheet for the max17043:http://cdn.sparkfun.com/datasheets/Prototyping/MAX17043-MAX17044.pdf
the schematic for the fuel gauge:http://cdn.sparkfun.com/datasheets/Prototyping/lipo_fuel_gauge-v11.pdf
and I simply can not figure out what the problem might be. It gives the same reading when the battery leads aren’t even attached to a battery.

Here’s the code, hopefully it helps you help me…

#include <SPI.h>
#include "MAX17043.h"
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>


#define OLED_RESET 4
MAX17043 batteryMonitor;

Adafruit_SSD1306 display(OLED_RESET);
float cellVoltage = 0;
float stateOfCharge = 0;
int icvers = 0;
int compval = 0;
void setup()   {          
  Serial.begin(9600);
  Wire.begin();
  batteryMonitor.reset();
  batteryMonitor.quickStart();
  delay(1000);
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  // init done

  // Clear the buffer.
  display.clearDisplay();
  icvers = batteryMonitor.getVersion(); 
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(0,0);
	display.print(icvers);
	
	compval = batteryMonitor.getCompensateValue(); 
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(20,0);
	display.print(compval);
	
	
	cellVoltage = batteryMonitor.getVCell(); 
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(0,20);
	display.print(cellVoltage);
	display.println("V");
	
stateOfCharge = batteryMonitor.getSoC();
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(60,20);
	display.print(stateOfCharge);
	display.println("%");
	display.display();
  delay(2000);

  // Clear the buffer.
  display.clearDisplay();
}


void loop() {
  icvers = batteryMonitor.getVersion(); 
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(0,0);
	display.print(icvers);
	
 compval = batteryMonitor.getCompensateValue();  
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(20,0);
	display.print(compval);
	
	
  cellVoltage = batteryMonitor.getVCell(); 
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(0,20);
	display.print(cellVoltage);
	display.println("V");
	
stateOfCharge = batteryMonitor.getSoC();
	display.setTextSize(1);
	display.setTextColor(WHITE);
	display.setCursor(60,20);
	display.print(stateOfCharge);
	display.println("%");
	display.display();
  delay(2000);

  // Clear the buffer.
  display.clearDisplay();
}

So I’ve tested 3 of 5 of these fuel gauges and none of them seem to work properly. I’ve also run the arduino I2C scanner sketch and none of them appear to be communicating. The oled appears on the scanner but not the fuel gauges.

You need to have pullups on SDA and SCL. Since your code does not seem to have enabled internal pullups for these you need to use external (around 4.7K) pullups. Have you done that or are internal pullups enabled behind the scenes in one of the libraries?

Hey Stowite

I apologize. I thought I had also linked to the schematic: http://cdn.sparkfun.com/datasheets/Prototyping/lipo_fuel_gauge-v11.pdf

Yes there are pullups on board.

Thank You, John

I think this is due to the same isse as here: http://forum.arduino.cc/index.php?topic=341825.0

I have also the same problem: Purchased several 17043 lipo fuel gauges from ebay. I have also purchased the Sparkfun ones. Sparkfun works without any problems on all libraries I have tried. I have testet multiple modules of the clones: The difference is in the MAX17043: Where the Sparkfun has markings: Line1: 17043 Line2: 47A18. The clones have markings on Line1: 17043 Line2: 17A1U. The new Sparkfun have a black battery connector, the clones a white one. I have tried multiple libraries and also tried direct communications using I2C commands. An interesting thing showed up in the testing with an I2C scanner: The Sparkfun uses address 0X36 and the clones 0X32 (on the ones that showed up in I2C scans- not all do). I though an address change in the code would fix it, but unfortunately no: If I get values returned, they are "all over the place" - i.e. no consistent results.

I have also tried to change the I2C speed to slower speeds, but no change. I have also tried additional pull-up resistors on the SLC/SDA lines, but no change. I am pretty much out of options and ideas at this time..

I think the clone modules I purchased from 2 different vendors are made by the same manufacturer: They both contain what I assume is an jst battery cable where red and black wired are reversed. On the board it is pretty obvious where ground is compared with battery/power, but could trip some up I guess... All have the same markings on the max17043. Could they be counterfeit?

I have not gotten any relevant response from the first seller, and I will now contact the second seller to see their response. If anyone has purchased a clone that works - I appreciate a comment on the seller / channel.