Arduino Battery Capacity Tester

Ar2uinoBatteryIllustrationS  NOTE! This Arduino Battery Capacity Tester has been updated!
See the new, improved and simplified version of the
New Battery Capacity Tester!

 

Arduino Battery Capacity Tester CircuitTo automate the testing of (camera)batteries and to make the tests repeatable I came up with a small circuit controlled by a Arduino microcontroller  – you can see the UPDATED battery capacity tester circuit on the left. (If anyone is interested I can put up the Arduino program that controls it.) I have used this on my tests of camera batteries – check them out!

Someone was! 🙂  (Interested in the Arduino program!) Link at the bottom of this post! The program outputs measurements to the serial monitor.  I just copy it from there to Excel and do the calculations and graphics in Excel.

After some consideration about the measurement process I decided to try to approximate the real world picture-taking – but I also wanted a repeatable and reasonable easy and quick way of comparing different batteries. The circuit I decided on can handle the three most common batteries: 1.2 V NiMh, 3.7  and 7.4 V Li-ion by changing the load resistor. I wanted the load to mimic the actual taking of pictures by applying the load for a number of shorter times – like taking pictures.

For the 3.7 V Li-ion batteries on test here I decided that, as the battery according to Canon should give about 300 pictures, I would apply the load in around 300 short intervals. That ideally translated to a 5.2 ohm resistor giving around 500 mA load for 16 seconds each. Settled for a more standard resistor of 5.6 ohm. The load in this case is around 2.5 watts so use an appropriate resistor – with higher rating unless you want it to get very hot! 🙂  I also decided to let the battery “catch its breath”  for 16 seconds between each “picture” – again mimicking (very oversimplified) the real world behaviour while keeping the time down. Initially I wanted to follow a “real” standard like the CIPA one – but it was much to complicated for me and would involve far too much manual work. More to read about battery measurement in the CIPA document – but be warned it is very technical!

PEPs This 16 second 5.6 ohm load followed by a 16 second rest period just had to have a name so I called it Photoman Equivalent Picture samples (PEPs) – cool eh? 😉 NOTE that this is not real pictures taken but gives a good enough approximation – especially for comparing batteries! . The circuit takes into account the resistance of the MOSFET transistor used – just below 0.4 ohm – but it lowers the load a little bit. Running through the whole test takes about 3 hours per battery. Cut off voltage is 3.0 V for Li-ion batteries so that is where I stopped the tests. (This goes well with my Canon S95 that signals empty battery at that voltage.)

mAh My testing method also gives the capacity in mAh under the above “simulated real world picture-taking” conditions. Note that under other (“laboratory”) conditions these batteries can give other mAh capacities – but as I do it the same way in all my tests you can compare the results between the batteries that I test.

Here is a link to the Arduino program: BatteryCapacityTester

NOTE: Right click on the link and select “Save target as…” Due to limitations with WordPress this Arduino source code file has been given the extension “.doc”. After saving this to your disk rename the extension to “.ino”.

As usual if anything goes wrong or gets broken by using this information I am sorry – but all the decisions are yours!

Photoman Signature

Advertisements

, , ,

  1. #1 by Jeff Wikstrom on June 5, 2013 - 19:02

    You have been busy!!! Nice experiment. Good to have the time on your hands to be able to do this.

  2. #2 by j on November 20, 2014 - 17:41

    this may be stupid question but I’m fairly new to all this… what is the purpose of those 33 and 47k ohm resistors?

    • #3 by sfennl on November 20, 2014 - 18:05

      Love the question!
      They exist so that the Arduino will be able to measure the full voltage from a “7.4” V battery – which I reality is up to around 8.5 V!
      The Arduino can handle up to 5 V as it is configured – by adding the resistors it can handle up to 8.5 V! Of course this must be taken into account in the calculations!
      The full voltage from the battery is fed to the “top” of the series connected resistors. They work as a voltage divider presenting the voltage of only 59% (47/(33+47) to the Arduino analogue inputs.
      If you plan to measure only batteries with voltages below 5 V (in reality!) then you can actually remove these resistors – connect the analogue ports directly to either side of the load resistor and simplify the circuit even more!
      There is actually a slight modification that might be worthwhile and that is to add a resistor of around 10 kohm on pin 12 before connecting it to the transistor. (I might do a small update to the post as well …)
      Thanks for asking! /Pho2oman

      • #4 by j on November 20, 2014 - 23:15

        thank you for nice explanation, now its clear 🙂 It confused me because my plan is to measure only betteries with maximum of 4.2V, measuring higher voltage battery packs didn’t ever cross my mind 🙂

        • #5 by sfennl on November 20, 2014 - 23:39

          I have just started to extend the article with a simplified circuit – for batteries below 5 V – as I mentioned to you in my previous reply. Others might be interested in that solution also – so I thank you for the inspiration!
          /Photoman

  3. #6 by j on December 4, 2014 - 16:24

    One more thing, I noticed in your code that you assume perfect 5V reference voltage for analog readings. Unfortunately, that’s almost never what you actually get on Arduino and it affects measuring precision noticeably.
    Check this http://hacking.majenko.co.uk/making-accurate-adc-readings-on-arduino
    you should use readVcc() function and work with real voltage like this V = analogRead(x) * readVcc() / 1023 instead of using just raw sensor values.

    • #7 by sfennl on December 4, 2014 - 22:56

      Hi Jiri,
      Thanks for your suggestion!
      Using the built-in voltage reference is very handy, but I use it mostly when I drive the Arduino from more unstable sources than a computer USB. The 1.1 V reference has roughly +- 10% variation (according to the datasheet) which translates to a 4.5 V to 5.5 V swing on the USB port. Without compensation for this possible variation of the reference voltage this did not seem to me to be the easiest/best choice so I settled for the simpler assumption that the USB 5V was “good enough”. Also, I just want to be able to compare batteries with this “PEPs” value and as long as the same computer is used this is very “comparable” between different batteries.
      You do bring out a weak point in my post and that is that I did no go in much – nothing actually – of the following calculations and that if you want to get correct voltages and mAh capacity you have to do it in Excel or similar. I just mentioned that you should really change “commas” to “tab” to make it easier to paste into Excel – and that only in the code-file! But doing the calculations in Excel and comparing them to my 1% multimeter voltage readings on my two computers shows an error less than 5%.
      As I mentioned in our last conversation I might do a “small” update – that has actually turned into a much expanded Battery Tester that I will publish shortly. Hope you will like it!
      And again: Thanks for your suggestion! I will be sure to add a calibration possibility to my new tester!

  4. #8 by Leao Simon Rodriguez on July 11, 2016 - 05:41

    Good Day
    If i want to test a 48V battery type li ion. Do I have to do?
    The battery is connected to another load like a lamp, Does this would cause a problem in measures?

  5. #10 by Mr. CUXI on October 28, 2016 - 10:19

    can you tell me clearly about how i can detect resister of battery???

    • #11 by sfennl on October 28, 2016 - 17:25

      Hello Mr. CUXI,
      First of all please do have a look at the much more extensive description on my other blog ar2uino.wordpress.com. In that are tables with load resistors for different loads and much more.

      I do not understand exactly what you want to know – I see two possible questions:

      1 – Find the internal resistans of the battery?
      This is a little more advanced but not very difficult. Let me know and I will tell how to do that.
      2 – What load resistance to chose for measurement of a battery?
      On my other blog there are two different tables; one mA table and a Watt table!
      First use the mA table to find the right load resistor for the battery voltage and mA load you want! (Ex: Say we have a 1.2V NiMh battery with 1500 mAh stated capacity. Normally you would load that with 1/10th of its stated capacity. That would be 150 mA. Go into the table in the column for 1.2 V and go down until you find 154 mA that is the closest you will get with standard resistors. Go out to the left and you will find that you should use a 7.8 ohm resistor.
      Next you want to use the Watt table to find the Watt generated for the battery voltage and the load resistor you have chosen! In the same 1.2V column look for the value that stands near the 7.8 ohm resistor you picked above. That is 0.2 W in this case. Make sure your load resistor has at least that wattage!

      Hope this helps and good luck!
      If you really wanted to know about internal resistance or have any more questions just let me know!

      /Sfenn

  1. Ar2uino Battery Tester | Ar2uino Scribblings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: