Subject: Original Headlamp Regulator Doc Original Document 9/22/93: Revised slightly 3/23/94, 8/4/94, 4/12/95 ------------------------------------------------------------------------ Pulse Width Modulated Voltage Regulator for Electric Caving Lamps Problem History A simple electric caving light using disposable alkaline batteries running a vacuum bulb works fine, but has many disadvantages. Since alkalines have a steep voltage-discharge curve, the difference in lamp brightness over the battery life can be great. Caving regularly requires spending significant money on non-reusable batteries. Vacuum bulbs do not provide as much light per watt of input as krypton or quartz-halogen lamps. Of course, krypton and halogen lamps can be and are used with alkalines, but since they tend to be relatively high- current bulbs they cause significant voltage drop of alkaline batteries because of the high cell-impedance. This drop becomes wasted power inside the batteries, which reduces the total watt-hours available, thus reducing the number of hours of light. Also, halogen bulbs perform well only if supplied with power at a small range of voltage. If the voltage is too high, the lamps burn out very fast because halogens normally operate at higher filament temperature than krypton or vacuum bulbs. If the voltage is too low, then the halogen bulb's cycle does not work properly and the bulb blackens prematurely. Since lithium batteries have a flat voltage-discharge curve, they are much better than alkalines at providing constant bulb power. However they are very expensive, non-reusable, and pose significant safety risk if a cell is ruptured in a cave. Rechargeable lithium batteries are available but are also very expensive. To overcome the cost problems with alkaline and lithium, two types of rechargeable batteries are normally used, nickel-cadmium (NiCad) and lead-acid. NiCads work well since they have a flat voltage-discharge curve and low cell-impedance. Thus, NiCads can run high-current bulbs at nearly constant brightness until almost depleted. However NiCads do have disadvantages. They are more expensive, especially at higher capacities, than lead-acids, and they need to be cycled completely to prevent memory problems which reduce their capacity. Lead-acids are relatively inexpensive and have a low cell-impedance. They have a steep voltage-discharge curve, but not nearly as steep as that of alkalines. This discharge curve makes them difficult to use with halogen bulbs. Another problem with most systems is properly matching the bulb voltage and battery voltage. For example, a 5.2-volt halogen matches poorly with any 6-volt lead-acid. The off-the-charger voltage above 6.8 will burn out the bulb immediately. Most of the power comes around 6.0 to 6.5 volts which is much too high. On the other hand, a 4-volt lead-acid is much too low. Even four NiCads produce voltage on the low side of what that bulb needs, after an hour or two of use. Often it is a game to find a bulb with the desired voltage and current to match the batteries and desired number of hours. One solution to the steep discharge curve of lead-acid batteries is to use a variable resistor (rheostat) in series with the bulb. The resistance can be decreased by the user as the battery drains. This works as a manual voltage-regulator where the user is part of the feedback system. When the bulb get noticeably dimmer, the user simply turns the knob. This solution does not conserve battery power, since power is wasted in the variable resistor. Electronic Regulator A better solution to many of these problems is to use an electronic voltage regulator. An ideal regulator would take power at any voltage and convert it to the desired voltage with no loss of power. Practical regulators can approach the ideal, with some limitations. By using a regulator between the battery and the lamp, constant brightness can be achieved over almost all of the battery's capacity. This is especially good for lead-acids and alkalines, since the battery voltage drops significantly from start to finish. For example, a 6-volt lead-acid can range from 7.2 to 5.2 volts, but run through a regulator it can produce a constant 5.2 volts RMS to run a 5.2-volt halogen lamp. Since the regulator can provide a different output voltage with the same battery, it is possible to run a 3.75-volt halogen or a 2.3-volt krypton bulb from a 6-volt lead-acid battery. Because of the regulator's high efficiency, almost all the battery power is delivered to the bulb, even though the bulb voltage may be far less than the battery voltage. This allows greater flexibility when choosing lamp-power to burn-hours for a given caving trip. Of course all good things have a down side. Regulators do cost money. They add complexity which undoubtably reduces reliability of the lighting system. If not properly protected from water, they will fail to work correctly. However, a well-built regulator should be trouble-free and last a lifetime. Regulator Designs In designing a regulator for low-voltage lamps there are many aspects to consider. High efficiency must be obtained or much of the benefit is lost. Thus, the power to run the regulator itself must be small. The cost should be low, and size of the parts should be small. The output need only maintain the bulb brightness, not necessarily be DC. It would be nice if the output voltage could be higher or lower than the battery voltage. Given these criteria, it was obvious that a pulse-width modulated waveform should be sent directly to the lamp. This requires only an electronic switch between the battery and the lamp. The only requirement of the waveform is that the RMS (root mean square) voltage be constant. In simpler terms, the power can be turned on and off at a high enough rate so that bulb averages the power, providing constant heating of the filament. As the battery voltage drops, the duty cycle (on time divided by the sum of the on and off times) increases so the bulb gets the same power (RMS voltage) but not the same peak or average voltage. When the battery voltage drops to the same voltage as the bulb, the duty cycle reaches 100%. Below that point the bulb will get dimmer, since the duty cycle cannot go beyond 100 percent. This means that the regulator cannot produce a higher output voltage than its input voltage. Thus, bulb voltages must be lower than the lowest battery voltage. The trick is knowing what duty cycle to use as the input voltage varies. In the first-generation design, the regulator samples the bulb resistance during the off-time. The regulator then increases or decreases the duty cycle to maintain constant bulb resistance. Since bulb resistance relates to filament temperature, this works very well. However this regulator is quite complex. The 2nd-generation design tries to approximate the desired mathematical function (reciprocal of the input voltage squared). It is too simple and does not provide a wide enough input voltage range. The 3rd-generation incorporates a refinement in the approximation function. It works well enough to provide a small-percentage variation from ideal over a wide input range. Also, it is simple enough that it can be built inside most headlamps. Regulator Operation Figure 1 shows the schematic of the 3rd-generation design. U1 (LM555) makes a 650Hz oscillator with a 99-percent duty cycle. R1 (220K), R2 (2.7K), D1 (1N914), and C1 (0.01uF) are the timing components of this oscillator. R3 pulls the output of U1 all the way up to the battery voltage: the 555's output does not go all the way to Vcc because of transistor voltage-drop. The discharge pin of U1 is connected to the pulse-width modulating (PWM) timing components VR1 (5K), R7 (15K), R11, and C3 (0.01uF). Since the discharge pin is an open-collector output, it behaves like a switch to ground. Every 1.5 mS (1/650 Hz) the discharge pin of U1 turns on for 25 uS, completely discharging C3. VR1, R7, and R11 then charge C3 back up. U2 (LM555) compares the voltage of C3, and the reference voltage coming from U3. U3 (LM317L), R5 (360), R6 (220), C4 (0.1uF), and C5 (0.01uF) make a 3.3-volt reference that does not vary until the battery voltage drops too low. When the voltage of C3 is less than 3.3 volts, the output of U2 is high, which turns on Q1 (30N03). Conversely, when the voltage of C3 is greater than 3.3 volts the output of U2 is low, which turns off Q1. When Q1 is on, the bulb is connected to the battery which heats the filament, and when Q1 is turned off the bulb has no power, so the filament cools. Being a high-current power MOSFET, Q1 has little voltage drop because of an "on" resistance of less than 30 milliohms. Q1 takes no DC gate power, unlike a bipolar power transistor. R8 (2.7K) like R3 pulls the output of U2 up to the battery voltage. R9 (220) prevents Q1 from oscillating in the 100+ MHz range during switching. C6 (220uF) lowers the high-frequency impedance of the battery. If Alkalines are used, C6 will need to be much larger. See the later section on use with Alkalines. SW1 turns the power on and off. Notice that the bulb current does not run through the switch. This prevents power loss in the switch due to bulb current. Leakage through Q1 is so small when the regulator is off that it will not affect the shelf life of the battery. R10 (1 ohm) is used to check the regulator current and prevent switch-contact pitting from charging C4. The regulator current is approximately 12 mA. Version 2 adds components Q2 (2N2907), R12 (2.7K), R13 (82K), R14 (82K), R15 (15K), C7 (10uF) and D2 (1N914). These components provide a temporary faster charging of C3 so that the bulb dims-up slowly to full brightness. This should help extend the life of the bulbs, since bulbs normally burn out when power is first applied. Because a cold filament has a much lower resistance than a hot one, the initial current is quite high. This high current can overheat and fuse a thin spot in the filament before the rest of the filament heats up. If this feature is not desired, these components can be left out. By adjusting VR1, all the timing components can be compensated for tolerance variations. R1, C1, VR1, R15, R11, C3, R5, R6, the trigger and theshold voltage of U1, and the reference voltage of U3 have the most effect on the PWM duty cycle. Of course, all the values could be calculated, but component tolerances, particularly the U1 LM555 and U3 LM317, are much wider than desired output tolerance, thus making it necessary to adjust for tolerances. Regulator Timing Theory This section is included for those who like math or are just curious how the component values were obtained. Calculated timing values are all based on the solution to the standard RC differential equation: v(t) d v(t) ------- = i(t) = C -------- R dt which has the solution: -t --------- v(t) = Vinit e R C For the oscillator U1, the C1 charges from 1/3 to 2/3 Vcc with a final voltage of Vcc. This is a ratio of 1/2 of the final voltage of Vcc, thus: -t ln( 0.5 ) = ------------------ 222.7K * 0.01uF This results in a time of 1.54 mS. Similarly, C1 discharges from 2/3 to 1/3 Vcc with a final voltage of 0.6 because of the diode. For a 6.0 Volt Vcc the ratio would be 0.412. This results in a time of 24 uS. The sum 1.57 ms makes a 638 Hz oscillator. C3 charges from zero to the voltage from U3 before the output switches off. At exactly 100% duty cycle C3 charges in exactly the time it takes C1 to charge. U3 (LM317) has a nominal 1.25 volt internal reference across the R6 (220 ohm) and 50 uA of current from the adjustment pin across R5 (360 ohm) results in a 3.31 volt reference. Given that R11 will be 100K and the duty cycle will be 100% with a Vcc of 5.2 volts, the ratio of Vcc that VR1 should produce can be calculated approximately as: - 1.54 mS = ln( 0.5) * 222.7K * 0.01uF -------------------------------------------------- V ratio = e ( 100K + 2K approx. impedance of VR1) * 0.01uF This results in a ratio of 0.220. So the reference voltage of 3.31 is ( 1 - 0.220 ) = 0.780 of the final voltage. Thus, the final voltage is 4.25 volts, which is 0.817 of the 5.2-volt Vcc. This means that VR1 should be 27% from the lower voltage end. Of course, component tolerances will make this vary greatly. It is interesting to note that a change of C1 and C3 values will not affect the duty cycle provided that they both change the same amount. Now, suppose that Vcc is raised to 6.5 volts. The output should maintain a 5.2 volt RMS. This implies the duty cycle should be 0.64 given this equation: V RMS ^ 2 duty cycle = -------------- Vcc ^ 2 Working backwards through the above timing calculation, the voltage of VR1 would be 5.31 volts. That makes the voltage ratio 0.376. Solving: -t ln( 0.376 ) = ------------------ 102K * 0.01uF result in 0.997 mS plus 24 uS on discharge time, which is 0.65 of the 1.57 mS cycle time. Thus the calculated value 0.65 implies that the regulator will be very close to the theoretical value of 0.64. The only question now should be how was the 100K for R11 selected? This was done by doing the above calculation at 24 different voltages from 5.2 to 7.5 volts. Different values for R11 were tried and all 24 calculated duty cycles were compared with the theoretical duty cycles. Iteratively, a best-fit R11 was found. Thanks to a computer, this was a quick process. Of course, the user need not understand any of this math to build and use the regulator. Regulator Adjustment To adjust VR1, the regulator needs to be hooked up to a 5.25v power source, and connect a 5.2 or greater voltage bulb to the regulator. Set R11 to 100K and adjust VR1 until 100% duty cycle is achieved on the output. Back-off VR1 very slowly until the output just starts pulsing and thus is around 99 to 100%. It is easy to see when the output starts pulsing with an oscilloscope or with a logic probe. If neither are available, use a digital voltmeter on the AC scale across the bulb. The meter will read zero when the output is not pulsing, and jump up when it starts. After this adjustment R11 can then be changed to whatever value is needed to match the bulb voltage being used. The adjustment of VR1 only needs to be done once regardless of changes in R11 later to match different voltage bulbs. Table 1 shows some values for R11: Bulb Voltage R11 ------------------------- 5.5 V 110K -----R16------------ 5.2 V 100K | | 4.8 82K ----*----R17---0\ | 3.75 50K | \0----*---- 2.8 24K -----R18---0 2.33 16K Multi bulb R11 substitute Table 1. Figure 2. R11 can be wired with a switch to select different values. A SPDT center-off switch can be used to select 3 different bulb voltages using the circuit in figure 2. For example, if R16 and R17 are 100K, and R18 is 19K, then a 5.2, 3.75, or 2.33 volt bulb can be used by switching the switch. Table 2 lists the theoretical duty cycles for various input and bulb voltages. This can be used to check the regulator operation and to trim the value of R11. Other values for R11 can be selected empirically by using the formula given in table 2. (bulb voltage)^2 Theoretical Duty Cycle = --------------------- (battery voltage)^2 battery bulb voltage voltage 2.33 2.80 3.75 4.80 5.20 5.50 --------------------------------------------------------------- 9.00 7 10 17 28 33 37 8.90 7 10 18 29 34 38 8.80 7 10 18 30 35 39 8.70 7 10 19 30 36 40 8.60 7 11 19 31 37 41 8.50 8 11 19 32 37 42 8.40 8 11 20 33 38 43 8.30 8 11 20 33 39 44 8.20 8 12 21 34 40 45 8.10 8 12 21 35 41 46 8.00 8 12 22 36 42 47 7.90 9 13 23 37 43 48 7.80 9 13 23 38 44 50 7.70 9 13 24 39 46 51 7.60 9 14 24 40 47 52 7.50 10 14 25 41 48 54 7.40 10 14 26 42 49 55 7.30 10 15 26 43 51 57 7.20 10 15 27 44 52 58 7.10 11 16 28 46 54 60 7.00 11 16 29 47 55 62 6.90 11 16 30 48 57 64 6.80 12 17 30 50 58 65 6.70 12 17 31 51 60 67 6.60 12 18 32 53 62 69 6.50 13 19 33 55 64 72 6.40 13 19 34 56 66 74 6.30 14 20 35 58 68 76 6.20 14 20 37 60 70 79 6.10 15 21 38 62 73 81 6.00 15 22 39 64 75 84 5.90 16 23 40 66 78 87 5.80 16 23 42 68 80 90 5.70 17 24 43 71 83 93 5.60 17 25 45 73 86 96 5.50 18 26 46 76 89 100 5.40 19 27 48 79 93 100 5.30 19 28 50 82 96 100 5.20 20 29 52 85 100 100 5.10 21 30 54 89 100 100 5.00 22 31 56 92 100 100 4.90 23 33 59 96 100 100 4.80 24 34 61 100 100 100 4.70 25 35 64 100 100 100 4.60 26 37 66 100 100 100 Table 2 Construction This regulator can be built on a small piece (1 x 1.5 inches) [2.5 x 4cm] of perf board by careful placement of components and standing-up resistors. A LM556 will save space since it is two LM555's in a 14- pin package. Since capacitors tend to be much less temperature-stable than resistors, it is critical that C1 and C3 be of good quality. Polycarbonate or polyester work well. Most modern 5% resistors are stable enough for this regulator, but 1%'s can be used for better stability. If the regulator is put inside the headlamp then temperature stability is more of a concern. With a high-power halogen bulb inside a plastic headlamp the regulator may be subjected to high temperatures. Conversely, a low-power bulb in a metal headlamp will not heat up much at all. Recent note: PCB are available and highly recommended for construction. Q1, the power MOSFET, may be any N-channel MOSFET with sufficiently low on-resistance. The 30N03 ratings are 30 volts, 30 amps, and on- resistance less than 0.03 ohms. Most MOSFETs below 60 volts and greater than 25 amps will work well, as they have appropriately low on-resistance. The 30N03 loses only 0.5 percent when running a 5.2 volt, 0.88 amp bulb. MOSFETs with higher resistance will work, but efficiency will be reduced and the bulb will get less power unless R11 is adjusted. What percentage constitutes a reasonable efficiency is debatable. A simple procedure to select a MOSFET would be to keep the ratio of the MOSFET on-resistance to the bulb resistance as low as practical. Table 3 shows various bulbs and their resistance, and table 4 shows various MOSFETs. Note that the bulbs with the * are particularly demanding on MOSFET selection. Also, the bulbs with the + will require a battery voltage higher than 6 volts. bulb volts amps watts ohms ----------------------------------------------- HPR36 Halogen 5.5 1.00 5.5 5.5 K-18 Krypton 7.2 0.7 5.0 10.3 + HPR50 Halogen 5.2 0.88 4.6 5.9 HPR51 Halogen 6.5 0.70 4.5 9.3 + HPR40 Halogen 6.0 0.67 4.0 9.0 K-12 Krypton 6.0 0.65 3.9 9.2 + HPR53 Halogen 4.0 0.85 3.4 4.7 * K-15 Krypton 4.8 0.7 3.4 6.9 605 Vacuum 6.0 0.5 3.0 12.0 + K-3 Krypton 3.6 0.8 2.9 4.5 * HPR41 Halogen 3.75 0.75 2.8 5.0 425 Vacuum 5.0 0.5 2.5 10.0 HPR52 Halogen 2.8 0.85 2.4 3.3 * Petzl Halogen 3.75 0.5 1.9 7.5 K-2 Krypton 2.4 0.8 1.9 3.0 * PR-3 Vacuum 3.57 0.5 1.8 7.1 K-1 Krypton 2.4 0.6 1.4 4.0 * K-222 Krypton 2.33 0.6 1.4 3.9 * PR-2 Vacuum 2.38 0.5 1.2 4.8 * K-4 Krypton 2.33 0.48 1.1 4.9 * Petzl Vacuum 3.75 0.22 0.8 17.0 243 Vacuum 2.33 0.22 0.5 10.6 Table 3 Paralleling MOSFETs is another option. Two 0.18-ohm MOSFETs in parallel make 0.09 ohms. Drains and sources can be connected directly in parallel, but separate gate-resistors must be used. If the gates are connected directly in parallel, a push-pull oscillator will result in the 100+ Mhz range. This often kills the MOSFETs, and at a minimum will waste power. MOSFET volts amps ohms ------------------------------ IRFZ40 50 51 0.028 30N03 30 30 0.03 IRFZ42 50 35 0.035 IRFZ30 50 30 0.05 35N05 50 35 0.055 35N06 60 35 0.055 25N05 50 25 0.08 IRF540 100 27 0.085 IRF541 60 27 0.085 15N05 50 15 0.16 15N06 60 15 0.16 IRF530 100 14 0.18 IRF531 60 14 0.18 Table 4 The finished board will fit inside a metal Justrite (tm) headlamp. The switch on the headlamp must be replaced with a subminiature toggle switch. The switch can be soldered in for a watertight seal. The cord coming into the headlamp should also be sealed by using sealant or a grommet or both. Jacketed cord will seal better than zip cord. The front lens can be glued to the metal ring and teflon tape used on the ring threads to complete the sealing job. This is by no means watertight but will suffice for temporary immersions. Figure 2 shows the board installed into a headlamp. For better water protection the unit can be potted. Polystyrene Q dope works well for this purpose and is available at most electronic supply stores. Figure 2 There are many other headlamps available and most are much more water- resistant than the one shown. If there is not sufficient space to put the regulator inside the headlamp then a separate box with watertight wiring through the box will be needed. If the regulator is built into a small pressure vessel it can be used diving but the user should be convinced of the construction reliability before using it for a real dive. Lead-Acid Batteries This regulator is designed for use with 6 volt (3 cell) starved- electrolyte sealed lead-acid batteries. There are many companies who sell these batteries in a range from 2 to 65 amp-hours. Many companies have thin packages in the 4 to 8 amp-hour range which are nice for caving. Recommended charging is constant voltage of 7.2 to 7.3 volts with an initial current limit. Most of these batteries have charging instructions printed on the batteries. Gelled types can be used although their general performance is not as good as the starved- electrolyte type. As with any rechargeable battery, be careful when discharging them fully not to reverse voltage on any one cell. The best way to prevent this is as soon as the light starts getting dim, stop using the battery. NiCad Batteries NiCads can also be used. A pack made of 5 cells will work best. This gives an initial voltage of less than 7 volts and an ending voltage greater than 5. AA, C and D cells are readily available, but only the high-capacity variety are worth using. The cells are rated at 0.85, 2.0, and 4.3 amp-hours, respectively. 7.5 and 10 amp-hour cells are available but are very expensive. Alkalines Batteries As shown, this regulator will not work properly with alkalines because they have a much higher impedance than NiCad or lead-acid batteries. The high impedance causes so much voltage ripple that the regulator will not produce the correct duty cycle. One solution to this problem is to change C6 to a sufficiently large value to reduce this ripple to small enough value so that the regulator can work properly. For a 3.75 volt 0.22 amp bulb using 5 AA's, 6000 uF is sufficient. For other bulb and battery combinations the ripple should be checked and capacitance added until the ripple is less than 200 mV peak-to-peak. Recent note: 2 1000uF low ESR caps are sufficient for the Petzl standard bulb. With high-current halogen bulbs it may be impractical to put enough capacitance in parallel with the battery, even using parallel sets of D-cells. One solution is to increase the switching frequency. This reduces the size of C6 needed for a given ripple amount. This can be done by changing both C1 and C3 to a smaller value. This has its limitations, because capacitors used for C6 will have internal resistance which will dominate the reactive capacitance if the frequency is high enough. There are low ESR capacitors made for switching power supplies which will work better than standard types. Also, if the frequency is increased the switching losses will start to become significant. Recent note: 2 low ESR 4700uF caps is sufficient for bulbs up to 1 amp and at least C or larger alakine batteries. These low ESR caps will fix the ripple problem where as the standard type just don't get the job done. Further Refinement If low-power bulbs are to be used, then the user may want to modify the circuit to reduce power consumption, thus increasing overall efficiency. If the regulator uses 80 mW with a 4.5-watt bulb, then regulator power is less than 2% of the bulb power, resulting in a 97% overall efficiency. However if the same regulator is used with a 0.8- watt bulb, then regulator power is 10% of the bulb power, resulting in a 89% efficiency. This is still high, but almost 10% more of the battery power could be used for light instead of heat. To reduce the regulator power, construct the regulator using a CMOS version of the LM555, and modify the resistor and capacitor values. Scale-up R1, R2, R7, R11, and VR1 by a factor of 10. Scale-down C1 and C3 by a factor of 10. Scale-up R5 and R6 by a factor of 3 to 4. The LM317 will have to be tested to make sure it still regulates properly with the larger values of R5 and R6. Remove R3 and R8, since the CMOS LM555 will pull up all the way to Vcc. Also, Q2, R12, R13, R14, R15, C7, and D2 can be removed since low-power bulbs will probably not burn out from initial current inrush. If the dimming is still desired then scale-up the resistors by a factor of 10 and scale-down C7 by a factor of 10. These modifications will reduce the regulator current to 2 mA, which equates to 13 mW at 6.5 volts. This is 1.6% of a 0.8-watt bulb, thus efficiency will be increased to 98%. Of course, these modifications, along with paralleling two 30N03's, can be used with a 4.5-watt bulb resulting in greater than 99% efficiency. This is perfect for those who need something to brag about. Recent note: The revised schematic shows different values that reduce power considerably with Bipolar 555's or the CMOS 555's.