Firmware library for the MAX17043 LiPo fuel gauge IC - used on SparkFun's Photon Battery Shield.
C++
Switch branches/tags
Clone or download
Jim Lindblom
Latest commit dc16097 Jan 16, 2017
Permalink
Failed to load latest commit information.
doc Adding MAX17043 datasheet. Jun 22, 2015
firmware Fix alert bit clearing bug Jan 16, 2017
LICENSE Initial commit Jun 22, 2015
README.md Typos in README Jun 22, 2015
spark.json Fix alert bit clearing bug Jan 16, 2017

README.md

SparkFun MAX17043 Particle Library

Firmware library SparkFun's Photon Battery Shield and the MAX17043 Breakout.

About

This is a firmware library for SparkFun's Photon Battery Shield.

Photon Battery Shield.

The MAX17043 interfaces between a LiPo battery and a microcontroller. The MAX17043 can read a battery's voltage and, using a sophisticated battery-modelling algorithm, estimate the state of charge (SOC).

Repository Contents

  • /doc - Additional documentation for the user. These files are ignored by the IDE.
  • /firmware - Source files for the library (.cpp, .h).
  • /firmware/examples - Example sketches for the library (.cpp). Run these from the Particle IDE.
  • spark.json - General library properties for the Particel library manager.

Example Usage

Include the MAX17043 library:

#include "SparkFunMAX17043.h" // Include the SparkFun MAX17043 library

Then use the lipo object to interact with it. Begin by initializing the IC:

void setup()
{
	// Set up the MAX17043 LiPo fuel gauge:
	lipo.begin(); // Initialize the MAX17043 LiPo fuel gauge

	// 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(10); // Set alert threshold to 10%.
}

Then you can read the voltage and state-of-charge (SOC) values like this:

// 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();

Check out the example files in the examples directory for more guidance.

Recommended Components

License Information

This product is open source!

Please review the LICENSE.md file for license information.

If you have any questions or concerns on licensing, please contact techsupport@sparkfun.com.

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.