5
\$\begingroup\$

I am working on a project "cat projector" which shall "shout" at the cat when she jumps on the table in the living room.

For the logic I use an Arduino board which plays/streams the sound at 22.1kHz from a SD-Card and using the MCP4821 DAC to generate the signal. This works perfectly fine (as you can see on the measurement). The output on the DAC is 0-4V.

This is the schema for the DAC part of my project. R3 and C4 should filter the noise from the Arduino board.

The DAC part of the schema.

VCC for the DAC is 5V and comes from the Arduino board.

The problematic part is the Amplifier I use. This is the schematic for the amplifier with the LM386N-1 and some resistors and capacitors to filter noise. I actually used one of the usage examples from the data sheet of the chip. The amplifier is powered with 9V directly from the power source.

The amp part of the schema.

I drew a yellow and a blue point at the places of the measurements. What I measure at this points is this:

The measurement.

I am just lost at this point. If I try to increase the amplification, I quickly reach the limit and get the shown distortion until there is no hearable sound left.

Note: the 0V line for the blue line is at the bottom of the screen. See the Marker "1" and "2" for the 0V line of the measurement.

I am a beginner with amplifier and do not know what I actually do wrong, or how I could improve this setup.

My final goal would be to get around 40-60 dB in front of a small speaker.

So, how can I improve my existing setup? Or what are I am doing wrong?

Final Solution

Just for documentation, this is the working circuit I ended up with. It is using the LM386N-1 with a 8Ω, 0.2W speaker. The sound quality is usable, with small distortions on high frequency tones.

The final solution

Using C1/C5, there is no hearable noise if the DAC is turned off (0V level). The actual measurement looks like this:

The measurement of the solution

The yellow signal is measured in front of the speaker. The blue signal is measured at pin 3 (input+) of the amp. Note the different scales: Yellow 1V, blue 50mV.

\$\endgroup\$
  • 1
    \$\begingroup\$ AC couple (i.e. stick a 1uf or 10uf capacitor in series) between the DAC and amplifier. As you turn R2 up you are sticking more DC into the amp and clipping to the positive rail. \$\endgroup\$ – Brian Drummond Oct 21 '14 at 23:28
  • \$\begingroup\$ @IgnacioVazquez-Abrams Your link [only] comment goes to a code page. The question seems to be about an analog amplifier. \$\endgroup\$ – Nick Alexeev Oct 22 '14 at 0:08
  • \$\begingroup\$ @NickAlexeev: Which is being used to amplify audio generated by an Arduino. I never claimed it was an answer to the question. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 22 '14 at 0:19
3
\$\begingroup\$

There are a couple problems with your amplifier circuit:

1) There is a 10 Ohm resistor (R1) which limits the current which can be drawn by the amplifier. There is no reason for this resistor.

2) Your input is not properly A/C coupled. Remember that if you have a DAC like yours which is single supply (in the sense that it is powered from "0V" and "5V") trying to output audio, audio signals go both positive and negative (e.g. representing the displacement of the speaker cone, which goes both in and out). This means inevitably the true "zero point" of your audio signal out of your DAC must be between your voltage rails (typically, it is chosen at the halfway point of 2.5V). However, sending this offset out to your speakers causes distortion and possibly damage to the speakers (since it means that your speaker cone is always driving one way), so we want to remove this offset in the amplifier via a high-pass filter.

The input side of your amplifier as drawn is not a high-pass filter, in fact it acts as a sort of low-pass filter (which makes the problem worse), this is probably the source of your distortion. Try using the circuit below, or a variation of it. You must choose capacitor C1, C2, and C3 such that the lowest frequency you care about is passed by in the input filter such that \$f_c=\frac{1}{2\pi*(R3||R4)*C1}\$. In general, a larger capacitor is better, so long as the above condition is satisfied "in the ballpark".

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Thank you very much, it seems this is the solution I am searching for. Can you explain what you mean with (R3||R4) in your formula? Serial, parallel calculation of the resistors? I checked my electrical engineering foundations book, but couldn't find this || symbol. \$\endgroup\$ – Flovdis Oct 22 '14 at 18:11
  • \$\begingroup\$ I mean the parallel combination of R3 and R4, essentially R3/2 if they are equal. \$\endgroup\$ – Zuofu Oct 22 '14 at 18:14
  • \$\begingroup\$ I built your suggested circuit, but it seems one of the problems is still the input from the DAC. In the spec for the LM386N, the input voltage is specified as ±0.4V, but the signal from the DAC is ±2.0V. Just put a resistor in front of the input? \$\endgroup\$ – Flovdis Oct 22 '14 at 21:56
  • \$\begingroup\$ Oh, I see, the LM386N has a fixed gain (I didn't realize this and I assumed it was an op-amp with a speaker driver on the output). In this case, use the input stage as you originally specified in the above circuit, but with a series capacitor. \$\endgroup\$ – Zuofu Oct 22 '14 at 22:22
  • \$\begingroup\$ I'm still stuck, but thank you for your help so far. At least I see the problem now. I will create a better question for my problem. \$\endgroup\$ – Flovdis Oct 25 '14 at 11:37
5
\$\begingroup\$

You should put a series capacitor between the output of you DAC and the input of your amplifier.

It looks to me that the problem you're seeing results from the amplifier doing its job on the DC component of the signal as well at the AC component. Having the capacitor in there will block the DC, but allow the AC to pass through.

Off the top of my head I'd guess that a value of a few uF would be sufficient.

\$\endgroup\$
3
\$\begingroup\$

Resistor R1 is limiting the amount of current the amplifier can draw from Vcc. With an 8 Ohm speaker the voltage on pin 6 is probably dropping to about 2.5V. Reduce the value of R1 to 1 Ohm, or remove it altogether and apply Vcc directly to pin 6.

\$\endgroup\$
  • \$\begingroup\$ I removed the resistor and also power the amplifier now directly from the power source with 9V (which is a lab power source). I updated the schema and the measurement in my question. \$\endgroup\$ – Flovdis Oct 21 '14 at 22:41

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.