Lipo FuelGauge draws too much power

This device, based on the MAX1704 chip, uses I2C communications to report battery voltage and battery percent-remaining.
It works correctly in my project, using an ATmega328P powered by a LiPo cell.
That's good.

Without the FuelGauge hooked up, my project draws 30 microamps or less while sleeping.
WITH the device hooked up, it draws 1,037 microamps.
That's bad.

If I remove all software references to the fuelgauge and its library, and simply hook up the device physically (only four connections: Power, ground, SDA, SCL), it draws 1,037 microamps.

If I restore the software bits, which includes a "FuelGauge.sleep()" function, it draws 1,007 microamps. (I'm measuring this with an INA226, FYI. Calibrated, tested, I believe it.)

So I guess it's the SDA and SCL lines that are pulling some current. I've done what I can in my sleep code to shut the I2C system down, but haven't found the magic bullet yet. Maybe I have to physically cut some traces on the board to disable some pullup resistors?

Not a total newbie but clearly there's SOMETHING I'm missing. Any advice appreciated, and thanks.

Here's my code for the GoToSleep() function:

void GoToSleep() {
  digitalWrite(MOTOR_ENABLE_PIN, LOW);  // turns a voltage booster on and off with this pin
  pinMode (CLOCK_POWER_PIN, OUTPUT);  // turn off RTC
  digitalWrite (CLOCK_POWER_PIN, LOW);
  digitalWrite(LEDPIN, LOW);
  #ifdef fuelgauge
    Serial.println(F("sleep: Fuelgauge about to sleep")); delay(10);
    //FuelGauge.sleep();
    Serial.print(F("sleep: Fuelgauge Sleeping: ")); Serial.println(FuelGauge.isSleeping());delay(10);
  #endif
  Wire.end();  // shouldnt need it but ...
  
  // turn off I2C pullups
  // but is this what is sucking up power while sleeping? 45 mA?
  digitalWrite (A4, LOW);
  digitalWrite (A5, LOW);

  byte adcsra = ADCSRA;
  ADCSRA = 0;               // disable ADC
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);
  sleep_enable ();          // ready to sleep
  noInterrupts ();          // timed sequence follows
  power_all_disable ();     // power off ADC, Timer 0 and 1, serial interface
  resetWatchdog ();         // get watchdog ready, 8-second timer

  // Note we commented out pullups in Wire-master/libraries/utility/twi.c for extra power savings.
  // per  http://forum.arduino.cc/index.php?topic=296269.0 comment #7

  // turn off brown-out enable in software
  // BODS must be set to one and BODSE must be set to zero within four clock cycles
  MCUCR = bit (BODS) | bit (BODSE);
  // The BODS bit is automatically cleared after three clock cycles
  MCUCR = bit (BODS);
  interrupts ();         // interrupts are required now
  
  sleep_cpu ();          // sleep
  
  // now we are sleeping
  // when we wake, continue from here
  sleep_disable ();      // precaution
  power_all_enable ();   // power everything back on// allow changes, disable reset
  ADCSRA = adcsra;
  // turn on I2C pullups
  digitalWrite (A4, HIGH);
  digitalWrite (A5, HIGH); delay(10);
  #ifdef fuelgauge
    //FuelGauge.awake();
    Serial.print(F("wake: Fuelgauge Sleeping: ")); Serial.println(FuelGauge.isSleeping());delay(10);
#endif


}

Disconnect Vcc from 3V3 (as you probably have now, I'm missing the wiring diagram) and connect it to one of the GPIO pins over a voltage divider. That set that pin HIGH before you use the chip but set the pin as input if you don't use the chip (before going to sleep). That way you don't loose power by the pull-ups.

Tried that, thanks. Current draw went down from 1.027 mA to .091 mA.
Good, but still not the 3 microAmps the chip spec says it will sleep at.

I found a schematic for the Lipo Fuel Gauge here.

A similar discussion here suggests severing the Vin line from the battery. I did that, but still see the same current draw, .091 mA while sleeping.

Here's how I did what you said: my project's PCB (Sorry I can't give you the schematic) includes one of these RTC (Real Time Clock) modules:


I power this RTC from an Arduino pin, but only when the Arduino is awake.

The RTC passes GND, VCC, SDA, and SCL through (see the top of the board?), so I connected the fuel gauge's GND, VCC, SDA, SCL from the RTC's similar pins. The battery's + and - are connected to the Fuel Gauge's input (JP1), and thence through JP5 to my project's PCB.

Now I see a huge current draw while sleeping, 800 mA. Whew. Confused, taking a walk. Advice welcome.

Tried that, thanks. Current draw went down from 1.027 mA to .091 mA.
Good, but still not the 3 microAmps the chip spec says it will sleep at.

If you really done what I wrote the chip will draw nothing.

Post a wiring diagram of your current setup and post the corresponding code. It seems that your project includes other parts you didn't mention yet. These can influence the power consumption. The RTC probably has internal pull-ups, together with the MAX it might draw current through the protection diodes. So we need complete documentation: schematics of your board and schematics of all external boards. Without this documentation we're just guessing and that's a waste of time.

You're right, I should, but I might sell this thing and I don't want to just give the schematic away to Chinese ripoff artists.
Your talking about this idea, right?

Your talking about this idea, right?

No. That should not happen as you turn off the gauge completely with my proposed solution. What I say is that it may consume power by the other connected pins depending on the state their in. So even without power on the Vcc pin there might be a consumption in the chip if other pins are powered during the power-off state.

You're right, I should, but I might sell this thing and I don't want to just give the schematic away to Chinese ripoff artists.

If you're building a commercial product you should buy the support from a professional.

1 Like