Does the capacitor in this circuit serve as a low-pass filter?

The circuit:

The premise of the circuit is to be a small SD card based music player. The write up, Simple SD Audio Player with an 8-pin IC, says that it is necessary to filter the PWM output with a low-pass filter. I believe this is usually done with a capacitor. Unfortunately, I'm not overly familiar with the mechanism that a capacitor uses to act as a low-pass filter. Is the capacitor in this circuit acting as a low-pass filter? If yes, then what value capacitor would be good as a low-pass filter for the PWM output?

  • \$\begingroup\$ A capacitor is a high-pass filter. If you want a low-pass filter you'd have to replace it by an inductor. \$\endgroup\$
    – flup
    Dec 24 '13 at 18:00

This does not make much sense. You said in comments that in PB4 there is a inductor and not a capacitor. Unless you did a incorrect assemble of your parts it should be a capacitor. The picture shows a capacitor and makes sense to be a capacitor. This is probably a low voltage and low power application. Usually you put low-pass filters into loudspeakers when you have woofers and subwoofers which, by the way, generally need high power. So it makes more sense to be a high-pass filter as Scott said, which is represented by a series capacitor. Depending on capacitor's value will filter more or less but still remove most of bass sound and DC levels.

As for the Vcc line, there is a capacitor (left) AND a battery (right). The 3.3v label should be linked to the battery. And this capacitor is now in parallel to the load. So it is a low pass filter and this is probably to help absorbing fast transients in Vcc line and keep it stable.

  • \$\begingroup\$ Thanks, all I wanted to know is if the cap connected to vcc is a LPF, and you answered that. Btw, I didn't make the schematic, I'm trying to interpret the work of a Japanese engineer. That could be why some of the symbols are a little unusual. \$\endgroup\$ Dec 12 '13 at 23:47
  • \$\begingroup\$ The decoupling cap is sort of a low pass filter, but it has absolutely nothing to do with low-pass filtering the PWM signal, which doesn't exist between the SD card and the microcontroller. The circuit shown does not low pass filter the PWM signal. \$\endgroup\$ Dec 12 '13 at 23:49
  • \$\begingroup\$ I see. But this left capacitor is not so unusual. It is a polarized capacitor by the way (which is different from the right one). Many IC's use decoupling caps in Vcc line and you can see this as a low pass filter because its function is to absorb fast transients or noise. \$\endgroup\$ Dec 12 '13 at 23:51
  • \$\begingroup\$ But Scott is right, this filter has nothing to do with the PWM signal. \$\endgroup\$ Dec 12 '13 at 23:51

There are two capacitors, one on Vcc for decoupling, and one on PB4. The latter actually is a HIGH PASS FILTER, to remove any DC component on the signal driving the speaker.

For a low pass filter, if you need one, I'd recommend an op amp circuit (to drive the low impedence speaker), like http://www.swarthmore.edu/NatSci/echeeve1/Ref/FilterBkgrnd/Filters.html, taken from http://www.swarthmore.edu/NatSci/echeeve1/Ref/FilterBkgrnd/Filters.html, with the cutoff frequency equal to \$ \frac{1}{2 \pi R_1C_1} \$, set to about 40KHz, assuming your PWM is well above 40KHz. Depending on what the speaker is, and how much power you need to generate, that might need to be an audio op amp capable of pushing some power.

\$C_2\$ would be the cap already in your circuit, and \$ \frac{R_1}{R_2} \$ would be the gain. If the resistors are equal, the gain is unity.

http://elm-chan.org/works/sd20p/sdsg.png looks like it is actually using the speaker itself as a low pass filter. If you keep the PWM frequency high enough, the speaker will not be able to track it, so you don't need another low pass filter.

  • \$\begingroup\$ 2 questions: 1)the component on pb4 is actually an inductor, so can inductors also work as filters? \$\endgroup\$ Dec 12 '13 at 23:13
  • \$\begingroup\$ 2) what is the purpose of the two capacitors connected to vcc \$\endgroup\$ Dec 12 '13 at 23:13
  • \$\begingroup\$ also, I believe the right "capacitor" connected to vcc is actually a battery, but my second question still stands. \$\endgroup\$ Dec 12 '13 at 23:15
  • \$\begingroup\$ Yes, one capacitor (for decoupling) and one battery. That makes more sense. The 3.3 volt label refers to the battery value, not the value of Vss. Not a particularly well laid out circuit, with power in the middle going both ways and the signal path from right to left. \$\endgroup\$ Dec 12 '13 at 23:24
  • \$\begingroup\$ Never seen that symbol used for an inductor. Are you sure? Looking at elm-chan.org/works/sd20p/sdsg.png, those are clearly caps \$\endgroup\$ Dec 12 '13 at 23:27

Capacitors have a an impedance that can be calculated as $$Z_c = \frac{1}{2\times\pi\times f\times C}$$ so as the frequency rises the impedance (resistance) lowers.

On the other hand the impedance for inductors is exactly the opposite, the equation is $$Z_l = {2\times\pi\times f\times L}$$

These properties can be used to create low/band/high pass filters.

Take a look at this regarding PWM filtering

(f: frequency, C: capacitance, L: inductance)

  • \$\begingroup\$ I'd be a bit careful about driving an 8 ohm speaker from a simple RC filter. It should probably have a buffer amp before the speaker to match impedances better. I have a feeling that the site the diagrams in the original post in this thread is actually driving a powered speaker, not a speaker, though. \$\endgroup\$ Dec 13 '13 at 0:01
  • 1
    \$\begingroup\$ I think this is explained in the hardware section elm-chan.org/works/sd8p/report.html , "The load may be too heavy for the output port. However the output current is never exceed the absolute maximum ratings at 3 volts supply voltage..." and also "When connect the audio outputs to the amplifier, the high frequency component must be filtered out with LPF. Do not input the PWM signals directly to the amplifier or the amplifier and speakers can be damaged." \$\endgroup\$
    – alexan_e
    Dec 13 '13 at 0:06

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.