Electronic – PWM Analog DAC using MCU

dacpwm

I have attempted to use a calculator without success.

Using a 5 V logic gate that will be driven by a Kinetis MCU, I would like to make a DAC. I have tried a 10k and 100nF filter but at 1 kHz I get a sawtooth on the output. I need <0.1V ripple at 500Hz.

Ideally I would like to lower the PWM frequency even more (say 200 Hz) but have a nice variable 0 – 5 V output. Any ideas on RC combo? Response is not that much of an issue. A full sweep from 0 V to 5 V in < 200 ms would be adequate.

PCBs are made so only option is to change the R/C values not redesign the layout.

Its currently logic TTL signal into a 10k then out of that to the "measure point" with a 100 nF cap to ground from there.

Best Answer

Your requirements make things impossible.

Let's write things down. Ripple specs:

  • filter approach: single-stage RC low pass, these have 6 dB attenuation per octave
  • Voltage range \$U_{tot} = 5 \text{ V}\$
  • ripple \$U_{rip}< 0.1\text{ V} = \frac{U_{tot}}{50}\$ at 500 Hz, that's 13 dB suppression of the 5 V peak-to-peak you're putting into the filter
  • Therefore, you need at least roughly 13/6 octaves separation between PWM frequency and 500 Hz
  • Therefore, the cut-off frequency of the filter needs to be at least ca 1.1 kHz

You'll have to tell your software guy to rework his firmware, I'm afraid.