MCP1631HV Digitally Controlled Programmable Current Source Reference Design © 2009 Microchip Technology Inc. DS51798A Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code. • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, rfPIC, SmartShunt and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, nanoWatt XLP, PICkit, PICDEM, PICDEM.net, PICtail, PIC32 logo, PowerCal, PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2009, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. DS51798A-page ii © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Table of Contents Preface ........................................................................................................................... 1 Introduction............................................................................................................ 1 Document Layout .................................................................................................. 1 Conventions Used in this Guide ............................................................................ 2 Recommended Reading........................................................................................ 3 The Microchip Web Site ........................................................................................ 3 Customer Support ................................................................................................. 3 Document Revision History ................................................................................... 4 Chapter 1. Product Overview 1.1 Introduction ..................................................................................................... 5 1.2 What is the MCP1631HV Digitally Controlled Programmable Current Source Reference Design? ...................................................................... 6 1.3 What the MCP1631HV Digitally Controlled Programmable Current Source Kit Includes ................................................................................... 6 Chapter 2. Installation and Operation 2.1 Introduction ..................................................................................................... 7 2.2 Features ......................................................................................................... 7 2.3 Getting Started ............................................................................................... 8 Appendix A. Schematic and Layouts A.1 Introduction .................................................................................................. 17 A.2 Board – Schematic ....................................................................................... 18 A.3 Board – Top Solder Pads and Silk-Screen Layers ...................................... 19 A.4 Board – Top Copper Layer .......................................................................... 20 A.5 Board – Bottom Copper Layer ..................................................................... 21 Appendix B. Bill Of Materials (BOM) Appendix C. Demo Board Firmware C.1 Summary Device Firmware Flowchart - LED Driver .................................... 25 C.2 Summary Device Firmware Flowchart - Li-Ion Charger ............................... 26 C.3 Summary Device Firmware Flowchart - NiMH/NiCd Charger ...................... 27 Worldwide Sales and Service .................................................................................... 28 © 2009 Microchip Technology Inc. DS51798A-page iii MCP1631HV Digitally Controlled Programmable Current Source Reference Design NOTES: DS51798A-page iv © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Preface NOTICE TO CUSTOMERS All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available. Documents are identified with a “DS” number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document. For the most up-to-date information on development tools, see the MPLAB® IDE on-line help. Select the Help menu, and then Topics to open a list of available on-line help files. INTRODUCTION This chapter contains general information that will be useful to know before using the MCP1631HV Digitally Controlled Programmable Current Source Reference Design. Items discussed in this chapter include: • • • • • • Document Layout Conventions Used in this Guide Recommended Reading The Microchip Web Site Customer Support Document Revision History DOCUMENT LAYOUT This document describes how to use the MCP1631HV Digitally Controlled Programmable Current Source Reference Design as a LED driver or a battery charger. The manual layout is as follows: • Chapter 1. “Product Overview” – Important information about the MCP1631HV Digitally Controlled Programmable Current Source Reference Design. • Chapter 2. “Installation and Operation” – Includes instructions on how to get started with this user’s guide and a description of the user’s guide. • Appendix A. “Schematic and Layouts” – Shows the schematic and layout diagrams for the MCP1631HV Digitally Controlled Programmable Current Source Reference Design. • Appendix B. “Bill Of Materials (BOM)” – Lists the parts used to build the MCP1631HV Digitally Controlled Programmable Current Source Reference Design. • Appendix C. “Demo Board Firmware” – Provides general information about the application firmware flowcharts and where the source code can be found. © 2009 Microchip Technology Inc. DS51798A-page 1 MCP1631HV Digitally Controlled Programmable Current Source Reference Design CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Arial font: Italic characters Represents Referenced books Emphasized text A window A dialog A menu selection A field name in a window or dialog A menu path MPLAB® IDE User’s Guide ...is the only compiler... the Output window the Settings dialog select Enable Programmer “Save project before build” A dialog button A tab A number in verilog format, where N is the total number of digits, R is the radix and n is a digit. A key on the keyboard Click OK Click the Power tab 4‘b0010, 2‘hF1 Italic Courier New Sample source code Filenames File paths Keywords Command-line options Bit values Constants A variable argument Square brackets [ ] Optional arguments Curly brackets and pipe character: { | } Ellipses... Choice of mutually exclusive arguments; an OR selection Replaces repeated text #define START autoexec.bat c:\mcc18\h _asm, _endasm, static -Opa+, -Opa0, 1 0xFF, ‘A’ file.o, where file can be any valid filename mcc18 [options] file [options] errorlevel {0|1} Initial caps Quotes Underlined, italic text with right angle bracket Bold characters N‘Rnnnn Text in angle brackets < > Courier New font: Plain Courier New Represents code supplied by user DS51798A-page 2 Examples File>Save Press <Enter>, <F1> var_name [, var_name...] void main (void) { ... } © 2009 Microchip Technology Inc. Preface RECOMMENDED READING This user's guide describes how to use the MCP1631HV Digitally Controlled Programmable Current Source Reference Design. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. MCP1631 Data Sheet, "High-Speed, Microcontroller-Adaptable, Pulse Width Modulator", DS22063A This data sheet provides detailed information regarding the MCP1631/MCP1631V, MCP1631HV and MCP1631VHV product families. PIC16F616/HV616 Data Sheet, "14-Pin Flash-Based, 8-Bit CMOS Microcontrollers”, DS41288A This data sheet provides detailed information regarding the PIC16F616 product family. AN1137 Application Note, “Using the MCP1631 Family to Develop Low-Cost Battery Chargers”, DS01137A. THE MICROCHIP WEB SITE Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information: • Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software • General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing • Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives CUSTOMER SUPPORT Users of Microchip products can receive assistance through several channels: • • • • Distributor or Representative Local Sales Office Field Application Engineer (FAE) Technical Support Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document. Technical support is available through the web site at: http://support.microchip.com. © 2009 Microchip Technology Inc. DS51798A-page 3 MCP1631HV Digitally Controlled Programmable Current Source Reference Design DOCUMENT REVISION HISTORY Revision A (May 2009) • Initial Release of this Document. DS51798A-page 4 © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Chapter 1. Product Overview 1.1 INTRODUCTION The MCP1631HV Digitally Controlled Programmable Current Source Reference Design is used to drive and dim one or more power LEDs in a series or parallel topology (depending on the LED’s capability). The reference design may also be used to charge one to four cell NiMH/NiCd or one to two cell Li-Ion battery packs. The board uses the MCP1631HV high-speed analog PWM controller and PIC16F616 microcontroller to generate the proper dimming ratio for LEDs or charge algorithm for NiMH, NiCd and Li-Ion batteries. The MCP1631HV Digitally Controlled Programmable Current Source Reference Design is used to evaluate Microchip’s MCP1631HV in a SEPIC power converter application. The MCP1631HV Digitally Controlled Programmable Current Source Reference Design is user programmable. Multiple user functions may be selected by re-compiling the source code. The board can drive LEDs or charge NiMH, NiCd or Li-Ion batteries with a maximum current of 1A. In Charger Mode, the MCP1631HV Digitally Controlled Programmable Current Source Reference Design provides a constant current charge (Ni-based chemistry) and constant current/constant voltage (Li-Ion based chemistry) with preconditioning, cell temperature monitoring (for Ni-based) and battery pack fault monitoring. In LED Driver mode, the MCP1631HV Digitally Controlled Programmable Current Source Reference Design provides a constant user defined current and a 10:1 dimming ratio. The dimming ratio and maximum current can be selected before compiling the source code. The board has LED indicators to provide multiple fault indication. This chapter covers the following topics: • What is the MCP1631HV Digitally Controlled Programmable Current Source Reference Design Reference Design? • What the MCP1631HV Digitally Controlled Programmable Current Source Reference Design Reference Design Kit includes. 3.5V to 16V Power Supply + MCP1631HV SEPIC Programmable Current Source FIGURE 1-1: © 2009 Microchip Technology Inc. THERMISTOR - LED or battery pack + Block Diagram. DS51798A-page 5 MCP1631HV Digitally Controlled Programmable Current Source Reference Design 1.2 WHAT IS THE MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN? This board utilizes Microchip’s MCP1631HV-3.3 (high-speed PIC® MCU PWM TSSOP-20, 3.3V supply version). The MCP1631HV Digitally Controlled Programmable Current Source Reference Design is a complete stand-alone constant current LED power supply with a dimming ratio of 10:1. The board is capable of delivering a maximum of 1 Amp @ 8.5W output power. Efficiency is typically 85% at the maximum power. TABLE 1-1: DEFAULT OUTPUT CAPABILITY IN DRIVING LED MODE Maximum output current1 Dimming ratio Maximum Output power1 Overvoltage protection Thermal shutdown2 700 mA 10:1 8.5W 9V 40°C Note 1: 2: Maximum output current can be modified in the source code. Absolute max is 1A @8.5W. For an easy start with the MCP1631HV Digitally Controlled Programmable Current Source Reference Design Board, this option is not enabled in the compiled .hex file which is available on the Microchip website. The board may also be re-programmed to charge Li-Ion, NiMH, and NiCd battery packs. The MCP1631HV Digitally Controlled Programmable Current Source Reference Design is capable of charging one to four NiMH/NiCd batteries connected in series or one to two Li-Ion batteries in series. See Table 1-2 for detailed charger capabilities. TABLE 1-2: MULTI-CHEMISTRY CHARGER CAPABILITY Battery Chemistry Li-Ion NiMH or NiCd Note: 1 Cell 2 Cells 3 Cells 1A 500 mA NA 4 Cells NA 700 mA 700 mA 700 mA 700 mA The SEPIC converter is capable of buck-boost operation. The duty cycle may be changed in the source code to allow boost operation. Set the “00234R1.h” header file pre-processor duty cycle definition to: #define OSCILLATOR_DUTY_CYCLE 25 for 25% duty cycle and to allow boost operation. The input voltage range for the reference board is 3.5V to 16V. An input terminal block is provided to apply the input voltage to the board. An output header with 5 pins is also provided as a means to connect the load LEDs or battery pack and an external 10 kΩ thermistor. When used, thermistors should either be mounted on the LED heatsink next to the LED case or internal to the MiMH/NiCd battery pack. A programming header compatible with the PICkitTM2 and ICD 2 programmers is on board for updating the firmware contained in the PIC16F616. Firmware updates are required to switch between LED, NiMH/NiCd, and Li-Ion modes of operation. 1.3 WHAT THE MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE KIT INCLUDES The MCP1631HV Digitally Controlled Programmable Current Source kit includes: • The MCP1631HV Digitally Controlled Programmable Current Source Reference Design,102-00234 • Important Information “Read First” DS51798A-page 6 © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Chapter 2. Installation and Operation 2.1 INTRODUCTION The MCP1631HV Digitally Controlled Programmable Current Source Reference Design demonstrates Microchip’s MCP1631HV high-speed Pulse Width Modulator (PWM) used in LED lighting and multi-chemistry battery charger applications. When used in conjunction with a microcontroller, the MCP1631HV will control the power system duty cycle to provide output voltage or current regulation. A PIC16F616 microcontroller is used to provide the MCP1631HV switching frequency oscillator and reference voltage. The MCP1631HV generates a duty cycle and provides fast overcurrent protection based upon the feedback and current sense inputs. MCP1631HV external signals include the input oscillator, the reference voltage, the feedback voltage and the current sense. The MCP1631HV generates a square-wave output signal to drive the powertrain switch. The power train used for the MCP1631HV Digitally Controlled Programmable Current Source Reference Design is a Single-Ended Primary Inductive Converter (SEPIC). The PIC16F616 microcontroller is programmable, allowing the user to modify or develop their own firmware routines to further evaluate the MCP1631HV Digitally Controlled Programmable Current Source Reference Design in this application. 2.2 FEATURES The MCP1631HV Digitally Controlled Programmable Current Source Reference Design has the following features: • • • • • • • • • Input Operating Voltage Range: +3.5V to +16V Firmware default output current of 700 mA with dimming ratio 10:1 (70 mA/step) Maximum output current of 1000 mA Maximum output power of 8.5W Drive one or more LEDs Firmware for charging Li-Ion, NiMH, and NiCd batteries ON/OFF/Dimming switch Status and fault indication Hardware and software overvoltage protection (OVP) set to 9.0V. The software value can be modified in the source code to be less than 9.0V © 2009 Microchip Technology Inc. DS51798A-page 7 MCP1631HV Digitally Controlled Programmable Current Source Reference Design 2.3 GETTING STARTED The MCP1631HV Digitally Programmable Current Source Reference Design is fully assembled and tested for driving and dimming power LEDs. At the output, one or more LEDs can be connected in parallel or series topology. With the default firmware, the board can drive a 700 mA load with 9V overvoltage protection. This board requires an external voltage source within a range of +3.5V to +16V input. User supplied LED’s are also required to evaluate the reference board. A user supplied thermistor mounted on the LED package is needed to use the thermal shutdown feature in firmware. Output Current (A) 0.8 700 mA Drive 0.7 0.6 0.5 350 mA Drive 0.4 0.3 0.2 0.1 0 0 2 4 6 8 10 12 14 16 Input Voltage (V) FIGURE 2-1: DS51798A-page 8 LED Driver Output Current vs. Input Voltage. © 2009 Microchip Technology Inc. Installation and Operation The MCP1631HV Digitally Programmable Current Source Reference Design firmware may be re-programmed with the charger profile for Li-Ion or NiMH/NiCd battery packs. Firmware profile pre-proccessor definitions are : • #define LION_SUPPORT DISABLED • #define NIMH_SUPPORT DISABLED • #define LED_DRIVER_SUPPORT ENABLED Setting one of the profiles to ENABLED and the other two to DISABLED will select the ENABLED profile at compile time. The re-compiled code will then perform the functions required for the selected profile. Figure 2-2 shows the charge profiles for a single-cell 1000 mAh Li-Ion battery pack. Figure 2-3 shows the charge profile for a three-cell 600 mAh NiMH battery pack with Temperature Shutdown disabled. Disabling the Temperature Shutdown is only done one time in the lab to profile the battery pack and chemistry. The Temperature Shutdown should always be enabled in production firmware to prevent the battery pack from overheating during a charge cycle. 5.0 2.0 4.0 1.6 3.0 1.2 2.0 0.8 Amps Volts VBAT IOUT 1.0 0.4 0.0 0.0 200 0 FIGURE 2-2: © 2009 Microchip Technology Inc. 50 100 Time (min) 150 Li-Ion Charge Profile for 1000 mAh Cell. DS51798A-page 9 MCP1631HV Digitally Controlled Programmable Current Source Reference Design I 5.0 1.0 VBAT 0.8 T/10 3.0 0.6 2.0 0.4 1.0 Amps Volts,°C/10 4.0 0.2 IOUT 0.0 0 20 40 60 80 0.0 100 Time (min) FIGURE 2-3: DS51798A-page 10 NiMH Three-Cell (3.6V/600 mAh) Charged at Maximum 0.75C. © 2009 Microchip Technology Inc. Installation and Operation 2.3.1 Power Input and Output Connection 2.3.1.1 POWERING THE MCP1631HV DIGITALLY PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN 1. Prepare the power supply to be connected to the input terminal block, J1. The input voltage source should be limited to the 0V to +16V range. For nominal operations, the recommended input voltage should be between +3.5 and +16 volts with a 12W input supply. 2. Connect the positive side of the input source (+) to pin +VIN of J1. Connect the negative or return side (-) of the input source to pin GND of J1. Refer to Figure 2-4. (+) LED Anode +VIN GND (+) THERMISTOR (optional) (-) LED Cathode (-) THERMISTOR (optional) FIGURE 2-4: 2.3.1.2 Power Supply and Load Connections Diagram. APPLYING A LOAD TO THE MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN 1. To apply an LED load to the MCP1631HV Digitally Controlled Programmable Current Source Reference Design, the anode of the LED should be connected to pin 1 (+) of J2. The cathode of the LED should be connected to pin 5 (-) of J2. The default drive current for LEDs is set to 700 mA in the supplied firmware. The LED load which is connected to the reference board must be capable of handling 700 mA. If the LED load is not capable of handling 700 mA, then the firmware must be re-compiled with the LED drive current set to the current capability of the LED load being used. The minimum programmed current that the board will generate is 10% of the programmed drive current. For the reference board firmware which is set to 700 mA of drive current, the minimum would be 70 mA. 2. Optionally, a thermistor referenced to the (-) pin of J2 may be utilized for thermal shutdown. The recommended thermistor is EPCOS Inc. P/N: B57500M0103A005. Note: © 2009 Microchip Technology Inc. The Thermal Shutdown is not enabled by default in the firmware. It can be enabled by re-compiling the source code with this feature enabled. The thermistor must be used if the board is programmed with NiMH/NiCd charger firmware. DS51798A-page 11 MCP1631HV Digitally Controlled Programmable Current Source Reference Design 2.3.1.3 USING THE REFERENCE BOARD The push button is used to switch the output ON or OFF (Standby). The first pressing of the power button will turn on the board and drive the output at 10% of programmed current (70 mA for the default firmware). The GREEN LED will flash with a 1 second period, indicating that it is in normal operating mode. The board is capable of a 10:1 dimming ratio. Each additional pressing of the power button will increment the output drive current by 10% of the programmed drive current up to the actual programmed drive current value. To switch the output OFF, press and hold the push button for about 2 seconds until the LED turns RED. 2.3.1.4 STATUS AND FAULT INDICATION The MCP1631HV Digitally Programmable Current Source Reference Design has a dual color (red/green) LED to indicate the status and faults. Table 2-1 shows the status of the LEDs during various states of operating modes. If a no load, overvoltage, or overtemperature fault condition occurs during operation, the fault condition will be indicated by a flashing RED LED. The RED LED will flash at a 1 Hz rate if an overtemperature condition has been detected. An overtemperature condition will result in Thermal Shutdown. The RED LED will flash at a 2 Hz rate if an overvoltage or missing load condition has been detected. An overvoltage or missing load condition will result in an Overvoltage Shutdown. A fault condition must exist for 5 consecutive firmware sampling periods to be validated as a hard fault. TABLE 2-1: STATUS OUTPUT STATE / FAULT DS51798A-page 12 LED Status Standby / Charge Complete State GREEN ON ON (Dimming or Charging) State GREEN Flashing Switching to Standby State RED ON after button press delay Over Temperature Fault RED Flashing (1 Hertz) Over Voltage Fault RED Flashing (2 Hertz) Charge Timeout Fault RED Flashing (2 Hertz) Calibration Complete State YELLOW (both LEDs ON) © 2009 Microchip Technology Inc. Installation and Operation 2.3.1.5 MCP1631 PROGRAMMABLE CURRENT SOURCE AS BATTERY CHARGER The MCP1631HV Digitally Controlled Programmable Current Source Reference Design reference board is provided with the LED driver firmware programmed into the U2 microcontroller. The reference board package also has compiled firmware *.hex files included for Li-Ion and NiMH/NiCd battery packs. There are two versions of charger firmware. One is for Li-Ion cells (00234R1-LiIon_Charger.hex) and the other is for NiCd/NIMH cells (00234R1-NiMH_NiCd_Charger.hex). 2.3.1.5.1 How to Connect and Charge a Battery with the MCP1631HV Digitally Controlled Programmable Current Source Reference Design To charge a battery pack with the MCP1631HV Digitally Controlled Programmable Current Source Reference Design, the positive connector of the battery should be connected to J2-1 (+). The negative terminal of the battery should be connected to J2-5 (-). A thermistor referenced to J2-5 (-) should be used for thermal shutdown if the battery chemistry is NiMH/NiCd. To evaluate a NiMH/NiCd battery charger pack that does not have an internal thermistor, it is recommended to attach an EPCOS Inc. P/N: B57500M0103A005 thermistor onto one of the cells of the battery pack. This thermistor should be connected to J2-4 (+) and J2-5 (-). Note: The maximum charge current for the Li-Ion chemistry is programmed and limited at 1A for a single cell (4.2V) or 500 mA for two cells in series topology. The pre-programmed maximum charge current for NiMH/NiCd chemistry is 700 mA. For evaluation, all charge parameters can be modified in source code. See the header file 00234R1.h for the pre-processor definitions. 2.3.1.5.2 Charge Profiles The pre-programmed parameters for the battery charge profiles are: • Li-Ion - Qualification: Precharge at 200 mA for VCELL < 3.0V - Constant Current: 1A for 1 Cell, 0.5A for 2 Cells - Constant Voltage: 4.20V (this value should be calibrated for better accuracy, see Section 2.3.1.5.4 “Calibrating the Output Voltage for the Li-Ion Chemistry Profile”) - Charge Termination: 70 mA for 1 Cell and 2 Cells - Overvoltage Detection: Once detected, attempts to restart the charge cycle 5 times. If overvoltage is still present, the charge cycle is aborted and the RED LED is flashed. • NiMH/NiCd - Qualification: Precharge at 140 mA for VCELL < 0.9V - Constant Current: 700 mA for 1 Cell to 4 Cell - Terminate Fast Charge for -dV/dT or +dT/dt - Top off Charge Current: 35 mA Top off Charge Time: 1 hour - Overvoltage Detection: Once detected, attempts to restart the charge cycle 5 times. If overvoltage is still present, the charge cycle is aborted and the RED LED is flashed. © 2009 Microchip Technology Inc. DS51798A-page 13 MCP1631HV Digitally Controlled Programmable Current Source Reference Design 2.3.1.5.3 How the MCP1631HV Digitally Controlled Programmable Current Source Reference Design Operates in Charger Mode Follow the instructions in Section 2.3.1.5.1 “How to Connect and Charge a Battery with the MCP1631HV Digitally Controlled Programmable Current Source Reference Design” to connect a battery pack at the board. In the Standby (OFF) state, the GREEN LED will be lit. Push the S1 button to start the charge profile and turn on the output. The GREEN LED will flash. If any fault conditions are detected during charging, the RED LED will flash and the output will automatically turn off. See Table 2-1 to identify the nature of the fault. When a charge cycle successfully completes, the GREEN LED will be turned ON and the output will be turned off. The system will stay in a Standby (OFF) state until the next button push. At any moment, the charging can be stopped by pressing and holding the push button until the RED LED turns on. The default calibration value for the Li-Ion pack is 4.2V. For better accuracy, the output voltage should be calibrated before starting a charge cycle. See Section 2.3.1.5.4 “Calibrating the Output Voltage for the Li-Ion Chemistry Profile” for instructions. 2.3.1.5.4 Calibrating the Output Voltage for the Li-Ion Chemistry Profile Prior to the first Li-Ion charging cycle, it is recommended to calibrate the charger termination voltage for better accuracy. Connect a 12V power supply to the J1 connector. Select another power supply for the calibration voltage and set it to the desired termination voltage between 3.9V and 4.20V. Connect the calibration power supply to the J2 connector. Connect the positive lead to J2-1 and the negative lead to J2-5. 1. Press S1 to turn on the board. 2. Wait for the GREEN LED to light. If it does not light, check for faults. 3. When the GREEN LED is lit, press and hold down S1 for 2 seconds until the YELLOW LED (both green and red LEDs) is lit. The YELLOW status indicator signals the calibration is complete. 4. The calibration power supply can now be removed from the J2 output connector. DS51798A-page 14 © 2009 Microchip Technology Inc. Installation and Operation 2.3.1.6 VIEW THE STATE OF MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN The MCP1631HV Digitally Controlled Programmable Current Source Reference Design is able to show, using an oscilloscope, the system state. To use this feature, connect the scope probe to test point TP1. Testpoint TP1 is output pin U2-8 of the PIC16F616 microcontroller. There are nine status waveforms listed below. A pulse stream of one to nine 10 µs pulses are generated at TP1 test point every one second interval. The pulse stream indicates the current state of the system software. Note that the first two states may complete immediately and thus may be difficult to capture on a non-storage scope. • • • • • • • • • 1 pulse - output power is switched ON 2 pulses - qualification charging 3 pulses - charging - NiMH / NiCd constant current mode 4 pulses - charging - NiMH / NiCd top off current mode 5 pulses - charging - Li-Ion constant current mode 6 pulses - charging - Li-Ion constant voltage mode 7 pulses - dimming - LED constant current mode 8 pulses - fault - overvoltage protection state 9 pulses - output power switched OFF (Standby) 2.3.1.7 PROGRAMMING THE PIC16F616 MICROCONTROLLER To evaluate the board, the firmware package provides 3 hex files for the LED driver, Li-Ion Battery Charger, and NiMH/NiCd Battery Charger. The board is factory programmed with the LED driver firmware for 700 mA maximum current and 10:1 dimming (~70 mA/step). All parameters may be changed in firmware to the desired value according to the output capability. The source code is commented extensively and helps the user to define the board. The header file, 00234R1.h, contains the pre-processor definitions which define the system. The user may modify the definitions to change specific system parameters to meet design goals. mikroElektronika’s mikroC compiler was used to compile the source code and create the hex files for downloading to the reference board. The mikroC compiler is available at http://www.mikroe.com. The compiler is not included with the reference board kit. Header J3 is provided for in-system circuit programming. A PICkitTM2 programmer may be connected to J3 to program the reference board. Connect the PICkitTM2 programmer to J3. Start the PICkitTM2 software. Set Device to PIC16F616. Erase the device. Select “File” then “Import Hex” from the menu. Browse to the desired *.hex firmware file to download. 6. Write the file. 7. The status window should indicate success or failure of the download. 1. 2. 3. 4. 5. © 2009 Microchip Technology Inc. DS51798A-page 15 MCP1631HV Digitally Controlled Programmable Current Source Reference Design NOTES: DS51798A-page 16 © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Appendix A. Schematic and Layouts A.1 INTRODUCTION This appendix contains the following schematics and layouts for the MCP1631HV Digitally Controlled Programmable Current Source Reference Design: • • • • Board Schematic Board – Top Solder Pads and Silk-Screen Layers Board – Top Copper Layer Board – Bottom Copper Layer © 2009 Microchip Technology Inc. DS51798A-page 17 MCP1631HV Digitally Controlled Programmable Current Source Reference Design BOARD – SCHEMATIC M A.2 1 2 3 4 5 6 7 8 2 1 3 DS51798A-page 18 © 2009 Microchip Technology Inc. Schematic and Layouts A.3 BOARD – TOP SOLDER PADS AND SILK-SCREEN LAYERS © 2009 Microchip Technology Inc. DS51798A-page 19 MCP1631HV Digitally Controlled Programmable Current Source Reference Design A.4 BOARD – TOP COPPER LAYER DS51798A-page 20 © 2009 Microchip Technology Inc. Schematic and Layouts A.5 BOARD – BOTTOM COPPER LAYER © 2009 Microchip Technology Inc. DS51798A-page 21 MCP1631HV Digitally Controlled Programmable Current Source Reference Design NOTES: DS51798A-page 22 © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Appendix B. Bill Of Materials (BOM) TABLE B-1: Qty BILL OF MATERIALS Reference Description Manufacturer Part Number 3 C1, C2, C4 CAP CERAMIC 10UF 25V X5R 1206 Panasonic® - ECG ECJ-3YB1E106M 1 C10, C12 CAP 1500PF 50V CERM CHIP 0805 Panasonic - ECG ECJ-2VB1H152K 1 C3 CAP CER 2.2UF 25V X7R 0805 Murata Electronics® North America GRM21BR71E225KA7 3L 1 C5 CAP .1UF 16V CERAMIC X7R 0805 Panasonic - ECG ECJ-2VB1C104K 8 C6, C8 ,C9, C13, CAP CER 1.0UF 25V X7R 0805 C14, C15, C16, C17 Taiyo Yuden TMK212BJ105KG-TR 2 C7, C11 CAP 22PF 50V CERM CHIP 0805 SMD Panasonic - ECG ECJ-2VC1H220J 1 D1 DIODE SCHOTTKY 30V 3A SMA ON Semiconductor MBRA340T3G 2 D2 LED Dual RED/GREEN Clear SOT-23 Lumex® Opto/Components Inc. SSL-LX15IGC-RP-TR 1 J2 CONN HEADER 5POS .100 VERT TIN FRICTION LOCK Molex® Electronics 22-23-2051 1 J3 CONN HEADER 5POS .100 VERT TIN Molex Electronics 22-03-2051 1 L1 SMD-Shielded Power Transformers Wurth Elektronik (SEPIC) WE-DD 744877100 1 PCB RoHS Compliant Bare PCB, Digitally Controlled Programmable Current Source Reference Design Microchip Technology Inc. 104-00234 1 Q1 MOSFET N-CH 30V 5.9A 8-SOIC Vishay® / Siliconix SI4346DY-T1-E3 Semiconductor® 1 Q2 MOSFET N-CH 60V 280MA SOT-23 Fairchild 2 R1, R19 RES 10.0K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF1002V 1 R12 RES 10.0 OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF10R0V 2 R14, R20 RES 49.9K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF4992V 1 R15 RES 107K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF1073V 1 R16 RES 20.0K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF2002V 2 R17, R18 RES 40.2K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF4022V Note 1: NDS7002A The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. © 2009 Microchip Technology Inc. DS51798A-page 23 MCP1631HV Digitally Controlled Programmable Current Source Reference Design TABLE B-1: Qty BILL OF MATERIALS (CONTINUED) Reference Description Manufacturer Part Number 1 R21 RES 3.92K OHM 1/8W 1% 0805 SMD 1 R24 RES 0.0 OHM 1/8W 5% 0805 SMD Panasonic - ECG ERJ-6GEY0R00V 1 R4 RES 39.2K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF3922V 2 R6, R7 RES 1.00K OHM 1/8W 1% 0805 SMD Panasonic - ECG ERJ-6ENF1001V 1 U1 MCP1631HV 3.3V 20 Pin TSSOP High Speed PWM Microchip Technology Inc. MCP1631HV-330E/ST 1 U2 IC PIC MCU 14-Pin Flash-Based, 8-Bit CMOS MCU Microchip Technology Inc. PIC16F616-I/SL Note 1: Panasonic - ECG ERJ-6ENF3921V The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. DS51798A-page 24 © 2009 Microchip Technology Inc. MCP1631HV DIGITALLY CONTROLLED PROGRAMMABLE CURRENT SOURCE REFERENCE DESIGN Appendix C. Demo Board Firmware C.1 SUMMARY DEVICE FIRMWARE FLOWCHART - LED DRIVER For the latest version of the MCP1631HV Digitally Controlled Programmable Current Source Reference Design LED Driver firmware, visit our web site at www.microchip.com. START Initialize: Processor, Parameters (ILEDmin = 70 mA, ILEDmax = 700 mA), Timers, Sample ADC() No S1 Pressed? Yes ILEDmin Yes OVP Test VOUT> 9.0V? No Shutdown No S1 Pressed? Yes No OVP time retries >5 S1 pressed > = 2s? Yes No Increment IREF(70 mA) Yes Shutdown Fault END FIGURE C-1: © 2009 Microchip Technology Inc. Summary LED Driver Flowchart. DS51798A-page 25 Demo Board Firmware C.2 SUMMARY DEVICE FIRMWARE FLOWCHART - LI-ION CHARGER For the latest version of the MCP1631HV Digitally Controlled Programmable Current Source Reference Design Li-Ion Charger firmware, visit our web site at www.microchip.com. START Yes S1 pressed > 2s ? Initialize: Processor, Parameters, Timers; SampleADC() Yes No OVP Test VBATT >4.4V/Cell? S1 pressed? No Yes No No Precondition Current Mode I=200 mA Calibrate LiIon() VBATT > 3.0V/Cell? Yes Constant Current Mode Yes MAX = 1.0A 1 Cell MAX = 0.5A 2 Cell VBATT<4.2V? No Constant Voltage Mode No Charge Timer =0? No V BATT>4.2V? Yes Yes Decrement IBATT Shutdown No IBATT <= 70 mA? Yes Shutdown (charge complete) Shutdown OVP No time retries >5 Yes END FIGURE C-2: © 2009 Microchip Technology Inc. Fault Summary Li-Ion Charger Profile Flowchart. DS51798A-page 26 Demo Board Firmware C.3 SUMMARY DEVICE FIRMWARE FLOWCHART - NIMH/NICD CHARGER For the latest version of the MCP1631HV Digitally Controlled Programmable Current Source Reference Design NiMH/NiCd Charger firmware, visit our web site at www.microchip.com. START Initialize: Processor, Parameters, Timers; SampleADC() S1 pressed? No Yes Yes ChargeTimer=0? Shutdown No Yes Is VBATT > 1.8V / Cell? No Cell temp > 40oC? Shutdown Yes No No Is VBATT > 0.9V / Cell? OVP time retries >5 Precondition No Current Mode Yes Fast charge Mode ICHARGE = 700 mA Yes Fault dV/dt<-10mV dT/dt>1.5C No Yes TopOff Charge Mode Charge Timer = 1h Yes No Cell Temp > 40°C? No OVP? No OTP No time retries > 5? Yes ChargeTimer=0? Yes Yes Fault OTP time retries > 5? No Yes Fault Shutdown END FIGURE C-3: © 2009 Microchip Technology Inc. Summary NiMH/NiCd Charger Profile Flowchart. DS51798A-page 27 WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.com Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 India - Bangalore Tel: 91-80-3090-4444 Fax: 91-80-3090-4080 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Cleveland Independence, OH Tel: 216-447-0464 Fax: 216-447-0643 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara, CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 Taiwan - Hsin Chu Tel: 886-3-6578-300 Fax: 886-3-6578-370 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 03/26/09 DS51798A-page 28 © 2009 Microchip Technology Inc.