AN2344 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Author: Oleksandr Karpin Associated Project: Yes Associated Part Family: CY8C27x43, CY8C29x66 Software Version: PSoC® Designer™ 5.1 Associated Application Notes: AN2180, AN2314 AN2344 integrates cell-balancing and fuel gauge methods into a multi-cell battery charger. The application is designed for battery packs with two, three, or four Li-Ion or Li-Pol cells in a series. It includes dedicated PC-based software for real-time viewing and analysis of the charge, cell-balance and fuel gauge processes. The application can be used as a complete battery pack management system for notebooks, medical and industrial equipment, and other, similar applications. Contents Introduction Introduction .......................................................................1 Regulator Topologies ........................................................3 Buck Converter.............................................................3 Buck-Boost Converter ..................................................4 SEPIC...........................................................................4 Device Schematic..............................................................5 Multi-Cell Battery Charger Firmware .................................9 Conclusion ........................................................................9 Appendix A: Charge, Discharge, Cell-Balance and Fuel Gauge Profile Examples.................................................. 10 Worldwide Sales and Design Support ............................. 14 This Application Note combines the cell-balancing method, “Cell Balancing in a Multi-Cell Li-Ion/Li-Pol Battery Charger,” and the fuel gauge method, “Li-Ion/Li-Polymer Battery Charger with Fuel Gauge Function” with a multi-cell battery charger into a complete battery pack management system. This battery pack management system provides: Correct charging of two, three, or four Li-Ion or Li-Pol cells in a series with one or more cells in parallel. Protection from overcharge, deep discharge, and short circuit conditions. Temperature detection that shuts off the charging or discharging processes when battery temperature is outside the allowed temperature range. Cell balancing in the battery pack. Calculation of fuel gauge parameters including absolute capacity, state of charge, and run and charge time remaining. This Application Note also includes dedicated PC-based software developed to allow real-time viewing and analysis of the charge, cell-balance, and fuel gauge www.cypress.com Document No. 001-15223 Rev. *B 1 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Figure 1 shows the battery pack management system schematic. Figure 1. Battery Pack Management Schematic Q5 Q6 Battery Pack Management System PACK+ R4 CELL4 Q4 R3 Charger, Monitor, Safety, Fuel Gauge, Cell Balance Software Load CELL3 Q3 R2 CELL2 Q2 R1 CELL1 Q1 PSoC PACK- A safety circuit, internal to the PSoC® device, controls the back-to-back MOSFET switches, Q5 and Q6. These switches are opened to protect the pack against fault conditions such as overcharge, deep discharge, and overcurrent. The resistor, Rsense, is a current-sense resistor that is in the battery pack current path. The fuel gauge accumulates the measured current to determine the available capacity of the battery pack. The cell-balancing circuit is represented by R1 and Q1) to R4 and Q4. These transistors and resistors dissipate energy and control the amount of balancing current to provide cell balancing in the battery pack. The unique architecture of the PSoC device provides an integrated hardware solution for a multi-cell battery charger with minimal external components at a very affordable price. It also provides flexible microcontroller-based cell-balancing and fuel gauge algorithms. You can upgrade algorithms with the latest charge, cell-balance, or fuel gauge technologies with a firmware change. This system uses its own COM-based protocol for communication between the battery pack management system and the host device. You can implement the SMBus protocol in the PSoC firmware, if desired. The characteristics and software capabilities of the multi-cell Li-Ion and Li-Pol battery charger with cell-balance and fuel gauge functions are listed in Table 1. Rsense The battery back management system provides correct battery pack charge and discharge processes. The only external connections required are the external power supply connections to PACK+ and PACK-. Table 1. Specifications for Multi-Cell Li-Ion and Li-Pol Battery Charger Item Specification Battery Charger 6..25 V Power Supply Voltage Power Consumption Active Mode 30 mA 1 8 mA Sleep Mode Battery Temp. Measurement Range (Software -20..60 °C Configurable) Battery Current Measurement Error (Not Calibrated) 5% Battery Voltage Measurement Error (After 0.5% Calibration) Temperature Measurement Absolute Error 1 °C User Interface 2 Buttons and 2 State LEDs PC Communication Interface RS232 PC Communication Speed 115,200 baud Cell-Balancing Parameters 1. During charge phase Cell-Balancing Algorithms 2. During discharge phase www.cypress.com Document No. 001-15223 Rev. *B 2 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Item Specification Cell-balance circuit resistors nominal Cell-balance interval parameter Minimum balance voltage value for charge phase Cell-Balancing Configuration Parameters Minimum balance voltage value for discharge phase Minimum charge current value when cell balancing is allowed Voltage value of the middle charging state for the discharge phase Minimum Balance Voltage Value for Charge Phase Equal to the voltage measurement error value (15 mV – 30 mV) Equal to the voltage measurement error value (15 mV – 30 mV) Minimum Balance Voltage Value for Discharge Phase plus the internal impedance error (10 mV – 30 mV) Fuel Gauge Parameters Fuel Gauge Battery Capacity Monitoring Method Coulomb counter-based fuel gauge Absolute capacity (ACR) State of charge (SOC) Runtime remaining in active mode Fuel Gauge Calculation Parameters Runtime remaining in suspend mode Full-charge time remaining Rapid-charge time remaining Temperature Fuel Gauge Correction Discharge rate Cell aging (fuel gauge learning charge cycle) Fuel Gauge State of Charge (SOC) Measurement 1-3% Error 1 Note The project in this Application Note is not optimized for power consumption. This value can be greatly decreased. Regulator Topologies Buck Converter There are two basic types of power regulators: linear regulators and switching regulators. The most popular of the switching regulator topologies are: The buck converter or step-down converter can only step voltage down from a higher level to a lower level. Figure 2 shows a buck converter schematic. Figure 2. Buck Converter Schematic Buck Converter (Step-Down Converter) Q L POWER+ Boost Converter (Step-Up Converter) Cin D Cout Buck-Boost Converter Flyback Converter Battery Single-Ended Primary Inductive Converter (SEPIC) This section describes the buck, buck-boost, and SEPIC topologies because they are most frequently used in battery chargers. Advantages of the buck converter: Low complexity Disadvantages of the buck converter: www.cypress.com There is a path from the battery pack to the Power+ input through the buck switch MOSFET body diode. Therefore, an additional blocking diode in the path is needed. If the MOSFET ever shorts there is no way to limit the current into the battery. Therefore, an additional protection device (fuse) must be used. Document No. 001-15223 Rev. *B 3 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Buck-Boost Converter Buck-boost converters produce a regulated output voltage either less than or greater than the input voltage. When the input voltage is higher than the output, the converter acts as a buck. When the input is lower than the output, the converter boosts. Figure 3 shows a buck-boost converter schematic. Figure 3. Buck-Boost Converter Schematic The output stage rectifier diode is used as a reverse blocking diode. It uses only a single switch. If switch Q1 shorts, the input voltage power supply is shorted as well and the battery pack is disconnected from the external power supply (in contrast to buck and buck-boost converters). Q1 L POWER+ Cin Disadvantages of the SEPIC: D2 D1 Cout Q2 R Battery Advantages of the buck-boost converter: The input voltage can be less than or greater than the output voltage. It has higher switch/diode peak voltages and currents compared to the other topologies. Two external components, an inductor with two windings and coupling capacitor, are needed. In this application, the technical advantages of the SEPIC outweigh the disadvantages. If you need a battery charger with only step-down capability, the simple buck converter (step-down regulator) is preferred. The output stage rectifier diode is used as the reverse blocking diode. Disadvantages of the buck-boost converter: If the MOSFET ever shorts there is no way to limit the current into the battery (similar to the buck converter). Two switches and two diodes are needed so that the output power is not inverted. SEPIC The Single-Ended Primary Inductive Converter (SEPIC) uses a two-winding inductor and a coupling capacitor to store and transfer energy. Figure 4 illustrates the SEPIC schematic. Figure 4. SEPIC Schematic D2 POWER+ Cin Cout L 1 1 Cc Battery Q1 Advantages of the SEPIC: The input voltage can be less than or greater than the output voltage. It has good capacitive primary-to-secondary isolation. www.cypress.com Document No. 001-15223 Rev. *B 4 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Device Schematic This Application Note uses the device structure, battery pack parameter measurement techniques, and PSoC internal structure from, “Cell Balancing in a Multi-Cell LiIon/Li-Pol Battery Charger.” The temperature measurement technique used is the one explained in AN2314, “Thermistor-Based Temperature Measuring in Battery Packs.” Figure 5 and Figure 6 show the complete multi-cell battery charger schematic. A signal from the pulse width modulator PWM_DRIVE goes to the high-speed MOSFET driver U1. This driver chip provides MOSFET Q1 with high slew rate regulation from the low current PWM_DRIVE signal. The PWM_DRIVE switch frequency was set close to 100 kHz. When switch Q1 is turned on, the current through the inductor L1 will ramp up at a rate of Vin/L1. When the inductor L1=L2 is coupled, the current through the inductor L2 will ramp at the same rate. Therefore, the switch current Q1 is equal to the sum of the inductor currents while the switch is on. The input current in the SEPIC is continuous. When switch Q1 turns off, the path for current is from the input through the inductor L1 and the coupling capacitors (C8, C10, C12-C14) to the output. Another path for current flow exists through inductor L2 to the output. Therefore, the sum of L1 and L2 currents flow to the output. This output current also replenishes the output capacitors (C3-C6) while the switch is off. The output capacitors provide the output current flow while the switch is on. This smoothes the output current pulses from the SEPIC. The cell-balancing circuit is represented by MOSFETs Q2Q5 and balancing resistors R8, R12, R15, R20. The resistors R9, R13, R17, capacitors C15, C17, C21, and diodes D5-D7 allow a TTL signal from the PWM_BAL to control the MOSFETs Q2-Q4. The lower transistor Q5 is directly controlled by the PSoC device port; a high level turns it on, low level turns it off. The resistive network (R5, R7, R10, R11, R14, R16, R18, R19, R21, R22, R24-R27, R30) and the reference voltage Vbias from the divider on R36 and D13 changes the battery current, voltage, and temperature signals to levels that are suitable for the PSoC device. The 100 mΩ resistor R29 is a current-sense resistor that is in the battery pack current path. The multi-cell charger user interface uses two buttons, SW1 and SW2, to control some of the process and two LEDs to display internal status: www.cypress.com Green LED lit – Charge phase Yellow LED lit – Discharge phase Both LEDs lit – Error state Both LEDs off – Idle state SW1 is used to turn the device on and off. Switch SW2 is used for test purposes. Holding switch SW1 on and pressing switch SW2 allows you to choose the number of batteries connected in series in the battery pack. The result is shown on the LEDs and on the PC software. The result is also stored to the internal Flash memory of the PSoC device. Linear regulator U3 provides the processor power supply from a higher level voltage. As an alternative, you can use a regulated step-down converter from the internal switch mode pump (SMP) as shown in AN2180, “Using the PSoC Switch Mode Pump in a Step-Down Converter.” To use this device as a battery pack management system you should use a switching regulator with very little power consumption. An external voltage supply is applied to the connector J4. Switch SW3 allows the device to be disconnected from the external power supply. Two diodes in the diode array D10 allow the processor to operate during the charge phase from the external power supply and during the discharge phase from the battery pack power supply. The external load is connected to the connector J3 LOAD. The diodes D8 and D9 are used to provide an uninterruptible power supply for the LOAD connector in a manner that is similar to that of D10 for the processor. The switch on transistors Q6 and Q7 allow the power supply to be disconnected from the LOAD to protect the battery from deep discharge. This switch is optional and can be removed to reduce total device cost. Often, deep discharge protection is implemented in the batteries themselves by means of a dedicated protection IC. The board ground level is set to the external ground level POWER- before the current-sense resistor. As a result, only the charge battery pack current and the total battery pack discharge current are passed through the currentsense resistor. These are used to supplement the battery fuel gauge function in the PSoC software. The user module placement and internal connectivity of the PSoC device are shown in Figure 7. The PWM_BAL is configured on the clock source from CPU 32 kHz (internal low speed oscillator). This gives the PWM_BAL user module the ability to work during processor sleep mode. The rest of the configuration is very similar. Document No. 001-15223 Rev. *B 5 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Figure 5. Multi-Cell Battery Charger Schematic – CPU, Cell Balancing, and Measuring Equipment C1 R1 POWER+ 20 1n 50V C2 L1 L2 D2 1 1 MBR360 . . 1u 25V R4 BAT+ + C3 C4 C5 C6 2u 25V 2u 25V 1u 25V 10 22u 25V 1:1 70uH + C7 D4 U1 MOSFET driver C11 6 12V 4.7u 0.1u 3 C12 VCC 20N06HD GND R6 2 DRIVE 4 IN1 OUT1 IN2 OUT2 C8 Q1 C10 7 R5 200K 0.1% C13 5 V4 10 C14 C9 0.01u MC34152 1u 25V R7 R8 40K 0.1% 100 Vbias Q2 IRLML2502 C15 VCC U2 10n Vcc Vi1 V3 Vref J1 VCC 1 2 3 4 5 V1 1 2 P0[7] 3 P0[5] 4 P0[3] P0[1] 5 6 P2[7] 7 P2[5] 8 P2[3] P2[1] BAL2 BAL1 BAL3 Tbat 9 SMP 10 11 P1[7] 12 P1[5] 13 P1[3] P1[1] BAL4 TX CALIBRATION 14 CALIBRATOR/DEBUG BAL4 P0[6] P0[4] P0[2] P0[0] P2[6] P2[4] P2[2] P2[0] Xres P1[6] P1[4] P1[2] P1[0] 28 D5 R9 BAT54S 1M R11 200K 0.1% V3 27 26 25 24 Vi2 V4 V2 BAT_GND 23 22 21 20 C16 0.01u LED_GREEN LOAD_EN LED_YELLOW EXT_POWER R10 R12 40K 0.1% 100 Vbias Q3 IRLML2502 C17 19 18 17 16 15 SW2 DRIVE SW1 R13 J2 BAT4 D6 BAL3 1M 10n BAT3 BAT54S R14 200K 0.1% V2 BAT2 C18 0.01u Vss CY8C27443_DIP28 R16 R15 40K 0.1% 100 BAT1 GND TERMO 1 2 3 4 5 6 7 8 9 BAT_CON VCC VCC C19 25pF Y1 Vbias Q4 IRLML2502 C21 C20 25pF D7 BAL2 10n XTALin XTALout R17 1M BAT54S R19 200K 0.1% V1 32,768kHz C22 0.01u Vref R18 R20 40K 0.1% 100 Vbias Q5 IRLML2502 BAL1 R21 R22 1M 1% 1M 1% R23 1M Vi2 Vi1 R24 200K 0.1% BAT_GND C23 0.1u C24 0.01u R25 R26 200K 1% R29 200K 1% R27 40K 0.1% Vbias POWER- Tbat R30 10K 1% 100mOh 1% Vref www.cypress.com Document No. 001-15223 Rev. *B 6 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Figure 6. Multi-Cell Battery Charger Schematic – Power Supply and User Interface Q6 IRLML6402 D8 J3 1 2 POWER+ R2 LED_YELLOW R32 D9 BAT+ 470 LED LOAD 20K R3 MBR360 POWER+ R38 D1 LED_GREEN D3 470 R28 LED 20K 56K R33 Q7 BC817 LOAD_EN 330R EXT_POWER R34 R31 10K 20K POWERSW1 SW3 + J4 D11 POWER+ 1 2 + C25 SW1 C30 SW2 MBR360 100u 25V 0.1u 25V POWER 20V DC SW2 POWERVCC D10 BAT+ Close to PSoC VCC R35 U3 HT7550-1 1 IN OUT R36 3 VCC 1K 130 1W POWER+ BAT54C Vbias + C26 C27 + C28 C29 D13 22u 0.1u BAS16 C31 0.1u 100u 25V www.cypress.com 0.47u 25V Document No. 001-15223 Rev. *B 7 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Figure 7. Internal User Module Placement and Configuration www.cypress.com Document No. 001-15223 Rev. *B 8 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Multi-Cell Battery Charger Firmware Conclusion The multi-cell battery charger firmware is separated into several modules that serve distinct functions: This multi-cell Li-Ion/Li-Pol battery charger with cellbalancing and fuel gauge technology supports single cell batteries or battery packs with two, three, or four Li-Ion or Li-Pol cells in series. It allows you to use an external supply with a wide voltage range either less than or greater than the battery pack voltage. Performing measurements Regulating the battery charge process and timer functions Performing the Li-Ion or Li-Pol battery charging algorithm Checking the charge termination conditions Performing fuel gauge and cell-balance algorithms Storing calibration settings to the PSoC device Flash memory Transmitting debug data It provides dedicated PC-based software for real-time viewing and analysis of the charge, cell-balance and fuel gauge processes. The unique architecture of the PSoC device provides an integrated hardware solution for a multi-cell battery charger with flexible microcontroller-based, cell-balance and fuel gauge algorithms requiring minimal external components at a very affordable price. The device can be used as a complete battery pack management system for notebooks, medical and industrial equipment, and other, similar applications. Figure 8. Multi-Cell Battery Charger Photograph www.cypress.com Document No. 001-15223 Rev. *B 9 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Appendix A: Charge, Discharge, Cell-Balance and Fuel Gauge Profile Examples Figure 9. Charge and Discharge Manager Profile www.cypress.com Document No. 001-15223 Rev. *B 10 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Figure 10. Fuel Gauge Information Profile Learning Cycle End Empty Capacity at 16 °C www.cypress.com Document No. 001-15223 Rev. *B 11 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Figure 11. Cell-Balancing Activity Profile Battery Voltages V1,V2,V3,V4 With Charge Interrupt Imbalance Value Initial Voltage Imbalance Value Voltage Imbalance Value after First Charge/Discharge Cycle www.cypress.com Document No. 001-15223 Rev. *B 12 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Document History Document Title: Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support – AN2344 Document Number: 001-15223 Revision ECN Orig. Change of Submission Date ** 1034485 YARD_UKR 05/02/2007 *A 3285106 ANBI_UKR 06/16/2011 *B 4429522 RJVB 07/03/2014 www.cypress.com Description of Change Added new spec Updated to latest PSoC Designer. Updated document to new template. Updated template. Document No. 001-15223 Rev. *B 13 Power Management - Battery Charger with Cell-Balancing and Fuel Gauge Function Support Worldwide Sales and Design Support Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find the office closest to you, visit us at Cypress Locations. PSoC® Solutions Products Automotive cypress.com/go/automotive psoc.cypress.com/solutions Clocks & Buffers cypress.com/go/clocks PSoC 1 | PSoC 3 | PSoC 5 Interface cypress.com/go/interface Lighting & Power Control cypress.com/go/powerpsoc cypress.com/go/plc Cypress Developer Community Community | Forums | Blogs | Video | Training cypress.com/go/memory Memory Optical Navigation Sensors cypress.com/go/ons PSoC cypress.com/go/psoc Touch Sensing cypress.com/go/touch USB Controllers cypress.com/go/usb Wireless/RF cypress.com/go/wireless EZ-USB is a registered trademark and FX3 and FX2LP are trademarks of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone Fax Website : 408-943-2600 : 408-943-4730 : www.cypress.com © Cypress Semiconductor Corporation, 2007-2014. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement. www.cypress.com Document No. 001-15223 Rev. *B 14