Low pass filter value for DAC

I was wondering, how to calculate the values needed for LC/RC filter when using it for digital to analog conversion?

Also, how does the square waves frequency affect DAC ?

For example: lets say I have 10 kHz 5V square wave output to the LPF. From it, I would like to get an analog value, with cut off frequency at 20kHz.

How would I calculate component values needed?

• When you say, "from [a 10 kHz square wave] I would like to get an analog value", are you talking about using pulse-width modulation (PWM)? Commented Jul 28, 2014 at 16:37
• Yes, sorry I was unclear. Commented Jul 28, 2014 at 16:38
• You can't encode a 20 kHz analog signal on a 10 kHz PWM signal. You need the PWM carrier frequency (10 kHz in your example) to be higher than the analog signal you are encoding, at least by a factor of 2, and preferably by a factor of 10 or more (to make the reconstruction circuit simple, which is usually the goal of using PWM). Commented Jul 28, 2014 at 16:46

$f_C = \dfrac{1}{2\pi RC}$ so...