summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdocs/CHARGING_ALGORITHM196
1 files changed, 196 insertions, 0 deletions
diff --git a/docs/CHARGING_ALGORITHM b/docs/CHARGING_ALGORITHM
new file mode 100755
index 0000000000..38a445490a
--- /dev/null
+++ b/docs/CHARGING_ALGORITHM
@@ -0,0 +1,196 @@
1CHARGING 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
11This 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.
15
16All following information is related to the recorder.
17
18
19[TECHNICAL POSSIBILITIES AJB]
20
21- The AJB can read the voltage of the battery (all four cells in series,
22 resulting in about 5V).
23- We can switch the charging current (about 350mA, constant) on and off.
24
25
26[VOLTAGE COURVES]
27
28See http://www.uwe-freese.de/rockbox for some voltage courves taken while
29charging and decharging an AJB.
30
31These voltage courves are implemented as arrays in rockbox. We can then
32calculate how full the batteries are (in percent) after taking the actual
33voltage. Both voltage courves (charging and decharging) are used here.
34
35
36[CHARGE OVERVIEW]
37
38- If voltage drops under a certain value (with "deep discharge" option on the
39 value is lower), charging is started.
40- If end of charge is detected, go to top off charge.
41- Make the batteries completely full. 90 minutes of top off charge (voltage
42 regulation at a high value).
43- After that, do trickle charge (max. 12 hours with voltage regulation at a
44 lower value).
45- When trickle charge is done and you did not disconnect or shut off your AJB by
46 now, the AJB decharges normally since it reaches a low voltage and everything
47 starts from the beginning.
48
49
50[NORMAL CHARGE]
51
52When charging is started, the charger is turned on. The batteries are charged
53with a constant current of about 350mA. The charging is stopped for three reasons:
54
55- the voltage goes down in a 5 min interval (delta peak, see below)
56- the voltage goes up only a little bit in an 30 min interval (is mainly constant)
57- the charging duration exceeds a maximum duration
58
59
60[DYNAMIC MAX DURATION CALCULATION]
61
62The max duration is calculated dynamically. The time depends on how full the
63battery is when charging is started. For a nearly full battery, the max duration
64is low, for an empty one, it is a high value. The exact formula can be found in
65the source code.
66
67
68[DELTA PEAK - WHY DOES IT WORK?]
69
70Delta peak means to detect that the battery voltage goes down when the
71batteries are full.
72
73Two facts on batteries are the reason why this works:
74
75- If the batteries are full, the charging current cannot charge the battery anymore.
76 So the energy is absorbed by heating up the battery.
77- Each battery has a negative temperature coefficient, that means the voltage goes
78 down when the temperature goes up.
79
80NiMH batteries have a smaller delta peak than NiCd, but is is enough for Rockbox
81to detect that the batteries are full.
82
83Related documents on the web:
84
85 http://www.nimhbattery.com/nimhbattery-faq.htm questions 3 & 4
86 http://www.powerpacks-uk.com/Charging%20NiMh%20Batteries.htm
87 http://www.angelfire.com/electronic/hayles/charge1.html (soft start idea)
88 http://www.powerstream.com/NiMH.htm (discouraging)
89 http://www.panasonic.com/industrial/battery/oem/images/pdf/nimhchar.pdf
90 http://www.duracell.com/oem/Pdf/others/nimh_5.pdf (discharging)
91 http://www.duracell.com/oem/Pdf/others/nimh_6.pdf (charging)
92 Philips TEA1102/1103/1104 PDFs available at www.philips.com.
93
94
95[TOP OFF CHARGE AND TRICKLE CHARGE]
96
97After a normal charge is completed, trickle charging is started. That means
98charging to keep the batteries full. While trickle charge in other (stand alone)
99chargers means charging the amount that the battery loses because of self
100decharging, here it's charging the amount the AJB consumes when it's on. That's
101because it is not possible to switch off the AJB when charging is done. It goes
102on again and then the archos firmware charger code would charge again. So we
103have trickle charge in rockbox.
104
105In simple words, rockbox charges about 15 seconds per minute in trickle mode. An
106AJB consumes 100 mA when it's on and the charging current is about 300mA. So
107charging 15 s and decharge 45 s will keep the batteries full.
108
109But the number of seconds the charger is on in trickle charge mode is also
110adjusted dynamically (between 1 and 24 sec). Rockbox tries to hold the battery
111level at 5,65 V (top off charge, that means "make the batteries completely
112full") for 90 minutes, then a level of 5,45 V. If the voltage drops below the
113wanted value, rockbox will charge one second more the next minute. If is is
114greater than this value, is will charge one second less.
115
116Trickle charging runs 12 hours after finishing the normal charging. That should
117be enough for charging the AJB over night and then unplug the charger sometime
118in this 12 hour trickle charge time. It is not recommended to trickle charge
119over days, that's because it is stopped after 12 hours.
120
121Many chargers do top off and trickle charge by feeding a constant (low) current
122to the batteries. Rockbox, as described, makes a voltage regulation. That's
123because the power consumption of the AJB changes when backlight is on/disk is
124spinning etc. and doing a voltage regulation is the simplest way to charge
125exactly the needed amount.
126
127There are two charge ICs I want to mention here: The Philips TEA1102 and TEA1103
128do voltage regulation for NiCd and NiMH at 1,325 V per cell. That would be 5,3 V
129for four cells, but I think 5,45 V is best for Rockbox with the maximum time of
13012 hours. Note that the voltage values are taken in the part of a minute where
131the charger is off, so the values are a little bit smaller than the actual
132average of the whole 60 seconds.
133The Philips TEA1102 top-off charge time (with 0,15 C) is one hour.
134
135My test results with trickle charge (battery capacities measured with an
136external charger):
137
138- after normal charge and top off time: 1798, 1834, 1819, 1815 mAh
139- after normal + top off + trickle charge (12h): 1784, 1748, 1738, 1752 mAh
140- charged with external charger: 1786, 1819, 1802, 1802 mAh
141
142Result: Trickle charge works. :)
143
144
145[REMAINING TIME ESTIMATION]
146
147In simple words, it is
148
149remaining time = remaining battery energy / power consumption of AJB
150
151With using the battery courves described above and a battery capacity (a
152constant in powermgmt.h), the remaining capacity is calculated. For the power
153consumption, a usual constant value is used. If the LED backlight is set to
154always on, it is also considered.
155
156
157[BATTERY LAZYNESS]
158
159The battery voltage gives no realistic hint to the actual charging status when
160the charger was just turned on or off.
161
162Assume a 50% full battery and then turn on the charger. The voltage goes up. But
163the voltage is smaller than the voltage of a 50% full battery when the charging
164started at 0%.
165
166To consider this (and make a better remaining time estimation possible), I
167implemented the battery lazyness array. It means (in simple words, let's assume
168the charger is turned on):
169
170- if the charger is just turned on, calculate the battery status (percentage)
171 out of the voltage for decharging (even if we actually charge)
172- after 20 minutes of charging, calculate the battery status out of the voltage
173 courve for charging
174- inside these 20 minutes, mix the voltage courves (another array in
175 powermgmt.c tells how)
176
177
178[WHICH CHARGING MODE TO USE]
179
180(trickle charge on and off not implemented yet!)
181
182If you use your AJB connected to the power supply the whole time, select "deep
183discharge on" and "trickle charge off".
184
185If you want to charge your AJB over night and take it with you the next day,
186select "deep discharge off" (that it starts charging immediately) and "trickle
187charge on" (that the batteries remain full).
188
189A special case: If you fill up the batteries that are still nearly full every
190night, it is recommended that you make a complete charge cycle from time to
191time. Select "deep discharge on" and "trickle charge on" and wait till the whole
192cycle is over (you can speed up the discharging a little bit by turning on the
193LED backlight). Even if the battery sellers say NiMH cells don't show a memory
194effect, I recommend making this procedure from time to time (every 10th charging
195cycle). BUT: Don't recharge the batteries completely every time if you don't
196have to.