Skip to content

A lightweight and efficient Arduino library for the TI BQ25620 battery charger IC, optimized for nRF52840 and low-power applications.

Notifications You must be signed in to change notification settings

Knockoi/BQ25620-Library-Lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BQ25620 Arduino Library

A lightweight and efficient Arduino library for the TI BQ25620 battery charger IC, optimized for nRF52840 and low-power applications.


Features

  • I2C communication using Arduino Wire API
  • Battery voltage / system voltage / temperature monitoring
  • Charging status & fault detection
  • INT pin event interrupt support
  • OTG mode disabled by default
  • Fully configurable charge voltage (10mV step) & current (80mA step)
  • System power reset via BATFET_CTRL
  • CE pin (charge enable) control

Hardware Compatibility

  • BQ25620 (I2C address 0x6B)
  • nRF52840 (tested on Adafruit Feather nRF52840 Express)
  • Any Arduino-compatible MCU with I2C

Example

To run tests, run the following command

#include <BQ25620.h>

BQ25620 bq(Wire);

void setup() {
  Serial.begin(115200);
  bq.begin();

  // Bind CE pin to GPIO 7 — controls charging enable via GPIO logic level
  // LOW = charging enabled, HIGH = disabled
  bq.setCEPin(7);

  // Bind INT pin to GPIO 6 (optional but recommended for low-power state tracking)
  // You can also attach an external interrupt to this pin
  bq.setINTPin(6);
  bq.configureINT(true); // Unmask charger event interrupts

  // Set target charge voltage
  // Range: 3500 mV to 4800 mV (step: 10 mV)
  bq.setChargeVoltage(4200); // 4.20V (standard Li-ion full voltage)

  // Set charge current
  // Range: 80 mA to 3520 mA (step: 80 mA)
  bq.setChargeCurrent(960); // 960mA is moderate/safe for most cells
}

void loop() {
  Serial.print("VBAT: ");
  Serial.print(bq.readBatteryVoltage());
  Serial.println(" V");

  Serial.print("VSYS: ");
  Serial.print(bq.readSystemVoltage());
  Serial.println(" V");

  Serial.print("Temp: ");
  Serial.print(bq.readTemperature());
  Serial.println(" °C");

  Serial.print("CHG_V: ");
  Serial.print(bq.getChargeVoltage());
  Serial.println(" mV");

  Serial.print("CHG_I: ");
  Serial.print(bq.getChargeCurrent());
  Serial.println(" mA");

  Serial.print("CHG Status: 0x");
  Serial.println(bq.getChargeStatus(), HEX);

  Serial.print("FAULT Status: 0x");
  Serial.println(bq.getFaultStatus(), HEX);

  delay(1000);
}

About

A lightweight and efficient Arduino library for the TI BQ25620 battery charger IC, optimized for nRF52840 and low-power applications.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages