4
\$\begingroup\$

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

\$\endgroup\$
7
  • \$\begingroup\$ A schematic would be very helpful in understanding your problem. \$\endgroup\$
    – Phil Frost
    Commented Jan 14, 2013 at 19:40
  • \$\begingroup\$ Why are you attenuating the signal before op amp? You could just reduce op amp gain if needed. I'd put filter after op amp since op amp provides low impedance output. It would be helpful if you put a schematic and gave information about your microcontroller. \$\endgroup\$ Commented Jan 14, 2013 at 19:41
  • \$\begingroup\$ Are you using single or dual supply configuration? if it single supply, those resistors I would assume might help being the reference point, so you might have a wrong circuit. Schematic would definitively help. \$\endgroup\$ Commented Jan 14, 2013 at 19:43
  • \$\begingroup\$ It sounds like you have problems in your synthesis software. Fixing those should make your output clean within the nyquist bandwidth, requiring only a low pass filter for anti-aliasing. \$\endgroup\$ Commented Jan 14, 2013 at 21:17
  • \$\begingroup\$ In effect, you are trying a crude workaround for the DDS implementation problems raised, but apparently not yet fixed, in your previous question electronics.stackexchange.com/questions/53567/frequency-shift \$\endgroup\$ Commented Jan 14, 2013 at 21:25

1 Answer 1

5
\$\begingroup\$

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.

\$\endgroup\$
7
  • \$\begingroup\$ @Daniel - I think I have jumped the gun here, I initially though the filter was after the divider (sorry). I see the DAC is built into the PIC, just checking now... \$\endgroup\$
    – Oli Glaser
    Commented Jan 14, 2013 at 20:28
  • \$\begingroup\$ I've looked at the PIC's datasheet, ww1.microchip.com/downloads/en/DeviceDoc/41579D.pdf on page 170 which describes the DAC, it says nothing about the output impedance... \$\endgroup\$
    – Daniel
    Commented Jan 14, 2013 at 20:31
  • \$\begingroup\$ No, it's not the best documentation, but on pg.169 last paragraph it says the DAC needs buffering due to limited drive capability. So add the simple opamp buffer shown and your filter afterwards. You need to have a knwon impedaance source to drive your filter from (or as mentioned it can be made part of the opamp by placing a capacitor across the feedback resistor - if you want I can add an example of this also) \$\endgroup\$
    – Oli Glaser
    Commented Jan 14, 2013 at 20:42
  • \$\begingroup\$ Thanks. Could you please explaining what you mean by "lower the bandwidth?" which bandwidth? If it's no trouble, I'd love to learn how to place a capacitor across the feedback resistor. thank you very much! \$\endgroup\$
    – Daniel
    Commented Jan 14, 2013 at 20:48
  • 2
    \$\begingroup\$ Yes, that's what I meant. I think it's actually better just to put the filter after your buffer (since it simplifies things for a single supply circuit) I'll add a couple of references that go into some detail on the subject of opamp filters though. \$\endgroup\$
    – Oli Glaser
    Commented Jan 14, 2013 at 21:03

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.