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