Electronic – Low pass filter value for DAC

daclow pass

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?

Best Answer

If you are not very close to the sampling frequency you can assume that the output amplitude from the DAC pretty much represents the input amplitude - this means that the low pass filter you wish to design (if a 1st order) would be based on a resistor feeding a capacitor to ground and the filtered output taken from the capacitor. The 3dB point of the filter is: -

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

Plug 20,000 Hz into the formula and maybe 1000 ohms and see what value capacitor you get. For higher order filters I'd use a 2nd order sallen-key calculator like from here - it's a good site and I trust it for coming up with the goods.

You do need to be aware of the problems if the highest frequency you want to produce is greater than a fifth of the sampling frequency - this will cause an amplitude error and you may want to "straighten" this out with a little bit of high pass filtering to. Here is an explanation and below is the formula that you need to worry about when compensating: -

enter image description here

It describes how the amplitude tails off as the input frequency gets closer to the sampling frequency.