I am trying to generate stereo sound using an Arduino UNO. Instead of using a separate DAC chip (as shown here), can I use the PWM pins on the UNO along with a low-pass filter?
Also, would I need any additional circuitry if I go this path?
-
To achieve stereo sound, you would need to be able to control either the volume or the phase (or preferably both) of the signals. As far as I know, neither of them are controllable by default.PMF– PMF03/24/2021 09:22:19Commented Mar 24, 2021 at 9:22
-
Yes that would work. You need one PWM pin per Channel. That's the principle of Class D Amplifiers. Yes, you would need additional circuitry. One low pass filter per channel. The better the filter, the better the audio quality. And don't expect to achieve HiFi Quality ;-).Peter Paul Kiefer– Peter Paul Kiefer03/24/2021 14:02:41Commented Mar 24, 2021 at 14:02
1 Answer 1
You can generate "stereo sound", but I don't think you'll like it. The PWM frequency is only 490 or 980 Hz, which is going to be plainly audible unless you filter the output very severely. So you'll only be able to produce low frequency sounds, about like what comes out of the woofer speakers in your home stereo. In other words, nothing like music. Might be OK for certain experiments, but nothing you'd want to listen to for pleasure.
As far as additional circuitry, you'll need to convert the DC outputs of your two low-pass filters to AC before you try to drive headphones. This requires a big decoupling capacitor for each channel. If you are going to drive a separate amp, you might be able to skip the capacitors since most amps have them built into the inputs.
-
Thanks for your response. Also, I think I can change the frequency of UNO’s PWM pins.TheReal_Skywalker– TheReal_Skywalker03/25/2021 08:12:51Commented Mar 25, 2021 at 8:12