Driver for Texas Instruments' battery state-of-charge estimator.

Dependents:   BQ34Z100G1-Utils BQ34Z100G1-ChemIDMeasurer

You are viewing an older revision! See the latest version

Setup and Calibration Guide

Table of Contents

  1. Code Settings

This page will walk you through the whole process of configuring and calibrating the BQ34Z100G1 fuel gauge IC.

Code Settings

The first step in getting the BQ34Z100G1 (BQ34 for short) running is to configure all of the constants in code to match your board. You'll notice this block at the top of the library cpp file:

Library configuration

//Battery configuration settings
//Stored in flash: run flashSettings() then reset sensor to save
#define DESIGNCAP 1400 //mAh, per cell (Page 48, offset 11)
#define DESIGNENERGY 5180 //mWh, per cell (Page 48, offset 14)
#define CELLCOUNT 0x04 //number of series cells (Page 65, offset 7)
#define LEDCONFIG 0x4b //5-LED Expander with I2C host comm (Page 64, offset 4)
#define VOLTSEL true //Switches to an external battery voltage divider
#define ZEROCHARGEVOLT 3375 //mV, charge cut-off voltage/Cell terminate voltages
#define FLASH_UPDATE_OK_VOLT 2800 // mV, below this voltage per cell flash writes will not go through

#define QMAX0 10000 //mAh, datasheet says to use c-rate current (max discharge current)

//The voltage divider works by this formula: Gain = (TOP LEG R/BOTTOM LEG R)*1000
//Top leg: 294Kohm and bottom leg: 16.5Kohm
//This only works if you enable the external voltage divider (VOLTSEL) option for the sensor
//Note: requires calibration after setting in flash
#define VOLTAGEGAIN 17818
#define LOADSELECT 0x01 // "Load Select defines the type of power or current model to be used to compute load-compensated capacity in the Impedance Track algorithm"
#define LOADMODE 0x00 // "Load Mode is used to select either the constant current or constant power model for the Impedance Track algorithm"
#define RESETVOLTAGE 22200 //mV, voltage to reset to after unsuccessful voltage calibration

//Sense resistor value
#define SENSE_RES 5.0f //mOhms, value of guage sense resistor

#define USE_EXTERNAL_THERMISTOR 0 // If 1, use an external thermistor connected to the IT pin.  If 0, use the internal temp sensor.

The comments should be fairly self-explanatory, but make sure that all values are configured appropriately for your application circuit.

For the LEDCONFIG value, see the "LED Display" section (7.3.13) in the BQ34 datasheet.

Care should be taken regarding the ZEROCHARGEVOLT value, especially if you are using an undervoltage protection IC that disconnects the battery if it goes below a certain voltage. When discharging, the battery needs to actually go below (ZEROCHARGEVOLT * CELLCOUNT / 1000) volts or the BQ34 won't see it as being completely discharged, so you won't be able to calibrate. So, make sure the ZEROCHARGEVOLT is above the undervoltage lockout threshold.


All wikipages