# Control A High-Power Load With A Low-Power Microcontroller

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, V_{PWM}, together with resistor network R1-R3 and filter capacitor C1, generates the control voltage (V_{C}), which is buffered and level shifted by IC1, R6, and R7. The load voltage (V_{L}) 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 (V_{S}).

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:

V_{L} = V_{C}\[1 + (R6/R7)\] (1)

where V_{C} 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 V_{L}, V_{C}, and R7:

R6 = R7\[(V_{L}/V_{C}) - 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\[(V_{C}(MAX) V_{C}(MIN))(V_{D} - V_{C}(MAX))\] (3)

R3 = R1\[(V_{C}(MAX)/V_{C}(MIN)) - 1\] (4)

The following two examples illustrate the design process.

EXAMPLE 1 V_{L}= 3.0 to 12.0 V; V

_{D}= 3.3 V. First, we allow some margin on the limits of V

_{L}and let the range be 2.8 to 12.2 V. Also, we can simplify the circuit by assuming that V

_{C}(MAX) = V

_{D}= 3.3 V. From Equation 2, we find that:

R6 = R7\[(V_{L}(MAX)/V_{C}(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:

V_{C}(MIN) = V_{L}(MIN)/(1 + 2.7) = 2.8/3.7 = 0.757 V

Inserting the values of V_{C}(MIN), V_{C}(MAX), and V_{D} 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 V_{S} 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, V_{L} ranged from 2.80 to 12.26 V.

_{L}= 2.5 to 4.5 V; V

_{D}= 5.0 V. Again, we allow some margin on V

_{L}and let the range be 2.3 to 4.7 V. Since V

_{L}(MAX) is less than V

_{D}, 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, V

_{C}(MAX) = V

_{L}(MAX) = 4.7 V, and V

_{C}(MIN) = V

_{L}(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 V_{L} range of 2.350 to 4.709 V.

Filter capacitor C1 determines the ripple on V_{C}. 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 V_{C} at its input, and its output voltage (V_{o}) must satisfy V_{o} = V_{L} - 1.25 V for all values of V_{L}. If IC1's positive output swing is somewhat limited, optional resistor R4 may be included. This will set IC1's output voltage to V_{o} = (V_{L} - 1.25 V) - (125 µA + I_{ADJ})R4 , where I_{ADJ} is the regulator's adjust pin current, typically around 50µA.

However, R4 should be added with caution, especially if V_{L(MIN)} is fairly low. For cases where V_{L(MAX)} > V_{D}, it will usually be necessary to power IC1 from the V_{S} 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 V_{D} 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 V_{L} depends directly on V_{D}, which should be well regulated.