A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1CHARGING ALGORITHM
2
3This doc and a part of the charger implementation (especially voltage curves,
4remaining time estimation, trickle charge) is written by Uwe Freese. If you
5miss some 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
12can be found in firmware/powermgmt.[c|h]. Debug output is done in
13apps/debug_menu.c.
14
15Charging for the player and the FM/V2 recorder is done by the hardware and
16therefore isn't implemented in rockbox. Only the functions that
17calculate the battery level are also used for these models.
18
19All following information is related to the recorder.
20
21
22[TECHNICAL POSSIBILITIES AJB]
23
24- The AJB can read the voltage of the battery (all four cells in series,
25 resulting in about 5V).
26- We can switch the charging current (about 350mA, constant) on and off.
27
28
29[VOLTAGE CURVES]
30
31See http://www.uwe-freese.de/hardware-projekte/rockbox/ladeverfahren.html
32for some voltage curves taken while charging and decharging an AJB.
33
34These voltage curves are implemented as arrays in rockbox. We can then
35calculate how full the batteries are (in percent) after taking the actual
36voltage. Both voltage curves (charging and decharging) are used here.
37
38
39[CHARGE OVERVIEW]
40
41- If voltage drops under a certain value (with "deep discharge" option on the
42 value is a lot lower), charging is started.
43- If end of charge is detected, go to top off charge.
44- Make the batteries completely full. 90 minutes of top off charge (voltage
45 regulation at a higher value).
46- After that, trickle charge (voltage regulation at a nominal battery value).
47 The trickle charge will continue as long as the charger is plugged in (this
48 is a change from the original charge algorithm).
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
55reasons:
56
57- the voltage goes down in a 5 min interval (delta peak, see below)
58- the voltage goes up only a little bit in an 30 min interval (is mainly
59 constant)
60- the charging duration exceeds a maximum duration
61
62
63[DYNAMIC MAX DURATION CALCULATION]
64
65The max duration is calculated dynamically. The time depends on how full the
66battery is when charging is started. For a nearly full battery, the max
67duration is low, for an empty one, it is a high value. The exact formula can
68be found in the source code. The battery capacity is also considered here.
69
70
71[LIION BATTERY IN FM RECORDER]
72
73(todo)
74http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf
75
76
77[DELTA PEAK - WHY DOES IT WORK?]
78
79Delta peak means to detect that the battery voltage goes down when the
80batteries are full.
81
82Two facts on batteries are the reason why this works:
83
84- If the batteries are full, the charging current cannot charge the battery
85 anymore.
86 So the energy is absorbed by heating up the battery.
87- Each battery has a negative temperature coefficient, that means the voltage
88 goes down when the temperature goes up.
89
90NiMH batteries have a smaller delta peak than NiCd, but is is enough for
91Rockbox to detect that the batteries are full (in theory :-).
92
93Related documents on the web:
94
95 http://www.nimhbattery.com/nimhbattery-faq.htm questions 3 & 4
96 http://www.powerpacks-uk.com/Charging%20NiMh%20Batteries.htm
97 http://www.angelfire.com/electronic/hayles/charge1.html (soft start idea)
98 http://www.powerstream.com/NiMH.htm (discouraging)
99 http://www.panasonic.com/industrial/battery/oem/images/pdf/nimhchar.pdf
100 http://www.duracell.com/oem/Pdf/others/nimh_5.pdf (discharging)
101 http://www.duracell.com/oem/Pdf/others/nimh_6.pdf (charging)
102 Philips TEA1102/1103/1104 PDFs available at www.philips.com.
103
104
105[TOP OFF CHARGE AND TRICKLE CHARGE]
106
107After a normal charge is completed, trickle charging is started. That means
108charging to keep the batteries full. While trickle charge in other (stand
109alone) chargers means charging the amount that the battery loses because of
110self decharging, here it's charging the amount the AJB consumes when it's on.
111That's because it is not possible to switch off the AJB when charging is done.
112It goes on again and then the archos firmware charger code would charge again.
113So we have trickle charge in rockbox.
114
115In simple words, rockbox charges about 15 seconds per minute in trickle mode.
116An AJB consumes 100 mA when it's on and the charging current is about 350mA.
117So charging 15 s and decharge 45 s will keep the batteries full.
118
119But the number of seconds the charger is on in trickle charge mode is
120also adjusted dynamically. Rockbox tries to hold the battery level at
1215,65 V (top off charge, that means "make the batteries completely full")
122for 90 minutes, then a level of 5,45 V. If the voltage drops below the
123desired value, rockbox will charge one second more the next minute. If
124is is greater than this value, is will charge one second less.
125
126The number of seconds the charger is on in top off and trickle charge
127modes is also dependant on the charger's output voltage: if the charger
128supplies less than about 10v, the current into the batteries is less and
129thus the percentage on is increased to maintain the proper current into
130the batteries.
131
132The original recharging algorithm stopped trickle charging after 12 hours,
133at which time the battery would be discharged until the the batteries
134fell below the "start charging" level. At that time the charge cycle
135would be repeated.
136
137The time limit was removed by Jerry Van Baren (along with other changes)
138in the February, 2005 timeframe. The rationale for this is that the
139trickle charge level is very low. In addition, it is disconcerting to
140have a AJR plugged in and "recharged" only to find out that the battery
141is only 86% full. This was giving the Rockbox recharging algorithm a
142bad name and frustrating our users.
143
144Many chargers do top off and trickle charge by feeding a constant (low)
145current to the batteries. Rockbox, as described, makes a voltage regulation.
146That's because the power consumption of the AJB changes when backlight is
147on/disk is spinning etc. and doing a voltage regulation is the simplest way
148to charge exactly the needed amount.
149
150There are two charge ICs I want to mention here: The Philips TEA1102 and
151TEA1103 do voltage regulation for NiCd and NiMH at 1,325 V per cell. That
152would be 5,3 V for four cells, but I think 5,45 V is best for Rockbox with the
153maximum time of 12 hours.
154Note that the voltage values are taken in the part of a minute where
155the charger is off, so the values are a little bit smaller than the actual
156average of the whole 60 seconds.
157The Philips TEA1102 top-off charge time (with 0,15 C) is one hour.
158
159My test results with trickle charge (battery capacities measured with an
160external charger):
161
162- after normal charge and top off time: 1798, 1834, 1819, 1815 mAh
163- after normal + top off + trickle charge (12h): 1784, 1748, 1738, 1752 mAh
164- charged with external charger: 1786, 1819, 1802, 1802 mAh
165
166Result: Trickle charge works. :)
167
168
169[REMAINING TIME ESTIMATION]
170
171In simple words, it is
172
173remaining time = remaining battery energy / power consumption of AJB
174
175With using the battery curves described above and the battery capacity you
176selected in the settings menu, the remaining capacity is calculated. For the
177power consumption, a usual constant value is used. If the LED backlight is set
178to always on, it is also considered. Having a modified Jukebox with 8 MB of
179RAM leads to about 22 percent longer estimated running time.
180
181
182[BATTERY DISPLAY HOW THE USER EXPECTS IT]
183
184To not confuse the user with the shown battery level, some tricks are used in
185the battery level calculation (this does not affect the charging algorithm,
186because it uses the raw voltages):
187
188- if charging is completed, top-off charge or trickle charge is running,
189 always set the battery level to 100%
190- the battery level is only allowed to change 1% per minute (exception: when
191 usb is connected, it is allowed to go 3% down/min)
192- after turning on the device, add another 5% to the battery level, because
193 the drive is used heavily when booting and the voltage usually gets a
194 little higher after that (rebounds)
195
196
197[WHICH CHARGING MODE TO USE]
198
199Jerry Van Baren's revised recommendation: Select "deep discharge OFF"
200and "trickle charge ON". This will keep your batteries charged up and
201IMHO will not damage them.
202
203Original recommendation:
204
205A special case: If you use your AJR connected to the power supply all
206the time or if you fill up the batteries that are still nearly full every
207night, it is recommended that you make a complete charge cycle from time to
208time. Select "deep discharge ON" and "trickle charge OFF" and wait till the
209whole cycle is over (you can speed up the discharging a little bit by turning
210on the LED backlight). Even if the battery sellers say NiMH cells don't show a
211memory effect, I recommend making this procedure from time to time (every 10th
212charging cycle). BUT: Don't recharge the batteries completely every time if
213you don't have to.