0
\$\begingroup\$

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?

\$\endgroup\$
  • 1
    \$\begingroup\$ 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)? \$\endgroup\$ – The Photon Jul 28 '14 at 16:37
  • \$\begingroup\$ Yes, sorry I was unclear. \$\endgroup\$ – Golaž Jul 28 '14 at 16:38
  • 1
    \$\begingroup\$ 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). \$\endgroup\$ – The Photon Jul 28 '14 at 16:46
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Sampling frequency means PWM frequency, right? \$\endgroup\$ – Golaž Jul 28 '14 at 16:46
  • 1
    \$\begingroup\$ If you are using PWM as your DAC output then yes, it could mean sampling frequency. If you are using a regular DAC it's normally called sampling frequency i.e. how often you update the output with a new digital value. \$\endgroup\$ – Andy aka Jul 28 '14 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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