Control an LM317T with a PWM signal

An EDN Design Idea

Aruna Prabath Rubasinghe, University of Moratuwa, Moratuwa, Sri Lanka; Edited by Martin Rowe and Fran Granville - February 3, 2011


Control an LM317T with a PWM signal figure 1The LM317T from National Semiconductor is a popular adjustable-voltage regulator that provides output voltages of 1.25 to 37V with maximum 1.5A current. You can adjust the output voltage with a potentiometer. The circuit in Figure 1 replaces the potentiometer with an analog voltage that you can control from a PWM (pulse-width-modulation) signal. You control this signal with a microcontroller or any other digital circuit. You can use the same microcontroller to dynamically monitor the output and adjust the LM317T.

Using an RC lowpass filter and an op amp, you can convert the PWM signal to a dc level that can adjust the LM317T’s voltage output. Varying the pulse width of the input signal lets you generate an analog voltage of 0 to 5V at the output of the lowpass filter. The op amp multiplies the voltage to achieve the desired voltage range.

For scenarios in which you must multiply the input voltage by two, the LM317T’s adjustment pin receives 0 to 10V. Its output-voltage range is 1.25 to 11.25V. The equation VOUT=VADJ+1.25V governs the LM3175T’s output voltage. You can change the op amp’s gain by choosing proper values for R4 and R2. You must be able to remove offset voltages from the op amp. Use an op amp, such as a National Semiconductor LM741, with null adjustment. The selection of values for the capacitor and resistor for the RC lowpass filter depends on the PWM signal’s frequency. This circuit uses values for a 1-kHz PWM signal.

You can improve the circuit by replacing the RC lowpass filter with an active filter and then feeding a feedback signal from the circuit’s output into the microcontroller for dynamic adjustments.

Comments to this article at EDN suggest that the LM741 op amp is not an ideal choice for this circuit; a better choice would be a rail-rail op amp.

 Control an LM317T with a PWM signal

Posted: 6 years 9 months ago by john p #12839
john p's Avatar
This is a scheme we've used for years at the MIT Model Railroad Club, and it works very well. We use an LM324 op amp running with 220Kohm and .1uF as a filter for a logic-level 60Hz PWM input at 5V, then a gain of 3 in the amplified loop, so our output is theoretically 0-15V. Here's a diagram:

One thing to note is that the output of an LM317 can't go below 1.25V, and we can't tolerate that (the trains might never stop!) so we put 3 diodes in series with the output.
Posted: 6 years 9 months ago by Jon Chandler #12840
Jon Chandler's Avatar

Thanks for sharing the model railroading circuit. It's nice to know this design idea works in the real world.

If the TMP512/513-based power monitor was added, this could be the basis of a nice power supply.

Forum Activity

  • No posts to display.

Member Access