Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 1 | CHARGING ALGORITHM |
| 2 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 3 | This doc and a part of the charger implementation (especially voltage curves, |
| 4 | remaining time estimation, trickle charge) is written by Uwe Freese. If you |
| 5 | miss some information here, write to mail@uwe-freese.de. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 6 | |
| 7 | |
| 8 | |
| 9 | [INTRODUCTION] |
| 10 | |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 11 | This doc describes how the charging works for the recorder. The algorithm |
| 12 | can be found in firmware/powermgmt.[c|h]. Debug output is done in |
| 13 | apps/debug_menu.c. |
| 14 | |
| 15 | Charging for the player and the FM/V2 recorder is done by the hardware and |
| 16 | therefore isn't implemented in rockbox. Only the functions that |
| 17 | calculate the battery level are also used for these models. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 18 | |
| 19 | All 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 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 29 | [VOLTAGE CURVES] |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 30 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 31 | See http://www.uwe-freese.de/hardware-projekte/rockbox/ladeverfahren.html |
| 32 | for some voltage curves taken while charging and decharging an AJB. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 33 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 34 | These voltage curves are implemented as arrays in rockbox. We can then |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 35 | calculate how full the batteries are (in percent) after taking the actual |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 36 | voltage. Both voltage curves (charging and decharging) are used here. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 37 | |
| 38 | |
| 39 | [CHARGE OVERVIEW] |
| 40 | |
| 41 | - If voltage drops under a certain value (with "deep discharge" option on the |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 42 | value is a lot lower), charging is started. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 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 |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 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). |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 49 | |
| 50 | |
| 51 | [NORMAL CHARGE] |
| 52 | |
| 53 | When charging is started, the charger is turned on. The batteries are charged |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 54 | with a constant current of about 350mA. The charging is stopped for three |
| 55 | reasons: |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 56 | |
| 57 | - the voltage goes down in a 5 min interval (delta peak, see below) |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 58 | - the voltage goes up only a little bit in an 30 min interval (is mainly |
| 59 | constant) |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 60 | - the charging duration exceeds a maximum duration |
| 61 | |
| 62 | |
| 63 | [DYNAMIC MAX DURATION CALCULATION] |
| 64 | |
| 65 | The max duration is calculated dynamically. The time depends on how full the |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 66 | battery is when charging is started. For a nearly full battery, the max |
| 67 | duration is low, for an empty one, it is a high value. The exact formula can |
| 68 | be found in the source code. The battery capacity is also considered here. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 69 | |
| 70 | |
Uwe Freese | 96f5de9 | 2003-01-26 17:19:31 +0000 | [diff] [blame] | 71 | [LIION BATTERY IN FM RECORDER] |
| 72 | |
| 73 | (todo) |
| 74 | http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf |
| 75 | |
| 76 | |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 77 | [DELTA PEAK - WHY DOES IT WORK?] |
| 78 | |
| 79 | Delta peak means to detect that the battery voltage goes down when the |
| 80 | batteries are full. |
| 81 | |
| 82 | Two facts on batteries are the reason why this works: |
| 83 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 84 | - If the batteries are full, the charging current cannot charge the battery |
| 85 | anymore. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 86 | So the energy is absorbed by heating up the battery. |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 87 | - Each battery has a negative temperature coefficient, that means the voltage |
| 88 | goes down when the temperature goes up. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 89 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 90 | NiMH batteries have a smaller delta peak than NiCd, but is is enough for |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 91 | Rockbox to detect that the batteries are full (in theory :-). |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 92 | |
| 93 | Related 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 | |
| 107 | After a normal charge is completed, trickle charging is started. That means |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 108 | charging to keep the batteries full. While trickle charge in other (stand |
| 109 | alone) chargers means charging the amount that the battery loses because of |
| 110 | self decharging, here it's charging the amount the AJB consumes when it's on. |
| 111 | That's because it is not possible to switch off the AJB when charging is done. |
| 112 | It goes on again and then the archos firmware charger code would charge again. |
| 113 | So we have trickle charge in rockbox. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 114 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 115 | In simple words, rockbox charges about 15 seconds per minute in trickle mode. |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 116 | An AJB consumes 100 mA when it's on and the charging current is about 350mA. |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 117 | So charging 15 s and decharge 45 s will keep the batteries full. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 118 | |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 119 | But the number of seconds the charger is on in trickle charge mode is |
| 120 | also adjusted dynamically. Rockbox tries to hold the battery level at |
| 121 | 5,65 V (top off charge, that means "make the batteries completely full") |
| 122 | for 90 minutes, then a level of 5,45 V. If the voltage drops below the |
| 123 | desired value, rockbox will charge one second more the next minute. If |
| 124 | is is greater than this value, is will charge one second less. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 125 | |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 126 | The number of seconds the charger is on in top off and trickle charge |
| 127 | modes is also dependant on the charger's output voltage: if the charger |
| 128 | supplies less than about 10v, the current into the batteries is less and |
| 129 | thus the percentage on is increased to maintain the proper current into |
| 130 | the batteries. |
| 131 | |
| 132 | The original recharging algorithm stopped trickle charging after 12 hours, |
| 133 | at which time the battery would be discharged until the the batteries |
| 134 | fell below the "start charging" level. At that time the charge cycle |
| 135 | would be repeated. |
| 136 | |
| 137 | The time limit was removed by Jerry Van Baren (along with other changes) |
| 138 | in the February, 2005 timeframe. The rationale for this is that the |
| 139 | trickle charge level is very low. In addition, it is disconcerting to |
| 140 | have a AJR plugged in and "recharged" only to find out that the battery |
| 141 | is only 86% full. This was giving the Rockbox recharging algorithm a |
| 142 | bad name and frustrating our users. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 143 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 144 | Many chargers do top off and trickle charge by feeding a constant (low) |
| 145 | current to the batteries. Rockbox, as described, makes a voltage regulation. |
| 146 | That's because the power consumption of the AJB changes when backlight is |
| 147 | on/disk is spinning etc. and doing a voltage regulation is the simplest way |
| 148 | to charge exactly the needed amount. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 149 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 150 | There are two charge ICs I want to mention here: The Philips TEA1102 and |
| 151 | TEA1103 do voltage regulation for NiCd and NiMH at 1,325 V per cell. That |
| 152 | would be 5,3 V for four cells, but I think 5,45 V is best for Rockbox with the |
| 153 | maximum time of 12 hours. |
| 154 | Note that the voltage values are taken in the part of a minute where |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 155 | the charger is off, so the values are a little bit smaller than the actual |
| 156 | average of the whole 60 seconds. |
| 157 | The Philips TEA1102 top-off charge time (with 0,15 C) is one hour. |
| 158 | |
| 159 | My test results with trickle charge (battery capacities measured with an |
| 160 | external 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 | |
| 166 | Result: Trickle charge works. :) |
| 167 | |
| 168 | |
| 169 | [REMAINING TIME ESTIMATION] |
| 170 | |
| 171 | In simple words, it is |
| 172 | |
| 173 | remaining time = remaining battery energy / power consumption of AJB |
| 174 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 175 | With using the battery curves described above and the battery capacity you |
Uwe Freese | f848453 | 2002-12-15 23:25:27 +0000 | [diff] [blame] | 176 | selected in the settings menu, the remaining capacity is calculated. For the |
| 177 | power consumption, a usual constant value is used. If the LED backlight is set |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 178 | to always on, it is also considered. Having a modified Jukebox with 8 MB of |
| 179 | RAM leads to about 22 percent longer estimated running time. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 180 | |
| 181 | |
Uwe Freese | 3e3d857 | 2002-12-18 19:39:13 +0000 | [diff] [blame] | 182 | [BATTERY DISPLAY HOW THE USER EXPECTS IT] |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 183 | |
Uwe Freese | 3e3d857 | 2002-12-18 19:39:13 +0000 | [diff] [blame] | 184 | To not confuse the user with the shown battery level, some tricks are used in |
| 185 | the battery level calculation (this does not affect the charging algorithm, |
| 186 | because it uses the raw voltages): |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 187 | |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 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) |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 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 |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 194 | little higher after that (rebounds) |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 195 | |
| 196 | |
| 197 | [WHICH CHARGING MODE TO USE] |
| 198 | |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 199 | Jerry Van Baren's revised recommendation: Select "deep discharge OFF" |
| 200 | and "trickle charge ON". This will keep your batteries charged up and |
| 201 | IMHO will not damage them. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 202 | |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 203 | Original recommendation: |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 204 | |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 205 | A special case: If you use your AJR connected to the power supply all |
| 206 | the time or if you fill up the batteries that are still nearly full every |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 207 | night, it is recommended that you make a complete charge cycle from time to |
Jörg Hohensohn | 2584896 | 2005-03-03 07:25:43 +0000 | [diff] [blame] | 208 | time. Select "deep discharge ON" and "trickle charge OFF" and wait till the |
Linus Nielsen Feltzing | 25a60a5 | 2004-07-23 08:45:34 +0000 | [diff] [blame] | 209 | whole cycle is over (you can speed up the discharging a little bit by turning |
| 210 | on the LED backlight). Even if the battery sellers say NiMH cells don't show a |
| 211 | memory effect, I recommend making this procedure from time to time (every 10th |
| 212 | charging cycle). BUT: Don't recharge the batteries completely every time if |
| 213 | you don't have to. |