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

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

What You Need

In order to create the initial calibration (golden image in TI-speak), you will need to perform tests on your first board of your design. To do this, you need:

  • Your PCB with a BQ34Z100G1 on it and the battery attached to it. It will also need to have a header to access the I2C bus, a way to charge it (such that current flows through the BQ34Z100G1 when charging), and some place for you to attach a dummy load.
  • A dummy load which can discharge your battery. I recommend a power resistor attached to a metal block. The load should discharge the battery at between 1/5 C and 1/10 C.
  • A TI EV2300 or EV2400 programmer box. These are kinda expensive but you can try to find them on Ebay (especially the older EV2300) for cheaper.
  • An accurate voltmeter
  • Ideally, an accurate current meter (though this is not strictly required).

Note about C rates: 1C refers to current that would exhaust the battery's capacity in 1 hour. So, if you have a 1500mAh battery, a 1C discharge rate is 1.5A, and a 1/10 C discharge rate would be 0.15A.

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 puts you above the undervoltage lockout threshold.

Initial Configuration and Calibration

To perform initial configuration of the chip, you will need to flash the BQ34Z100G1-Utils program we created. Make sure that the changes you made to BQ34Z100G1.cpp get copied into that program's copy of that file.

  1. Run the "Test Connection to Sensor" test. This will verify that the BQ34 is correctly connected and communicating. If it fails, check that the I2C pins and address in the header are right.
  2. Run "Write Settings to Flash". This will take all the settings you wrote into the cpp file and download them to the BQ34's flash memory.
  3. Run the "Calibrate Voltage" test. This will require you to enter the voltage across the battery, and then it will set the BQ34's voltage measurement scaling to match this reading.
  4. Connect the dummy load, then run the "Calibrate Current" test. This will guess the BQ34 current scaling factor based on your sense resistor, and then refine the guess based on a real current reading. If you aren't set up to read the current from a real measurement, you can also calculate it fairly accurately if you know the battery voltage and the resistance of the load.

After these steps, if you run "Display Data", you should now see accurate voltage and current values.

Finding the Chem ID


All wikipages