While this circuit may not be as efficient as an LED driver module or a switching solution the LM317 is cheap and readily available. [Afroman] also describes how the circuit works in detail ...
This design idea revisits another: “PWM power DAC incorporates an LM317.” Like the earlier circuit, this one implements a power DAC by integrating an LM317 positive regulator into a mostly passive PWM ...