---
title: "BatteryManagement"
date: 2025-01-27
draft: false
description: "a description"
tags: ["battery", "bq34z100"]
---
# BatteryManagment
The project contains an additional companion board, with a bq34z100 battery management ic. 

It allows to track the health and charge for an external battery and is supposed to be soldered directly to the battery. 
The main board contains a xt30 connector for power, and additionally a two pin I2C bus next/combined with it, to communicate with the BatteryManagement.

# Setup
{{< alert >}}
A protected Battery is required. There is only a very simplistic output voltage adjustment for the MPPT system and no charge termination. It is expected that the battery itself protects against overcharging and deep discharges!
{{< /alert >}}
* BatteryManagement is purely optional, but recommended for solar power.
* If available it will be used for an extended low power deep sleep in case of critical charge.
* If available it will also be used, to reduce the nightlight, if the charge drops to a predefined level, so the nightlight cannot drain to much battery
* If available, all relevant battery metrics will be published via mqtt

 Currently the setup requires a custom Ev2400 flasher and the properitary windows software from texas instruments.
 {{< alert >}}
 Before soldering to the battery
{{< /alert >}}
1. The voltage devider high side must be bridged, while being connected to the computer and being supplied with around 4.2 V from the battery solder leads.
2. Then the data/register for low voltage flash write protection should be set to 0V, as else with the voltage divider and no further configuration, the IC will refuse all write requests.
3. After this the supplied golden image can be used, it will setup the battery for 6Ah and a 4S lifepo. Different values can be adjusted after this to the users liking.
{{< alert >}}
The main board, does not care or process any of the charge discharge limits that can be set. Ensure that the battery can supply enough current as well as accept a 2A charging current from the MPPT system.
{{< /alert >}}

The golden image sets the statups led up, to be in blinky mode. one very long interval means, that the battery is pretty much full. A few very short flashes mean that the battery is nearly empty. No light means, that the battery is in discharge protection and shut down.

If the red error led lights, something is wrong with the battery. This can be abnormal voltages or a very low health state.

# Todo?
If the battery reports that no discharging should occure, report this and then shutdown without using pumps