Most controller/processor come with PWM output and integrated standalone DAC module....

My need is to generate 50/60Hz analog signal for testing purpose! Which would be the good choice PWM DAC or Standalone DAC?

Better in terms of: * Simple electronics * Simple coding * Quality signals (lesser distortion) * Sine wave generation

  • 3
    \$\begingroup\$ What do you define as "better"? Not all DACs are the same. Many high performance "standalone" sigma-delta DACs actually generate a (sort of) PWM signal. Also a 50/60Hz analog signal means little, a 50 Hz signal can have very different requirements depending on shape of the signal and its bandwidth. \$\endgroup\$ Commented Feb 18, 2019 at 11:05
  • \$\begingroup\$ Sine or square wave? \$\endgroup\$
    – winny
    Commented Feb 18, 2019 at 11:07
  • \$\begingroup\$ Better in terms of: * Simple electronics * Simple coding * Quality signals * Sine wave generation \$\endgroup\$ Commented Feb 18, 2019 at 11:08
  • \$\begingroup\$ Do you only care about generating pure sine tones, or more complicated waveforms should be supported? \$\endgroup\$
    – anrieff
    Commented Feb 18, 2019 at 12:29

2 Answers 2


Given the MCU_PWM_DAC has electro-static-discharge protection diodes on the (inputs and) outputs of the MCU, your signal will always have MCU_CLOCK and MCU_program_related spikes and trash that are non-random.

Use this filter on the "DAC"


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ I like this approach. If parts allow, the filter corner can be made a little sharper (less overdamped) by keeping the RC of each section constant. In principle for this example 1k/10u , 3k3/3u3 , 10k/1u ... this is prob more reasonable with higher freq filter (a bit smaller caps) \$\endgroup\$
    – Pete W
    Commented Feb 13, 2021 at 18:33

I'm assuming that a Sinewave output is required here.

Any primitive DAC you implement will work fine but will likely be noisy unless a fair bit of design is carried out to filter it etc.

All things considered the PWM DAC you implement yourself is likely to be much noisier than a standalone one - purely for the reason that it has been optimized for a particular usage / price point. On the other hand a PWM one will likely be cheaper and easier to get working - because you will not need to figure out the comms and configuration registers of the external DAC.

So for simple I would go with the PWM option - but for better quality I would use the external DAC.

Actually if it's just the signal that is of interest, I would just use a computer with sound card to generate the signals if that is an option. You should get a very clean signal at these frequencies with 16-24bits of resolution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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