Start with the R C time being 10X the frequency. You can't really get all the bumps out without turning it into DC.
How good does it need to be? What's the application?
R C time is microfarads times megohms. for time in seconds. Rule of thumb.
@MLE_online @RueNahcMohr what arduino do you have? They have different PWM speeds. And what is your acceptable ripple in your output?
Slowest pwm is 490hz. If you filter that with a 1k resistor and a 10uf capacitor, that’s a cutoff of about 16hz. So you could have a control signal of about that. It would have a ripple of about [edit: 0.25] volts on the output
Edit: I accidentally ran the calculation at the wrong PWM speed. The slower speed gives you .25 volts ripple, the faster gives you 0.12v
@MLE_online @RueNahcMohr additional info: you can software bit bang a faster pwm, there are arduino libraries
Also, you can use this calculator for PWM. It has been around for decades and I use it all of the time. Just plug in the pwm frequency, and the resistor and capacitor values and it will come back with cutoff frequency, and output ripple, and even graph it over time
If the pwm is at 100kHz and you are trying to generate a sub 100hz tone, it might be fine. If you want full bandwidth audio to 20kHz, nope.
https://www.allaboutcircuits.com/technical-articles/low-pass-filter-a-pwm-signal-into-an-analog-voltage/
additionally, if you need steady more than resolution, an R-2R DAC is easy to make.