2002-12-14 12:21:54 +00:00
|
|
|
CHARGING ALGORITHM
|
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
This doc and a part of the charger implementation (especially voltage curves,
|
|
|
|
remaining time estimation, trickle charge) is written by Uwe Freese. If you
|
|
|
|
miss some information here, write to mail@uwe-freese.de.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[INTRODUCTION]
|
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
This doc describes how the charging works for the recorder. The algorithm can
|
|
|
|
be found in firmware/powermgmt.[c|h]. Debug output is done in
|
|
|
|
apps/debug_menu.c.
|
|
|
|
Charging for the player and the FM/V2 recorder is done by the hardware and
|
2003-03-03 13:41:04 +00:00
|
|
|
therefore isn't implemented in rockbox. Only the functions that calculate the
|
|
|
|
battery level are also used for these models.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
All following information is related to the recorder.
|
|
|
|
|
|
|
|
|
|
|
|
[TECHNICAL POSSIBILITIES AJB]
|
|
|
|
|
|
|
|
- The AJB can read the voltage of the battery (all four cells in series,
|
|
|
|
resulting in about 5V).
|
|
|
|
- We can switch the charging current (about 350mA, constant) on and off.
|
|
|
|
|
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
[VOLTAGE CURVES]
|
2002-12-14 12:21:54 +00:00
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
See http://www.uwe-freese.de/hardware-projekte/rockbox/ladeverfahren.html
|
|
|
|
for some voltage curves taken while charging and decharging an AJB.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
These voltage curves are implemented as arrays in rockbox. We can then
|
2002-12-14 12:21:54 +00:00
|
|
|
calculate how full the batteries are (in percent) after taking the actual
|
2004-07-23 08:45:34 +00:00
|
|
|
voltage. Both voltage curves (charging and decharging) are used here.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
[CHARGE OVERVIEW]
|
|
|
|
|
|
|
|
- If voltage drops under a certain value (with "deep discharge" option on the
|
|
|
|
value is lower), charging is started.
|
|
|
|
- If end of charge is detected, go to top off charge.
|
|
|
|
- Make the batteries completely full. 90 minutes of top off charge (voltage
|
|
|
|
regulation at a high value).
|
|
|
|
- After that, do trickle charge (max. 12 hours with voltage regulation at a
|
|
|
|
lower value).
|
2004-07-23 08:45:34 +00:00
|
|
|
- When trickle charge is done and you did not disconnect or shut off your AJB
|
|
|
|
by now, the AJB decharges normally since it reaches a low voltage and
|
|
|
|
everything starts from the beginning.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
[NORMAL CHARGE]
|
|
|
|
|
|
|
|
When charging is started, the charger is turned on. The batteries are charged
|
2004-07-23 08:45:34 +00:00
|
|
|
with a constant current of about 350mA. The charging is stopped for three
|
|
|
|
reasons:
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
- the voltage goes down in a 5 min interval (delta peak, see below)
|
2004-07-23 08:45:34 +00:00
|
|
|
- the voltage goes up only a little bit in an 30 min interval (is mainly
|
|
|
|
constant)
|
2002-12-14 12:21:54 +00:00
|
|
|
- the charging duration exceeds a maximum duration
|
|
|
|
|
|
|
|
|
|
|
|
[DYNAMIC MAX DURATION CALCULATION]
|
|
|
|
|
|
|
|
The max duration is calculated dynamically. The time depends on how full the
|
2004-07-23 08:45:34 +00:00
|
|
|
battery is when charging is started. For a nearly full battery, the max
|
|
|
|
duration is low, for an empty one, it is a high value. The exact formula can
|
|
|
|
be found in the source code. The battery capacity is also considered here.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
|
2003-01-26 17:19:31 +00:00
|
|
|
[LIION BATTERY IN FM RECORDER]
|
|
|
|
|
|
|
|
(todo)
|
|
|
|
http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf
|
|
|
|
|
|
|
|
|
2002-12-14 12:21:54 +00:00
|
|
|
[DELTA PEAK - WHY DOES IT WORK?]
|
|
|
|
|
|
|
|
Delta peak means to detect that the battery voltage goes down when the
|
|
|
|
batteries are full.
|
|
|
|
|
|
|
|
Two facts on batteries are the reason why this works:
|
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
- If the batteries are full, the charging current cannot charge the battery
|
|
|
|
anymore.
|
2002-12-14 12:21:54 +00:00
|
|
|
So the energy is absorbed by heating up the battery.
|
2004-07-23 08:45:34 +00:00
|
|
|
- Each battery has a negative temperature coefficient, that means the voltage
|
|
|
|
goes down when the temperature goes up.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
NiMH batteries have a smaller delta peak than NiCd, but is is enough for
|
|
|
|
Rockbox to detect that the batteries are full.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
Related documents on the web:
|
|
|
|
|
|
|
|
http://www.nimhbattery.com/nimhbattery-faq.htm questions 3 & 4
|
|
|
|
http://www.powerpacks-uk.com/Charging%20NiMh%20Batteries.htm
|
|
|
|
http://www.angelfire.com/electronic/hayles/charge1.html (soft start idea)
|
|
|
|
http://www.powerstream.com/NiMH.htm (discouraging)
|
|
|
|
http://www.panasonic.com/industrial/battery/oem/images/pdf/nimhchar.pdf
|
|
|
|
http://www.duracell.com/oem/Pdf/others/nimh_5.pdf (discharging)
|
|
|
|
http://www.duracell.com/oem/Pdf/others/nimh_6.pdf (charging)
|
|
|
|
Philips TEA1102/1103/1104 PDFs available at www.philips.com.
|
|
|
|
|
|
|
|
|
|
|
|
[TOP OFF CHARGE AND TRICKLE CHARGE]
|
|
|
|
|
|
|
|
After a normal charge is completed, trickle charging is started. That means
|
2004-07-23 08:45:34 +00:00
|
|
|
charging to keep the batteries full. While trickle charge in other (stand
|
|
|
|
alone) chargers means charging the amount that the battery loses because of
|
|
|
|
self decharging, here it's charging the amount the AJB consumes when it's on.
|
|
|
|
That's because it is not possible to switch off the AJB when charging is done.
|
|
|
|
It goes on again and then the archos firmware charger code would charge again.
|
|
|
|
So we have trickle charge in rockbox.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
In simple words, rockbox charges about 15 seconds per minute in trickle mode.
|
|
|
|
An AJB consumes 100 mA when it's on and the charging current is about 300mA.
|
|
|
|
So charging 15 s and decharge 45 s will keep the batteries full.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
But the number of seconds the charger is on in trickle charge mode is also
|
|
|
|
adjusted dynamically (between 1 and 24 sec). Rockbox tries to hold the battery
|
|
|
|
level at 5,65 V (top off charge, that means "make the batteries completely
|
|
|
|
full") for 90 minutes, then a level of 5,45 V. If the voltage drops below the
|
|
|
|
wanted value, rockbox will charge one second more the next minute. If is is
|
|
|
|
greater than this value, is will charge one second less.
|
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
Trickle charging runs 12 hours after finishing the normal charging. That
|
|
|
|
should be enough for charging the AJB over night and then unplug the charger
|
|
|
|
sometime in this 12 hour trickle charge time. It is not recommended to trickle
|
|
|
|
charge over days, that's because it is stopped after 12 hours.
|
|
|
|
|
|
|
|
Many chargers do top off and trickle charge by feeding a constant (low)
|
|
|
|
current to the batteries. Rockbox, as described, makes a voltage regulation.
|
|
|
|
That's because the power consumption of the AJB changes when backlight is
|
|
|
|
on/disk is spinning etc. and doing a voltage regulation is the simplest way
|
|
|
|
to charge exactly the needed amount.
|
|
|
|
|
|
|
|
There are two charge ICs I want to mention here: The Philips TEA1102 and
|
|
|
|
TEA1103 do voltage regulation for NiCd and NiMH at 1,325 V per cell. That
|
|
|
|
would be 5,3 V for four cells, but I think 5,45 V is best for Rockbox with the
|
|
|
|
maximum time of 12 hours.
|
|
|
|
Note that the voltage values are taken in the part of a minute where
|
2002-12-14 12:21:54 +00:00
|
|
|
the charger is off, so the values are a little bit smaller than the actual
|
|
|
|
average of the whole 60 seconds.
|
|
|
|
The Philips TEA1102 top-off charge time (with 0,15 C) is one hour.
|
|
|
|
|
|
|
|
My test results with trickle charge (battery capacities measured with an
|
|
|
|
external charger):
|
|
|
|
|
|
|
|
- after normal charge and top off time: 1798, 1834, 1819, 1815 mAh
|
|
|
|
- after normal + top off + trickle charge (12h): 1784, 1748, 1738, 1752 mAh
|
|
|
|
- charged with external charger: 1786, 1819, 1802, 1802 mAh
|
|
|
|
|
|
|
|
Result: Trickle charge works. :)
|
|
|
|
|
|
|
|
|
|
|
|
[REMAINING TIME ESTIMATION]
|
|
|
|
|
|
|
|
In simple words, it is
|
|
|
|
|
|
|
|
remaining time = remaining battery energy / power consumption of AJB
|
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
With using the battery curves described above and the battery capacity you
|
2002-12-15 23:25:27 +00:00
|
|
|
selected in the settings menu, the remaining capacity is calculated. For the
|
|
|
|
power consumption, a usual constant value is used. If the LED backlight is set
|
2004-07-23 08:45:34 +00:00
|
|
|
to always on, it is also considered. Having a modified Jukebox with 8 MB of
|
|
|
|
RAM leads to about 22 percent longer estimated running time.
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
|
2002-12-18 19:39:13 +00:00
|
|
|
[BATTERY DISPLAY HOW THE USER EXPECTS IT]
|
2002-12-14 12:21:54 +00:00
|
|
|
|
2002-12-18 19:39:13 +00:00
|
|
|
To not confuse the user with the shown battery level, some tricks are used in
|
|
|
|
the battery level calculation (this does not affect the charging algorithm,
|
|
|
|
because it uses the raw voltages):
|
2002-12-14 12:21:54 +00:00
|
|
|
|
2004-07-23 08:45:34 +00:00
|
|
|
- if charging is completed, top-off charge or trickle charge is running,
|
|
|
|
always set the battery level to 100%
|
|
|
|
- the battery level is only allowed to change 1% per minute (exception: when
|
|
|
|
usb is connected, it is allowed to go 3% down/min)
|
2002-12-18 19:39:13 +00:00
|
|
|
- if charging just started (or stopped), ignore the battery voltage for the
|
|
|
|
first 25 minutes
|
2004-07-23 08:45:34 +00:00
|
|
|
- after turning on the device, add another 5% to the battery level, because
|
|
|
|
the drive is used heavily when booting and the voltage usually gets a
|
|
|
|
little higher after that
|
2002-12-14 12:21:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
[WHICH CHARGING MODE TO USE]
|
|
|
|
|
|
|
|
If you use your AJB connected to the power supply the whole time, select "deep
|
|
|
|
discharge on" and "trickle charge off".
|
|
|
|
|
|
|
|
If you want to charge your AJB over night and take it with you the next day,
|
|
|
|
select "deep discharge off" (that it starts charging immediately) and "trickle
|
|
|
|
charge on" (that the batteries remain full).
|
|
|
|
|
|
|
|
A special case: If you fill up the batteries that are still nearly full every
|
|
|
|
night, it is recommended that you make a complete charge cycle from time to
|
2004-07-23 08:45:34 +00:00
|
|
|
time. Select "deep discharge on" and "trickle charge on" and wait till the
|
|
|
|
whole cycle is over (you can speed up the discharging a little bit by turning
|
|
|
|
on the LED backlight). Even if the battery sellers say NiMH cells don't show a
|
|
|
|
memory effect, I recommend making this procedure from time to time (every 10th
|
|
|
|
charging cycle). BUT: Don't recharge the batteries completely every time if
|
|
|
|
you don't have to.
|