Battery Capacity Tester

So I’ve decided to use my new website to document my various electronics projects. This will be the first real post.

At my high school, we have a Vex robotics competition run by my physics teacher. I am a lab assistant for this teacher, so I help out whenever he needs things done. A few weeks ago, my teacher purchased new batteries for the Vex robots. These battery packs were cheaper than the official version and claimed more than twice the capacity. I was, of course, skeptical of the rating given on the package. I was then given the assignment to find a way to measure the capacity of these batteries and compare which we should buy in the future as replacements.

My solution, while somewhat complex, was to build a circuit to calculate the capacity. My original plans were to discharge the battery through a resistor and measure the voltage of the battery using the analog to digital converter of a PIC microcontroller, using a MOSFET to control current. After building a prototype, I decided there were too many issues with this method including limited storage on the controller, difficulty in retrieving and analyzing the data, and issues with the current changing as the voltage decreased.

My next design, the current version, utilizes a Teensy microcontroller. I had one of these lying around from previous projects, so I decided to use it. The first reason I decided to use it was the simple setup which allowed me to quickly design a prototype. I like the simplicity of the Arduino environment and the USB serial connection. I also found the USB keyboard function to be quite useful, as I will explain.

The next step was to build a loading circuit to discharge the battery. I like the idea of using a MOSFET to control current, but I realized that this wasn’t really necessary and just complicated things for me. Instead, I set up a simple LM317T constant current load. To do this, I set the output voltage of the 317T to 2.5V, significantly lower than the voltage of the batteries that I am testing. Then, I connected the output across a 10 ohm, 10 watt resistor. The 10W power rating is a bit higher than necessary, but it was what I had and it’s better for running the circuit for long periods of time anyway. With this setup, my load current stayed around 250mA, which is an acceptable discharge current for this type of battery.

After setting up the load, all I needed to do was build a resistor divider to measure the voltage of the battery over time. I also added another analog reading to measure the current of the load since it still varies slightly. These were both simple to set up. Due to the tolerances of the resistors, I had to calibrate the setup in software using my multimeter.

After the circuit was complete, I decided to throw in a 16×2 parallel LCD so I could see exactly what was going on. On it, I displayed discharge current, voltage, time running, and calculated capacity. This made the whole setup easier to use.

Now comes the software. As I previously mentioned, I used the Arduino platform to set this up due to its simplicity. Many people don’t like Arduino because it allows beginners to fully bypass the process of interfacing hardware and it’s way too powerful for most the projects it’s used for, but I needed to quickly design this circuit and simplicity was needed. My code collects voltage and current data once a minute, calculates the capacity drained milliamp-hours, displays all the data on the screen, and uses the keyboard function of the Teensy to type it all into a spreadsheet on the connected computer, then saving the file. This makes it easy to read the capacity of the battery on the LCD and have a nice discharge graph to further analyze.

A final touch I added was a heatsink on the 317T which sits nicely on top of the 10W resistor, keeping all of the power components nice and cool.

In the end, I used this circuit to test several different batteries. It seems to work quite well. For a few 2000mAh batteries, my circuit calculated around 1900mAh, which is acceptable since batteries are often slightly over-rated in capacity. The Chinese battery, rated at over 6000mAh came out to be a little over 3000mAh, which was better than the official Vex batteries and cheaper, so that is what we are going to be using in the future. I also got around 800mAh out of a slightly used 900mAh 14500 lithium battery.

TrustFire “14500″ lithium test results:

He is the code that I used. My coding skills aren’t too great, but it does work properly.

http://pastebin.com/GSusP8P6

Tags: , , , , ,

Saturday, March 5th, 2011 Electronics

18 Comments to Battery Capacity Tester

  • [...] was tasked with building a battery capacity tester by one of his teachers in order to test some aftermarket batteries that were purchased for their [...]

  • [...] was tasked with building a battery capacity tester by one of his teachers in order to test some aftermarket batteries that were purchased for their [...]

  • DrF says:

    Pretty good idea, I was thinking of testing some rechargeable battery’s from the discount store they are really poor.

  • Roger Williams says:

    Excellent!!

    Could you tell us how you configured Excel to capture the serial data?

  • Nicko01 says:

    What I did was I used the Teensy’s USB Keyboard function and basically had it type out the numbers and press enter to go to the next line. In my final version, it outputs more information in different columns so it enters data, sends a right arrow key, enters more data, etc, until it hits the end and presses enter to move down to the next line. Then I had to have it send the left arrow key a few times until it got back to the starting position. It does it all almost instantly so you can’t see it happening when it’s running. The data kind of just appears.

  • JDN says:

    The LM317T can be configured as a handy current regulator. Resistor R across the Out and Adj pins (Input = LM317.in, Output = LM317.adj). This circuit can be placed in series before or after the load.

    Since Iadj is very low, the LM317 will clamp the voltage across R to 1.25V, so the current limit is V/R. Therefore, for Imax = 0.25A, R = 1.25/0.25 = 5 ohms. 1/2 watt is sufficient (power = i^2*R = 0.3125 watts).

  • Reza says:

    You over discharged them and probably ruined them. Do not go below 2.7 and ideally not less than 3. Also discharge rate and temp will affect results

    • Nicko01 says:

      I just ran one battery that low and it was a “protected” lithium. It still works fine, but I’ll take that into consideration when I test more of them.

  • Brian Williams says:

    Great project!

    Any chance of a circuit diagram?

    B.

    • Nicko01 says:

      I originally didn’t think it was necessary to put up a circuit diagram because of how simple the setup was, but I guess since a few people want it I’ll work on getting it together.

      Thanks!

  • [...] was tasked with building a battery capacity tester by one of his teachers in order to test some aftermarket batteries that were purchased for their [...]

  • jim says:

    hi, i am really interested in your project. do u mind provide a schematic & a BOM of ur project? email me if u perfer that way.

  • JR_Dubya says:

    I love what you did, but not everybody needs this level of sophistication. Just to compare batteries, or to get a rough idea of the capacity do this: 1. compute a resistor value to limit the current to your anticipated discharge rate. 2. compute the wattage generated in the resistor and find or make a suitable load resistor. Maybe just an open coil of steel craft wire? 3. Put the load resistor, a lab thermometer, and a weighed mass of cold water into a vacuum insulated “Thermos” container. 4. Connect a VOM to the battery so you know when it has reached it’s recommended discharge voltage. 5. Discharge the battery through the load and measure the temperature rise of the water. 6. Compute the BTUs from the standard formulas for the rise in water temperature, and convert to watts or whatever units you want. Don’t boil the water, use a load with enough surface area, or attach a (submerged) heat-sink, and make sure you have a large enough volume of water that the temperature rise does not become excessive.

    • Nicko01 says:

      Wow, that’s quite an interesting idea. It sounds like it would work well for comparison purposes. I’m the kind of person who hates error and loves data, which you can see from my project. Your method wouldn’t give the same level of accuracy or precision, but it’s definitely a great way to do it if you need a quick and inexpensive setup. Thanks for the idea!

  • [...] was tasked with building a battery capacity tester by one of his teachers in order to test some aftermarket batteries that were purchased for their [...]

  • JR_Dubya says:

    How hard would it be to adapt this project so that it functions as a capacity state monitor? What I mean is, could you track both the current leaving the battery and the charging current going into the battery to get an idea of how much capacity is available at any given time. I think that some laptop computers monitor the available battery capacity by the same or similar means.

    • Nicko01 says:

      To measure the current capacity of a battery, I would measure the loaded voltage. If you had the discharge data you’d be able to compare loaded voltage at a given load with the capacity remaining. I’m not sure how accurate it would be, but I’m pretty sure the internal resistance increases as the battery discharges, decreasing the loaded voltage. So I guess if you needed to find the capacity for different loads, you could calculate the internal resistance vs current capacity using the data collected from this circuit, then calculate internal resistance in whatever circuit the battery is in based on terminal voltage and load. Of course, this would change slightly over the life of the battery. As the capacity decreases from repeated charge/discharge cycles, it would need to be recalibrated.
      I’ll have to test that idea and see how well it works.

  • [...] TrustFire “14500? lithium test nicko01.com [...]

  • Leave a Reply

    *