mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aras Vaichas <arasv@magellan-technology.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Linus Walleij <linus.walleij@stericsson.com>,
	cbou@mail.ru, dwmw2@infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-embedded@vger.kernel.org,
	Brian Swetland <swetland@google.com>,
	rpurdie@rpsys.net, lenz@cs.wisc.edu, Dirk@opfer-online.de,
	arminlitzel@web.de, Cyril Hrubis <metan@ucw.cz>,
	thommycheck@gmail.com,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	dbaryshkov@gmail.com, omegamoon@gmail.com, eric.y.miao@gmail.com,
	utx@penguin.cz, zaurus-devel@www.linuxtogo.org
Subject: Re: [POWER] battery calibration parameters from sysfs
Date: Tue, 15 Dec 2009 10:43:21 +1100	[thread overview]
Message-ID: <ed62800912141543v2ab7ef63v4b6b2c33018b3296@mail.gmail.com> (raw)
In-Reply-To: <20091214212257.GA9213@elf.ucw.cz>

2009/12/15 Pavel Machek <pavel@ucw.cz>:
> Hi!
>
>> > > I'm not sure how familiar you are with the issues surrounding trying to
>> > > do a voltage to charge mapping for a battery but it's much more complex
>> > > than a simple table if you want to get it accurate.  There's a lot
>> > > of
>>
>> > Well... current zaurus kernels use _huge_ table that maps voltage to
>> > battery %... and that table is linear function :-(.
>>
>> > Do you have some papers on that?
>>
>> Something like "Measure Battery Capacity Precisely in Medical Design"
>> by Bernd Krafthoefer in Power Electronics Technology Jan 2005 might be
>> useful here.
>
> Well, that would really require extensive hardware modifications: it
> needs _way_ more accurate ADCs on battery for a start, and a way to
> generate huge load.

I've worked on several battery powered devices and battery monitoring
is very hard to achieve without a deep understanding of the chemistry,
circuitry and the algorithms. Large current loads can cause the
battery voltage to drop and therefore there can be a significant
voltage drop between measuring the quiescent and the loaded battery
voltages.  I once did try to implement an algorithm which took into
account the different battery voltage during heavy current drain but
it's hard to know how to interpret that data.  One of the RFID systems
I worked on could run the user interface for days on a low battery but
a single RFID read would cause the system to die due to the internal
resistance current drop ...

One of the easiest ways to monitor the battery is with a coulomb
counting method (accumulate current going into and out of the battery)
e.g. "LTC4150 - Coulomb Counter/Battery Gas Gauge"
http://www.linear.com/pc/productDetail.jsp?navId=H0,C1,C1003,C1037,C1134,P2354

As long as you aren't draining very large amounts of current from the
battery, the accumulated current measurement should be almost equal to
the amp-hour rating of the battery.

Unfortunately the simple coulomb counting chips have the disadvantage
that the CPU has to be running to accumulate the pulses. Of course,
the pulses could wake the CPU from a suspend mode, but I'd rather not
do that just to add "one" to a counter ...

Finally we decided on a fully integrated "smart" battery monitor
device like the DS2782
http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4779. This chip has
Linux device driver support, I got the driver from Ryan Mallon at
Bluewater Systems. It was fairly complex to set up and calibrate but
we now use it in a commercial product.

I recommend having a look at the datasheet for the DS2782 to see what
methods they use for determining the remaining charge in a battery and
to get an idea of the complexity of the problem.

Good luck!

Aras Vaichas

  reply	other threads:[~2009-12-14 23:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04 10:42 Linus Walleij
2009-12-04 10:49 ` Mark Brown
2009-12-04 14:17   ` Mark Brown
2009-12-05 13:08   ` Linus Walleij
2009-12-05 17:45     ` Mark Brown
2009-12-07 11:48     ` Mark Brown
2009-12-07 14:07       ` Linus Walleij
2009-12-07 16:56         ` Mark Brown
2009-12-08  5:27           ` Brian Swetland
2009-12-08 10:28             ` Mark Brown
2009-12-13 13:24           ` Pavel Machek
2009-12-14 12:12             ` Mark Brown
2009-12-14 21:22               ` Pavel Machek
2009-12-14 23:43                 ` Aras Vaichas [this message]
2009-12-15  3:02                   ` Bill Gatliff
2009-12-15 22:58                     ` Aras Vaichas
2009-12-15 23:32                       ` Stanislav Brabec
2009-12-16  9:40                         ` Andy Green
2009-12-18  8:48                           ` Pavel Machek
2009-12-16 22:53               ` Pavel Machek
2009-12-13 13:19         ` Pavel Machek
2009-12-14 11:50           ` Mark Brown
2009-12-14 11:58             ` Pavel Machek
2009-12-14 12:14               ` Mark Brown
2009-12-04 11:34 ` Alexander Clouter
2009-12-06 20:52 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed62800912141543v2ab7ef63v4b6b2c33018b3296@mail.gmail.com \
    --to=arasv@magellan-technology.com \
    --cc=Dirk@opfer-online.de \
    --cc=arminlitzel@web.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cbou@mail.ru \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=eric.y.miao@gmail.com \
    --cc=lenz@cs.wisc.edu \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-embedded@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=metan@ucw.cz \
    --cc=omegamoon@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    --cc=swetland@google.com \
    --cc=thommycheck@gmail.com \
    --cc=utx@penguin.cz \
    --cc=zaurus-devel@www.linuxtogo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®