summaryrefslogtreecommitdiff
path: root/docs/CHARGING_ALGORITHM
diff options
context:
space:
mode:
Diffstat (limited to 'docs/CHARGING_ALGORITHM')
-rwxr-xr-xdocs/CHARGING_ALGORITHM133
1 files changed, 69 insertions, 64 deletions
diff --git a/docs/CHARGING_ALGORITHM b/docs/CHARGING_ALGORITHM
index 81c4fc3b5c..a1a6e2b56e 100755
--- a/docs/CHARGING_ALGORITHM
+++ b/docs/CHARGING_ALGORITHM
@@ -1,16 +1,17 @@
1CHARGING ALGORITHM 1CHARGING ALGORITHM
2 2
3This doc and a part of the charger implementation (especially voltage courves, 3This doc and a part of the charger implementation (especially voltage curves,
4remaining time estimation, trickle charge) is written by Uwe Freese. If you miss 4remaining time estimation, trickle charge) is written by Uwe Freese. If you
5some information here, write to mail@uwe-freese.de. 5miss some information here, write to mail@uwe-freese.de.
6 6
7 7
8 8
9[INTRODUCTION] 9[INTRODUCTION]
10 10
11This doc describes how the charging works for the recorder. The algorithm can be 11This doc describes how the charging works for the recorder. The algorithm can
12found in firmware/powermgmt.[c|h]. Debug output is done in apps/debug_menu.c. 12be found in firmware/powermgmt.[c|h]. Debug output is done in
13Charging for the player and the FM recorder is done by the hardware and 13 apps/debug_menu.c.
14Charging for the player and the FM/V2 recorder is done by the hardware and
14therefore isn't implemented in rockbox. Only the functions that calculate the 15therefore isn't implemented in rockbox. Only the functions that calculate the
15battery level are also used for these models. 16battery level are also used for these models.
16 17
@@ -24,14 +25,14 @@ All following information is related to the recorder.
24- We can switch the charging current (about 350mA, constant) on and off. 25- We can switch the charging current (about 350mA, constant) on and off.
25 26
26 27
27[VOLTAGE COURVES] 28[VOLTAGE CURVES]
28 29
29See http://www.uwe-freese.de/rockbox for some voltage courves taken while 30See http://www.uwe-freese.de/hardware-projekte/rockbox/ladeverfahren.html
30charging and decharging an AJB. 31for some voltage curves taken while charging and decharging an AJB.
31 32
32These voltage courves are implemented as arrays in rockbox. We can then 33These voltage curves are implemented as arrays in rockbox. We can then
33calculate how full the batteries are (in percent) after taking the actual 34calculate how full the batteries are (in percent) after taking the actual
34voltage. Both voltage courves (charging and decharging) are used here. 35voltage. Both voltage curves (charging and decharging) are used here.
35 36
36 37
37[CHARGE OVERVIEW] 38[CHARGE OVERVIEW]
@@ -43,27 +44,29 @@ voltage. Both voltage courves (charging and decharging) are used here.
43 regulation at a high value). 44 regulation at a high value).
44- After that, do trickle charge (max. 12 hours with voltage regulation at a 45- After that, do trickle charge (max. 12 hours with voltage regulation at a
45 lower value). 46 lower value).
46- When trickle charge is done and you did not disconnect or shut off your AJB by 47- When trickle charge is done and you did not disconnect or shut off your AJB
47 now, the AJB decharges normally since it reaches a low voltage and everything 48 by now, the AJB decharges normally since it reaches a low voltage and
48 starts from the beginning. 49 everything starts from the beginning.
49 50
50 51
51[NORMAL CHARGE] 52[NORMAL CHARGE]
52 53
53When charging is started, the charger is turned on. The batteries are charged 54When 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: 55with a constant current of about 350mA. The charging is stopped for three
56reasons:
55 57
56- the voltage goes down in a 5 min interval (delta peak, see below) 58- 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) 59- the voltage goes up only a little bit in an 30 min interval (is mainly
60 constant)
58- the charging duration exceeds a maximum duration 61- the charging duration exceeds a maximum duration
59 62
60 63
61[DYNAMIC MAX DURATION CALCULATION] 64[DYNAMIC MAX DURATION CALCULATION]
62 65
63The max duration is calculated dynamically. The time depends on how full the 66The 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 67battery is when charging is started. For a nearly full battery, the max
65is low, for an empty one, it is a high value. The exact formula can be found in 68duration is low, for an empty one, it is a high value. The exact formula can
66the source code. The battery capacity is also considered here. 69be found in the source code. The battery capacity is also considered here.
67 70
68 71
69[LIION BATTERY IN FM RECORDER] 72[LIION BATTERY IN FM RECORDER]
@@ -79,13 +82,14 @@ batteries are full.
79 82
80Two facts on batteries are the reason why this works: 83Two facts on batteries are the reason why this works:
81 84
82- If the batteries are full, the charging current cannot charge the battery anymore. 85- If the batteries are full, the charging current cannot charge the battery
86 anymore.
83 So the energy is absorbed by heating up the battery. 87 So the energy is absorbed by heating up the battery.
84- Each battery has a negative temperature coefficient, that means the voltage goes 88- Each battery has a negative temperature coefficient, that means the voltage
85 down when the temperature goes up. 89 goes down when the temperature goes up.
86 90
87NiMH batteries have a smaller delta peak than NiCd, but is is enough for Rockbox 91NiMH batteries have a smaller delta peak than NiCd, but is is enough for
88to detect that the batteries are full. 92Rockbox to detect that the batteries are full.
89 93
90Related documents on the web: 94Related documents on the web:
91 95
@@ -102,16 +106,16 @@ Related documents on the web:
102[TOP OFF CHARGE AND TRICKLE CHARGE] 106[TOP OFF CHARGE AND TRICKLE CHARGE]
103 107
104After a normal charge is completed, trickle charging is started. That means 108After a normal charge is completed, trickle charging is started. That means
105charging to keep the batteries full. While trickle charge in other (stand alone) 109charging to keep the batteries full. While trickle charge in other (stand
106chargers means charging the amount that the battery loses because of self 110alone) chargers means charging the amount that the battery loses because of
107decharging, here it's charging the amount the AJB consumes when it's on. That's 111self decharging, here it's charging the amount the AJB consumes when it's on.
108because it is not possible to switch off the AJB when charging is done. It goes 112That's because it is not possible to switch off the AJB when charging is done.
109on again and then the archos firmware charger code would charge again. So we 113It goes on again and then the archos firmware charger code would charge again.
110have trickle charge in rockbox. 114So we have trickle charge in rockbox.
111 115
112In simple words, rockbox charges about 15 seconds per minute in trickle mode. An 116In simple words, rockbox charges about 15 seconds per minute in trickle mode.
113AJB consumes 100 mA when it's on and the charging current is about 300mA. So 117An AJB consumes 100 mA when it's on and the charging current is about 300mA.
114charging 15 s and decharge 45 s will keep the batteries full. 118So charging 15 s and decharge 45 s will keep the batteries full.
115 119
116But the number of seconds the charger is on in trickle charge mode is also 120But 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 121adjusted dynamically (between 1 and 24 sec). Rockbox tries to hold the battery
@@ -120,21 +124,22 @@ full") 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 124wanted value, rockbox will charge one second more the next minute. If is is
121greater than this value, is will charge one second less. 125greater than this value, is will charge one second less.
122 126
123Trickle charging runs 12 hours after finishing the normal charging. That should 127Trickle charging runs 12 hours after finishing the normal charging. That
124be enough for charging the AJB over night and then unplug the charger sometime 128should be enough for charging the AJB over night and then unplug the charger
125in this 12 hour trickle charge time. It is not recommended to trickle charge 129sometime in this 12 hour trickle charge time. It is not recommended to trickle
126over days, that's because it is stopped after 12 hours. 130charge over days, that's because it is stopped after 12 hours.
127 131
128Many chargers do top off and trickle charge by feeding a constant (low) current 132Many chargers do top off and trickle charge by feeding a constant (low)
129to the batteries. Rockbox, as described, makes a voltage regulation. That's 133current to the batteries. Rockbox, as described, makes a voltage regulation.
130because the power consumption of the AJB changes when backlight is on/disk is 134That's because the power consumption of the AJB changes when backlight is
131spinning etc. and doing a voltage regulation is the simplest way to charge 135on/disk is spinning etc. and doing a voltage regulation is the simplest way
132exactly the needed amount. 136to charge exactly the needed amount.
133 137
134There are two charge ICs I want to mention here: The Philips TEA1102 and TEA1103 138There are two charge ICs I want to mention here: The Philips TEA1102 and
135do voltage regulation for NiCd and NiMH at 1,325 V per cell. That would be 5,3 V 139TEA1103 do voltage regulation for NiCd and NiMH at 1,325 V per cell. That
136for four cells, but I think 5,45 V is best for Rockbox with the maximum time of 140would be 5,3 V for four cells, but I think 5,45 V is best for Rockbox with the
13712 hours. Note that the voltage values are taken in the part of a minute where 141maximum time of 12 hours.
142Note 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 143the charger is off, so the values are a little bit smaller than the actual
139average of the whole 60 seconds. 144average of the whole 60 seconds.
140The Philips TEA1102 top-off charge time (with 0,15 C) is one hour. 145The Philips TEA1102 top-off charge time (with 0,15 C) is one hour.
@@ -155,11 +160,11 @@ In simple words, it is
155 160
156remaining time = remaining battery energy / power consumption of AJB 161remaining time = remaining battery energy / power consumption of AJB
157 162
158With using the battery courves described above and the battery capacity you 163With using the battery curves described above and the battery capacity you
159selected in the settings menu, the remaining capacity is calculated. For the 164selected 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 165power consumption, a usual constant value is used. If the LED backlight is set
161to always on, it is also considered. Having a modified Jukebox with 8 MB of RAM 166to always on, it is also considered. Having a modified Jukebox with 8 MB of
162leads to about 22 percent longer estimated running time. 167RAM leads to about 22 percent longer estimated running time.
163 168
164 169
165[BATTERY DISPLAY HOW THE USER EXPECTS IT] 170[BATTERY DISPLAY HOW THE USER EXPECTS IT]
@@ -168,15 +173,15 @@ To not confuse the user with the shown battery level, some tricks are used in
168the battery level calculation (this does not affect the charging algorithm, 173the battery level calculation (this does not affect the charging algorithm,
169because it uses the raw voltages): 174because it uses the raw voltages):
170 175
171- if charging is completed, top-off charge or trickle charge is running, always 176- if charging is completed, top-off charge or trickle charge is running,
172 set the battery level to 100% 177 always set the battery level to 100%
173- the battery level is only allowed to change 1% per minute (exception: when usb 178- the battery level is only allowed to change 1% per minute (exception: when
174 is connected, is is allowed to go 3% down/min) 179 usb is connected, it is allowed to go 3% down/min)
175- if charging just started (or stopped), ignore the battery voltage for the 180- if charging just started (or stopped), ignore the battery voltage for the
176 first 25 minutes 181 first 25 minutes
177- after turning on the device, add another 5% to the battery level, because the 182- after turning on the device, add another 5% to the battery level, because
178 drive is used heavily when booting and the voltage usually gets a little higher 183 the drive is used heavily when booting and the voltage usually gets a
179 after that 184 little higher after that
180 185
181 186
182[WHICH CHARGING MODE TO USE] 187[WHICH CHARGING MODE TO USE]
@@ -190,9 +195,9 @@ charge on" (that the batteries remain full).
190 195
191A special case: If you fill up the batteries that are still nearly full every 196A special case: If you fill up the batteries that are still nearly full every
192night, it is recommended that you make a complete charge cycle from time to 197night, it is recommended that you make a complete charge cycle from time to
193time. Select "deep discharge on" and "trickle charge on" and wait till the whole 198time. Select "deep discharge on" and "trickle charge on" and wait till the
194cycle is over (you can speed up the discharging a little bit by turning on the 199whole cycle is over (you can speed up the discharging a little bit by turning
195LED backlight). Even if the battery sellers say NiMH cells don't show a memory 200on the LED backlight). Even if the battery sellers say NiMH cells don't show a
196effect, I recommend making this procedure from time to time (every 10th charging 201memory effect, I recommend making this procedure from time to time (every 10th
197cycle). BUT: Don't recharge the batteries completely every time if you don't 202charging cycle). BUT: Don't recharge the batteries completely every time if
198have to. 203you don't have to.