AN1156. Battery Fuel Measurement Using Delta-Sigma ADC Devices INTRODUCTION REVIEW OF BATTERY CHARGING AND DISCHARGING CHARACTERISTICS



Similar documents
TB3016. Using the PIC MCU CTMU for Temperature Measurement IMPLEMENTATION BASIC PRINCIPLE MEASUREMENT CIRCUIT

AN1286. Water-Resistant Capacitive Sensing INTRODUCTION THEORY OF OPERATION. Sensing Steps. Sensing Steps Description DESIGN

AN1303. Software Real-Time Clock and Calendar Using PIC16F1827 DATA INTERFACE INTRODUCTION IMPLEMENTATION INTERNAL REGISTER MAP

AN687. Precision Temperature-Sensing With RTD Circuits RTD OVERVIEW INTRODUCTION EQUATION 1:

AN1142. USB Mass Storage Class on an Embedded Host INTRODUCTION. USB Mass Storage Class. Overview

AN Wire Communication with PIC Microcontroller INTRODUCTION. OVERVIEW OF THE 1-Wire BUS. 1-Wire Protocol. Prerequisites

Installing and Licensing MPLAB XC C Compilers

Recommended Usage of Microchip 23X256/23X640 SPI Serial SRAM Devices RECOMMENDED CONNECTIONS FOR 23X256,23X640 SERIES DEVICES VCC 23X256/ HOLD.

AN1325. mtouch Metal Over Cap Technology THEORY OF OPERATION INTRODUCTION CROSS SECTION OF METAL OVER CAPACITIVE (UNPRESSED)

Universal Programming Module 2

Designing A Li-Ion Battery Charger and Load Sharing System With Microchip s Stand-Alone Li-Ion Battery Charge Management Controller

TC1047/TC1047A. Precision Temperature-to-Voltage Converter. General Description. Applications. Block Diagram. Features.

Uninstalling Incorrect USB Device Drivers

MCP73X23 Lithium Iron Phosphate (LiFePO 4 ) Battery Charger Evaluation Board User s Guide

Timers: Timer0 Tutorial (Part 1)

AN1275. KEELOQ with Advanced Encryption Standard (AES) Receiver/Decoder KEY FEATURES OVERVIEW. Microchip Technology Inc.

AN1332. Current Sensing Circuit Concepts and Fundamentals CURRENT SENSING RESISTOR INTRODUCTION. Description. Microchip Technology Inc.

AN1470. Manchester Decoder Using the CLC and NCO ABSTRACT INTRODUCTION MANCHESTER ENCODED DATA (AS PER G.E. THOMAS)

AN1265. KEELOQ with AES Microcontroller-Based Code Hopping Encoder INTRODUCTION DUAL ENCODER OPERATION BACKGROUND FUNCTIONAL INPUTS AND

Features, Value and Benefits of Digital Control for Power Supplies

WORKSHOP-IN-A-BOX 2: LOW POWER SOLUTIONS DEMONSTRATION BOARD

AN1857. RGBW Color Mixing DALI Control Gear. COLOR MIXING USING RED, GREEN, BLUE AND WHITE LEDs INTRODUCTION HARDWARE

AN1353. Op Amp Rectifiers, Peak Detectors and Clamps INTRODUCTION BASIC RECTIFIERS. Choosing the Components. Positive Half-Wave Rectifier.

AN1492. Microchip Capacitive Proximity Design Guide INTRODUCTION CAPACITIVE SENSING BASICS SENSING

AN1212. Using USB Keyboard with an Embedded Host INTRODUCTION. USB Keyboard Overview. USB Keyboard with an Embedded Host USB KEYBOARD OUTPUT REPORT

TC7660. Charge Pump DC-to-DC Voltage Converter. Package Types. Features. General Description. Applications. Functional Block Diagram TC7660

AN905. Brushed DC Motor Fundamentals INTRODUCTION PRINCIPLES OF OPERATION. Stator. Rotor SIMPLE TWO-POLE BRUSHED DC MOTOR. Microchip Technology Inc.

AN1256. Microchip s Power MOSFET Driver Simulation Models INTRODUCTION MODEL DESCRIPTION. Using The Power MOSFET Simulation Models

AN1543. Using MRF24W with PIC32 Internal Program Flash Memory For EZ_CONFIG_STORE ALTERNATIVE LOW-COST SOLUTIONS OVERVIEW SCOPE

MCP2515 CAN Bus Monitor Demo Board User s Guide

PIC32 Microcontroller Families

MCP73811/2. Simple, Miniature Single-Cell, Fully Integrated Li-Ion / Li-Polymer Charge Management Controllers. Description. Features.

AN1066. Microchip MiWi Wireless Networking Protocol Stack INTRODUCTION CONSIDERATIONS TERMINOLOGY FEATURES

Resistive Temperature Detector (RTD) Reference Design

MCP1701A. 2 µa Low-Dropout Positive Voltage Regulator. Features. General Description. Applications. Package Types

Section 15. Input Capture

MCP2200 USB to RS-232 Demo Board User s Guide

Integrated Development Environment

Touch Through Metal. mtouch Metal Over Capacitive Technology Part 1

dspic30f3012/3013 dspic30f3012/3013 Rev. B0 Silicon Errata dspic30f3012/3013 (Rev. B0) Silicon Errata Silicon Errata Summary

AN1465. Digitally Addressable Lighting Interface (DALI) Communication TERMINOLOGY PHYSICAL LAYER DALI FREE-FORM LAYOUT. Topology FIGURE 1:

Analog-to-Digital Converters

TCP/IP Networking: Web-Based Status Monitoring

Integrated Development Environment

28-PIN DEMO BOARD USER S GUIDE

How To Use Microchip.Com

AN956. Migrating Applications to USB from RS-232 UART with Minimal Impact on PC Software OVERVIEW INTRODUCTION. Microchip Technology Inc.

PICkit 3 Programmer/Debugger User s Guide

AN1307 FULL STEP MODE PHASE VOLTAGE AND PHASE CURRENT MICROSTEPPING WITH 1/4 STEP SIZE

TABLE 1: BUCK REGULATOR

AN1861. Bluetooth Smart Communication Using Microchip RN4020 Module and 16-bit PIC Microcontroller BLUETOOTH SMART COMMUNICATION INTRODUCTION

MPLAB XC8 GETTING STARTED GUIDE. MPLAB XC8 Getting Started Guide

MCP3004/ V 4-Channel/8-Channel 10-Bit A/D Converters with SPI Serial Interface. Features. Description. Applications.

PICkit 2 Microcontroller Programmer USER S GUIDE

AN990. Analog Sensor Conditioning Circuits An Overview INTRODUCTION SENSOR APPLICATIONS. Target Audience. Goals. Description.

PIC10F200/202/204/206

LIN Serial Analyzer User s Guide Rev2.0

Section 5. Flash Programming

MPLAB Code Configurator User s Guide

MCP3204/ V 4-Channel/8-Channel 12-Bit A/D Converters with SPI Serial Interface. Features. Description. Applications.

AN884. Driving Capacitive Loads With Op Amps INTRODUCTION LINEAR RESPONSE. Simplified Op Amp AC Model. Overview. Purpose OP AMP MODEL EQUATION 1:

AN1426. Design Tips for the MCP3911 INTRODUCTION. Addressable Devices on Single SPI Bus. Addressable SPI for Poly-phase Meter Designs.

PIC18F26K20/46K20 Rev. B2/B3/B5/B6 Silicon Errata and Data Sheet Clarification

Serial EEPROM Powered for Automotive

AN232. Low-Frequency Magnetic Transmitter Design ABOUT THIS APPLICATION NOTE INTRODUCTION LFMC LINK COMPONENTS

AN709. System Level Design Considerations When Using I 2 C TM Serial EEPROM Devices INTRODUCTION INSURING BUS-FREE DURING POWER-UP

Selecting the MCU Memory Technology That s Right for You

AN688. Layout Tips for 12-Bit A/D Converter Application GETTING A GOOD START INTRODUCTION. Microchip Technology Inc. / 2 MCP602

AN645. PIC16C57 Based Code Hopping Security System PINOUT OVERVIEW FEATURES BLOCK DIAGRAM RECOMMENDED READING

AN1140. USB Embedded Host Stack INTRODUCTION USB OVERVIEW. Host vs. Embedded Host. USB Hosts and Peripheral Devices

AN1095. Emulating Data EEPROM for PIC18 and PIC24 Microcontrollers and dspic Digital Signal Controllers INTRODUCTION THEORY OF OPERATION

PICmicro DC Motor Control Tips n Tricks

TCM809/TCM Pin Microcontroller Reset Monitors. General Description. Features. Applications. Pin Configurations. Typical Application Circuit

MCP3021. Low Power 10-Bit A/D Converter With I 2 C Interface. Description. Features. Applications. Functional Block Diagram.

Peripheral Brief: Programmable Switch Mode Controller (PSMC) 1, 2, 4, 8 PSMCXTMR CLR PSMCXPR = Period. Event PSMCXPRS. Rising.

MPLAB ICD 3 In-Circuit Debugger User s Guide For MPLAB X IDE

AN2680 Application note

TC4423A/TC4424A/TC4425A

PICkit TM 2 Microcontroller Programmer USER S GUIDE

AN1387. Using PIC32 MCUs to Develop Low-Cost Controllerless (LCC) Graphics Solutions INTRODUCTION. Basic Graphics Definitions

ZENA Wireless Network Analyzer User s Guide

AN1370. Smart Card Communication Using PIC MCUs INTRODUCTION SMART CARD COMMUNICATION USING PC APPLICATION

dspic Digital Signal Controllers

PDIP, MSOP, SOIC, TSSOP

Software Real Time Clock Implementation on MC9S08LG32

AN2389 Application note

Uninstalling Incorrect USB Device Drivers

AN1106. Power Factor Correction in Power Conversion Applications Using the dspic DSC INTRODUCTION

AN1521. Practical Guide to Implementing Solar Panel MPPT Algorithms SOLAR PANEL MPPT INTRODUCTION

Introduction to the dspic DSC SMPS (Part 1)

Bootloader for dspic30f/33f and PIC24F/24H Devices

AN1767. Solutions for Radio Frequency Electromagnetic Interference in Amplifier Circuits WHAT IS ELECTROMAGNETIC INTERFERENCE (EMI)

MPLAB Starter Kit for dspic Digital Signal Controllers User s Guide

MCRF khz Passive RFID Device with Sensor Input. Not recommended for new designs. Package Type. Features. Description. Applications PDIP/SOIC

ZENA Wireless Network Analyzer User s Guide

AN1305. Sensorless 3-Phase Brushless Motor Control with the PIC16FXXX TYPICAL MOTOR CONNECTION OVERVIEW DRIVE AND CONTROL CIRCUITRY

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

M Floating Point to ASCII Conversion

Processor Extension Pak (PEP) and Debug Header Specification

"Charging Lithium-Ion Batteries: Not All Charging Systems Are Created Equal"

Transcription:

Battery Fuel Measurement Using Delta-Sigma ADC Devices Author: INTRODUCTION Youbok Lee, Ph.D. Microchip Technology Inc. The battery fuel status indicator is a common feature of the battery-supported handheld devices. The battery fuel measurement is achieved by measuring the discharging and charging currents in real time. The discharging current is the current coming out from the battery and the charging current is the current flowing into the battery. The fuel used (mah) and the fuel remaining (mah) are calculated by tracking the discharging and charging currents over time. The fuel used is the total discharged current over time and the remaining fuel is simply the subtraction of the fuel used from the fully charged fuel. The behavior of the battery fuel is greatly affected by temperature and the battery aging. A true battery management needs to consider these effects by measuring current, voltage, and temperatures with a function of time. The battery voltage and current measurement is achieved using an analog-to-digital converter (ADC). The accuracy of the fuel management relies on the accuracy of the ADC performance. Measuring the battery voltage is straightforward. However, the current measurement is achieved indirectly using a current sensor. The current sensor has a resistive component. When the current flows through the current sensor, there is a voltage drop across the sensor element. The current is calculated by measuring the voltage drop on the known resistive value of the sensor. The system designers must be aware that the voltage drop across the current sensor is waste that brings down the battery voltage budget for the system. Therefore, it is best to use a current sensor that has the smallest resistance value, as possible. The voltage drop across the current sensor is inversely proportional to the resistance value of the sensor element. If the ADC bit resolution is not enough, the system may not be able to detect the current in µa or low ma range, unless the current sensor has a high resistance value. Therefore, for current measurement, a high bit resolution ADC or a high resolution ADC with internal programmable gain amplifier (PGA) is preferred. Today s integrated battery fuel gauging devices include both the ADC and the control logic circuits. The feature sets for these devices are still evolving to meet general application specifications. These devices are still relatively expensive for cost-sensitive product designers. Furthermore, due to the limitations in bit resolution of the internal ADC circuit, the accuracy may not be sufficient for certain applications. Instead of using the integrated fuel gauging devices, some clever designers create their own fuel gauging algorithm by using firmware for the microcontroller unit (MCU). The current and voltage are measured using a stand-alone ADC device of their choice. This choice provides flexible solutions for their application and enables them to manage their battery fuel economically. Since the MCU is used regardless of which option is chosen, the cost-saving can be significant in high volume applications. Depending on the battery used and the application, the system designers can make various tradeoffs in the fuel measurement. Some designers only need battery voltage for simple applications or some need a sophisticated fuel gauging function for accurate applications. This application note reviews the battery fuel measurement using the MCU and ADC devices. REVIEW OF BATTERY CHARGING AND DISCHARGING CHARACTERISTICS The battery discharging behavior changes with various parameters, such as battery chemical type, load current, temperature, and aging. Figure 1 shows the battery discharging curves of several battery chemical types. The battery discharging curve of most batteries is almost flat until it reaches about 80% of its full range, and then falls off sharply after that. Since the battery s internal chemical reaction is largely governed by voltage and temperature, the battery discharging behavior is greatly affected by the temperature. The low temperature limit is determined by the freezing temperature of the electrolyte. Most batteries do not work well below -40 C. The battery performs better at higher temperatures. This is because the chemical reaction processing is accelerated at higher temperatures. However, the rate of undesirable chemical reactions increases and results in an acceleration of battery life. At extremely high temperatures, the active chemicals become unstable and can destroy the battery. 2008 Microchip Technology Inc. DS01156A-page 1

Figure 2 shows the battery discharging curve versus temperature. As shown in Figures 1 and 2, a true battery fuel management system requires monitoring both the current, the voltage, and the temperature. Cell Voltage (V) Battery Discharge Characteris- FIGURE 1: tics. Cell Voltage (V) 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 Li-Ion Lead-Acid 20 % 40 % 60 % 80 % 100 % % of Capacity Discharged -25 o C 55 o C 25 o C FIGURE 2: LI-Ion Battery Discharge Characteristics vs. Temperature. Ni-Zn Ni-Cd NiMh ZnMnO2 1 2 3 4 5 6 7 8 10 9 Discharge Time (Hour) KEY FEATURES OF THE MCP3421 18- BIT DELTA-SIGMA ADC FAMILY The MCP3421 ADC family has unique features for voltage and current measurement applications. The MCP3421 is an 18 bit, single channel, Delta-Sigma ADC with user programmable configuration bit settings. The device has two operating modes: (a) Continuous and (b) One-Shot mode. In the continuous mode, the device performs conversions continuously. During the conversion time, the device draws about 140 µa. However, in the One-Shot mode, the device automatically switches to current saving mode after one conversion is completed. Assuming the device is configured for 18 bit mode, and taking data once per second, it draws only about 40 µa. In standby mode, it draws only about 100 na. This feature is extremely useful for battery powered low power applications. The device has an internal programmable gain amplifier (PGA) with a gain of up to 8 and an internal reference voltage of 2.048V. This PGA gain feature is very useful when measuring low voltage drops across the low resistance current sensor. The input is internally multiplied by a factor of 8 before the ADC conversion takes place. This means the PGA can detect an input signal eight times lower than its LSB size. The 2.048V internal reference voltage is useful because the ADC performance is not affected by the V DD variations. However, it limits the input range to a maximum of 2.048V. Because of this limit, a simple voltage divider circuit may be necessary to measure a battery voltage higher than the reference voltage. The MCP3421 family consists of single, dual, and four channels devices. Key features of the MCP3421 device family are: Programmable ADC resolution: - 12 bits, 14 bits, 16 bits, or 18 bits. Differential or single-ended input operation On-board Voltage Reference On-board Programmable Gain Amplifier (PGA): - Gains of 1, 2, 4 or 8 One-Shot or Continuous Conversion Options Low current consumption: - 145 µa typical in Continuous Conversion) - One-Shot Conversion (1 SPS) with V DD = 3V: 39 µa typical with 18 bit mode 9.7 µa typical with 16 bit mode 2.4 µa typical with 14 bit mode 0.6 µa typical with 12 bit mode DS01156A-page 2 2008 Microchip Technology Inc.

BATTERY VOLTAGE MEASUREMENT USING ADC Figure 3 shows the battery voltage measurement circuit using the MCP3421 device (U1). Since the MCP3421 device has an internal reference voltage, the measurable maximum input voltage range is limited to the internal voltage reference voltage of up to 2.048V. Therefore, to measure the input voltage higher than the internal reference, a voltage divider is needed formed by R 1, R 2, and R 3. The R 3 is optional and is used to calibrate the R 1 and R 2 component tolerance. By choosing the series resistance value of the voltage divider to be very high (> 1 MΩ), the current losses due to the voltage divider is negligible. In the example circuit as shown in Figure 3, the ADC is configured as single ended by connecting the positive input pin (V IN +) to the battery voltage, while the negative input pin (V IN -) to the V SS. The ADC output is available to the MCU via the I 2 C bus line. Figure 4 shows the discharge curve of a 3.7V Li-Polymer battery (3.7V, 170 mah). The curve shows that the battery voltage reduces linearly until it reaches about 80% of its full capacity. Since the battery discharging characteristics are very linear until the point where the curve falls off sharply, measuring only the battery voltage is an alternative low-cost method to estimate the current status of the battery. In this case, the measured battery voltage can be compared with the fuel values in the lookup table in the MCU firmware. The circuit shown can be used for measuring the battery voltage of any battery type. When the circuit is used, the voltage divider (R 1, R 2, R 3 ) must be properly adjusted in order to keep the maximum input voltage (or the voltage at V IN + pin when the battery is fully charged) to the ADC device is less than the ADC internal reference voltage (2.048V). Although using the voltage alone is not sufficient to represent the battery fuel status, this method is widely used for simple and cost-sensitive applications because of its straightforward implementation. To Load Voltage at V IN + pin = Battery Volt * (R 2 + R 3 ) R 1 + (R 2 + R 3 ) LSB = 2.048V = 15.625 µv 2 (18-1) FIGURE 3: Battery Voltage Measurement. 2008 Microchip Technology Inc. DS01156A-page 3

Actual Curve Linear Approximation Line FIGURE 4: Battery Voltage Discharging Curve of 3.7V Li-Polymer Battery. DS01156A-page 4 2008 Microchip Technology Inc.

Start Send I 2 C Write Command to write the ADC Configuration Register Bits (One-shot conversion and 18 bit mode, PGA = 1) Send I 2 C Read Command and Acquires 18 Bits of Conversion Data Convert the acquired digital data into voltage: Measured Voltage = Acquired ADC Code * LSB where: LSB = 2.048V = 15.625 µv 2 (17) Battery Voltage = Measured Voltage * = Measured Voltage * 1 Scale Factor of Voltage Divider Circuit R1 + (R2 + R3) (R2 + R3) No Do you want to display the voltage on LCD? Yes Convert the resulting Input Battery Voltage in binary form to decimal number Display the Battery Voltage in LCD FIGURE 5: MCU Firmware Flow Chart for Battery Voltage Measurement. 2008 Microchip Technology Inc. DS01156A-page 5

DISCHARGING AND CHARGING CURRENT MEASUREMENT Figure 6 shows the battery discharging and charging current measurement circuit using the MCP3421 ADC device. In the discharging mode, the direction of the current is from the battery to the load via the current sensor element. The current flows through the current sensor causing a voltage drop across the sensor due to the sensor s resistive component. This voltage drop is measured by the MCP3421 device. In the example circuit, the MCP3421 s differential input pins are connected across the current sensor. In the discharging mode, the voltage at the V IN + input pin is positive with respect to the voltage at the V IN - pin. In the charging mode, the polarity is opposite due to the opposite direction of the current flow. The MCU can determine the direction of the current by testing the sign bit (MSB) in the ADC output code. When the designers choose the current sensor, they need to consider both the battery voltage budget and the ADC bit resolution. Since the voltage drop due to the current sensor is losses, it needs to be minimized. On the other hand, it must be high enough to be measured by the ADC. In theory, the ADC can measure the input signal as long as it is greater than 1 LSB (Least Significant Bit). EQUATION 1: LSB OF MCP3421 LSB = Reference ------------------------------------------- Voltage = 2.048V ---------------- = 15.625 μv Where: 2 n 1 2 17 n = number of bit resolution Assuming a load curret of 10 ma is passing through a 10 mω current sensor, the voltage drop across the current sensor becomes 100 µv. This is equivalent to 6.4 LSB of the 18 bit MCP3421 ADC device, or 6.4 output codes. The MCP3421 device has an internal PGA. By setting the PGA to a gain of 8, the input is boosted to 800 µv internally before the ADC conversion takes place. This results in 51 LSB or 51 output codes which are sufficient for measurement. This example shows that the current measurement needs a high resolution ADC for accurate measurement. Furthermore, the ADC with an internal PGA is the preferred choice unless you are using a relatively high resistance current sensor. The current is calculated by dividing the measured voltage by the known resistance value of the current sensor. By doing this, the current can be measured periodically with a small time interval. The measured value is then added over time. The total fuel used is the sum of the measured discharging current over time, and the remaining battery fuel is the difference between the battery fuel when it is fully charged and the fuel used. The calculation of these parameters can be done using the MCU firmware. EQUATION 2: I = CURRENT CALCULATION ----------------------------------------------- Measured Voltage R of Current Sensor EQUATION 3: TOTAL BATTERY FUEL USED (DISCHARGED) N Fuel Used( mah) = Discharging Current( ma) ΔTime( n) n = 1 N Fuel Used( mah) = Discharging Current( ma) ΔSecond ------------------------------ ( n) 3600 n = 1 EQUATION 4: REMAINING BATTERY FUEL Fuel Remaining ( mah) = Battery Full Capacity( mah) Fuel Used ( mah) DS01156A-page 6 2008 Microchip Technology Inc.

The MCU firmware involves controlling the MCP3421 ADC device for conversion data, multiplication, division, and binary to decimal conversion. The MCU code examples for these operations are included in the attached firmware. FIGURE 6: Battery Discharging and Charging Current Measurement. 2008 Microchip Technology Inc. DS01156A-page 7

Start Send I 2 C Write Command to write the ADC Configuration Register Bits (One-shot conversion, 18 bits mode, PGA = 8) Send I 2 C Read Command and Acquires 18 Bits of Conversion Data No Sign Bit = 0? ADC Data = MSB = 1 two s complement of Acquired ADC Data This is the discharging current Yes This is the battery charging current. The direction of current is MSB = 0 The current flows into the battery. from the battery to the load. Convert the acquired ADC code into voltage: Measured Voltage = Acquired ADC Code 8 * LSB where: LSB = 2.048V = 15.625 µv 2 (18-1) (Dividing the factor of 8 is to take care of the PGA setting for the input signal.) Convert to current: Current = Measured Voltage Resistance Value of Current Sensor No Do you want to display the current on LCD? Yes Convert the current in binary form into decimal number Display the value in LCD FIGURE 7: MCU Firmware Flow Chart for Battery Current Measurement. DS01156A-page 8 2008 Microchip Technology Inc.

VOLTAGE AND CURRENT MEASUREMENT USING DUAL CHANNEL ADC channel. The same principles that are described in the previous sections for voltage and current measurement are applicable here, except the channel multiplexing. Figure 8 shows the circuit example measuring both battery voltage and current. A dual channel MCP3421 ADC device is used for this measurement. The MCU can measure the voltage and current by multiplexing its 2-channel MCP3421 Family Device FIGURE 8: Battery Voltage and Current Measurement. 2008 Microchip Technology Inc. DS01156A-page 9

BATTERY FUEL GAUGING ALGORITHM USING THE MCP3421 BATTERY FUEL GAUGE DEMO BOARD Figure 9 shows the MCP3421 Battery Fuel Gauge Demo Board and Figure 10 shows the schematics. The MCP3421 Battery Fuel Gauge Demo Board measures the battery voltage and current every second and calculates the battery fuel being used and remaining. The measured and calculated results are displayed on LCD. If the rechargeable battery is used, it can recharge the battery if needed. In the circuit, two MCP3421 devices are used to measure the voltage (U5) and current (U1) separately. A dual channel device (U6) can replace the U5 and U1 functions. The U6 is not populated on the board. The R3, R4, and R1 form a voltage divider circuit. The R1 is an adjustable resistor to calibrate the R3 and R4 tolerance. When the total resistance of these resistors are larger than 1 MΩ, the current draw due to the voltage divider is negligible. R12 is the 0.01Ω - current sensor. All load currents are passing through R12. R11 represents the total load resistance (100Ω). This value is simply chosen to represent a load condition and can be any number. With the conditions above and a 1.5V AAA battery, the load current becomes 15 ma. The voltage drop across the current sensor is: When the ADC U1 is configured with a PGA gain setting of 8 and operated with 18 bit resolution, the total number of useful digital conversion code (or counts) from the ADC device is: EQUATION 5: V = 15mA 0.01Ω = 150μV Input Voltage to the ADC Converter with PGA setting of 8 = 150 µv * 8 = 1.2 mv Total Number of Useful ADC Code Count = 1.2 mv LSB ( = 15.6 µv) the ADC component price increases with the bit resolution due to the cost that is associated with the device test time. By setting the PGA to a gain of 8, the MCP3421 device can measure the input voltage as low as 1.953 µv. This is the LSB size of a 21-bit ADC, which is the equivalent of gaining 3 extra bits while using the 18-bit ADC device. The MCU firmware tracks the current flow across the current sensor and calculates the fuel used and remaining. The MCP73831 (U3) is a single cell Li-Ion/Li-Polymer battery charger. The MCU controls the PROG pin to start or stop recharging the battery. The MCU also monitors the STATUS pin for the battery recharging condition. Figure 11 shows the flowchart of the algorithm example used in the MCP3421 Battery Fuel Gauge Demo Kit. Since the algorithm is based on the MCU firmware, the user can easily modify the algorithms for their own. MCU FIRMWARE EXAMPLES The MCU firmware examples for the Figures 9, 10, and 11 are attached in this application note. The firmware is written using the PIC18F4550 MCU. The rechargeable battery is 3.7V / 170 ma Li-Ion/Polymer Battery from Powerizer (P/N: PL052025) in California (Website: http://www.batteryspace.com). In the MCP3421 Battery Fuel Gauge Demo Board Kit, the battery recharge function is disabled, since the board is shipped to the customer with the 1.5 AAA nonrechargeable battery. However, the firmware examples in this application note use the rechargeable battery (P/ N: PL052025). The user can simulate the recharging battery feature using the MCP3421 Battery Fuel Gauge Demo Board Kit, attached firmware, and the specified rechargeable battery (P/N: PL052025). The MCP3421 Battery Fuel Gauge Demo Board Kit with this firmware tracks the battery fuel and allows the battery to be recharged after the fuel is consumed. The MCU firmware is downloadable (File Name: MCP3421 App Note on Battery Fuel Gauge.Zip). = 77 counts The example in Equation 5 is measuring the current flow of 15 ma through the 10 mω current sensor. It shows that about 77 digital codes are useful out of the total of 131072 available codes from the 18-bit MCP3421 ADC device. These available output codes are still sufficient enough to keep track of the current of 15 ma on 10 mω sensor. The higher number of useful codes gives the better accuracy, and it increases with the ADC s bit resolution and PGA settings. In general, DS01156A-page 10 2008 Microchip Technology Inc.

Connector for MPLAB ICD2 In-Circuit Menu Selection Switch 2x16 LCD Test Pins for Battery Charger USB Connector (not used) Battery Under Test + 9V Battery Connector (TP11) (See Note 1) 9V Power Supply (See Note 1) Potentiometer Current Sensor PIC18F4550 MCP3422 Footprint MCP3421 MCP73831 MCP3421 I 2 C Interface Test Points MCU MCLR Reset Switch Jumper for Discharging Path FIGURE 9: MCP3421 Fuel Gauge Demo Board. 2008 Microchip Technology Inc. DS01156A-page 11

M FIGURE 10: MCP3421 Fuel Gauge Demo Board Schematic. DS01156A-page 12 2008 Microchip Technology Inc.

Start Fuel Remaining (mah) = Initial Battery Fuel (fully charged, 170 mah) Get ADC value from U1 ( for Discharging Current) Multiply ADC counts * LSB (LSB = 15.625 µv) Get ADC value from U5 (for Battery Voltage) (Take into account the voltage divider at input) Display Discharging Current and Battery Voltage Battery Voltage < 50% and want to Recharge? Yes Fuel Used (mah) = Fuel Used (mah) + ΔDischarging Fuel (mah) No (Discharging Fuel (mah) = Discharging Current (ma s)/3600) Fuel Remaining (mah) = Fuel Remaining (mah) - Fuel Used (mah) Enable MCP73831 output (to recharge battery) Display Fuel Remaining and Fuel Used Disable MCP73831 output (recharging is done) Get ADC value from U1 ( for Charging Current) Get ADC value from U5 (Battery Voltage) Display Charging Current & Battery Voltage Fuel Remaining (mah) = Fuel Remaining (mah) + Fuel Charged (mah) Display Fuel Remaining Is Battery Fully Charged? or Interrupted? Yes No FIGURE 11: Battery Fuel Management Algorithm. 2008 Microchip Technology Inc. DS01156A-page 13

CONCLUSIONS The battery fuel gauging is relatively simple task if the device can keep track the current out of the battery (discharging current) and to the battery (charging current). The accuracy in the battery fuel gauging is depending on the accuracy of the current measurement. The stand-alone MCP3421 ADC family device provides much higher measurement accuracy than the ADC used in typical integrated fuel gauge devices. Beside its performance, it is also much cost saving choice. The MCU firmware examples that are needed for realizing the fuel gauging algorithm are shown in the attachment. The MCU firmware are based on the PIC18F4550. The examples include many valuable codes such as reading and writing of the MCP3421 ADC device, binary multiplications, divisions, binary to decimal conversion for LCD display, etc. The examples given in this application note do not include the temperature effect on the battery characteristics. REFERENCES [1] MCP3421 Data Sheet, 18-bit ADC with I 2 C Interface and On-Board Reference, DS22003, Microchip Technology Inc. [2] MCP3421 Battery Fuel Gauge Demo Board User s Guide, DS51683A, Microchip Technology Inc. [3] MCP73831/2 Data Sheet, Miniature Single-Cell, Fully Integrated Li-Ion, Li-Polymer Charger Management Controllers, DS21984, Microchip Technology Inc. [4] PIC18F2455/2550/4455/4450 Data Sheet, DS39632, Microchip Technology Inc. Note: The MCU firmware example shown in the attachment is only valid for the specified battery type. The user needs to modify the firmware for other battery types. DS01156A-page 14 2008 Microchip Technology Inc.

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, PRO MATE, rfpic and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, 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, PICkit, PICDEM, PICDEM.net, PICtail, PIC 32 logo, PowerCal, PowerInfo, PowerMate, PowerTool, REAL ICE, rflab, Select Mode, Total Endurance, UNI/O, 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. 2008, 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. 2008 Microchip Technology Inc. DS01156A-page 15

WORLDWIDE SALES AND SERVICE AMERICAS 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 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 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 ASIA/PACIFIC 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 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 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 ASIA/PACIFIC India - Bangalore Tel: 91-80-4182-8400 Fax: 91-80-4182-8422 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 Japan - Yokohama Tel: 81-45-471-6166 Fax: 81-45-471-6122 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan - Hsin Chu Tel: 886-3-572-9526 Fax: 886-3-572-6459 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 EUROPE Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 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 01/02/08 DS01156A-page 16 2008 Microchip Technology Inc.