EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: rexxar on July 14, 2015, 11:24:32 pm
-
I'm trying to use an MCP4921 DAC to output audio with an Arduino. This actually works pretty well.... sometimes.
I really have no idea what's going on. With some sketches, it works normally, but with others I have to pull the headphones halfway out of the jack before it works (putting the speakers in series rather than parallel). Sometimes the audio effects I apply, like reverb don't make any sound at all, even though I can see that it's outputting data, and the DAC is outputting everything correctly--if the headphones aren't connected.
I had connected the output of the DAC straight to the output jack, but that didn't work, so I added a 1uF series capacitor, which worked just fine. I've tried increasing it to 4.7uF, but that didn't have any effect. The DAC can provide 25mA, so that should be enough for a pair of headphones. It's updating at 15kHz, and the DAC is capable of running much faster than that, so that shouldn't be the problem either.
Any ideas? I'm completely stumped. I just don't understand why it works in some cases but not others. If I feed the input straight to the output it works great, but not if I try to do anything to the input before it goes out.
-
phasing? is one phones spkr out of phase (gnd, hot reversed)?
-
25mA is max absolute rating, you can see typical short circuit current is 15mA. I usually put a 10 to 22 Ohm resistor in series with the output. The capacitor is needed to block DC, a typical audio signal rests at the center scale and moves above and below. Are you always dealing with signed samples in the digital domain (or you have no clue what I am talking about)?
-
25mA is max absolute rating, you can see typical short circuit current is 15mA. I usually put a 10 to 22 Ohm resistor in series with the output. The capacitor is needed to block DC, a typical audio signal rests at the center scale and moves above and below. Are you always dealing with signed samples in the digital domain (or you have no clue what I am talking about)?
I'm dealing with everything in the digital domain. Since I can't sample negative voltages with the ADC, and the DAC can't output negative, everything's unsigned and the center point of the output waveform is somewhere above 0.
The hardware works the way it's set up in some cases, but not others, which is what's so confusing.
-
You're probably doing something "wrong" in sw, you say it works with some programs but not with others.
-
What makes some outputs different from others, though? What makes the difference between being able to drive headphones and not?
If I use an amplifier, the audio comes out as I expect no matter what. Amplifier ICs aren't that expensive, so if that's what I need to do, I can just add one to the next board, but I still want to understand what's happening.
-
I've done such things and it has always worked. Without the output series capacitor I can imagine cases where you could be driving the DAC's output stage out of spec for big amounts of time; with the capacitor that can still happen but not at rest anymore (I use a series resistor to limit output current). Maybe there's a cable broken with intermittent connection on your phones?