In this article I want to show you some different ways to use the BQ24250 breakout board

The most full feature mode is to use it with a microcontroller and using the I2C communication

In the circuit you can see:

  • VBAT+ of the battery connected to the BAT+ pin of BQ24250 Breakout Board
  • VBAT- of the battery connected to the BAT- pin of BQ24250 Breakout Board
  • LOAD pin of BQ24250 Breakout Board that is the output of the battery and you can connect it to your system to supply it with the battery voltage
  • VIO pin connect to the 3V3 pin of the arduino M0, this is useful to pull up the I2C line at 3V3 voltage
  • SCL pin of BQ24250 Breakout Board directly connect to SCL pin of arduino M0
  • SDA pin of BQ24250 Breakout Board directly connect to SDA pin of arduino M0
  • A 5V power supply, that can handle at least the fast charge current that you want to use, connected to the VIN pin of the BQ24250 Breakout Board
  • and all GND tied together

With the library of BQ24250 that you can find here , you can set via I2C all of these functions:

  • Enable and disable charging
  • get the CE pin status
  • get the STAT pin status
  • set the fast charging current, with this function you are able to set the fast charge current from 500 to 2000mA however a maximum of 1500mA chrging current is recommended
  • set the maximum charge voltage of the battery, with this function you can set the maximum voltage that the battery could be reach during charging (set this voltage to a typical 4.2V is recommended and it is the default state)

These are the main and “black box” functions but you can also set or get the status of all 7 registers of the BQ24250 with these functions:

  • setRegister1, setRegister2, setRegister3, setRegister4, setRegister5, setRegister6, setRegister7
  • getRegister1, getRegister2, getRegister3, getRegister4, getRegister5, getRegister6, getRegister7

With these last 14 functions you can control and monitoring the BQ24250 in all of its features.

Here an arduino code example:

 

#include <BQ24250.h>
#include <Wire.h>
int addrBQ24250 = 106;//0x6A I2C Address
BQ24250 BQ24250obj;

void setup() {

while(!Serial);//setup Serial port for arduino M0
SerialUSB.begin(115200);

BQ24250obj.begin(addrBQ24250);

delay(3000);
}

void loop() {

for(int i=0;i<=10;i++)//charge battery from 500mA to 1A with 50mA steps every 2 seconds
{
SerialUSB.print("Charging current set to ");
int currentValue = 500 + i*50;
SerialUSB.println(currentValue);
BQ24250obj.enableCharging();
BQ24250obj.setChargingCurrent(currentValue);
delay(2000);
}
}

This code allow the breakout board to charge the battery with a starting current of 500mA to 1000mA with 50mA steps that change every 2 seconds.

Another mode to control the BQ24250 is without the I2C but usign a microcontroller to set the CE pin and reading the status (if you need) of INT and STAT pin
A typical circuit of this configuration is like this:

INT and STAT pin allow you to read the state of charging and  faults that can occur, instead with CE pin you can set the board in charging mode (logic LOW to CE pin) or in shutdown mode (Logic HIGH to CE pin).

You don’t need to connect INT and STAT pin to charge the battery but if you want to use them you must connect 3V3 to VIO pin of the breakout board to pull up their line

The fast charging current in this configuration is set by R7 that is a 249Ω resistor so the fast charging current is set to a 1A.

here an arduino code example for this configuration:

 

boolean StatPin = 0;
boolean IntPin = 0;
void setup() {

while(!Serial);
SerialUSB.begin(115200);

pinMode(2,INPUT);//INT pin
pinMode(3,INPUT);//STAT pin
pinMode(4,OUTPUT);//CE pin
delay(2000);
}

void loop() {

SerialUSB.println("disable charging");
digitalWrite(4,HIGH); //disable charging

SerialUSB.print("STAT Value: "); //read the value of STAT pin
delay(100);
StatPin = digitalRead(3);
SerialUSB.println(StatPin);


SerialUSB.print("INT Value: "); //read the value of INT pin
delay(100);
IntPin = digitalRead(2);
SerialUSB.println(IntPin);

delay(5000);
SerialUSB.println();

SerialUSB.println("enable charging");
digitalWrite(4,LOW); //enable charging

SerialUSB.print("STAT Value: "); //read the value of STAT pin
delay(100);
StatPin = digitalRead(3);
SerialUSB.println(StatPin);

SerialUSB.print("INT Value: "); //read the value of INT pin
delay(100);
IntPin = digitalRead(2);
SerialUSB.println(IntPin);

delay(5000);
SerialUSB.println();
}

The last configuration is the standalone mode:
Here you don’t need any microcontroller, the fast charging current is set to 1A thanks to R7 and as soon as you connect 5V to VIN the breakout board start to charge the battery.

Remember that you can buy BQ24250 here on my Tindie store!
Enjoy!