Stefan's Electronics Web Site
Electronic Projects, Reviews, and Techniques for Hobbyists, Experimenters, and Aviators
Return to Table of Contents Visit Stefan's Home Page
Google

Web
StefanV.com

 

 

 

 

Subscribe

  • Subscribe to stefanv.com feed
  • Subscribe to stefanv.com with MY AOL
  • Subscribe to stefanv.com with Bloglines
  • Subscribe to stefanv.com with Google
  • Subscribe to stefanv.com with My MSN
  • Subscribe to stefanv.com with NewsIsFree
  • Subscribe to stefanv.com with newsgator
  • Subscribe to stefanv.com with My Yahoo!
  • Recommend

  • Submit this article to del.icio.us
  • Submit this article to digg
  • Submit this article to StumbleUpon
  •   
    USB Powered AA NiMH and NiCd Battery Charger

    In a recent blog entry, I complained about all the chargers and wall warts I need to carry with me when going on a trip. This project, which can charge a pair of AA Nickel Metal Hydride (NiMH) or Nickel Cadmium (NiCd) cells using a laptop's USB port for power, arose to address part of that problem. (By the way, if you want to lighten your laptop load, take a look at the MoGo Mouse.)

    Any USB port can supply 5V at up to 500mA. The USB standard specifies that a device may not use more than 100mA until it has negotiated the right to use 500mA, but apparently no USB ports enforce that requirement. This makes the USB port a convenient source of power for devices such as this charger.

    There are commercially available USB AA charging solutions available, but they each have some drawbacks:

    • The USBCell is a 1300mAh AA NiMH cell with a removable top that allows it to be plugged directly into a USB port. No separate charger is needed. Unfortunately, the cell capacity is very low (most NiMH AA cells are 2500mAh these days), and each cell requires its own port.

    • There is a two cell USB powered AA charger available, sold under a variety of names, but it charges at a very low 100mA rate. The distributor calls it an "overnight charger", but at 100mA, a 2500mA cell would take about 40 hours to charge (40 instead of 25 due to the inefficiencies of charging at low currents).

    • I found a 2/4 cell charger that can be powered by a USB port, auto adapter, or wall wart, but it is as large as the wall charger I'm trying to replace. Different ones can be found here and here, but these take 10 to 12 hours to charge 2500mAh cells.

    [December 2007 Update: Sanyo has introduced a USB powered charger for their Eneloop batteries. This charger has none of the drawbacks listed above, and will charge a pair of 2000mAh cells in about 5 hours, or a single cell in half that time. Although designed for Eneloops (see my review), it will work with regular NiMH cells as well. Watch for a review on this site soon.]

    The charger in this project is designed to charge two AA NiMH or NiCd cells of any capacity (as long as they are the same) at about 470mA. It will charge 700mAh NiCds in about 1.5 hours, 1500mAh NiMHs in about 3.5 hours, and 2500mAh NiMHs in about 5.5 hours. The charger incorporates an automatic charge cut-off circuit based on cell temperature, and the cells can be left in the charger indefinitely after cut-off.

    Specifications

    This charger has the following specifications:
    • Size: 3.8"L x 1.2"W x 0.7"H (9.7cm x 3.0cm x 1.5cm).
    • Cells: Two AA, NiMH or NiCd
    • Charging Current: 470mA
    • Charge Termination Method: Battery Temperature (33°C)
    • Trickle Current: 10mA
    • Power Source: Desktop, Laptop, or Hub USB port
    • Operating Conditions: 15°C to 25°C (59°F to 77°F)

    The Circuit

    The heart of this charger is Z1a, one half of an LM393 dual voltage comparator. The output (pin 1) can be in one of two states, floating or low. While charging, the output is pulled low by an internal transistor, drawing about 5.2mA of current through Q1 and R5. Q1 has a beta of about 90, so about 470mA will flow through into the two AA cells being charged. This will fully charge a pair of 2500mAh cells in just over 5 hours.

    USB powered AA charger schematic.
    USB powered AA charger schematic.

    During charging, R1, R2, and R4 form a three-way voltage divider which yields about 1.26V at the non-inverting input of Z1a (pin 3, Vref).

    TR1 is a thermistor that is in direct contact with the cells being charged. It has a resistance of 10kΩ at 25°C (77°F), which varies inversely with temperature by about 3.7% for every 1C° (1.8F°). R3 and TR1 form a voltage divider whose value is applied to the inverting input (pin 2, Vtmp). At a temperature of 20°C (68°F), TR1 is about 12kΩ, which makes Vtmp about 1.76V.

    Once the cells are fully charged, the charge current will literally go to waste, in the form of heat. As the cell temperature rises, TR1's resistance drops. At 33°C (91°F), the resistance will be about 7.4kΩ, which makes Vtmp about 1.26V, which equals the Vref voltage.

       Battery voltage versus time. The cells are full when the voltage peaks, and the charger shuts off shortly thereafter.
    Battery voltage versus time. The cells are full when the voltage peaks, and the charger shuts off shortly thereafter.
    As the temperature rises above 33°C, Vtmp will become less than Vref, and the open-collector output of Z1a will float high. Therefore, the current flowing through R5 is greatly reduced, as it is now limited by R1, R2, and R4. As a result, the current flowing through Q1 and the cells is reduced to a 10mA trickle charge rate.

    Also, because R4 is now connected to +5V through R5 and Q1 instead of being held at 0.26V by Z1a, the Vref voltage changes to about 2.37V. This guarantees that as the cell temperature drops, the charger won't turn back on. In order for Vtmp to reach 2.37V, TR1 would have to reach about 20kΩ, corresponding to a temperature of about 6°C (43°F), which should never happen in a room temperature environment.

    Z1b is the other comparator on the LM393 chip, and a close look at the schematic reveals that it's performing the same comparison as Z1a. Instead of driving the charging transistor however, it drives an LED that indicates that charging is in progress. R6 limits current to the LED to about 10mA. By running the LED from its own comparator (which is on the chip whether we use it or not), the LED current has no effect on Vref.

    Finally, C1 is there to ensure that charging starts when a pair of cells is inserted. With no cells in place and the charger off, C1 has about 1.9V across it (5V - 0.7V - Vref). As soon as the second of two cells is inserted, the positive side of C1 is suddenly forced down to the battery voltage (about 2.4V). This immediately forces the negative side 1.9V lower than this, to about 0.5V. Since this is connected to Vref, Z1a's output goes low, causing charging to start. After a few milliseconds, C1 adjusts to the new voltage difference imposed by R1, R2, and R4 on one side and the cells on the other, and no longer affects the circuit.

    Construction

    The circuit is best built on a printed circuit board. Refer to my article on the subject, Making Excellent Printed Circuit Boards. Here is the printed circuit layout:

    Copper side. Actual size is 3.8" x 1.2" (9.7cm x 3.0cm). Click to enlarge.
    Copper side. Actual size is 3.8" x 1.2" (9.7cm x 3.0cm). Click to enlarge.

    Begin by installing all the resistors and the capacitor. The resistors should be installed lying flat. Install LED1, being sure to orient it so that the negative terminal is the one connected to pin 7 of Z1b.

    Component placement diagram. Click to enlarge.
    Component placement diagram. Click to enlarge.

    Install Z1 next, ensuring that pin 1 (indicated by a small dot or identation on one corner of the IC) is oriented as shown in the placement diagram. If you wish, use a socket for Z1.

    Transistor Q1 is mounted on a small heatsink. First bend the leads back 90° just where they start to narrow. Don't bend them too sharply or they might break. Insert Q1 into its lead holes, and slide the heatsink underneath. Hold everything in place with a clamp while soldering the leads. With the clamp still in place, drill the hole for the heatsink bolt.

    Charger with all electronic components installed. Note that there is space under Q1 for the heatsink. The board area where the battery holder will go has been scuffed up to aid adhesion.
    Charger with all electronic components installed. Note that there is space under Q1 for the heatsink. The board area where the battery holder will go has been scuffed up to aid adhesion.

    Installing the battery holder is the next step. I used a 2-cell holder made by cutting the two outer cell positions off of a side-by-side 4-cell holder. You can of course just buy a 2-cell holder, but none was available when I went to the parts store. My approach has the additional advantage that the cells are easier to insert and remove, because the sides of the holder don't curve inwards over the cells.

    Before installing the holder, remove a ¼" long section of the centre divider to make room for the thermistor. Also solder some leads to the cell holder terminals. Glue the holder in place on the circuit board, flush with the sides and ends of the board. When the glue has dried, drill through the TR1 holes in the board to make matching holes in the battery holder. If you did everything carefully, these two holes should be right on the centre line, where you removed the section of divider.

    Insert the thermistor through the holes, and then put a pair of AA cells in the holder. From the copper side, push up on the thermistor so it is in firm contact with the cells, and then solder it in place. Then remove the cells, and connect the battery holder leads to the holes marked B+ and B- on the placement diagram.

    The completed charger with one cell in place. The 2-cell holder was made by cutting the outer positions off of a 4-cell holder. Notice how the thermistor is installed so as to make physical contact with the cells being charged. A small heatsink keeps Q1 cool.
    The completed charger with one cell in place. The 2-cell holder was made by cutting the outer positions off of a 4-cell holder. Notice how the thermistor is installed so as to make physical contact with the cells being charged. A small heatsink keeps Q1 cool.

    The last step is to connect a USB power cable. Either buy a cable, or cut one off of a discarded USB device such as a broken mouse. Cut the cable to the desired length, and strip about 1" of the outer covering off the end. Roll back the shielding, and find the +5V and GND wires. These will generally be red and black respectively. Strip and tin the ends of them, and solder them to the USB+5V and USBGND terminals of the charger.

    Testing

    Before connecting the charger to a power source, inspect your work carefully. Be sure all the components are oriented correctly (specifically Q1, LED1, Z1, and the battery holder).

    For initial tests, I used a USB hub for power. A pair of #11 hobby knife blades between the cells and the contacts let me hook up a voltage monitor.   
    For initial tests, I used a USB hub for power. A pair of #11 hobby knife blades between the cells and the contacts let me hook up a voltage monitor.
    For initial tests, I suggest you use a powered USB hub. By using a hub, you ensure that the charger is not drawing power from your computer, since a defect in the charger could damage the power source. Note however that most powered hubs won't output any power unless the hub is connected to a computer. Alternatively, you could use a regulated 5V power supply, temporarily connected to the +5V and GND traces on the circuit board.

    With power applied, check that the LED is off. If it is on, use a 330Ω resistor to short out TR1 for an instant (this makes the circuit think the cells have gotten extremely hot). If the LED doesn't extinguish, there's something wrong.

    With the LED off, measure the voltage between GND and Vref (pin 3 of Z1). This should be approximately 2.37V. It can be a bit more or less depending on the exact supply voltage and the variation in resistor values. Also check the voltage at Vtmp (pin 2). At room temperature, this should be in the range of 1.60V to 1.85V, depending on the temperature.

    Now insert a pair of matching AA NiMH cells, preferrably ones that are partially or fully discharged. As soon as you insert the second cell, the LED should light up. Measure the Vref voltage again; it should now be about 1.26V. Vtmp may also have changed a little bit, due to the supply voltage drop caused by the load placed on the power supply.

    The charger is now charging and the voltage at the battery terminals should be increasing. After a while, the rate of increase should slow down. As the cells reach about 75% charge, the rate of increase will speed up again. Finally, when the cells reach 100% charge, the voltage will start decreasing, and the cells will start to get warm. 15 to 20 minutes later, the charger should turn off. If the cells get uncomfortably warm and the charger has not shut off, there's something wrong.

    It's also worth measuring the charge current. The easiest way to do this is to insert two thin conductive strips, such as brass shim, separated by an insulator, between one cell and a battery holder contact. Then connect an ammeter to the two strips, so that the charging current flows through the meter. The meter should read somewhere between 450 and 490mA. If it's any higher, you will be exceeding the USB current supply specification, since the charger itself uses an additional 10mA (primarily for the LED).

    If the measured current, I, is too high or too low, replace R5 with a different value resistor according to the following formula:

    R5 = 1.6 x I

    Use the nearest standard value. For example, if you measure a current of 510mA, replace R5 with an 820Ω resistor. If the measured current was 420mA, use a 680Ω resistor.

    Enclosure

    At the time I wrote this, I had not yet constructed an enclosure for this circuit, but plan to do so in the near future, since the bare board is not robust enough to throw into the laptop bag when going on a trip. The enclosure will be made from 1/16" plastic or aircraft plywood for the sides and bottom, with a translucent plastic panel over the circuitry. The battery compartment will be left open. A strain relief will prevent the USB leads from breaking off where they attach to the board. For cooling, I plan to drill holes in the sides and top in the heatsink area.

    Using the Charger

    Using the charger is easy. Just plug it into a USB port and insert the two cells you want to charge. When the LED extinguishes, charging is complete. Approximate charge times are as follows:

    Cell TypeCharge Time
    700mAh NiCd1.5h
    1100mAh NiCd2.5h
    1600mAh NiMH3.5h
    2000mAh NiMH4.5h
    2500mAh NiMH5.5h

    It is important that the two cells being charged are of the same type and at the same level of discharge. If the cells are mismatched, one will become fully charged before the other. When it reaches 33°C, the charger will shut off. If the second cell needs more than about 200mAh more than the first cell, it will not have reached a full charge.

       This charger, with a suitable enclosure, is ideal for use on trips, using a laptop to power the charger. The laptop should be plugged in to avoid running down its battery.
    This charger, with a suitable enclosure, is ideal for use on trips, using a laptop to power the charger. The laptop should be plugged in to avoid running down its battery.
    In general, if two cells are used together in a single device (digital camera, GPS, etc.), then they will remain in sync, and can be charged together.

    When charging is completed, the charger will switch to a 10mA trickle charge. This is sufficient to overcome the cells' natural self-discharge rate, but low enough that the cells can be left in the charger indefinitely. However, do not leave the cells in the charger unless the charger is plugged into a powered-up USB port. Otherwise, the cells will supply power to the circuit and be drained in the process.

    When using this charger with any computer, make sure that the computer is not set to go into a power saving mode that turns off power to the USB ports. If this happens, charging will stop, and the cells being charged will discharge. When using a laptop as a power source, it's best to plug in the laptop's power supply, since the charger uses a significant amount of power, and will probably take longer to complete than the laptop battery will last.

    If powering this charger from a USB hub, be sure to use a powered hub. A non-powered hub will not be able to deliver enough current to the charger, since it must share the 500mA coming from the computer with the ports in the hub (typically four). The extra cable length also tends to reduce the voltage reaching the charger.

    Charging AAA Cells

    If the springs in the battery holder are long enough, the charger can also be used to charge a pair of AAA cells. However, it is then necessary to insert shims between the cells and the sides of the battery holder to ensure that the cells remain in contact with the thermistor. Only charge modern AAA cells, having a capacity of 700mAh or more.

    Parts List

    Some parts can be obtained at Radio Shack, but larger electronic supply houses like DigiKey are more likely to stock all the parts needed.

    PartDescription
    R156kΩ ¼W, 5% resistor
    R227kΩ ¼W, 5% resistor
    R322kΩ ¼W, 5% resistor
    R447kΩ ¼W, 5% resistor
    R5750Ω ¼W, 5% resistor
    R6220Ω ¼W, resistor
    TR110kΩ @ 25°C thermistor, approx. 3.7%/C° NTC
    Radio Shack #271-110 (discontinued)
    C10.1µF 10V capacitor
    Q1TIP32C PNP transistor, TO-220 case
    Z1LM393 dual voltage comparator IC, DIP
    LED1Red, green, or yellow LED, 10mA
    Other2-cell AA battery holder
    USB cable
    Small heatsink

    Note that the Radio Shack thermistor has been discontinued. Although I have not tried any of them, there are other similar thermistors available, such as the Vishay #2381 640 54103 (Digi-Key #BC2298-ND). The temperature coefficient is slightly different (about 4.6%/C°), but over the range we're interested in, is close enough. Using this thermistor, the cut-off and turn-on temperatures would be about 32°C (89°F) and 10°C (50°F) respectively.

    Alternatively, you can use the resistor values below with the Vishay thermistor to raise the cut-off temperature back to 33°C, while lowering the turn-on temperature to 3°C (37°F).

    PartAlternative Resistor Values to use with
    Vishay #2381 640 54103 Thermistor
    R182kΩ ¼W, 5% resistor
    R233kΩ ¼W, 5% resistor
    R327kΩ ¼W, 5% resistor
    R439kΩ ¼W, 5% resistor

    I have not tested this combination, but the values were computed using the same program that I used to compute the values that were used with the Radio Shack thermistor. Do not mix and match values from this table with those listed above. If you change any of the values to those in this table, change all of them.

    If anyone finds an alternate source for the Radio Shack thermistor, please let me know.

    I'd Like to Hear from You

    If you build this circuit (or not), let me know what you think. If you have problems, I may be able to help you, but be sure to supply a detailed description. I can be reached at stefan@capable.ca.

    Other Articles of Interest

    If you found this article useful, you may also be interested in:

     

    Frequently Asked Questions

    Q: I built your circuit, and it doesn't work. Can you help me?

    A: Maybe.

    I'm providing the information to build this project because I like to share my work. I can't provide detailed troubleshooting, since I only do this as a hobby, and my hobby time is limited. However, if you've built this circuit, and you send me a detailed description of the way in which it doesn't work, I might have an idea or two to help you fix it. There are no guarantees though.

    Q: Can you send me the parts, or build me a completed circuit?

    A: Unfortunately not.

    As I mentioned in the previous answer, I only do this as a hobby, and I don't have the time to collect and mail parts or build circuits for others. Even if you were to pay me to build one, it would cost far more than just going out and buying an equivalent commercial product. Homemade electronics cost more than mass produced products if you factor in the time it takes for construction.


     
     
     
     
    Buy Stefan a coffee! If you've found this article
    useful, consider leaving a donation to help support
    Stefan's Electronics Web Site.
     
     
    Last updated Saturday April 12, 2008. E-mail Stefan
     

    Disclaimer: Although every effort has been made to ensure accuracy and reliability, the information on this web page is presented without warranty of any kind, and Stefan Vorkoetter assumes no liability for direct or consequential damages caused by its use. It is up to you, the reader, to determine the suitability of, and assume responsibility for, the use of this information.

    Copyright: All materials on this web site, including the text, images, and HTML mark-up, are Copyright © 2008 by Stefan Vorkoetter unless otherwise noted. All rights reserved. Unauthorized duplication prohibited. You may link to this site or pages within it, but you may not link directly to images on this site, and you may not copy any material from this site to another web site or other publication without express written permission. You may make copies for your own personal use.

    Return to Table of Contents Visit Stefan's Home Page