![]()
Battery Management System
(Project finished in 2015)
Description
Communication protocol
Fast charging procedure
Central unit (prototype)
Host protocol
Setup utility program for PC
Downloads
The central unit has been built using an dsPIC30F4011 DSP microcontroller. This unit uses serial port (UART1) for communicating with the battery via optocouplers as well as for communicating with external computer (e.g. PC) via same port.
As the same communication port is shared between two devices, the communication protocol with the external computer is bit more complicated...
The central unit uses LCD display (4*20 or 2*16) for displaying the status of the battery, charge progress, etc.
The first prototype has been built with the 4*20L CD display and has following features:
Display input voltage
Display output voltage
Isolated serial port for communication with the battery
Isolated serial port for communication with the external computer
Display the temperature of the power supply (7-12V) power stage
Display cell No., the voltage and the status of the cell with highest voltage
Display cell No., the voltage and the status of the cell with lowest voltage
Display the battery pack status (any cell bleeding, all cells bleeding, etc.)
Displays the PWM duty cycle of the charger
Displays time
Has integrated charger for battery with two LiPo cells, current up to 1A
Accepts input power in voltage range from 12V, up to 30V (28kHz buck converter)
Connects to external computer via isolated RS232 port, which is shared with cell modules
With this prototype are developed all programs needed for
LC display (alphanumeric display, 4 bit data bus)
Math library
Serial communication service routines
PWM service routine
Communication protocols for battery and the external computer
The firmware is written in ASM30, i.e. all software has been developed without any third party libraries and it is written directly in machine code, using ASM30 assembler.
The module accepts battery packs up to 255 cells and automatically detects the number of cells in the battery as well as it reads all calibration constants from cell modules during the init procedure.
The module uses internal R/C oscillator (~7.19MHz in PLL*16 mode, ~34ns enabling instruction cycle) and is running in interrupt mode (the microcontroller is held in idle mode while waits for an interrupt) in order to reduce energy consumption.
The prototype has connected two LiPo cells (18650) with cell
modules and polls the cells every half second (per cell) when the external power
is not present and, when charging (external power is present), it polls the
cells every 30ms per cell.
Next to do is to change polling system in such way that central module sends
commands to cells without waiting for answer, but leaving enough time to
first cell module to pass the message through.
The charging procedure is made as it is described in
Fast charging procedure, the difference is that
the charging is controlled by voltage, not current all the time.
The battery is connected through 1 Ohm resistor (on it's negative side), which
is used to measure the charging current. In moment when the external voltage is
connected, the controller records first initial voltage of battery and then
increases it in steps of 0.01V every second (this one second is initial time
constant for increasing voltage) until:
If any cell goes into high voltage alarm, the voltage is
decreased by 0.01V, the time is increased by one (e.g. from one second to two
seconds) but max to 32 seconds and charging is continued monitoring cells every
30ms per cell (total time 60ms to read both cells).
If both cells are found bleeding, same procedure as for high voltage alarm is
applied.
If one cell is found bleeding, the timer has been reset.
If no one cell is found bleeding and timer expired time constant as well as the
temperature of the power stage is below 50 deg. C, the voltage is increased
again for 0.01V.
If temperature of the power stage increases above 56 deg. C, the output voltage
is decreased for 0.01V, but the timer constant is left unchanged.
During the charging, the voltages of both cells are displayed on the display as well as the temperature of the power stage, charging current, PWM duty cycle and the input voltage (external power supply). The status of the battery is shown on the display with three characters, used to indicate presence of low alarm, high alarm and bleeding:
The central module uses same port (which is used for communication with the cells) for communication with the host computer (e.g. PC). The host communication protocol is explained here.
