To convert a PWM signal to a DC voltage it must be filtered with a low pass filter. How can you know which cut-off frequency should be used and how do you calculate the values for the resistor and capacitor belonging to that cut-off frequency. I do know that the cut-off frequency needs to be much higher/lower in comparison to the PWM signal, for example a factor 100 lower/higher.

enter image description here

  • 1
    – Juraj
    Mar 18 '19 at 11:02
  • program the cut-off based on how fast you need to change set voltage, not by PWM frequency. If you need to adjust in 100ms, aim for that, and you won't be disappointed. Also, you can use a 2nd stage to drastically improve the smoothing at a given resistor size, which can help response times by using a higher-frequency cut-off but still getting enough smoothing.
    – dandavis
    Mar 18 '19 at 17:48
  • Note also this will not work exactly as expected depending on how much current is sink on Uout
    – Julien
    Mar 20 '19 at 13:01

The PWM frequency on the Arduino is about 500Hz by default, so you want your -3dB frequency to be below that. How far below? That's subjective. Lower gives a smoother output but a lower response speed. Since you want DC out then you can afford to go very low, unless you need it to respond to changes in the set point quickly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.