blob: f7d198fdf49f804e0b67b5b3dbcdcf3bef3892c8 [file] [log] [blame]
Uwe Freese38177302002-12-14 12:21:54 +00001CHARGING ALGORITHM
2
3This doc and a part of the charger implementation (especially voltage courves,
4remaining time estimation, trickle charge) is written by Uwe Freese. If you miss
5some information here, write to mail@uwe-freese.de.
6
7
8
9[INTRODUCTION]
10
Uwe Freese3e3d8572002-12-18 19:39:13 +000011This doc describes how the charging works for the recorder. The algorithm can be
12found in firmware/powermgmt.[c|h]. Debug output is done in apps/debug_menu.c.
13Charging for the player is done by the hardware and therefore isn't implemented
14in rockbox. Only the functions that calculate the battery level are also used
15for the player.
Uwe Freese38177302002-12-14 12:21:54 +000016
17All following information is related to the recorder.
18
19
20[TECHNICAL POSSIBILITIES AJB]
21
22- The AJB can read the voltage of the battery (all four cells in series,
23 resulting in about 5V).
24- We can switch the charging current (about 350mA, constant) on and off.
25
26
27[VOLTAGE COURVES]
28
29See http://www.uwe-freese.de/rockbox for some voltage courves taken while
30charging and decharging an AJB.
31
32These voltage courves are implemented as arrays in rockbox. We can then
33calculate how full the batteries are (in percent) after taking the actual
34voltage. Both voltage courves (charging and decharging) are used here.
35
36
37[CHARGE OVERVIEW]
38
39- If voltage drops under a certain value (with "deep discharge" option on the
40 value is lower), charging is started.
41- If end of charge is detected, go to top off charge.
42- Make the batteries completely full. 90 minutes of top off charge (voltage
43 regulation at a high value).
44- After that, do trickle charge (max. 12 hours with voltage regulation at a
45 lower value).
46- When trickle charge is done and you did not disconnect or shut off your AJB by
47 now, the AJB decharges normally since it reaches a low voltage and everything
48 starts from the beginning.
49
50
51[NORMAL CHARGE]
52
53When charging is started, the charger is turned on. The batteries are charged
54with a constant current of about 350mA. The charging is stopped for three reasons:
55
56- the voltage goes down in a 5 min interval (delta peak, see below)
57- the voltage goes up only a little bit in an 30 min interval (is mainly constant)
58- the charging duration exceeds a maximum duration
59
60
61[DYNAMIC MAX DURATION CALCULATION]
62
63The max duration is calculated dynamically. The time depends on how full the
64battery is when charging is started. For a nearly full battery, the max duration
65is low, for an empty one, it is a high value. The exact formula can be found in
Uwe Freesef8484532002-12-15 23:25:27 +000066the source code. The battery capacity is also considered here.
Uwe Freese38177302002-12-14 12:21:54 +000067
68
Uwe Freese96f5de92003-01-26 17:19:31 +000069[LIION BATTERY IN FM RECORDER]
70
71(todo)
72http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf
73
74
Uwe Freese38177302002-12-14 12:21:54 +000075[DELTA PEAK - WHY DOES IT WORK?]
76
77Delta peak means to detect that the battery voltage goes down when the
78batteries are full.
79
80Two facts on batteries are the reason why this works:
81
82- If the batteries are full, the charging current cannot charge the battery anymore.
83 So the energy is absorbed by heating up the battery.
84- Each battery has a negative temperature coefficient, that means the voltage goes
85 down when the temperature goes up.
86
87NiMH batteries have a smaller delta peak than NiCd, but is is enough for Rockbox
88to detect that the batteries are full.
89
90Related documents on the web:
91
92 http://www.nimhbattery.com/nimhbattery-faq.htm questions 3 & 4
93 http://www.powerpacks-uk.com/Charging%20NiMh%20Batteries.htm
94 http://www.angelfire.com/electronic/hayles/charge1.html (soft start idea)
95 http://www.powerstream.com/NiMH.htm (discouraging)
96 http://www.panasonic.com/industrial/battery/oem/images/pdf/nimhchar.pdf
97 http://www.duracell.com/oem/Pdf/others/nimh_5.pdf (discharging)
98 http://www.duracell.com/oem/Pdf/others/nimh_6.pdf (charging)
99 Philips TEA1102/1103/1104 PDFs available at www.philips.com.
100
101
102[TOP OFF CHARGE AND TRICKLE CHARGE]
103
104After a normal charge is completed, trickle charging is started. That means
105charging to keep the batteries full. While trickle charge in other (stand alone)
106chargers means charging the amount that the battery loses because of self
107decharging, here it's charging the amount the AJB consumes when it's on. That's
108because it is not possible to switch off the AJB when charging is done. It goes
109on again and then the archos firmware charger code would charge again. So we
110have trickle charge in rockbox.
111
112In simple words, rockbox charges about 15 seconds per minute in trickle mode. An
113AJB consumes 100 mA when it's on and the charging current is about 300mA. So
114charging 15 s and decharge 45 s will keep the batteries full.
115
116But the number of seconds the charger is on in trickle charge mode is also
117adjusted dynamically (between 1 and 24 sec). Rockbox tries to hold the battery
118level at 5,65 V (top off charge, that means "make the batteries completely
119full") for 90 minutes, then a level of 5,45 V. If the voltage drops below the
120wanted value, rockbox will charge one second more the next minute. If is is
121greater than this value, is will charge one second less.
122
123Trickle charging runs 12 hours after finishing the normal charging. That should
124be enough for charging the AJB over night and then unplug the charger sometime
125in this 12 hour trickle charge time. It is not recommended to trickle charge
126over days, that's because it is stopped after 12 hours.
127
128Many chargers do top off and trickle charge by feeding a constant (low) current
129to the batteries. Rockbox, as described, makes a voltage regulation. That's
130because the power consumption of the AJB changes when backlight is on/disk is
131spinning etc. and doing a voltage regulation is the simplest way to charge
132exactly the needed amount.
133
134There are two charge ICs I want to mention here: The Philips TEA1102 and TEA1103
135do voltage regulation for NiCd and NiMH at 1,325 V per cell. That would be 5,3 V
136for four cells, but I think 5,45 V is best for Rockbox with the maximum time of
13712 hours. Note that the voltage values are taken in the part of a minute where
138the charger is off, so the values are a little bit smaller than the actual
139average of the whole 60 seconds.
140The Philips TEA1102 top-off charge time (with 0,15 C) is one hour.
141
142My test results with trickle charge (battery capacities measured with an
143external charger):
144
145- after normal charge and top off time: 1798, 1834, 1819, 1815 mAh
146- after normal + top off + trickle charge (12h): 1784, 1748, 1738, 1752 mAh
147- charged with external charger: 1786, 1819, 1802, 1802 mAh
148
149Result: Trickle charge works. :)
150
151
152[REMAINING TIME ESTIMATION]
153
154In simple words, it is
155
156remaining time = remaining battery energy / power consumption of AJB
157
Uwe Freesef8484532002-12-15 23:25:27 +0000158With using the battery courves described above and the battery capacity you
159selected in the settings menu, the remaining capacity is calculated. For the
160power consumption, a usual constant value is used. If the LED backlight is set
161to always on, it is also considered.
Uwe Freese38177302002-12-14 12:21:54 +0000162
163
Uwe Freese3e3d8572002-12-18 19:39:13 +0000164[BATTERY DISPLAY HOW THE USER EXPECTS IT]
Uwe Freese38177302002-12-14 12:21:54 +0000165
Uwe Freese3e3d8572002-12-18 19:39:13 +0000166To not confuse the user with the shown battery level, some tricks are used in
167the battery level calculation (this does not affect the charging algorithm,
168because it uses the raw voltages):
Uwe Freese38177302002-12-14 12:21:54 +0000169
Uwe Freese3e3d8572002-12-18 19:39:13 +0000170- if charging is completed, top-off charge or trickle charge is running, always
171 set the battery level to 100%
172- the battery level is only allowed to change 1% per minute (exception: when usb
173 is connected, is is allowed to go 3% down/min)
174- if charging just started (or stopped), ignore the battery voltage for the
175 first 25 minutes
176- after turning on the device, add another 5% to the battery level, because the
177 drive is used heavily when booting and the voltage usually gets a little higher
178 after that
Uwe Freese38177302002-12-14 12:21:54 +0000179
180
181[WHICH CHARGING MODE TO USE]
182
Uwe Freese38177302002-12-14 12:21:54 +0000183If you use your AJB connected to the power supply the whole time, select "deep
184discharge on" and "trickle charge off".
185
186If you want to charge your AJB over night and take it with you the next day,
187select "deep discharge off" (that it starts charging immediately) and "trickle
188charge on" (that the batteries remain full).
189
190A special case: If you fill up the batteries that are still nearly full every
191night, it is recommended that you make a complete charge cycle from time to
192time. Select "deep discharge on" and "trickle charge on" and wait till the whole
193cycle is over (you can speed up the discharging a little bit by turning on the
194LED backlight). Even if the battery sellers say NiMH cells don't show a memory
195effect, I recommend making this procedure from time to time (every 10th charging
196cycle). BUT: Don't recharge the batteries completely every time if you don't
197have to.