Electronic – Low-pass filter on microcontroller output

analogaudiofiltermicrocontroller

I'm producing a signal which contains 7 frequencies using a microcontroller with a DAC. the frequencies are 16.5kHz 16.7kHz 16.9kHz 17.2kHz 17.4kHz 17.6kHz 17.8kHz. and sampling frequency (at the output) is 86kHz.
The signal from the mc is at is then decreased by two resistors (600R/2600R)and fed into
LM-386 (which increases the signal by 20) and then into a 4ohm Speaker.

Because of the generation method I get harmonics, aliasing and some parasitic low frequency of which I wish to get rid off.
I've calculated that for RC-LPF with Fc=20kHz I need 220nF and 34ohm however, when I put them just before the the (600R/2600R) resistors the whole signal seems to be attenuated significantly!

Am I doing something wrong here?
Thanks for the help!

EDIT:
The microcontroller is pic16F1783

here's the schematic:
enter image description here

Best Answer

The PICs DAC peripheral has a very low drive capability (read high output impedance) so it needs to be buffered. The datasheet gives an example:

DAC Buffer

If you add your RC filter directly after the DAC, the impedance of he DAC will add to the R in the RC filter and lower the bandwidth. So implement the buffer and then put the filter afterwards (or you can make the filter part of the gain opamp)

To filter the opamp with the gain of 20, you can add a capacitor across the feedback resistor something like ths:

Opamp Filter

Here's a couple of references on opamp filters:

Basic reference
Opamps for Everyone - not just filters, but an excellent overall free book on opamps, well worth having handy.