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.