2
\$\begingroup\$

I have an msp430 synth project and can't decide on the output:

I get an 8 bit ~45kHz PWM output out of the chip which I'd like to use as an audio signal, but I am unsure whether

  • I can just stick an impulse amplifier on it and let it in a speaker through a decoupling capacitor
  • I should filter off the PWM frequency

So the question is - should I filter off the ~45kHz component of the signal before I let it into any audio output device (amplified speakers, headphones etc.).

I do know for a fact that it'll work either way, I'm just concerned about damaging any additional amplifiers following in the signal path and harming the speakers themselves. So I'd appreciate tips from someone with experience with this.

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

It depends.

If you want a line-level output for headphones, recording, other audio systems, yes you should filter off the 45kHz PWM component. I would suggest the "3rd order Sallen-Key low-pass filter" from your filter design page as a starting point. It ought to provide a clean enough signal to prevent damage to anything downstream.

But if you want to re-record this signal you may need to clean it up further : you can add 2nd-order Sallen-Key stages to make a 5th or 7th order filter, but a nice alternative would be the "twin-T notch filter" on that site, with the notch at 45 kHz.

If you want power output, take the raw PWM signal to a half-bridge to form a Class-D amplifier. Then I would recommend the R-L-C lowpass filter from that site with R = 4 or 8 ohms : in reality, your loudspeaker.

\$\endgroup\$
3
  • \$\begingroup\$ Thanks. I guess I'm gonna go with a third order multiple feedback lowpass (Sallen Key only allows amplification over 1, I need the signal to be a bit smaller to comfortably amplify) followed by an A-Class transistor amplifier. Can't really have my filter Q change with different loads, so the D-class option won't work. \$\endgroup\$
    – Linards
    Mar 23, 2014 at 11:42
  • 2
    \$\begingroup\$ The notch filter is a nice idea, but I wonder if the PWM harmonics at 90kHz (and above) might remain problematic? \$\endgroup\$ Mar 23, 2014 at 12:39
  • 2
    \$\begingroup\$ If the notch is all you have, higher harmonics are problematic. I meant to use it in conjunction with a 3rd order LPF, providing increasing attenuation at higher frequencies. \$\endgroup\$
    – user16324
    Mar 23, 2014 at 13:01
3
\$\begingroup\$

Yes, you should filter off the PWM frequency. 'Tweeters' (high frequency speakers) are susceptible to damage from excess power at high frequencies.

Since you presumably want to keep all frequencies below about 20kHz, a simple RC filter will give only a little over 6dB of attenuation at 45kHz. You may want to consider a higher-order filter if the aim is to connect this to a hi-fi and speakers. (This filter design tool from Analog Devices may be helpful).

\$\endgroup\$
1
  • \$\begingroup\$ Any idea about the desired attenuation factor? Your filter design link doesn't seem to work for me, but I use sim.okawa-denshi.jp/en/Fkeisan.htm usually anyway. \$\endgroup\$
    – Linards
    Mar 23, 2014 at 10:41
-2
\$\begingroup\$

I've been playing with PWM output on an arduino following http://makezine.com/projects/make-35/advanced-arduino-sound-synthesis/ the output they use just has a 10K resistor and a 0.1uF filtering cap.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, but this answer's a bit too simple for my case. \$\endgroup\$
    – Linards
    Mar 23, 2014 at 10:49

Your Answer

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

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