dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re[2]: Question to powermgm.c charging algorithm
From: Heikki Hannikainen (
Date: 2002-08-11


On Fri, 9 Aug 2002, Uwe Freese wrote:

> >> Now a question to the code:
> >>
> >> ------snip------
> >> if (delta < -50) { /* delta < -0.3 V */
> >> DEBUGF("power: short-term negative delta, enough!\n");
> >> charger_enable(false);
> >> snprintf(power_message, POWER_MESSAGE_LEN, "end negd %d %dmin", delta, charged_time);
> >> ------snip------
> HH> Linus got this right. The first test is for a large negative delta over
> HH> a short time (which should be a good sign of a NiMH cell being full). The
> Are you kidding? A typical voltage falloff that marks the ending of a
> charging phase is 0.05 volts or less, not 0,3 v!

  Right - please note that the code actually checks for delta of 0.05 V or
so, and the comment in the code is wrong (I wrote the code before actually
measuring the falloff and fixing the constant). I'm not sure if 50 is
actually a good value either, it might need to be tuned a little.

> If disk spinups (normal usage of the AJB) change the voltage too much so
> that a "full" battery is detected too early, then it tells me that we
> shouldn't load batteries in normal usage!!

  A lot of people want to use the device at home connected to the stereos,
playing DJ gigs etc, where it's a must to charge during normal usage. We
can reduce the interference caused by disk spinups by not taking samples
while the disk is active, and calculating average voltages. Work in
progress here...

> My tests with the AJB said that the Archos firmware changes the
> "power strength" (how it is called in english? I mean "Amperes"). It
> changed from 330 mA to about 200 mA. But it could be that this was only
> because of the lower difference between battery voltage and charging
> voltage.

  According to the schematics (if they're right), the only way to control
the charger is the digital output pin which is used to turn the charger
on/off. We can only control the effective current by turning the charger
on and off very fast while adjusting the duty cycle (ratio of charger
enabled/disabled). Someone with an oscilloscope could check what the power
coming to the batteries looks like with the archos charger logic, in
different phases of charging...

> Maybe the rockbox charging algorithm should start the normal charging
> (and complete it to the end) if the battery voltage is low and a trickle
> charge when the batteries are almost full.
> Trickle could mean: Voltage at max: Turn off power
> Voltage < max-0.05: charge with 1/20 C = 80 mA
> The AJBR has a adjustable voltage regulator, hasn't it? Why do we
> have only "on/off" in the sourcecode?

  As far as I know, it doesn't, but see above.

> I made a battery charger about 8 years ago, wired to the parallel
> port and with an A/D converter. I wrote a (pascal) charging program and
> tested very much with that. Because of that, I've some experience with
> charging algorithms..
> You can download the source at (see "Projekte und
> Software"). It is not written so well, because I had not much
> experience in programming then. But maybe it gives you some ideas for
> the archos charging algorithm.

  Excellent! This is my first smart charger logic, soldered a dumb one 7
years ago or so. 8-) Your feedback, testing results and, especially,
tested modifications are very welcome.

> One thing that could be used here, too:
> I divided the charging in three phases (with typically high, low and
> high gradient).
> When the gradient goes lower -> start of phase 2.
> When the gradient goes higher -> start of phase 3.
> The gradient is going up now in phase 3. If is goes down again under a
> percentage of the highest gradient in phase 3, I assume that the battery
> is charged.
> What about that? (I hope that you understood my explanation. If not -
> ask!)

  I'm not sure I understood that, but I'll try to read the Pascal code
within a few days.

  - Hessu

Page was last modified "Jan 10 2012" The Rockbox Crew