Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 16
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
One birthday today, congrats!
uzzors2k (35)


Next birthdays
03/29 GrantX (34)
03/30 Adam Horden (39)
03/30 Mr.Warwickshire (23)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

Arduino Battery Capacity Tester

Move Thread LAN_403
Inducktion
Thu Jan 15 2015, 07:02AM
Inducktion Registered Member #3637 Joined: Fri Jan 21 2011, 11:07PM
Location: Buffalo, NY
Posts: 1068
Hi guys.

So I've been foolin' around with my teensy 3.1 in the arduino IDE...

And came up with this program;

Link2

My only question is, did I create the proper equation for figuring out the capacity?

From my understanding

Capacity = time x load current, which is what the equation I'm using equates to. I'm not looking for 100% superb accuracy, just a rough estimate of it. If anyone could double check my work I'd be super appreciative.
Back to top
Jrz126
Fri Jan 16 2015, 02:24AM
Jrz126 Registered Member #242 Joined: Thu Feb 23 2006, 11:37PM
Location: Erie PA
Posts: 210
how are you measuring the current? Looks like you are just running an equation on the battery voltage?

You need to integrate the current to get mAh.

Back to top
...
Fri Jan 16 2015, 05:04AM
... Registered Member #56 Joined: Thu Feb 09 2006, 05:02AM
Location: Southern Califorina, USA
Posts: 2445
Assuming the load resistor you are using is 4.7 ohms then your code is roughly correct, although will under estimate the capacity of the battery a fair bit.

The formula you give (capacity = time * current) is only accurate in the case where you discharge the battery with a constant current (as many other chargers do). It looks like you are using a resistor to discharge the battery, so the discharge current will inherently be changing as the battery voltage decreases (starting around 4.2v/4.7ohms = 0.9amps and stopping at 2.7v/4.7ohms = 0.5amps). You are currently using the current at the end of the battery discharge to calculate the capacity, so you will be underestimating the capacity by somewhere between a factor of 10-50% depending on the initial charge of the battery.

Ideally you would integrate the current, for example if you run the loop at 25hz (your code will run slightly slower than that) you could say capacity = capacity + (current * 0.000111hours). Of course you would want to initialize 'capacity' to zero before the main loop.
Back to top
Inducktion
Wed Jan 21 2015, 02:35AM
Inducktion Registered Member #3637 Joined: Fri Jan 21 2011, 11:07PM
Location: Buffalo, NY
Posts: 1068
I changed the code a little, but it's more or less the same. I instead went with a basic constant current source (using an op amp, transistor and a sense resistor).

It draws 530 mA (roughly) from the battery all the way down to 2.7 volts, so the mAh curve should be much more accurate now.
Back to top
Conundrum
Sat Feb 28 2015, 04:41AM
Conundrum Registered Member #96 Joined: Thu Feb 09 2006, 05:37PM
Location: CI, Earth
Posts: 4059
Would this work for my pile of LiNiMn cells?
Culled from a dead e-bike (fried controller) pack, most of the cells look OK but unfortunately I'd never find ones with the same remaining capacity or impedance to rebuild it into a safe pack.
These are structurally similar to Li phosphate but a higher terminal voltage (3.6V) so a single schottky 120mV diode will allow them to be charged from a standard Li charger.
Back to top

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.