Charging Batteries from USB

Sep 23, 2005

Abstract: USB offers great opportunities as a power source for all types of low power electronics, many of which are battery operated. The widespread availability of USB presents unique opportunities as well as challenges for battery-charging designs. This article describes how to interface a simple battery charger to a USB power source. This review of USB power bus characteristics include an overview of NiMH and Li+ battery technologies, charging methods, and charge termination techniques, and a complete circuit example for smart-charging NiMH cells from a USB port.


The Universal Serial Bus (USB) port is a bidirectional data port with power and ground. Peripherals of all types can be connected to the USB, including external drives, memory devices, keyboards, mice, wireless interfaces, video and still cameras, MP3 players, and countless other electronics. Many of these devices are battery powered, some with internal batteries. The widespread availability of USB presents unique opportunities, as well as challenges, for battery-charging designs. This paper describes how to interface a simple battery charger to a USB power source. This review of USB power bus characteristics includes voltage, current limits, inrush current, connectors, and cabling. An overview of nickel metal hydride (NiMH) and lithium battery technologies, charging methods, and charge-termination techniques is given. A complete example circuit for smart-charging NiMH cells from a USB port is presented, along with charging data.

USB Characteristics

The USB bus can provide power for low-power electronics. It is isolated from power mains and is relatively well regulated. However, there are limitations on available current and potential interactions between the load and the host or power source.

The USB port consists of a 90Ω bidirectional differential shielded twisted pair, VBUS (+5V power), and ground. These four wires are shielded with an inner shield of solid aluminum and a stranded outer shield. Copies of the USB 2.0 specification are available free of charge from the USB organization. Full compliance with the specification requires bidirectional communication between the device and the host through a function controller. The specification defines a unit load as 100mA (max). The maximum current that any device is allowed to draw is five unit loads.

USB ports are classified as either low-power ports, which supply up to one unit load, or high-power ports which supply up to five unit loads. When devices are first connected to the USB port, an enumeration process identifies the device to determine its load requirements. During this time, the device is only allowed to draw one unit load from the host. After the enumeration process, higher powered devices are permitted to draw higher current if the power-management software in the host allows it.

Some host systems (including downstream USB hubs) have current limiting either through fuses or active current sensors. If a USB device presents a high current (over one unit) load to the USB port without enumerating, it can cause a detectable overcurrent condition that could shut down one or more of the USB ports in use. Many commercially available USB devices, including stand-alone battery chargers, draw over 100mA without a function controller to handle the enumeration process; they run the risk of causing problems for the host under the wrong circumstances. For instance, if a device drawing 500mA is plugged into a bus-powered USB hub, it could overload both the hub port and the host port if it is not properly enumerated.

Further complications arise when the host operating system is using advanced power management, especially for notebook computers, and is expecting the port current to be extremely low. In some power-saving modes, the computer issues suspend commands to USB devices, which are then expected to go to a low-power mode. It is always a good idea to include a function controller to communicate with the host even with low-power devices.

The USB 2.0 specification is quite thorough and specifies power quality, connector construction, cable materials, allowable voltage drops, and inrush current. Low-current and high-current ports have different power-quality specifications. These are determined primarily by the voltage drop in the connectors and cabling between the host and the load, including voltage drop across a USB-powered hub. A host, such as a computer or self-powered USB hub, has high-current ports capable of supporting up to 500mA. Lower current ports are found on passive, bus-powered USB hubs. Table 1 gives the allowable tolerances for the voltage at the pins on the upstream (source) side of the USB port for high- and low-current ports.

Table 1. USB 2.0 specification power-quality standards
Parameter Requirement
DC voltage, high-power port* 4.75V to 5.25V
DC voltage, low-power port* 4.40V to 5.25V
Maximum quiescent current (low power, suspend mode) 500µA
Maximum quiescent current (high power, suspend mode) 2500µA
Maximum allowable Input capacitance (load side) 10µF
Minimum required output capacitance (host side) 120µF ±20%
Maximum allowable inrush charge Into load 50µC
*These specifications apply to the pins of the host or hub port connector on the upstream side. Additional I x R drops due to cables and connectors must be counted separately.

In hosts that are compatible with the USB 2.0 specification, the upstream side of a high-power port is provided with 120µF of low-ESR capacitance. The input capacitance of attached USB devices is limited to 10µF, and the total allowable charge drawn from the host (or powered hub) during an initial load connection is 50µC. Thus, when a new device is connected to a USB port, the transient voltage drop at the upstream port is less than half a volt. If more capacitance is required for correct operation of the load, it must be provided with an inrush current limiter to charge the larger capacitance at no greater than 100mA.

The allowable DC voltage drops for a USB port having a bus-powered USB hub with low-powered functions attached are shown in Figure 1. A high-power load connected to an unpowered hub has larger voltage drops than shown in Figure 1 and can overload the bus.

Figure 1. Drops larger than these allowable DC voltage drops from host to low-power load can overload the bus.
Figure 1. Drops larger than these allowable DC voltage drops from host to low-power load can overload the bus.

Battery-Charging Requirements

Single-Cell Lithium Ion and Lithium Polymer

Present-day lithium chemistries are typically 4.1V to 4.2V when the cells are charged to their maximum-rated capacity. Newer, higher capacity cells are being marketed with voltages in the 4.3V to 4.4V range. Typical prismatic lithium ion (Li+) and lithium polymer (Li-Poly) have capacities of 600mAh to 1400mAh.

The preferred charge profile for both Li+ and Li-Poly cells is to start the charge with a constant charge current until the cell voltage reaches the rated voltage. When this occurs, the charger then regulates the voltage across the cell. These two regulation states are called constant-current (CC) and constant-voltage (CV) charging; therefore, this type of charger is usually referred to as a CCCV charger. When the CCCV charger is in CV mode, the current into the cell begins to drop. For typical charge rates, between 0.5C and 1.5C, the transition between CC and CV mode occurs when the cell has accepted about 80% to 90% of its full-charge capacity. Once the charger is in CV charging mode, it then monitors the cell current; when it reaches a low threshold (milliamps or tens of milliamps), the charger terminates charge. A typical charge profile for a lithium chemistry battery is shown in Figure 2.

Figure 2. Typical results are shown for a Li+ battery charged using a CCCV charger.
Figure 2. Typical results are shown for a Li+ battery charged using a CCCV charger.

The USB voltage drops shown in Figure 1 show that a low-powered port, on the downstream side of a port-powered hub, would barely have enough headroom to charge a cell to 4.2V. Small amounts of additional resistance in the charge path could prevent proper charge.

Li+ and Li-Poly cells should be charged at moderate temperatures. Manufacturers' recommended maximum charging temperatures are typically in the +45°C to +55°C range, with allowable discharge temperatures about 10°C higher. The materials used in these cells are highly reactive and can ignite if the cell temperature exceeds +70°C. Chargers for lithium chemistry cells should be designed with a thermal cutoff circuit that monitors cell temperature and terminates charging if the cell temperature exceeds manufacturer-recommended maximum charging temperatures.

Nickel Metal Hydride Cells

NiMH cells are heavier and have less energy density than lithium-based cells. Historically, they have been less expensive than lithium, but the price gap has recently been shrinking. NiMH cells are available in standard sizes and are a direct replacement for alkaline cells in most applications. Nominally, each cell is 1.2V, and when fully charged they are as high as 1.5V.

NiMH batteries are usually charged with a constant-current source. As they reach the fully charged state, an exothermic chemical reaction occurs that causes the battery temperature to increase and the terminal voltage to decrease. Either the rate of rise of the battery temperature or a negative voltage change can be detected and used to terminate the charge. These termination methods are known as dT/dt and -ΔV, respectively. At very low charge rates, the dT/dt and -ΔV effects become less pronounced and can be difficult to detect accurately. The dT/dt and -ΔV responses begin as the cell starts to become overcharged. Continued charging beyond this point can damage the cell.

Termination detection at charge rates above C/3 is much easier than at low charge rates. The temperature rise is about 1°C/min, and the -ΔV response is more pronounced than at lower rates. After fast-charge terminates, an additional charging period at a reduced current is recommended to top off the cell (top-off charge). When the top-off charge cycle is done, a trickle-charge current of C/20 or C/30 counters the effects of self-discharge and maintains the battery in a fully charged state. A graph showing the cell voltage during a charging cycle of a partially charged NiMH cell using a DS2712 NiMH charger is shown in Figure 3. In this graph, the upper curve is data taken while current is being driven into the battery; the lower curve shows data taken with the charge current source turned off. In the DS2712, this difference in voltage is used to distinguish between NiMH cells and alkaline cells. If an alkaline cell is detected, the DS2712 will not charge it.

Figure 3. A DS2712 charge controller is used to charge a NiMH cell.
Figure 3. A DS2712 charge controller is used to charge a NiMH cell.

Switching vs. Linear

The USB 2.0 specification allows up to 100mA from a low-power port and 500mA from a high-power port. If a linear pass element is used to regulate charge current to the battery, these are the maximum allowable charge currents. The power dissipated in the linear pass element (Figure 4) is P = VQ x IBATT. This causes power dissipation in the pass transistor and can require the use of a heat sink to prevent overheating.

Figure 4. Power dissipation is the battery current times the voltage across the pass transistor.
Figure 4. Power dissipation is the battery current times the voltage across the pass transistor.

For a nominal input voltage of 5V, the pass element dissipates a varying amount of power based on the type and number of cells, as well as the battery voltage.

Figure 5. Power dissipated in a linear pass element, with NiMH cells being dissipated from a USB port at 5.0V input voltage.
Figure 5. Power is dissipated in a linear pass element, with NiMH cells being dissipated from a USB port at 5.0V input voltage.

Figure 5 shows the calculated power dissipation for a linear USB charger with NiMH cells at a nominal input voltage of 5.0V. With single-cell charging, a linear charger is only about 30% efficient; a two-cell charger is 60% efficient. Charging a single cell at 500mA results in up to 2W of power dissipation. This amount of power typically requires a heatsink. At 2W of dissipation, a +20°C/W heatsink heats up to about +65°C from an ambient temperature of +25°C, and it needs exposure to free air for full performance. Inside an enclosure with still air, it will get much hotter.

Several problems are solved by using a switching-regulator-based charger. First, the cells can be charged faster and at a higher current than with a linear charger (Figure 6). Because less power is lost as heat, the thermal management problem is reduced. Also, the charger is more reliable, as it runs cooler.

Figure 6. Charge times differ for a linear charger vs. a switching charger when charging a single-cell NiMH battery.
Figure 6. Charge times differ for a linear charger vs. a switching charger when charging a single-cell NiMH battery.

The calculated values in Figure 6 are based on charging from a high-power USB port at about 90% of the 500mA maximum allowable current. The switching regulator in this example is assumed to be a nonsynchronous buck converter with 77% efficiency.

Circuit Example

The circuit shown in Figure 7 is a switch-mode buck regulator for charging a single NiMH cell. It uses a DS2712 charge controller to regulate charging current and terminate charge. The charge controller monitors temperature, battery voltage, and battery current. If the temperature is above +45°C or below 0°C, the controller does not begin charging the battery.

Figure 7. Schematic shows a single-cell NiMH charging from a USB port.
Figure 7. Schematic shows a single-cell NiMH charging from a USB port.

In Figure 7, Q1 is the switching power transistor for the step-down charger; L1 is the smoothing inductor; and D1 is the freewheeling, or catch, diode. Input C1 is a 10µF, very low-ESR ceramic filter capacitor. Substituting tantalum or other electrolytic capacitors for C1 can adversely influence charger performance. R7 is the current-sense resistor for the sense amplifier of the current regulator. The reference voltage for the DS2712 is 0.125V with an hysteretic component of 24mV. Closed-loop, switch-mode current control is provided through CSOUT. Gate drive to Q1 is enabled when the gate of Q2 is pulled low by the charge control pin, CC1. Both Q1 and Q2 are low-Vt (gate-source threshold voltage) pMOSFETs. When CC1 and CSOUT are both low, the drain to source voltage of Q2 is slightly over one Vt. This voltage, plus the forward voltage drop of CSOUT, establishes the available switching-gate drive voltage for Q1. When CC1 is low, it enables closed-loop control of the current. Startup switching waveforms are shown in Figure 8. The top waveform is the voltage across the 0.125Ω current-sense resistor, and the bottom waveform is the Q1 drain to GND voltage. Initially, current ramps up in the inductor while Q1 is ON (CC1 and CSOUT both low). When the current reaches 0.125V, CSOUT goes high. Also, current ramps down until the voltage on the current-sense resistor reaches about 0.1V, whereupon CSOUT goes low again. This process continues as long as CC1 is low.

Figure 8. Startup waveforms are shown for a USB NiMH charger.
Figure 8. Startup waveforms are shown for a USB NiMH charger.

The DS2712's internal state machine controls the gating action of CC1. At the beginning of charge, the DS2712 performs cell qualification tests to make sure that the cell voltage is between 1.0V to 1.65V, and to verify that the temperature is between 0°C and +45°C. If the voltage is below 1.0V, the DS2712 gates CC1 low at a duty factor of 0.125, which slow-charges the cell to prevent damage. Once the cell voltage exceeds 1.0V, the state machine transitions into fast-charge. The fast-charge duty factor is 31/32, or about 97%. The "skipped" pulse is used to perform impedance tests on the cell to make sure that a high-impedance cell, such as an alkaline cell, has not been installed in the charger. Fast-charge continues until a ΔV of -2mV is detected. If no -ΔV is detected, fast-charge continues until the fast-charge timer expires or until an overtemperature or overvoltage fault condition (including impedance failure) is detected. When the fast-charge is done (either due to -ΔV or expiration of the fast-charge timer) the DS2712 enters its timed topoff mode, with a duty factor of 12.5% and a duration of half of the programmed fast-charge timeout. After topoff is complete, the charger goes into maintenance mode with a duty factor of 1/64, and remains in maintenance until the cell is removed or power is cycled.

The charger shown in Figure 7 fast-charges a 2100mAh NiMH cell from a high-power USB port in a little over two hours, with a full top-off charge achieved in about three hours. Current drawn from the port is 420mA. If enumeration with the host and high-current enable is required, an open-drain NMOSFET can be inserted in series between R9 and ground. If the MOSFET is off, TMR floats and the DS2712 is in its suspend state.


The USB port is an economical and practical power source for charging batteries for small consumer electronics. To be fully compliant with the USB 2.0 specification, loads connected to the USB port must be capable of bidirectional communication with the host. Loads must also comply with power-management requirements, including low-power modes and a means of allowing the host to determine when high power is drawn from a port. While partially compliant systems may operate compatibly with most USB hosts, they occasionally give unexpected results. A good understanding of USB requirements and expectations of the load are needed to make the right tradeoff between full compliance and load complexity.

A similar version of this article appeared in the January, 2006 issue of Battery Power Products Technology magazine.

Related Parts
DS2711 Loose-Cell NiMH Chargers Free Samples  
DS2712 Loose-Cell NiMH Chargers Free Samples  
DS2715 NiMH Battery Pack Charge Controller Free Samples  

Next Steps
EE-Mail Subscribe to EE-Mail and receive automatic notice of new documents in your areas of interest.
Download Download, PDF Format (165.5kB)  
Other Channels  Email this page to an associate or friend. 

APP 3607: Sep 23, 2005
APPLICATION NOTE 3607, AN3607, AN 3607, APP3607, Appnote3607, Appnote 3607