* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Multi-Cell Lithium Ion Battery Management System
Power engineering wikipedia , lookup
Electrical ballast wikipedia , lookup
Three-phase electric power wikipedia , lookup
Immunity-aware programming wikipedia , lookup
Electrical substation wikipedia , lookup
Power inverter wikipedia , lookup
Variable-frequency drive wikipedia , lookup
History of electric power transmission wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Current source wikipedia , lookup
Electric battery wikipedia , lookup
Integrating ADC wikipedia , lookup
Distribution management system wikipedia , lookup
Surge protector wikipedia , lookup
Schmitt trigger wikipedia , lookup
Stray voltage wikipedia , lookup
Pulse-width modulation wikipedia , lookup
Power MOSFET wikipedia , lookup
Voltage regulator wikipedia , lookup
Rechargeable battery wikipedia , lookup
Power electronics wikipedia , lookup
Voltage optimisation wikipedia , lookup
Alternating current wikipedia , lookup
Current mirror wikipedia , lookup
Opto-isolator wikipedia , lookup
Switched-mode power supply wikipedia , lookup
2011 Multi-Cell Lithium Ion Battery Management System -For Electric Vehicles Final Report Iowa State University Team: Sdmay11-04 Pramit Tamrakar Jimmy Skadal Matthew Schulte Hao Wang William Zimmerman 4/28/2011 Table of Contents Definitions..................................................................................................................................................... 6 Executive Summary ...................................................................................................................................... 7 Acknowledgement ........................................................................................................................................ 8 Statement and Approach ............................................................................................................................... 8 Problem Statement .................................................................................................................................... 8 Solution Approach .................................................................................................................................... 8 Operating Environment ................................................................................................................................. 9 Intended Users and Intended Uses ................................................................................................................ 9 Intended Users .......................................................................................................................................... 9 Intended Uses ............................................................................................................................................ 9 Assumptions and Limitations ..................................................................................................................... 10 Assumptions............................................................................................................................................ 10 Limitations .............................................................................................................................................. 10 Expected End Product ................................................................................................................................. 10 System Design Approach ............................................................................................................................ 11 Functional Requirements ........................................................................................................................ 11 Non Functional Requirements ................................................................................................................ 11 Market Alternatives ................................................................................................................................ 12 Proposed Approach and statement of work ................................................................................................ 13 Proposed Approach ................................................................................................................................. 13 Constraints considerations .................................................................................................................. 13 Technology Consideration .................................................................................................................. 13 Comparison of two similar integrated circuits from Texas Instruments: ............................................ 16 Detailed Design ........................................................................................................................................... 17 Boost Converter .......................................................................................................................................... 17 Boost Converter Control ......................................................................................................................... 19 Implementation and Testing: Boost Converter ....................................................................................... 20 Testing of the Boost Converter ............................................................................................................... 21 Boost Converter Test Results.................................................................................................................. 22 Boost converter Usage ............................................................................................................................ 25 Battery Management System ...................................................................................................................... 26 Cell monitoring and regulating ............................................................................................................... 26 Page | 1 Technical Approach ................................................................................................................................ 26 Implementation and Testing for the BMS: bq76PL536EVM-3 ................................................................. 27 Implementation of multiple EVM Stacking ............................................................................................ 29 Testing of the bq76PL536EVM-3........................................................................................................... 30 DC Power Supply - EVM Test ........................................................................................................... 30 DC Power Supply – EVM Test Results .............................................................................................. 30 EVM Stack Testing ............................................................................................................................. 31 EVM Stacking Test Results ................................................................................................................ 31 Implementation and Testing of Complete System ...................................................................................... 32 Complete System Test – Charging Cycle ............................................................................................... 32 TI analog design contest ............................................................................................................................. 33 MSP430G2231........................................................................................................................................ 33 MSP430F5529 ........................................................................................................................................ 33 bq76PL536EVM-3 .................................................................................................................................. 33 UCC27322 MOSFET driver ................................................................................................................... 33 OPA335 .................................................................................................................................................. 33 Security Consideration ................................................................................................................................ 34 Safety Consideration ................................................................................................................................... 34 Intellectual Property Consideration ............................................................................................................ 34 Commercialization considerations .............................................................................................................. 34 Possible risks and risk management............................................................................................................ 35 Schedule ...................................................................................................................................................... 36 Hardware/Software Statement of work ....................................................................................................... 37 Resources .................................................................................................................................................... 38 Future Work ................................................................................................................................................ 39 Closing Summary........................................................................................................................................ 39 Project Team Information ........................................................................................................................... 40 Client’s Information ................................................................................................................................ 40 Faculty advisor Information .................................................................................................................... 40 Student Team Information ...................................................................................................................... 40 References ................................................................................................................................................... 41 Appendix A ................................................................................................................................................. 43 Appendix B ................................................................................................................................................. 44 Page | 2 Appendix C ................................................................................................................................................. 57 Appendix D ................................................................................................................................................. 61 Appendix E ................................................................................................................................................. 63 Appendix F.................................................................................................................................................. 68 Appendix G ................................................................................................................................................. 70 Operational Manual by 491 Team .......................................................................................................... 70 Appendix F.................................................................................................................................................. 72 Constant current test code ....................................................................................................................... 72 Appendix G ................................................................................................................................................. 74 Constant voltage test code ...................................................................................................................... 74 Appendix H ................................................................................................................................................. 76 Full system code ..................................................................................................................................... 76 Appendix I .................................................................................................................................................. 81 3.3V Regulated source from 12V ........................................................................................................... 81 Page | 3 Table of Figures Figure 1: The NLG503-light battery charger. 1.6 kW 200-540V, $2,145 (Brusa) ........................................ 12 Figure 2: Hardware Functional Block Diagram .......................................................................................... 14 Figure 3: Large scale system diagram ......................................................................................................... 14 Figure 4: Small Scale system diagram ......................................................................................................... 15 Figure 5: Software Functional Block Diagram ............................................................................................. 15 Figure 6: The series scalability of the bq76pl536 ........................................................................................ 16 Figure 7: Boost Converter Schematic .......................................................................................................... 17 Figure 8: Boost Converter Specification ...................................................................................................... 18 Figure 9: Boost Converter Bill of Materials ................................................................................................. 20 Figure 10: Boost Converter Test Stages ...................................................................................................... 21 Figure 11: 27 V Input for the Boost Converter ............................................................................................ 21 Figure 12: Boost Converter Test Setup ........................................................................................................ 22 Figure 13: Test 3 output at 61% duty cycle ................................................................................................. 22 Figure 14: Average efficiency over the range of inputs is 87% ................................................................... 23 Figure 15: Test 1 output voltage with various loads ................................................................................... 23 Figure 16: Output voltage vs. PWM duty cycle for Test 4 ........................................................................... 23 Figure 17: Schematic for current sense circuit ........................................................................................... 24 Figure 18: Output voltage from a Current Sense Circuit ............................................................................. 24 Figure 19: Output voltage from a voltage sense circuit.............................................................................. 25 Figure 20: Connection between Bq76PL536EVM-3, computer, cells and adaptor ..................................... 26 Figure 21: Main Window for the Evaluation software ................................................................................ 27 Figure 22: Plot View of Cell Information within Evaluation software ......................................................... 28 Figure 23: (a & b) The Stacked EVMs .......................................................................................................... 29 Figure 24: (a & b) Resistor changes for EVM Stacking ................................................................................ 29 Figure25(a): Bq76PL536EVM-3 DC Supply Testing setup with computer display ....................................... 30 Page | 4 Figure26(b): A closer view of the DC Supply connections ........................................................................... 30 Figure 27: A close up view of voltage information displayed for device 1 .................................................. 30 Figure 28: EVM Stacking Test setup while connected to Li-Ion cells ........................................................... 31 Figure 29 : EVM Stacking Test Results Display ............................................................................................ 31 Figure 30: Screen Print of a short full stack charge test ............................................................................. 32 Figure 31: Various components require a 3.3V source, and the LM317 voltage regulator is used from the input 12V source ......................................................................................................................................... 81 Page | 5 Definitions Terms EV DC AC Fuel gauge Power Converter Feedback Overcharging BMS PWM Constant Current Constant Voltage Thermal Runaway Fast Charge SPI SMBus Level 1 Charging Definition Electric Vehicle Direct current Alternating current Device to measure overall status of the battery A Device for stepping up or down the voltage Used stabilize the signal of the output of the device Continuing to charge a fully charged battery Warning! Overcharging could lead to overheating which could cause explosion, damage, or shortened life of the cell. Battery Management System Pulse Width Modulation The current is held a specific value(C = 3A) until a the adequate voltage is achieved The voltage is held at specific value (3.6V) until the cell is fully charged (current is 0.1C) Overheating of cell in relation to overcharging A condition where 10A is used to charge the cell in 15 minutes Serial Peripheral Interface - bus for device communication System Management Bus This is an industry standard Bus protocol Ac energy to the vehicle’s onboard charger from a typical 120V outlet. 120Vac; 16A (1.8kW) Page | 6 Executive Summary Electric vehicles are one of the cleanest, most efficient, and most cost effective form of transportation. The market demand for electric vehicles has increased ever since the Toyota Prius was introduced as an alternative to traditional oil vehicles. (Wired) Other vehicle manufacturers are now introducing full electric vehicles, including Tesla Motors, Nissan, and Ford. A major complication in developing an electric vehicle is the battery management system. This project’s goal is to find an efficient and safe way to charge and monitor multi-cell series lithium ion batteries for an electric vehicle using AC to DC converters and monitoring microcontrollers The approach to accomplish this task is twofold: develop a charging system and develop a battery management system. In order to focus more on the battery management system, and to prevent from electric shock due to high voltage, we are scaling down the power supply from using a 120V AC outlet to four series connected DC power supplies that will output 65 VDC and up to 3 Amp for the system. This is an agreement with our faculty advisor and the client. Therefore, when we have to bring the system to a large scale it will be just the matter of building up from smaller abstract systems. When planning for the high voltage, full scale system (90 Series cells in 18 parallel packs) the most efficient way to transform the 120VAC from the wall outlet to the needed 324VDC will be by using a line filter, full-wave rectifier, AC-DC power Correction boost pre-regulator and a DC-DC boost converter. With the full scale system needing high voltage poses some difficult roadblocks, the focus will thus be directed at developing the battery management system for the small scale system (18 series cells). This system will monitor the charge of each individual cell in order to prevent the batteries from overheating, overcharging, or over discharging. The result of over-heating, over-charging, or over-discharging can include loss of cell functionality, fire, or even explosion. The approach used to handle this major problem is to use a battery management system (bq76PL536EVM-3) to monitor the charge of the batteries while monitoring the temperature of the cells. The system will keep track of how much power is remaining in the batteries, sending the information to a PC for displaying, and from there the PC will send needed information to the MSP430 to adjust the voltage to the battery pack. The expected functionality of the design is to efficiently and safely charge multi-cell lithium ion batteries. It will charge the 18 series lithium ion batteries while checking for overcharging and overheating. The system will continue to monitor cells and will automatically turn off supply voltage when charge is complete. Page | 7 Acknowledgement We would like to acknowledge the client for this project, Adan Cervantes, from Element 1 Systems. He will be giving us direction, feedback, and guidance throughout the process of this project. He will also be contributing the vehicle to be tested, the bank of lithium ion batteries, the engine controller, and the engine. Adan will also provide financial aid for this project. Secondly, we would like to acknowledge our faculty advisor, Professor Ayman Fayed for giving valuable guidance and advice in order to achieve the goals of our project. Statement and Approach Problem Statement To develop an efficient, safe and scalable system for charging and monitoring multi-cell series battery pack for electric vehicles. The system will use switching mode power supply and a battery management system. The initial scope of this project was to charge the bank of lithium-ion batteries to 324 VDC supplied from a 120 VAC wall outlet. In order to focus more on the battery management system of this project, we are scaling down the power supply to 65 VDC, and developing a battery management system for 18 series cells that can later be scaled to 90 series cells. Solution Approach The first objective of this project is to develop the battery management system for a small scale battery pack (18 series cells). Several integrated circuits are offered from Texas Instruments to provide battery monitoring for battery packs with a large number of cells. The bq76pl536 is used specifically to monitor the state of charge and battery status of packs with many series cells. The information obtained from the bq76pl536 integrated circuits is then used to control a switching mode power supply that follows the charging algorithm necessary for safe and efficient lithium ion battery charging. The system will keep track of remaining batteries power and send information to a PC where it will be displayed while being sent to the MSP430 to adjust the voltage to the battery pack. Page | 8 Operating Environment The final product must operate in various conditions. It needs to handle dusty conditions, due to sitting in garages or driving down a gravel road. It will also need to be able to withstand typical summer and winter temperatures. The batteries and controllers will be shielded from the rain and wet conditions to prevent short circuits. The circuits and batteries will never be thrown or dropped since they will be semi-permanently fixed in the vehicle, but they will have to withstand shocks from the road. However, the scaled down version is just a proof of concept. It only must operate in optimal laboratory conditions. The system will have to be made more rugged after further development. Intended Users and Intended Uses Intended Users The users of the final design will be the vehicle owners, family members, friends, etc. They could range anywhere between 14 to 100 years old and could be of any sex. As long as they can pick up an extension cord and plug it into the outlet and to the vehicle, anyone could use this project. However, since this project is only a scaled down version of the prototype the intended user is the client, Element 1 Systems. However, the final user of the scaled down version will be the team that works to further develop the project. It will be assumed that the next team will also work in optimal laboratory conditions. Intended Uses The intended use of the project is to charge a bank of lithium ion batteries and manage their charge and discharge cycles. The high voltage supply is designed to operate as a constant-current constant-voltage lithium ion battery supply, and only for the specified A123 battery chemistry. Page | 9 Assumptions and Limitations Assumptions The user has access to a suitable 200W DC power supply, or will build one in the future. The batteries are provided by the client and suitable analogs for the larger batteries that will be used in the final implementation. The components in the design are expandable to handle more than rated power. This is only a small scale prototype. The client, or a future team, is responsible for integration into the final system. Limitations High voltage control. A suitable 200W DC power supply. Safety: In order to develop a scalable abstract system, only 18 cells in series will be used in our design, rather than all 90 in series and 18 in parallel. The developed solution will be scalable in order to handle more series cells in the future. Parts availability. Expected End Product The expected finished product will consist of the scaled down version of the original project, with the associated documentation, design, construction plans, and software necessary to complete the finalized product. The completed product will be delivered to Adan Cervantes from Element 1 Systems in May 2011. Page | 10 System Design Approach Functional Requirements The project goal is for the charger module to charge a battery bank with 16 parallel branches, with each branch having 90 series cells. Our initial design will be limited to 18 series cells to ensure system functionality and scalability. A switching mode power supply will convert the input wall outlet power from 120Vac up to 324dc (or three phase DC power supply with 27 V input up to a 65 VDC output for the scaled down version). The charging and discharging of these cells will be monitored with a battery management system to prevent overcharge, over discharge, and over temperature situations. With proper implementation of the charging cycle, the cells should be able to reach full charge in about 45 minutes. The goal for this project is to provide a system that is capable of charging a stack of cells within this amount of time. See the Constraint Consideration section for details on charging time for large scale system. The main areas that this system will be focusing on are the following: Constant-Current Constant-Voltage charging procedure Battery Gauging Temperature Monitoring Overcharge Protection Non Functional Requirements The scaled down prototype should be usable by our client during the development of the scaled up version. The system should be reliable, even in the condition of a fault. System maintenance should be straightforward. Price should be as low as possible to ensure the product is a competitive market alternative. The system should be robust and long-lasting. Total weight should be kept to a minimum. The system should be using the most efficient methods available. The end product should be designed to ensure safety and prevent the user from coming into contact with high voltages and currents. Page | 11 Market Alternatives Since only a handful of electric vehicles have been successfully implemented on a large scale, there are few existing commercial solutions. As for the switching mode power supply the only commercially available solution designed specifically for electric vehicles is offered by Brusa. The NLG5 is a battery charger that provides a high voltage power source from a 120V or 240V wall outlet. The only problem with using a Brusa battery charger is cost; their simplest charger costs over $2,000. (Brusa) Figure 1: The NLG503-light battery charger. 1.6 kW 200-540V, $2,145 (Brusa) As for battery management systems, even Brusa is still developing a commercial solution. Thus, there are no market alternatives to building a custom BMS. (Brusa) Page | 12 Proposed Approach and statement of work Proposed Approach Constraints considerations Lithium ion batteries require a protection system to maintain safe voltage and current levels. They may suffer thermal runaway and cell rupture if overheated or overcharged. Furthermore, over-discharge can irreversibly damage a battery. To reduce these risks, we have to design a circuit that shuts down when the lithium ion cells vary outside the safe range of 2V – 3.6 V. The amount of power a typical 120V wall outlet in the United States can provide is limited to about 1.8 kW, which is defined to be level 1 charging. (Electric) This will constrain our charging time, as the battery will typically only be able to draw 1.8 kW. Since our battery pack holds about 11 kW-hr, the minimum charging time will be about 6 hours. Technology Consideration An MSP430 will be used to control the charging process in three stages; As demonstrated in Appendix A: Slow charge: Pre- charging stage using current of 0.1C (where C is 3A). Constant-current charging stage: Using current of 1C. Constant voltage charging stage: Maintaining the nominal max battery voltage until the minimum current is supplied, which is 0.1C As shown in Figure 2, on the next page, the microcontroller is used to control the boost converter by increasing or decreasing the voltage to maintain the current during the slow charge and constant current charging stages. It will then maintain a constant voltage during the constant voltage charging stage. Page | 13 Figure 2: Hardware Functional Block Diagram Figure 3: Large scale system diagram Page | 14 Figure 4: Small Scale system diagram The microcontroller software will be implemented according to the software functional diagram in Figure 5 using either C language. Figure 5: Software Functional Block Diagram Page | 15 Comparison of two similar integrated circuits from Texas Instruments: bq78PL114 According to the TI data sheet slua495 for the bq78PL114 “The minimum number of parallel cells is 1. The maximum number of parallel cells is limited by the system capacity which is a16-bit unsigned integer.” This data sheet only refers to parallel configurations of the bq78PL114. Nowhere does it talk about an implementation of a series configuration. The bq78PL114 with the bq76PL102 allow for charging 12 series cells alone. The ability to charge more than 12 cells with this design may be possible, but very difficult to achieve. With no SMBus built into this IC, a series configuration of more than 12 cells may be very difficult to implement. Also TI would have to write a custom TMAP file for each bq78PL114 to assign an address for SMBus compatibility. The bq78PL114 requires communication with a computer using the .Net communication protocol, which we would we have to use to simulate the bq78PL114 API on a microcontroller. With these many requirement and setbacks, we looked to find a more suitable IC that would supply features more suitable for the design. (BQ78PL114) bq76PL536 After running into many issues with the bq78PL114 design we decided on the bq76PL536 to give us the needed features that the previous configuration did not. According to the TI data sheet, “The bq76PL536 can be stacked vertically to monitor up to 192 cells without additional isolation components between ICs. A high-speed serial peripheral interface (SPI) bus operates between each bq76PL536 to provide reliable communications through a high-voltage battery cell stack.” This device can run at a continuous 36 V Peak with respect to the voltage of the bottom most cells in the series. Charging 6 cells at 3.6 V the voltage required is 21.6 V, and so the bq76PL536 can handle the capacity of our supplied cells. With the ability to connect up to 192 cells in series, the bq76PL536 is the perfect choice for this project. Also another advantage to using the bq76PL536 is that there is already a SMBus built in to this IC which will allow easy communication of series configurations. With the bq76PL536 hooked up in series one Host interface is required to communicate with the system which is a lot easier than the previous design. (Battery) Figure 6: The series scalability of the bq76pl536 Page | 16 Detailed Design Boost Converter The battery pack must be charged from a lower 120V source to 324V. This requires a step-up voltage converter, and our design uses a boost converter switching mode power supply. A switching mode power supply is a high frequency device capable of controlling charge through ideally lossless inductors and capacitors. In the case of a boost converter a transistor is turned on by a high frequency duty cycle which shorts an inductor to ground. The inductor stores charge until the transistor turns off. The charge then has a path through a diode to an output capacitor where it is stored for some output load. The ideal relationship between input and output voltage according to the control duty cycle is This shows that output voltage is always larger than input voltage. In reality the output diode has a voltage drop and parts exhibit losses, but the step-up function remains. Figure 7: Boost Converter Schematic Page | 17 For the scaled down demo version of 18 cells we require the output voltage to be between 28.8V and 64.8V, which are the minimum and maximum voltages of the 18 series batteries. Thus we will simulate the converter with a 27V input from a 3-phase power supply provided by Iowa State University. Given: Input Voltage Vin 27V Maximum Output Voltage Vout 70V Frequency / Period Ts 100kHz/10us Maximum Output Current Iout 3A Minimum Output Current Imin 0.3A Ripple Current, Vripple=Iripple*Rbat 0.05A Rbat 8 mOhm/battery Number of batteries 18 Find: Max Duty Cycle Dmax= 1-Vin/Vout 61.4% Inductor L=Vin*Ts/(2*Imin)*Dmax*(1-Dmax) 106 uH Output capacitance Cap >Iout/(Vripple*Rbat*#bat) 4166.67uF Max Diode current @ Duty cycle=0 3A Figure 8: Boost Converter Specification Equations from http://focus.ti.com/download/trng/docs/seminar/Topic_3_Lynch.pdf The inductor value is calculated at the boundary of discontinuous current mode and continuous current mode operation. In continuous current mode the current through the inductor never falls to zero which occurs if the output load is continuously high. If the output load becomes small enough the boost converter enters discontinuous current mode and the transfer characteristics of the circuit change. In order to avoid operating in discontinuous current mode the inductor is chosen to be higher than this calculated inductor value. This circuit uses three 100uH toroidal magnet-core inductors in series, although functionality is the same with at least one 106uH inductor at appropriate peak currents. Page | 18 The peak current in the inductor at maximum output load is the maximum input voltage divided by the inductor value and the time that the transistor is open. Using 300uH the peak current is 1.45 A. Knowing that the system will output about 200W at 70V/3A, the input power will need to be max output power multiplied by efficiency. Using a conservative efficiency of 70% maximum input power is 267W. At 27V this means the input current is 267W/27V =9.88A. Inductors rated at 17A Ipk were chosen to ensure they stay within the core saturation limit. If they were to exceed this limit the part would function like an air core inductor, greatly affecting the value of the inductance and the transfer function of the circuit. The MOSFETs provided by the previous team were used as the switching device. It is a TK20A60U, which has maximum ratings of 20A drain current and 600V drain source voltage. In order to achieve maximum efficiency and drain current, a gate voltage of 12V is used. Since the MSP430 microcontroller provides the PWM at 3.3V, a level shifting MOSFET driver is used. The UCC27322 low side power MOSFET driver from Texas Instruments was chosen because it can handle the large currents (up to 9A) that the transistor gate charge (27nC) will draw at 20ns rise and fall times. It also has an enable input, which is useful for achieving low power draw when the system is off. Other drivers were considered, but few had the capability to be driven directly by a low voltage microcontroller without level shifting. Boost Converter Control and the MSP430 Voltage and current feedback are used with an MSP430 microcontroller to control the charging cycle. The voltage feedback is achieved using a voltage divider. The output voltage was designed to be in the range of the MSP430 0V-3.3V ADC input. The current feedback is achieved using a low side current sense resistor and an OPA335 op amp from Texas Instruments. The op amp is operated in a non-inverting feedback loop and amplifies the input signal to a wider range for the MSP430 0V-3.3V ADC input. The MSP430G series microcontroller is used to isolate the boost converter and the MSP430F series MCU used in the battery management system. The MSP430G turns on with an input voltage, measures the battery voltage and current, avoids operation when the MSP430F detects a fault in the batteries, and charges the batteries using the constant-current constant-voltage method. The MSP430F can be used for cell balancing if a PC interface in undesired. The communication with the Aardvark interface allows for active cell balancing. These two options for cell balancing will need to be decided upon by the client and future senior design teams. For complete implementation and testing code for the MSP430G please refer to the Appendix F, G, and H. Page | 19 Implementation and Testing: Boost Converter The parts for the boost converter circuit were obtained and assembled piecewise on a 6 inch breakout board. The parts list is provided below: Part Name Description N-Channel MOSFET TK20A60U INDUCTOR TOROID PWR Inductor 100UH 17.6A 100uH PROTOBOARD 8PIN SOIC 8PIN SIP Protoboard UCC27322 CAPACITOR 1500UF 100V ELECT TSUP DIODE SCHOTTKY 100V 10A TO220AC LAUNCHPAD DEV BRD FOR MSP430G2XX C BOARD FR4 1-SIDE PPH 6.0X6.0 MOSFET driver Digikey part number TK20A60 UQM-ND Qua ntity Additional information Non-stock at Digikey, not 1 recommended for future builds 513-1721ND A single inductor can be used 3 instead (over 106uH) 9082CAND 29613673-5ND Used to prototype the UCC2733 1 and the OPA335 1 Output Capacitor P6991-ND Limits the converter output range to under 100V, use a different 3 product for increased voltages Diode MBR1010 0GOS-ND Low voltage drop, fast switching, 1 limited to 100V Microcontrol ler 29627570-ND Very cheap microcontroller 1 development, limited code size V2012-ND Prototype board to hold the 1 components Perf board Figure 9: Boost Converter Bill of Materials Wire used to connect high power components and to power sources is 12 gauge insulated copper wire. Wire used to connect the low current data lines can be just about any gauge, although insulated wire is preferred to avoid short circuits. Page | 20 Testing of the Boost Converter Testing is performed in stages: Test 1 Test 2 Test 3 Test 4 Test 5 Test 6 Test 7 Test 8 Low Power MOSFET driver Low Power, High voltage High Power MSP430G inputs MSP430G outputs High Power battery output High power, battery output, MCU control Testing just the boost converter circuit (transistor, diode, inductor, and output capacitor) with a signal generator and a 30W 6V input supply. Functionality of the MOSFET driver is confirmed separately from the boost converter circuit. Testing the boost converter and the MOSFET driver with a high power supply at high input voltages (12-27V) and high loads to limit system current. A function generator provides the PWM at 100kHz Testing the boost converter and the MOSFET driver with a high power supply at high voltage (27V) and low loads to simulate maximum output current. A function generator provides the PWM at 100kHz The voltage and current sensing circuits are verified and sampled with the microcontroller. Control of the PWM output is verified using a scope and the microcontroller inputs. Testing the boost converter at high power manually with a function generator and a battery output. The final demonstration of system functionality with constant current and constant voltage charge control. Figure 10: Boost Converter Test Stages Figure 11 below shows the usage of the boost converter with a 27V input from a 3-phase power supply. Page | 21 Figure 11: 27 V Input for the Boost Converter Boost Converter Test Results The figures below shows the succesful testing of the boost converter. Figure 12(left) shows the testing set up of the boost converter with a high power supply at 27 V and low loads to simulate the maximum current output. Then figure 13 (below) shows the output of the boost converter at 61 % duty cycle and 27 V input giving 65.636 V DC with a 25 ohms load. Figure 12: Boost Converter Test Setup Figure 13: Test 3 output at 61% duty cycle The graphs in the next page shows the successful test results and efficiency of the boost converter for Test 1 at low voltage, low current and Test 4 at high power, high voltage/current with various loads. For Test 1 we received an output of 6-15 volts at 0.01 to 0.5 A at about 80 % duty cycle depending on the load. And at the high power we successfully received an output voltage of 65.5 V at 3.3 A which is also shown in figure 13. In figure 15, it demonstrates the output voltages that we received using 23 ohms and 50 ohms at high power test simulation. Also we received an efficiency of about 87% in our high power test. Page | 22 Efficiency [%] Boost Converter Efficiency 120.00% 100.00% 80.00% 60.00% 40.00% 20.00% 0.00% Load (23 Ohms) Load (55 Ohms) 1 5 10 15 20 25 30 35 40 45 50 55 60 65 PWM input [% duty cycle] Figure 14: Average efficiency over the range of inputs is 87% Boost Output at Varying Loads Vo [V] 20 Vout [V]:21 Ohm 15 10 Vout [V]: 50 Ohm 5 0 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 PWM [%/100] Vout [V]: 85 Ohm Figure 15: Test 1 output voltage with various loads SMPS Output Voltage Output Voltage [V] 80 60 40 Output V[23 Ohm] 20 Output V [50 Ohm] 0 1 5 10 15 20 25 30 35 40 45 50 55 60 65 PWM duty cycle [%] Figure 16: Output voltage vs. PWM duty cycle for Test 4 Page | 23 Figure 18 below shows the successful output from a current sense resistor. We received an output voltage raging from 0.1 V to 3.3 V when a varying current from 0.09 A to 3.44 A was applied to the current sense circuit. The observed resistance was 0.1 ohms. Figure 17: Schematic for current sense circuit Constant Current Control 3.00 y = 0.0102x + 0.0039 Load Current [A] 2.50 2.00 Constant Current Control 1.50 1.00 Linear (Constant Current Control) 0.50 0.00 0.00 100.00 200.00 300.00 MSP 430 ADC value (10 bit 0-1023) Figure 18: Output voltage from a Current Sense Circuit Page | 24 The voltage sense circuit was a voltage divider made from a 100kOhm potentiometer. Its transfer characteristics with the MSP430 can be seen in Figure 19. Constant Voltage Control 80 y = 0.2853x + 0.0403 Load Voltage [V] 70 60 50 Constant Voltage Control 40 30 Linear (Constant Voltage Control) 20 10 0 0 100 200 300 MSP430 ADC value (10 bit 0-1023) Figure 19: Output voltage from a voltage sense circuit Boost converter Usage The boost converter has various inputs and an output. One of the inputs is a 12V source which powers the MOSFET driver directly and powers the MSP430 through a 3.3V linear regulator. The other input is a 27V power source which enables the 3.3V linear regulator and the MOSFET driver. Plugging in the 27V source starts the constant current constant voltage charging cycle assuming a battery is detected and has no faults. Page | 25 Battery Management System The battery management system (BMS) will be required to measure current, voltage, and temperature of the battery cells. This system will then report this information to the microcontroller. With this communication between the BMS and the microcontroller, the system will be able to perform a charging cycle, as well as active balancing of the cells. The purpose of this design is to provide safety features in case of dangerous cell conditions. Cell monitoring and regulating All of the duties of the battery management system are performed by a system of integrated circuits designed and manufactured by Texas Instruments. The IC that we will be using to monitor and regulate the Li-Ion batteries and send information to the processor is the TI bq76PL536EVM-3, shown in figure 20. In the pictures below, the TI evaluation module is connected to Aardvark USB-SPI adaptor. The adaptor is then connected to the PC where the status of the batteries will be displayed in the main screen software referred to as “Window Graphical User Interface”. Figure 20: Connection between Bq76PL536EVM-3, computer, cells and adaptor Technical Approach . Since the bq76PL536 EVM-3 is designed to balance 18 series battery cells we will have to combine 5 of them to monitor and manage 90 series cells in large scale. Whereas, for the small scale, we will charge (3*3) + (3*3) = 18 cells with two EVMs. As shown in the figure above, we will daisy chain the host EVM with the slave EVM, and will monitor three cells with each of the chips. This is to demonstrate that this design can be expanded for large scale purposes. The detail process for implementing and testing this design provided in the section below. Page | 26 Implementation and Testing for the BMS: bq76PL536EVM-3 The battery management system relies on the Texas Instruments bq76PL536EVM-3 Evaluation Module and the Aardvark USB-SPI adaptor attached it a PC to display the real-time system charging information. The bq76PL536EVM-3 is then attached multiple MSP430s to complete the required system information loop that allows for adjustment to the charging controls. This setup meets all requirements for under-voltage, over-voltage, and over-temperature protection. The bq76PL536EVM-3 integrates dedicated overcharge and under-voltage fault detection for each cell and two over-temperature fault detection inputs for our device. The protection circuits use a separate band-gap reference from the ADC system and operate independently. The protector also uses separate I/O pins from the main communications bus, and therefore is capable of signaling faults in hardware without intervention from the host MSP430. . Figure 21: Main Window for the Evaluation software Page | 27 VBRIC K VCELLn ADDR LOG DEVICE TSn : The voltage measured by the bq76PL536 between the BATx and VSS pins : The voltage measured between the pair of pins VCn – VCn-1 (i.e. VCELL2 = VC2 -VC1). : Displays the address of the device being monitored in the measurement result area. : Checking this box will add the contents of the device at this address to the log file. : The voltage measured between the TSn+ and TSn- inputs, converted by the WinGUI to temperature based on the characteristics of the thermistor used in the EVM design. The EVM and WinGUI are configured to measure this voltage as a ratio of REG50, which removes any offset or gain errors introduced by drift in the REG50 output. Figure 22: Plot View of Cell Information within Evaluation software Running of these integrated circuits include learning about the SMBus protocol, which is a set of industry defined standards which allows a host controller to easily obtain large amounts of data from the batteries over a single communication interface. In this case, TI’s evaluation modules will be gathering information on the battery conditions and communicating with two different MSP430s to making decisions. The MSP430G2231 will receive information from the EVM and will be used to control the voltage and current part of the charging cycle. The MSP430F5529 will also receive information from the EVM to be used to control the cell balancing aspect of the charging system. We will be using the Aardvark adaptor, manufactured by TI, to gather the data and display it on a PC, which uses the Evaluation software that is referred as the “WinGui” to display the detailed status of each battery. This interface is the other option for balancing the during charging cells. Balancing can be controlled by the computer if the MSP430F5529 is not used . Figure 21 above and figure 22 on the previous page show images of the main screens that will display system charging information. An important aspect to this project is proving that multiple bq76PL536EVM-3 evaluation module boards can be connected together to monitor a large number of cells. The implementation and testing of the EVMs in the system will be focused on configuring the EVMs for stacking and testing the communication of cell information to a PC. Page | 28 Implementation of multiple EVM Stacking When the bq76PL536EVM-3 arrives from TI it is ready to work as an independent board. There are a few changes that will need to be made in order to create a configuration where multiple EVM boards can be hooked together. To configure the system correctly, first one board must be chosen as the main communication board. This board needs to be configured to Host Mode. Next all other EVM boards must be changed to Slave mode. In order to configure the Host and Slave EVMs, a number of resistors will need to be either added or removed. Host Mode: 1. Make sure there is a 0 ohm resistor already at R36. 2. Insert 0 ohm resistors (RES0603) at R213. Slave Mode: 1. Remove the 0 ohm resistor at R36 and add it to R33. 2. Insert a 100 K ohm resistor at R212. Figure 23: (a & b) The Stacked EVMs To Stack North: 1. Remove the 0 ohm resistors at R205, R206, R207, R208, R209, R210, R211, and R212. 2. Insert 0 ohm resistors (RES0603) at R204, R213, R214, and R215. To Stack South: 1. Remove the 0 ohm resistors at R8, R9, R10, R11, R12, R13, R14, and R15. 2. Insert 0 ohm resistors at R5, R6, R7, and R16. Figure 24: (a & b) Resistor changes for EVM Stacking To make an easy connection for stacking, part number FC10P connection cable can be used. When the EVMs arrived from TI, one contained ten pin male connectors (Molex 90131-0765) on both ends and the other EVM required a ten pin male connection (Molex 90131-0765) to be soldered on. When running the BMS with multiple EVMs, the usb cable will supply the needed 3.3VDC to turn on the EVM for SPI Communication. There is no external power needed for the other EVMs in the stack. As long as cells are attached to each device, communication will be established. In the case where the Aardvark usb adapter is not used, either 3.3VDC or 5VDC will need to be applied to the Host EVM. The EVM must be configured so its power jumper for either 3.3V or 5V. For a complete schematic layout refer to Appendix E. Page | 29 Testing of the bq76PL536EVM-3 DC Power Supply - EVM Test Testing of the bq76PL536EVM-3 was conducted by first hooking up each EVM to three DC power supplies. Each device on the boards would see the power supply voltage as if battery cells were being monitored. This first test was done to each EVM that would be used in the system to ensure the boards would be working correctly to monitor a group of Lithium-Ion Batteries in the future. Each DC Power supply was set to 20 VDC while the negative and positive connections were attached to the battery monitoring terminal of each device on the board. The device would then see 6 cells at 3.33 VDC. The expected results for this test would then be verified by getting the voltage information to display on the computer screen. (a) (b) Figure25(a): Bq76PL536EVM-3 DC Supply Testing setup with computer display Figure26(b): A closer view of the DC Supply connections DC Power Supply – EVM Test Results The figure on the right shows the successful outcome of this test. Figure 27 shows how device 1 thinks it is seeing six cells which are all at 3.33 VDC, which is a combine voltage of 19.9VDC. This test verifies that the communication is working correctly. Figure 27: A close up view of voltage information displayed for device 1 Page | 30 EVM Stack Testing After configuring the two EVMs for stacking, it was important to test the system while stacked together, along with being hooked up to the bank of 18 cells. Each device within the EVM is designed to monitor three to six cells. With being limited to only having 18 cells, and wanting to keep the system voltage to a minimum, three cells were hooked up to each device. Once all cells were hooked together in series and the voltage wires were properly connected to the EVMs, the testing could begin. The expected results of this test could also be verified by all six devices showing up in the device stack box in the display interface on the PC. This test was successful when all battery information could be seen from all six devices. Figure 28: EVM Stacking Test setup while connected to Li-Ion cells EVM Stacking Test Results The results of this test were successful after a few minutes of plugging in the USB cable and restarting the EVM PC software. Although the system did not always recognize all six devices, eventually they were successfully found by communication interface. Figure 29 below shows that there are six devices found in the stack height and the v stack voltage is around 59.1 VDC. With the total stack voltage being displayed, it can be seen that the 18 cells all have about 3.3 VDC, which add up to the expected total. With the successful implementation of this setup, proof that our complete system is working properly will be easily displayed. Figure 29 : EVM Stacking Test Results Display Page | 31 Implementation and Testing of Complete System Complete System Test – Charging Cycle The input voltage is 27 VDC. Since the prototype system is scaled down to 18 series cells from 90 series in 16 parallel branches, the output of our boost circuit simulation was between 28.8 V to 64.8 V. Power will be provided for the BMS by a laboratory power supply during testing. The EVM will then be connected to the SPI-USB Aardvark adaptor, allowing a personal computer to control the boards. The evaluation software allows the tester to evaluate the condition and state of the cells in the system and monitoring the system in the evaluation module software. All 18 batteries will be discharged to around 2 V apiece. The batteries will then be connected to the EVM boards and a complete charging cycle will be implemented. The cycle will include a constant current phase at 3A. When the charge reaches 80% the cycle will switch from constant current to a constant voltage of 64.8V until fully charged. The figure below shows the graphical representation of charging of 18 batteries over time. All 18 were connected in series to one EVM board. The graph was generated by the EVM software via the Aardvark interface from TI. Although the cycle was short, the graph shows that voltage of batteries is increasing with time. The initial voltage of 18 cells was 54.2 V and after 25 seconds the voltage reading was 55 V. Combined with the proper 3A output from the power supply, it shows this prototype can complete a proper charging cycle. Figure 30: Screen Print of a short full stack charge test Page | 32 TI analog design contest Being included in the TI analog design contest has helped immensely in the planning and execution of this project. The superior support and quality of the TI products and personnel have proved indispensible in creating a successful design. The specific TI products used are discussed below. Full integration details including circuit diagrams and programming are provided in the design section of Boost Circuit and Battery Management System and the Appendices. MSP430G2231 The ADC on this microcontroller takes voltage and current measurements and outputs a PWM waveform to control the boost converter. It will also detect the bq76PL536EVM-3 stack for fault information. By modulating the PWM signal, the microcontroller ensures the system is in the correct phase of the constant current/constant voltage charging cycle. TI support provided excellent skeleton code that considerably sped up development when using the msp430 with the bq76PL536EVM-3 boards. MSP430F5529 This microcontroller will monitor the system for faults due to undercharge, overcharging, and overheating. When the full scale system is integrated, the fault protection can be used to shut down the system or turn off power to a specific battery cluster. The MSP430F5529 can also be used to manage the cell balancing of the finalized system. bq76PL536EVM-3 The bq76PL536EVM-3 battery management boards combined with the aardvark adaptor and the evaluation software are used to manage the cell balancing and fault detection of the batteries. This system can also be used for cell balancing when communicating with a PC. The management software also gives an excellent overall view of the system for debugging and demonstration purposes. Two boards were used in series with 18 cells to demonstrate the scaling capabilities necessary for the finalized product. UCC27322 MOSFET driver The UCC27322 MOSFET driver was used to boost the PWM output of the MSP430G2231 to 12V to control the output of boost converter. It was the only driver available with the required specifications that operated at the extremely low input on threshold of 2V, making for a highly responsive driver with the MSP430 3.3V pwm. OPA335 The OPA335 was used as a non-inverting amplifier to multiply the small voltage across the sense resistor. It was useful in our circuit due to its low power consumption and accurate results. Page | 33 Security Consideration There are few security concerns related to this project, however care should be given not to give development information directly to the clients competitors. Safety Consideration When dealing with high voltages: 1. Keep one hand in a pocket to prevent conduction channel through the heart. 2. Set up a work area away from possible grounds. 3. If circuit boards need to be removed from its mountings use insulating material. 4. Discharge high voltage capacitors appropriately. 5. Remove metal objects such as jewelry. 6. Prove that exposed metal surfaces are grounded, as are outlet grounds. 7. Do not assume insulation integrity. 8. Do not leave an experiment unattended. 9. Do not work on an experiment while tired or not alert. 10. Ensure that someone is trained in CPR. 11. When working with high voltages, ensure two people are present in the high voltage laboratory at all times. Intellectual Property Consideration The design for this project could potentially be patented, trademarked, and copyrighted. Patent protection can be applied for with the U.S. Copyright Office, which handles copyright registration in order to ensure a market claim to the product. Commercialization considerations This design is a prototype that could potentially become a commercial venture. Page | 34 Possible risks and risk management Risks have been identified throughout the project and tracked for resolution and mitigation. A risk register is used to identify risk to the project: Risk Register: No Risk Risk Description 1 High power systems Generate 324 VDC for electrical car motor 2 Electric shock 3 IC replacement The risk of electric shock is possible when working with a charging system In case any small part of the system malfunctions. 4 Over-temperature Over-voltage Under-voltage 5 Weight 6 Cost Cells may suffer thermal runaway and cell rupture if overheated or overcharged The mass of the system. Cost should be as low as possible Mitigation Run simulations before physically testing. Start at a lower voltage level to test the components before using it at the higher voltage level. Be careful when doing the circuit testing, follow the rules listed in the safety consideration. Disconnect the problem section and determine if further shut down is necessary. Replace the faulty component. The bq76PL536 provided by TI is available for protecting our system. Ensure lightweight components are utilized when possible Only purchase necessary components. Introduces risk with schedule if replacement contingency parts are not available. Page | 35 Schedule Page | 36 Hardware/Software Statement of work Task 1 - Problem Definition: Design a charger and battery management system operating from a 120 Vac source. Subtask 1a – Define the problem Subtask 1b – Identify the intended audience and End-Use Subtask 1c – Define the requirements and constraints Task 2 – Acquire a suitable power source Find an inexpensive power source that can be used to demonstrate the prototype. Subtask 2a – Compare alternatives. Subtask 2b – Choose the best alternative based upon cost and ease of use Task 3 – Boost Converter Design Boost the output of the power source from 27V to between 28.8V and 64.8V. Subtask 3a – Select component values Subtask 3b – Simulate Subtask 3c – Code an MSP430 to control the PWM Task 4 – bq76PL536EVM-3BMS system design Implement a scalable battery management system using two bq76PL536EVM-3 boards to monitor nine series cells each. Subtask 4a – Acquire the boards from TI. Subtask 4b – Modify the boards so they work in master/slave configuration. Subtask 4c – Code an MSP430 to control the fault response. Subtask 4d – Code an MSP430 to control the cell balancing. Task 5 – Building and Testing Build and test the systems designed in Tasks 2 through 4 Subtask 5a – Gather materials and components Subtask 5b – Solder the components onto perf board Subtask 5c – Code the various MSP430s Subtask 5d – Test each system individually and together for complete functionality. Task 6 – Documentation and Demonstration Provide End-Project Documentation and Project Reporting, as well as demonstrate the project to faculty. Subtask 5a – Write End-Project Documentation Subtask 5b – Write Project Report Subtask 5c – Develop a project poster Subtask 5d – Weekly reporting Subtask 5e – Demonstrate the project to the client and IRP panel Page | 37 Resources Items Cost Parts and Materials: a. Bq76PL536EVM-3 $400 b. MSP430 $75 c. Various Discrete components $50 d. TK20A60U N-Channel Mosfet $5.78 $10.40 e. INDUCTOR TOROID PWR 100UH 17.6A f. PROTO-BOARD 8PIN SOIC 8PIN SIP $4.11 g. UCC27322 mosfet driver $3.64 h. CAPACITOR 1500UF 100V ELECT TSUP $3.04 i. DIODE SCHOTTKY 100V 10A TO220AC $2.38 j. LAUNCHPAD DEV BRD FOR MSP430G2XX $4.30 k. C BOARD FR4 1-SIDE PPH 6.0X6.0 Subtotal: $10.59 $569.24 a. Test and Build equipment b. oscilloscope, function generator, digital multimeter $0 c. soldering equipment $0 Subtotal: $0 Labor at $20.00/hour: $20,000 a. Pramit Tamrakar $4,000 b. Matt Schulte $4,000 c. Jimmy Skadal $4,000 d. Hao Wang $4,000 e. William Zimmerman $4000 Subtotal: $20,000 Total: $40,569.24 Page | 38 Future Work We have a proof of concept and control system for a battery charging system. Our prototype system charges 18 series cells in two EVMs. The next step is to develop a full sized system that charges 90 cells and 16 parallel packs. The parts we have chosen are scalable and appropriate for this task. After the large scale 90 cell and 16 parallel pack configuration is successful, an appropriate transformer must be chosen to convert from a standard wall outlet to the DC power needed to run that system. This working system must then be made rugged enough to withstand conditions in the field. After these steps are completed a commercially viable product should result. Closing Summary With global demand for oil increasing and supplies more difficult to obtain, the price of oil based fuels for transportation is expected to rise. The need to find a viable alternative to oil necessitates researching in electric alternatives. The long wait time to charge Electric Vehicle batteries makes transitioning from internal combustion engines to battery electric vehicles inconvenient for a society dependent on traveling large distances. Electric vehicles have to be convenient, safe, and affordable to meet the needs of consumers without major sacrifices in perceived quality of life. Lithium ion batteries support a high energy density and are the preferred source of mobile electric power. This project implements a solution for a battery management system for a large number of lithium ion cells. There are still many problems to solve when charging an electric vehicle and the goals for this project are to find the best solutions for those problems. The use of 120VAC outlet would be ideal for home charging, but means that we must work with the restrictions of home outlets. Home charging is a very important problem to solve for this project. Scaling down problems and focusing on solving each step was very essential to successfully building this charger. Scaling down allowed the team to focus on developing a working solution without dealing with dangerous voltage levels during conception. Our project goal to successfully implement a lithium-ion battery charger prototype for the electric vehicle owned by Adan Cervantes and Element 1 Systems is completed. Page | 39 Project Team Information Client’s Information Adan R. Cervantes Principle system Engineer Email Address: [email protected] 3286 North Center Point Road, Marion, IA 52302 Phone: (319) 929-8928 www.element1systems.com Faculty advisor Information Ayman A. Fayed Assistant Professor Email Address: [email protected] Dept. of Electrical & Computer Engineering Iowa State University 2117 Coover Hall Ames, IA 50011 Phone: (515) 294-6112 Fax: (515) 294-8432 http://home.eng.iastate.edu/~aafayed/ Student Team Information Pramit Tamrakar Major: Electrical Engineering Email Address: [email protected] 918 NE Crestmoor Place Apt 306, Ankeny, IA 50021 Phone: 515-203-5291 Jimmy Skadal Major: Electrical Engineering Email Address: [email protected] 3819 Tripp St Unit 7, Ames, IA 50014 Phone: 563-320-6878 Matthew Schulte Major: Electrical Engineering Email Address: [email protected] 3223 Frederiksen Ct, Ames, IA 50010 Phone: 319-396-9959 Hao Wang Major: Electrical Engineering Email Address: [email protected] 230 Raphael Ave Unit 9, Ames, IA 50014 Phone: 515-520-9372 William Zimmerman Major: Electrical Engineering Email: [email protected] 1310 Garfield Ave, Ames, IA 50014 Page | 40 References "A123Systems :: Products." A123Systems. 2009. Web. 10 Oct. 2010. <http://www.a123systems.com/a123/products>. "Battery Management - Battery Fuel Gauge - BQ76PL102 - TI.com." TI.com. Texas Instruments, Oct.-Nov. 2009. Web. 10 Oct. 2010. <http://focus.ti.com/docs/prod/folders/print/bq76pl102.html>. "Battery Management - Lithium Ion Protection - BQ76PL536 - TI.com." TI.com. Texas Instrument, July-Aug. 2010. Web. 10 Oct. 2010. <http://focus.ti.com/docs/prod/folders/print/bq76pl536.html>. Baxter, Tyler, Brian Chee, Liam Keams, Philip Leo, and Philip Schmitz. Lithium Ion Battery Charging: Portable Renewable Power Module. May 10-15 Senior Design Project, Fall 2009. Sept.-Oct. 2010. <http://seniord.ece.iastate.edu/may1015/>. "Block Diagram (SBD) - Battery Management: High Cell Count for HEV - TI.com." TI.com. Texas Instruments. Web. 11 Oct. 2010. <http://focus.ti.com/docs/solution/folders/print/599.html>. "BQ78PL114 BQ76PL102 Evaluation Kit - BQ78PL114EVM-001 - TI Tool Folder." TI.com. Texas Instruments, 14 Jan. 2010. Web. 10 Oct. 2010. <http://focus.ti.com/docs/toolsw/folders/print/bq78pl114evm-001.html>. “Brusa.” Brusa. 2010. Web. 10 Oct. 2010. < http://www.brusa.biz/e_welcome.html>. "Li-Ion Battery Charger Solution Using the MSP430 Microcontrollers Slaa287 - TI.com." TI.com. Texas Instruments, Dec.-Jan. 2005. Web. 10 Oct. 2010. <http://focus.ti.com/lit/an/slaa287/slaa287.pdf>. "Linear Technology - LTC6802-1 - Multicell Battery Stack Monitor." Linear Technology - Linear Home Page. Linear.com, 2009. Web. 10 Oct. 2010. <http://www.linear.com/pc/productDetail.jsp?navId=H0,C1,C1003,C1037,C1786, P86662#descriptionSection>. "NOTES ON HIGH VOLTAGE SAFETY." Nanoscience at UNM. Web. 14 Oct. 2010. <http://nnin.unm.edu/safety/Hi_Voltage_Safety.html>. “Supply and Demand, Prius Style.” Wired Magazine. 2008. Web. 10 Oct. 2010. <http://www.wired.com/autopia/2008/07/supply-and-dema/>. “UCC28019 Evaluation Module.” TI.com. Texas Instruments, 01 Mar 2007. Web 10 Oct 2010. < http://focus.ti.com/docs/toolsw/folders/print/ucc28019evm.html>. Page | 41 "USB Interface Adapter EVM - USB-TO-GPIO - TI Tool Folder." TI.com. Texas Instruments, Aug.-Sept. 2006. Web. 10 Oct. 2010. <http://focus.ti.com/docs/toolsw/folders/print/usb-to-gpio.html>. "Electric Car." Wikipedia, the Free Encyclopedia. Web. 14 Oct. 2010. <http://en.wikipedia.org/wiki/Level_1,_2,_and_3_charging#Level_1.2C_2.2C_and_3_ch arging>. Page | 42 Appendix A Below is information about charging a lithium-ion battery from the TI data sheet SLAA287 Page | 43 Appendix B Below is the part of the information to connect the bq76pl536 evaluation modules to an MSP430F5529. This is necessary if the output laptop is not desired, and performs the fault and cell balancing control. Provided code and further information can be found at http://focus.ti.com/analog/docs/litabsmultiplefilelist.tsp?literatureNumber=slaa478&docCategoryId=1& familyId=413 Page | 44 Page | 45 Page | 46 Page | 47 Page | 48 Page | 49 Page | 50 Page | 51 Page | 52 Page | 53 Page | 54 Page | 55 Page | 56 Appendix C Battery definitions for the MSP430F //****************************************************************************** //THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR //REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, //INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS //FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR //COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE. //TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET //POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY //INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR //YOUR USE OF THE PROGRAM. // //IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL, //CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY //THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED //OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT //OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM. //EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF //REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS //OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF //USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S //AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF //YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS //(U.S.$500). // //Unless otherwise stated, the Program written and copyrighted //by Texas Instruments is distributed as "freeware". You may, //only under TI's copyright in the Program, use and modify the //Program without any charge or restriction. You may //distribute to third parties, provided that you transfer a //copy of this license to the third party and the third party //agrees to these terms by its first use of the Program. You //must reproduce the copyright notice and any other legend of //ownership on each copy or partial copy, of the Program. // //You acknowledge and agree that the Program contains //copyrighted material, trade secrets and other TI proprietary //information and is protected by copyright laws, //international copyright treaties, and trade secret laws, as //well as other intellectual property laws. To protect TI's //rights in the Program, you agree not to decompile, reverse //engineer, disassemble or otherwise translate any object code //versions of the Program to a human-readable form. You agree //that in no event will you alter, remove or destroy any //copyright notice included in the Program. TI reserves all Page | 57 //rights not specifically granted under this license. Except //as specifically provided herein, nothing in this agreement //shall be construed as conferring by implication, estoppel, //or otherwise, upon you, any license or other right under any //TI patents, copyrights or trade secrets. // //You may not use the Program in non-TI devices. // //This software has been submitted to export control regulations //The ECCN is EAR99 //***************************************************************************** /** * @file data_flash.h * * @brief this file contains all the definitions of the battery pack * * @author Daniel Torres - Texas Instruments, Inc * @date November 2010 * @version 1.0 Initial version * @note Built with IAR for MSP430 Version: 5.10 */ #ifndef DATA_FLASH_H #define DATA_FLASH_H //Battery pack definition #define NUMBER_OF_BQ_DEVICES 3 //3 BQ76PL536 devices are connected #define NUMBER_OF_CELLS 18 //MAX number of cells in the system #define MAX_CELLS_NUMBER_IN_BQ 6 //MAX number of cells per BQ76PL536 device #define CELL_BALANCING_EN 1 //set to 1 to enable cell balancing #define ONE_MINUTE 60 //Battery pack information and threshold values #define dCOV_THRESHOLD 3700 //COV_THRESHOLD [mV] #define dCOV_RECOVERY_THRESHOLD 3600 //COV_RECOVERY_THRESHOLD [mV] #define dCOV_TIME 5 //20 //COV_TIME (max value 32) [100ms] #define dCUV_THRESHOLD 2000 //CUV_THRESHOLD [mV] #define dCUV_RECOVERY_THRESHOLD 2200 //CUV_RECOVERY_THRESHOLD [mV] #define dCUV_TIME 5 //20 //CUV_TIME (max value 32) [100ms] #define dPACK_OVER_TEMP1 #define dPACK_OT_TIME1 #define dPACK_OVER_TEMP2 #define dPACK_OT_TIME2 50 2000 50 2000 //3 PACK_OVER_TEMP1 [st C] //PACK_OT_TIME1 [ms] //3 PACK_OVER_TEMP2 [st C] //PACK_OT_TIME2 [ms] //PACK_END_OF_CHARGE_VOLTAGE [mV] #define dPACK_END_OF_CHARGE_VOLTAGE (DWORD)dCOV_THRESHOLD*NUMBER_OF_CELLS #define dCC_CV_QUAL_TIME 20 //CC_CV_QUAL_TIME [s] Page | 58 //PACK_END_OF_DISCHARGE_VOLTAGE[mV] #define dPACK_END_OF_DISCHARGE_VOLTAGE (DWORD)dCUV_THRESHOLD*NUMBER_OF_CELLS #define dEND_OF_DISCHARGE_QUAL_TIME 20 //END_OF_DISCHARGE_QUAL_TIME [s] #define dCHARGE_CURRENT 1100 //CHARGE_CURRENT [mA] #define dCHARGE_TAPER_CURRENT 300 //CHARGE_TAPER_CURRENT #define dCHARGE_TAPER_TIME (DWORD)240*ONE_MINUTE//CHARGE_TAPER_TIME[s] #define dMAX_CHARGE_TIME (DWORD)200*ONE_MINUTE//MAX_CHARGE_TIME [s] [mA] //FULL_DISCHARGE_CLEAR_VOLTS [mV] #define dFULL_DISCHARGE_CLEAR_VOLTS dPACK_END_OF_DISCHARGE_VOLTAGE //FULL_CHARGE_CLEAR_VOLTS [mV] #define dFULL_CHARGE_CLEAR_VOLTS dPACK_END_OF_CHARGE_VOLTAGE #define dDELTA_CHARGE_V 300 //DELTA_CHARGE_V [mv] #define dCHARGE_DISCHARGE_TIME (DWORD)5*ONE_MINUTE//CHARGE_DISCHARGE_TIME [s] #define dDELTA_DISCHARGE_V 200 //DELTA_DISCHARGE_V [mV] #define dSOV_THRESHOLD 4200 //SOV_THRESHOLD [mV] #define dSOV_RECOVERY_THRESHOLD 3800 //SOV_RECOVERY_THRESHOLD #define dSOV_TIME 3000 //SOV_TIME [ms] [mV] #define dCELL_IMBALANCE_FAIL_THRESHOLD 500 //CELL_IMBALANCE_FAIL_THRESHOLD[mV] #define dCELL_IMBALANCE_FAIL_TIME (DWORD)120*ONE_MINUTE//CELL_IMBALANCE_FAIL_TIME[s] #define dBALANCE_TIME (DWORD)1*ONE_MINUTE //BALANCE_TIME A.K.A CB_TIME[s] #define dBALANCE_VOLTS_THRESHOLD 50 //BALANCE_VOLTS_THRESHOLD [mV] #define dMIN_BALANCE_VOLTS dCUV_RECOVERY_THRESHOLD //MIN_BALANCE_VOLTS[mV] #define dMAX_BALANCE_TIME (DWORD)120*ONE_MINUTE//MAX_BALANCE_TIME[s] /** * @brief Global defines */ . //definition of the Parameters structure typedef enum PARAM_ID { /*Voltage*/ COV_THRESHOLD, //COV_THRESHOLD = 0, COV_RECOVERY_THRESHOLD, COV_TIME, CUV_THRESHOLD, CUV_RECOVERY_THRESHOLD, Page | 59 CUV_TIME, /*Temperature*/ PACK_OVER_TEMP1, PACK_OT_TIME1, PACK_OVER_TEMP2, PACK_OT_TIME2, /*Charge and Discharge*/ PACK_END_OF_CHARGE_VOLTAGE, CC_CV_QUAL_TIME, PACK_END_OF_DISCHARGE_VOLTAGE, END_OF_DISCHARGE_QUAL_TIME, CHARGE_CURRENT, CHARGE_TAPER_CURRENT, CHARGE_TAPER_TIME, MAX_CHARGE_TIME, FULL_DISCHARGE_CLEAR_VOLTS, FULL_CHARGE_CLEAR_VOLTS, DELTA_CHARGE_V, CHARGE_DISCHARGE_TIME, DELTA_DISCHARGE_V, /*Safety*/ SOV_THRESHOLD, SOV_RECOVERY_THRESHOLD, SOV_TIME, /*Balancing*/ CELL_IMBALANCE_FAIL_THRESHOLD, CELL_IMBALANCE_FAIL_TIME, BALANCE_TIME, BALANCE_VOLTS_THRESHOLD, MIN_BALANCE_VOLTS, MAX_BALANCE_TIME } param_id_t; /** * @brief Global functions declaration */ . extern unsigned short get_u16_value(param_id_t param_id); extern unsigned long get_u32_value(param_id_t param_id); #endif /*EOF*/ Page | 60 Appendix D Below is the Quick User Guide for the EVM TI bq76PL536EVM-3 Quick User Guide Aadrvark-JP1 selects power from the USB connection through the Aardvark when installed in the “USB” position. AC power- The JP1 should be configured to use power from the 5VDC adapter by installing the jumper in the “EXT 5VDC” position. To use 5VDC adapter, 2.5mm DC jack needs to be installed on the EVM. 5VDC adopter needs to 5V 100mA power supply and DC plug is 2.5mm. Center pin is positive. If USB doesn’t supply sufficient power then use power from the 5VDC adapter. 1.1 Configure The EVM With cells 1. Remove jumpers JP1-18 (18) located near the black battery connectors P1-P3 to reduce the current draw of the board. 2. Connect cells to the supplied mating connectors with screw terminals BEFORE plugging the connector into the EVM at P1, the large black connector on the left edge of the board. 3. The bottom-most pin of the battery connector is the most negative connection to the board from the battery stack. This is the negative end of cell 1. The next pin up the connector is the positive end of cell (and the negative end of cell 2). 4. Pin 7 of P1 (P1.7) is connected to P2.1 on the board, and the banana jack located between P1 and P2. 5. The battery connections should be made secure, a loose connection may result in device destruction. 1.2 With 12-26 VDC power supply 1. Install jumpers JP1-18 (18) located near the black battery connectors P1-P3 before connecting power supplies. 2. Connect an appropriate power supply capable of supplying 12-26VDC to connector P1, then plug P1 into the EVM connector. 3. Plug additional supplies into P2 and P3. Plug additional supplies into P2 and P3. The supplies must be isolated from each other and from earth ground to avoid unintentional short circuits. 4. A separate supply is required for each IC. 5. The supply negative connection is made to pin 1 of the mating connector, the pin that will connect to the bottom-most pin of the mating connector. 6. The positive connection is made to pin 7, the top-most on the connector. 7. Alternately use the banana plug connections in lieu of using the black P1-3 connectors. 1.3 Connecting the EVM Connection order 1. Configure the EVM jumpers per 1.1 2. Connect the EVM to the Power Supplies or cells, turn on the supplies at ~12 to 24V is recommended. The Absolute Maximum voltage per IC is 36V and should not be exceeded, 30V is the recommended maximum continuous voltage. Page | 61 3. Connect the USB cable to the Aardvark and your PC. 4. “A” version is designed to use USB power from Aardvark. 5V DC adapter is not required. For None “A” version, plug the supplied wall adapter into an AC outlet. Connect the DIN plug to the EVM board 5. Connect the Aardvark ribbon cable to the 10 pin header on the EVM board The Aardvark adapter should be connected last during power-up, and disconnected first when powering down. If not using the wall adapter to supply power, it must be after starting the Windows application to avoid a turn-on issue with the Aardvark adapter. Many laptop computers power off their USB ports when they go into sleep, standby, or hibernate modes. If the device the Aardvark is connected to remains powered when this happens, the Aardvark may suffer permanent damage. 6. Start the WinGUI User Interface software supplied with the EVM and installed earlier. Page | 62 Appendix E Below are the binder drawings for the bq76PL536EVM-3 to illustrate the use of the EVM in large scale (daisy chain). Page | 63 Page | 64 Page | 65 Page | 66 Page | 67 Appendix F Below is the user guide to set up the MSP430 Setting up the MSP430 Launchpad Go to http://processors.wiki.ti.com/index.php/Download_CCS and download the code limited version, which requires a my.TI account: Run the installation Connect the launchpad hardware by USB. Start Code Composer Studio v4 Start a new CCS Project and select the following options: Page | 68 To add program files to the project, shown with the example project pre loaded on the MSP430: Project->Add Files to Active Project C:\Program Files\Texas Instruments\ccsv4\msp430\examples\msp430x2xx\Csource\msp430x2xx_fet_1.c To debug (compile and load the program onto the launchpad) click Target->Debug Active Project The program is now loaded on the microcontroller, and can be run directly from debug by pressing F8 or Run from the Target menu. Page | 69 Appendix G Operational Manual by 491 Team Authors: Deogratius Mpinge, Michael Healy, Abdelmagid Yousif, Spenser Mussmann What is the high level objective of the project? The objective is to create an efficient system to monitor and charge lithium ion batteries for use in electric vehicles. This project will create the base case to eventually be capable of monitoring sixteen parallel packs of ninety cells in series. This project will also address AC to DC converters for charging from either wall outlets or other power sources. What are the key functional requirements of the system? Functional Requirements ○ Achieve 100 Mile Range Per Full Battary Charge ○ Monitor Temperature of Cells ○ Prevent Overcharging ○ Monitor Battery Charge ○ Develop Constant Current Constant Voltage Charging Procedure What has been actually implemented? The system relies on several hardware components to monitor and regulate the charging of the batteries. The battery management hardware is bq76PL536EVM developed by Texas Instruments. This project will have two of these battery management systems in series, each connected to nine lithium ion batteries. The management hardware will be connected to a PC to actively monitor the current conditions of the charging. The PC will be able to control a MSP430 microprocessor, which controls the output of a boost converter. The Boost converter is powered by a wall AC power supply and will control the voltage and current entering the battery management hardware. How to setup the system? 1. Gather all items needed, that include: a. Computer or laptop b. Boost Converter c. 120 VAC wall outlet d. Texas Instruments UCC28019, PFC boost converter control integrated circuit e. TI bq76PL536EVM-3 Microprocessor for cell monitoring f. Aardvark USB-SPI , a USB connection adaptor g. Monitoring system software h. 18 series connected lithium ion battery cells i. USB Cable j. Power cable for the battery banks 2. Turn ON the computer 3. Connect the cell monitoring microprocessor to the USB connection adapter 4. Connect the USB cable to the computer and the USB adapter 5. Connect the boost converter to the battery bank using the power cable 6. Connect the boost converter to the wall outlet 7. Open the user interface software in the computer to monitor the cells 8. Turn ON the boost converter The setup should be completed now and the system is ready. Page | 70 Test results observed? The monitoring system user interface provides the user with valuable data about the battery cells. The most important data presented is the voltage level and graphical plot for the voltage and the temperature in each cell. Critique of the project: ○ The monitoring system can be scaled up to be used in electric vehicles by using different power supply ○ The team analyzed several different models before deciding which would produce the most efficient charging. ○ A minimized design should be considered since the final product is intended for a vehicle. Does the implementation meet the specification? The implementation meets the specification by: -Coding for the MSP430 PWM output and ADC has been completed -Components for the buck converter have been sourced -Basic resistor divider input has been implemented to changed the PWM duty cycle Page | 71 Appendix F Constant current test code //Constant Current test code //The output pwm is low by defualt and will only increase with a voltage input //The delay each cycle was found to be necessary in practice due to a lack //in time for the boost converter to respond to very fast increases in pwm. //Otherwise the power fet quickly becomes continuously on and the inductor shorts. //As an added precaution, the maximum duty cycle is set to 110/150. #include <msp430g2231.h> void delay(unsigned int ms); double voltage_calc(int adc_value); void main(void) { //The LED on pin P1.0 is used for visual feedback of the pwm switching feedback P1DIR |= 0x01; //High Frequency Clock Configuration WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 |= 0xF; // High frequency mode, Highest Range Select DCOCTL |= 0x70; // Range 7 //Pulse Width Modulation P1DIR |= 0x0C; P1SEL |= 0x0C; CCR0 = 150; CCTL1 = OUTMOD_6; CCR1 = 0; TACTL = TASSEL_2 + MC_1; // P1.2 and P1.3 output // P1.2 and P1.3 TA1/2 options // PWM Period // CCR1 toggle/set // CCR1 PWM duty cycle // SMCLK, up to CCR0 //Analog to Digital Converter Initialization ADC10CTL1 = INCH_3; Output Unit 0, single conversion ADC10CTL0 = ADC10ON + ADC10SHT_3 + ADC10IE; Interrupt Enabled for (;;) { //Constant Current ADC10CTL0 |= ENC + ADC10SC; __bis_SR_register(CPUOFF + GIE); // Clock Divider, Input Channel 3 (P1.3), Timer A // Sample reference Vcc and Vss, enable core, // Sampling and conversion start // LPM0, ADC10_ISR will force exit //Change "3" to desired output current in amps if (current_calc(ADC10MEM) > 3 && CCR1 != 0) { Page | 72 P1OUT |= 0x01; CCR1--; } if (current_calc(ADC10MEM) < 3 && CCR1 != 110) { P1OUT &= 0x00; CCR1++; } delay(100); } } //Input: value of output current adc //Output: calculated output current obtained in practice in amps double current_calc(int adc_value) { return((adc_value*0.0102+0.0039); } // Millisecond delay void delay(unsigned int ms) { while (ms--) { __delay_cycles(16000); // set for 16Mhz change it to 1000 for 1 Mhz } } // ADC10 interrupt service routine breaks from LPM #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR (void) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } Page | 73 Appendix G Constant voltage test code //Constant Voltage test code //The output pwm is low by defualt and will only increase with a voltage input //The delay each cycle was found to be necessary in practice due to a lack //in time for the boost converter to respond to very fast increases in pwm. //Otherwise the power fet quickly becomes continuously on and the inductor shorts. //As an added precaution, the maximum duty cycle is set to 110/150. #include <msp430g2231.h> void delay(unsigned int ms); double voltage_calc(int adc_value); void main(void) { //The LED on pin P1.0 is used for visual feedback of the pwm switching feedback P1DIR |= 0x01; //High Frequency Clock Configuration WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 |= 0xF; // High frequency mode, Highest Range Select DCOCTL |= 0x70; // Range 7 //Pulse Width Modulation P1DIR |= 0x0C; P1SEL |= 0x0C; CCR0 = 150; CCTL1 = OUTMOD_6; CCR1 = 0; TACTL = TASSEL_2 + MC_1; // P1.2 and P1.3 output // P1.2 and P1.3 TA1/2 options // PWM Period // CCR1 toggle/set // CCR1 PWM duty cycle // SMCLK, up to CCR0 //Analog to Digital Converter Initialization ADC10CTL1 = INCH_1; Output Unit 0, single conversion ADC10CTL0 = ADC10ON + ADC10SHT_3 + ADC10IE; Interrupt Enabled for (;;) { //Constant Voltage ADC10CTL0 |= ENC + ADC10SC; __bis_SR_register(CPUOFF + GIE); // Clock Divider, Input Channel 1 (P1.1), Timer A // Sample reference Vcc and Vss, enable core, // Sampling and conversion start // LPM0, ADC10_ISR will force exit //Change "65" to desired output voltage in volts if (voltage_calc(ADC10MEM) > 65 && CCR1 != 0) { Page | 74 P1OUT |= 0x01; CCR1--; } if (voltage_calc(ADC10MEM) < 65 && CCR1 != 110) { P1OUT &= 0x00; CCR1++; } delay(100); } } //Input: value of output voltage adc //Output: calculated output voltage obtained in practice in volts double voltage_calc(int adc_value) { return((adc_value*0.2853+0.0403); } // Millisecond delay void delay(unsigned int ms) { while (ms--) { __delay_cycles(16000); // set for 16Mhz change it to 1000 for 1 Mhz } } // ADC10 interrupt service routine breaks from LPM #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR (void) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } Page | 75 Appendix H Full system code //****************************************************************************** // MSP430G2xx - Boost Converter Control // // Description: This program generates one PWM output on P1.2 using // Timer_A configured for up/down mode. The value in CCR0, 128, defines the PWM // period and the value in CCR1 the PWM duty cycle. // // A single Analog to Digital conversion is performed on Pin 1.1 and // the low power mode is entered while the conversion is taking place. // The conversion value is used as feedback for increasing or decreasing // the PWM signal duty cycle. // // MSP430x2xx // -----------------------// /|\| XIN|// || | // --|RST XOUT|// | | // Vout>---|A1/P.1 P1.2/TA1|--> CCR1 - PWM // | | // Iout>---|A3/P1.3 | // | | // VIN >---|A5/P1.5 | // // // sdmay11-04 // Iowa State University // November 2010 // Built with CCE Version: 4.2 //****************************************************************************** #include <msp430g2231.h> #define C_CURRENT = 3; //Amps #define C_CURRENT_MIN = 0.3 //Amps, stop charging constant voltage at this current #define NUMBER_OF_BATTERIES = 18; #define BAT_VOLTAGE_MIN = 1.6; //Volts #define BAT_VOLTAGE_MAX = 3.6; //Volts #define PACK_VOLTAGE_MIN = NUMBER_OF_BATTERIES*BAT_VOLTAGE_MIN; //Volts #define PACK_VOLTAGE_MAX = NUMBER_OF_BATTERIES*BAT_VOLTAGE_MAX; //Volts #define PWM_UPPER_LIMIT = 100; // 100 over 150 is a duty cycle of 0.66 #define PWM_LOWER_LIMIT = 0; // duty cycle of 0 char state = 0; //0=MSP430 startup/discharge/wait for charge 1=Constant Current 2=Constant Voltage Page | 76 double current_calc(int adc_value); double voltage_calc(int adc_value); void delay(unsigned int ms); void main(void) { P1DIR |= 0x01; //High Frequency Clock Configuration WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 |= 0xF; // High frequency mode, Highest Range Select DCOCTL |= 0x70; // Range 7 //Pulse Width Modulation P1DIR |= 0x0C; P1SEL |= 0x0C; CCR0 = 150; CCTL1 = OUTMOD_6; CCR1 = 0; TACTL = TASSEL_2 + MC_1; // P1.2 and P1.3 output // P1.2 and P1.3 TA1/2 options // PWM Period // CCR1 toggle/set // CCR1 PWM duty cycle // SMCLK, up to CCR0 //Analog to Digital Converter Initialization ADC10CTL1 = INCH_1; Channel 1, Timer A Output Unit 0, single conversion ADC10CTL0 = ADC10ON + ADC10SHT_3 + ADC10IE; Interrupt Enabled // Clock Divider, Input // Sample reference Vcc and Vss, enable core, for (;;) { switch(state) { //MSP430 power on, beginning state case 0: //Start by getting the input voltage ADC10CTL1 = INCH_5; // Input channel 5 for input voltage sense ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (ADC10MEM < 200) { state=0; //Wait a minute before checking to recharge delay(60000); } else { //Start by getting the output voltage (battery voltage) ADC10CTL1 = INCH_1; // Input channel 1 for input voltage sense Page | 77 ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit //Set to charge if the voltage is between the constant current boundary if((voltage_calc(ADC10MEM) < PACK_VOLTAGE_MAX) && (voltage_calc(ADC10MEM) > PACK_VOLTAGE_MIN)) { state=1; } } break; //Constant Current case 1: //Input plugged in, ready to charge constant current //Start by getting the output voltage (battery voltage) ADC10CTL1 = INCH_1; // Input channel 1 for input voltage sense ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit //Set to constant voltage if the voltage is greater than the pack max voltage if(voltage_calc(ADC10MEM) > PACK_VOLTAGE_MAX) state=2; //otherwise, perform constant current changes to the power supply //Constant Current ADC10CTL1 = INCH_3; // Input channel 3 for current ADC10CTL0 |= ENC + ADC10SC; __bis_SR_register(CPUOFF + GIE); // Sampling and conversion start // LPM0, ADC10_ISR will force exit if (current_calc(ADC10MEM) > C_CURRENT && CCR1 != 0) { P1OUT |= 0x01; CCR1--; } if (current_calc(ADC10MEM) < C_CURRENT && CCR1 != 110) { P1OUT &= 0x00; CCR1++; } break; //Constant voltage case 2: Page | 78 //Check the output current to determine if charge is finished ADC10CTL1 = INCH_3; // Input channel 3 for current ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (voltage_calc(ADC10MEM) < C_CURRENT_MIN); state=0; //Constant Voltage ADC10CTL1 = INCH_1; // Input channel 3 for current ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit if (voltage_calc(ADC10MEM) > PACK_VOLTAGE_MAX && CCR1 != 0) { P1OUT |= 0x01; CCR1--; } if (voltage_calc(ADC10MEM) < PACK_VOLTAGE_MAX && CCR1 != 110) { P1OUT &= 0x00; CCR1++; } } delay(100); } } //Input: value of output current adc //Output: calculated output current obtained in practice in amps double current_calc(int adc_value) { return((adc_value*0.0102+0.0039); } //Input: value of output voltage adc //Output: calculated output voltage obtained in practice in volts double voltage_calc(int adc_value) { return((adc_value*0.2853+0.0403); } // Delays by the specified Milliseconds void delay(unsigned int ms) { while (ms--) { __delay_cycles(16000); // set for 16Mhz change it to 1000 for 1 Mhz Page | 79 } } // ADC10 interrupt service routine breaks from LPM #pragma vector=ADC10_VECTOR __interrupt void ADC10_ISR (void) { __bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR) } Page | 80 Appendix I 3.3V Regulated source from 12V Figure 31: Various components require a 3.3V source, and the LM317 voltage regulator is used from the input 12V source Page | 81