Battery Chargers‎ > ‎

Basic charger

Project features

Project description and main features listing

Aim of this project is to build a battery charger and discharger capable to work also as a battery tester and characterizer, capable to measure the cell capacity, internal resistance, and several other parameters. For this purpose the "battery tester" function is performed when connected to a PC serial port using a set of programs, the charger/discharger function can be performed in stand-alone mode or under PC control.

The general instrument features are the following:
- Compact dimensions
- Very large transistors cooler for up to 300W power dissipation
- Three keys for settings, single LED for operation status
- Two independent charge/discharge profiles stored in internal EEPROM
- PC serial port connection with parameters: 9600,N,8,1
- Profile change when connected to a PC
- Low cost

Charger characteristics:
- Current setting and control from 0.1A to 5A
- Delta peak voltage for end of charge detection
- User configurable delta peak threshold setting
- Timeout period configurable
- Number of cells selectable modifying a single resistor
- Trickle charge after fast charge for no auto-discharge processes

Discharger characteristics:
- Current setting and control from 0.1A to 30A
- Cut-off cell voltage user adjustable
- Slow charge for extremely deep discharge process

The main characteristic of this project is the extreme flexibility of the internal architecture that can accomodate any charge or discharge sequence/profile under PC control. The set of programs already developed performs the following functions:

- Charge manager with graphic cell voltage visualization
- Discharge manager with graphic cell voltage visualization
- Stand alone charger/discharger parameter database manager
- Small display to follow the charge discharge process in stand alone
- Pack run time and mean voltage @30A
- Pack race simulator

The user, using the very exhaustive project documentation, can build a particular application for special purposes or can modify the microcontroller program for particular current or voltage control operations.


Schematic description

Detailed schematic description

The schematics for Basic Charger is completely based on the PIC 16F876 device. All the other components are for basic I/O functions that the charger performs during normal operations. The PIC microprocessor has a crystal of 4MHz in order to have a true calculation power of 1 MIPS. The PIC interfaces the PC serial port using a MAX232 that translate the TTL levels to true RS232 levels. The version of the MAX232 used allow the usage of 100N capacitors for charge pumps.

The power supply for PIC is a linear regulator LM7805, capable to source 1A at 5V.
The fan cooler is commanded directly from the PIC using a small power npn transistor, in order to switch on the fan only during the charge or discharge operations.
The led is wired directly to the PIC open collector output pin and the key switches uses an input port with internal pull-ups.

The "Start" key is directly connected to the reset pin of the PIC microcontroller for "break and restart" fast operation.

The wires for power supply are doubled in order to have less resistance and better performances during the charge process. This resistance is critical because using a power supply of 12V or a bit less (computer power supply) there is about 1V of difference between the maximum of the pack voltage (10.7-10.8V) and the power supply. This difference divided by the mosfet P-channel on resistance plus the cables gives the maximum charge current.
For the same reasons there is no diodes between the power supply and the charger, with the disadvantage that a battery pack connected to a not powered charger turn on the charger itself because the current flows on the body diode of the mosfet P-channel, giving a not well specified functioning. Users that have a power supply of 12.5V or higher can introduce a 10A schottky diode with the anode connected to the power supply and the catode to the charger in order to avoid this problem. A fast work around is, in any case, to connect the battery pack to a powered charger.

The charge/discharge block is built with a P-channel mosfet for the charge and the double N-channel for the discharge. The selected components mounted on a Pentium-style cooler (with fan) reaches 30A for discharge and 5-6A for charge without problems. The mosfets are directly driven by a low pass filtered PWM signal coming from the PIC. This signal is referenced to GND for N-channel driving and to power supply for P-channels driving. The voltage sense wires are differents from the power wires in order to avoid the problem of the variable offset depending from the charge/discharge current.
The feedback for current and voltage are directly taken from a current to voltage (hall sensor based) converter and from a simple resistive partitor. This partitor has a relatively high output resistance and the value must be taken into account in the settling time of battery signal conversion inside the PIC processor. The current to voltage converter has a zero-current output of about 2.5V and swings 0.6V around this point for currents flowing inside the sensor in the two opposite directions.


Firmware description

PIC microcontroller firmware description

The PIC microcontroller program is written in assembler using the Parallax-like macro (included in the package). The program structure is quite simple because it is based on a periodic interrupt with 5msec period. This basic tic allow the processor to sample the two analog inputs (voltage and current) that are read in a 15-bit format at each tic. The processor works on a cycle time of 100 msec. In this cycle the first 16 (5 msec * 16 = 80 msec) slots are for analog reading and for low noise signals conditioning. After this phase, when the cycle is at 80 msec, the serial parameters are sent out. After 2 slots, at 95msec from the start of the cycle, the processor executes the finite state machine for the local management (if enabled).

The charge/discharge state machine has a simmetrical functioning, because there are the same states for charging or discharging the batteries:

Charge/discharge state machine

State 0: in this state the zero current output is sampled in order to minimize the offset errors, and the target current for fast charging or discharging is calculated recalling the value from the table with the enabled profile. The machine goes to the state 1 after about 20 seconds.
State 1: In this state the machine enables the fast (high current charge or discharge) checking at each cycle if the phase is finished. The machine goes to the next state if: (in charge) the timeout period has expired or the delta voltage from the peak has been reached or (in discharge) the cut-off voltage is above the actual pack voltage.
State 2: The state 2 is the battery recovery, with a small pause for battery cooling and at the same time a re-zero sampling for the zero current and calculation for slow current charging/discharging.
State 3: The state 3 is completely equivalent to the state 1 but with a different (lower) target current .
State 4: The state 4 is the finish of the charging or discharging, with a small final cooling, then a pause for next start.

Program initialization

The program when starts reads the switches status for next operation scheduling and recall from the EEPROM memory the right charge/discharge profile.The profiles if the EEPROM was not yet written are entered and saved at the right places. The two PWMs (for charge and discharge) are enabled. The serial port is initialized for 9600,N,8,1 operations.

Remote control management

In this mode the charger is completely slave of the host computer that sends all the operative commands and reads the values for batteries current and voltage. The charger in this case is only an output peripheral for the serial commands. The commands are received, decoded, checked for consistency and enabled directly in the interrupt routine: the command lets the user to control all the charger functions from the mosfet driving to the led state.


Project building

Building notes and mounting tips

The project building does not present particular difficulties. The PCB is a single layer that can be realized with the "homemade" techniques. Particular care has to be taken printing the master on a transparent paper: the "adapt to the paper size" or any resizing functions for the master must be avoided.

The board mounting must start from the wires, resistors, capacitors and ic sockets. The power mosfets are mounted on the bottom side of the PCB, with the top face very near to the PCB copper layer. Only the hole on PCB allows the user to mount the transistors on the cooler.
The tracks for very high currents must be well sized with sn-pb plating. The wire that enters in the current to voltage converter must be at least 2.5sqmm. All the wires from/to power supply and from/to battery must have at leat a copper area of 2.5sqmm and the terminal with a banana plug of 4mm with a current rating of 32A.

The connectors with multiple pins have the pin number one with a square pad. The ICs sockets have to be depopulated for the pins that have no hole on the PCB area.

The serial port should be connected to a DEM9P connector (D type connector exactly equal to the one present on the PC rear side) and for this the TX wire should be connected to the pin number 3, the RX pin to pin 2 and GND to pin 5. With this pin assignment the PC connection is done using a 3-wire, 2 and 3 pins twisted, serial cable.

Note that the cooler is connected to the P-channel and N-channel mosfet drain pin, with a good effect on the interconnection resistance, but with the disadvantage of a cooler potential equal to the battery pack.



ċ
BCH_Battery_charge_sw.zip
(324k)
Oloap,
Nov 5, 2013, 1:02 PM
ċ
BCH_Battery_discharge_sw.zip
(323k)
Oloap,
Nov 5, 2013, 1:02 PM
ċ
BCH_Set_parameters_sw.zip
(199k)
Oloap,
Nov 5, 2013, 1:03 PM
Ċ
Oloap,
Nov 5, 2013, 1:02 PM
Ċ
Oloap,
Nov 5, 2013, 1:02 PM
ċ
BCH_material_list.txt
(4k)
Oloap,
Nov 5, 2013, 1:02 PM
ċ
BCH_monitor_sw.zip
(310k)
Oloap,
Nov 5, 2013, 1:02 PM
Ċ
Oloap,
Nov 5, 2013, 1:02 PM
ċ
BCH_pic.zip
(16k)
Oloap,
Nov 5, 2013, 1:02 PM
Ċ
Oloap,
Nov 5, 2013, 1:02 PM
Ċ
Oloap,
Nov 5, 2013, 1:03 PM
Comments