Many microcontrollers feature a pulse-width-modulated (PWM) output that can be low-pass filtered to produce a variable dc voltage. Without additional circuitry, however, this technique is limited to controlling very low-power loads.
The circuit here illustrates a scheme that lets this dc voltage control a high-power load, such as a motor, actuator, or heating element (see the figure). Furthermore, the load voltage may be higher or lower than the microcontroller's supply voltage. On top of that, it may be adjusted over any suitable range with a resolution equal to the PWM signal.
The PWM signal, VPWM, together with resistor network R1-R3 and filter capacitor C1, generates the control voltage (VC), which is buffered and level shifted by IC1, R6, and R7. The load voltage (VL) appears at the output of the adjustable, positive voltage regulator (IC2) and can be set to any value from around 1.25 V up to a volt or so below the level of the high-power supply voltage (VS).
Although a bipolar or MOSFET transistor could be used as the pass device, the regulator has the advantage of intrinsic protection mechanisms, such as short-circuit current limiting and thermal overload shutdown. Furthermore, regulators such as the LM317 or LM1084IT-ADJ are relatively inexpensive and can deliver considerable load power with appropriate heatsinking.
These devices feature an internal bandgap reference that sets the output voltage to 1.25 V (typical) above the potential at the adjust (ADJ) pin. The closed loop around IC1, IC2, R6, and R7 produces the following relationship:
VL = VC\[1 + (R6/R7)\] (1)
where VC is the control voltage appearing at the op amp's non-inverting input terminal. This equation can be rearranged to give R6 in terms of VL, VC, and R7:
R6 = R7\[(VL/VC) - 1\] (2)
Now, provided VPWM can swing rail-torail and cover a 0 to 100% duty-cycle range, the following equations may be used to determine R1, R2, and R3:
R2 = R1\[(VC(MAX) VC(MIN))(VD - VC(MAX))\] (3)
R3 = R1\[(VC(MAX)/VC(MIN)) - 1\] (4)
The following two examples illustrate the design process.
VL = 3.0 to 12.0 V; VD = 3.3 V. First, we allow some margin on the limits of VL and let the range be 2.8 to 12.2 V. Also, we can simplify the circuit by assuming that VC(MAX) = VD = 3.3 V. From Equation 2, we find that:
R6 = R7\[(VL(MAX)/VC(MAX)) 1\], and so:
R6 = R7\[(12.2)/3.3) 1\] = 2.7 R7 Suitable preferred values are: R6 = 270 kΩ = 100kΩ. Rearranging Equation 1, we find that:
VC(MIN) = VL(MIN)/(1 + 2.7) = 2.8/3.7 = 0.757 V
Inserting the values of VC(MIN), VC(MAX), and VD into Equations 3 and 4, we find that R2 = ∞ (i.e., R2 is omitted), and R3 = 3.359 R1. Suitable preferred values are: R1 = 270kΩ, R3 = 910kΩ. The supply voltage VS should be set high enough to account for IC2's dropout voltage, typically 1.5 to 2.0 V for the LM317 and 1.0 V for the LM1084IT-ADJ (assuming 1-A load current, T = 25°C). In a test circuit built using the resistor values quoted above, VL ranged from 2.80 to 12.26 V.
VL = 2.5 to 4.5 V; VD = 5.0 V. Again, we allow some margin on VL and let the range be 2.3 to 4.7 V. Since VL(MAX) is less than VD, the potential divider action provided by R6 and R7 isn't required, so R7 may be omitted and the value of R6 is chosen to suit stability capacitor C3; say R6 = 100Ωk . Thus, VC(MAX) = VL(MAX) = 4.7 V, and VC(MIN) = VL(MIN) = 2.3 V. Inserting these values into Equations 3 and 4 yields:
R3 = 1.043 R1≈ R1, and R2 = 8 R1
Suitable preferred values are R1 and R3 = 150Ωk , R2 = 1.2 M Ω. A test circuit built using these values produced a VL range of 2.350 to 4.709 V.
Filter capacitor C1 determines the ripple on VC. If the PWM frequency isn't very low, a value of 100 nF to 1µF should be suitable. Op-amp IC1 should be chosen to accommodate the full range of VC at its input, and its output voltage (Vo) must satisfy Vo = VL - 1.25 V for all values of VL. If IC1's positive output swing is somewhat limited, optional resistor R4 may be included. This will set IC1's output voltage to Vo = (VL - 1.25 V) - (125 µA + IADJ)R4 , where IADJ is the regulator's adjust pin current, typically around 50µA.
However, R4 should be added with caution, especially if VL(MIN) is fairly low. For cases where VL(MAX) > VD, it will usually be necessary to power IC1 from the VS rail. However, for applications such as the one outlined in Example 2, it may be possible to use an op amp with rail-to-rail output powered from the VD rail.
Capacitor C3 is necessary to ensure stability of the op-amp/regulator loop. If R6 and R7 are in the hundreds of kilohms range, a value of 100 µF to 1 nF should be suitable. Smaller values of R6 and R7 may require a larger value of C3. Capacitors C2 and C4 must be chosen to suit the requirements of the regulator type used for IC2. Note that the precision of VL depends directly on VD, which should be well regulated.