Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 1 | CHARGING ALGORITHM |
| 2 | |
| 3 | This doc and a part of the charger implementation (especially voltage courves, |
| 4 | remaining time estimation, trickle charge) is written by Uwe Freese. If you miss |
| 5 | some information here, write to mail@uwe-freese.de. |
| 6 | |
| 7 | |
| 8 | |
| 9 | [INTRODUCTION] |
| 10 | |
| 11 | This doc describes how the charging works for the recorder. The algorithm can be |
| 12 | found in firmware/powermgmt.[c|h]. Debug output is done in apps/debug_menu.c. |
| 13 | Charging for the player is done by the hardware and therefore isn't implemented |
| 14 | in rockbox. |
| 15 | |
| 16 | All 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 | |
| 28 | See http://www.uwe-freese.de/rockbox for some voltage courves taken while |
| 29 | charging and decharging an AJB. |
| 30 | |
| 31 | These voltage courves are implemented as arrays in rockbox. We can then |
| 32 | calculate how full the batteries are (in percent) after taking the actual |
| 33 | voltage. 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 | |
| 52 | When charging is started, the charger is turned on. The batteries are charged |
| 53 | with 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 | |
| 62 | The max duration is calculated dynamically. The time depends on how full the |
| 63 | battery is when charging is started. For a nearly full battery, the max duration |
| 64 | is low, for an empty one, it is a high value. The exact formula can be found in |
Uwe Freese | f848453 | 2002-12-15 23:25:27 +0000 | [diff] [blame] | 65 | the source code. The battery capacity is also considered here. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 66 | |
| 67 | |
| 68 | [DELTA PEAK - WHY DOES IT WORK?] |
| 69 | |
| 70 | Delta peak means to detect that the battery voltage goes down when the |
| 71 | batteries are full. |
| 72 | |
| 73 | Two 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 | |
| 80 | NiMH batteries have a smaller delta peak than NiCd, but is is enough for Rockbox |
| 81 | to detect that the batteries are full. |
| 82 | |
| 83 | Related 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 | |
| 97 | After a normal charge is completed, trickle charging is started. That means |
| 98 | charging to keep the batteries full. While trickle charge in other (stand alone) |
| 99 | chargers means charging the amount that the battery loses because of self |
| 100 | decharging, here it's charging the amount the AJB consumes when it's on. That's |
| 101 | because it is not possible to switch off the AJB when charging is done. It goes |
| 102 | on again and then the archos firmware charger code would charge again. So we |
| 103 | have trickle charge in rockbox. |
| 104 | |
| 105 | In simple words, rockbox charges about 15 seconds per minute in trickle mode. An |
| 106 | AJB consumes 100 mA when it's on and the charging current is about 300mA. So |
| 107 | charging 15 s and decharge 45 s will keep the batteries full. |
| 108 | |
| 109 | But the number of seconds the charger is on in trickle charge mode is also |
| 110 | adjusted dynamically (between 1 and 24 sec). Rockbox tries to hold the battery |
| 111 | level at 5,65 V (top off charge, that means "make the batteries completely |
| 112 | full") for 90 minutes, then a level of 5,45 V. If the voltage drops below the |
| 113 | wanted value, rockbox will charge one second more the next minute. If is is |
| 114 | greater than this value, is will charge one second less. |
| 115 | |
| 116 | Trickle charging runs 12 hours after finishing the normal charging. That should |
| 117 | be enough for charging the AJB over night and then unplug the charger sometime |
| 118 | in this 12 hour trickle charge time. It is not recommended to trickle charge |
| 119 | over days, that's because it is stopped after 12 hours. |
| 120 | |
| 121 | Many chargers do top off and trickle charge by feeding a constant (low) current |
| 122 | to the batteries. Rockbox, as described, makes a voltage regulation. That's |
| 123 | because the power consumption of the AJB changes when backlight is on/disk is |
| 124 | spinning etc. and doing a voltage regulation is the simplest way to charge |
| 125 | exactly the needed amount. |
| 126 | |
| 127 | There are two charge ICs I want to mention here: The Philips TEA1102 and TEA1103 |
| 128 | do voltage regulation for NiCd and NiMH at 1,325 V per cell. That would be 5,3 V |
| 129 | for four cells, but I think 5,45 V is best for Rockbox with the maximum time of |
| 130 | 12 hours. Note that the voltage values are taken in the part of a minute where |
| 131 | the charger is off, so the values are a little bit smaller than the actual |
| 132 | average of the whole 60 seconds. |
| 133 | The Philips TEA1102 top-off charge time (with 0,15 C) is one hour. |
| 134 | |
| 135 | My test results with trickle charge (battery capacities measured with an |
| 136 | external 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 | |
| 142 | Result: Trickle charge works. :) |
| 143 | |
| 144 | |
| 145 | [REMAINING TIME ESTIMATION] |
| 146 | |
| 147 | In simple words, it is |
| 148 | |
| 149 | remaining time = remaining battery energy / power consumption of AJB |
| 150 | |
Uwe Freese | f848453 | 2002-12-15 23:25:27 +0000 | [diff] [blame] | 151 | With using the battery courves described above and the battery capacity you |
| 152 | selected in the settings menu, the remaining capacity is calculated. For the |
| 153 | power consumption, a usual constant value is used. If the LED backlight is set |
| 154 | to always on, it is also considered. |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 155 | |
| 156 | |
| 157 | [BATTERY LAZYNESS] |
| 158 | |
| 159 | The battery voltage gives no realistic hint to the actual charging status when |
| 160 | the charger was just turned on or off. |
| 161 | |
| 162 | Assume a 50% full battery and then turn on the charger. The voltage goes up. But |
| 163 | the voltage is smaller than the voltage of a 50% full battery when the charging |
| 164 | started at 0%. |
| 165 | |
| 166 | To consider this (and make a better remaining time estimation possible), I |
| 167 | implemented the battery lazyness array. It means (in simple words, let's assume |
| 168 | the 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 | |
Uwe Freese | 3817730 | 2002-12-14 12:21:54 +0000 | [diff] [blame] | 180 | If you use your AJB connected to the power supply the whole time, select "deep |
| 181 | discharge on" and "trickle charge off". |
| 182 | |
| 183 | If you want to charge your AJB over night and take it with you the next day, |
| 184 | select "deep discharge off" (that it starts charging immediately) and "trickle |
| 185 | charge on" (that the batteries remain full). |
| 186 | |
| 187 | A special case: If you fill up the batteries that are still nearly full every |
| 188 | night, it is recommended that you make a complete charge cycle from time to |
| 189 | time. Select "deep discharge on" and "trickle charge on" and wait till the whole |
| 190 | cycle is over (you can speed up the discharging a little bit by turning on the |
| 191 | LED backlight). Even if the battery sellers say NiMH cells don't show a memory |
| 192 | effect, I recommend making this procedure from time to time (every 10th charging |
| 193 | cycle). BUT: Don't recharge the batteries completely every time if you don't |
| 194 | have to. |