Hi all. This is my first post and I hope it's in the right place. I found several other discussions around this issue but with no resolution.
I am having issues with my MKR Zero where there is a loud, low pitched buzzing noise that appears to be coming from the DAC pin when not playing a file from the internal SD card reader. The Arduino is attached to a PAM8403 amp, powered from the 5V output on the Arduino, and the Arduino is powered from a USB via my PC (see diagram). The buzzing still occurs when I power my Arduino from a 5V transformer and when I power the Arduino and amp separately with a shared GND.
This is what I have tried (separately and in combination):
100 uF capacitor across 5V and GND of transformer and amp
100 uF capacitor and/or 10-100kO resistor between DAC output and amp input
assigned mid-level value to DAC pin
silencing DAC when not in use. This stops the constant buzz but causes a buzz at the start and end of each playback.
Can anyone suggest how I may remove this buzzing without having to silence the DAC?
No DC blocking capacitor between the DAC and the amplifier input? Also, low pass audio filter is always a good idea between the DAC output and the amplifier input. Try a two stage RC filter with a 10-15 kHz rolloff.
For decent audio, you need clean audio input and clean, well filtered power supplies. 100 uF is not going to cut it.
The amplifier is a switching, class D module and horrible beat frequency interference can result when combined with different frequencies present in the output of switching power supplies.
Try powering the amplifier separately, with all the grounds connected. Batteries are best, next are linearly regulated power supplies.
Thanks for your advice. I tried a 100 uF capacitor in series between DAC and amplifier input but it made no difference, and I powered the amplifier separately, connecting the ground to Arduino ground, but no luck.
My electronics knowledge is quite poor and I am not familiar with audio filters but will look into that option.
Are you able to suggest an alternative amplifier that might be less sensitive to noise in the power supply?
I powered the amplifier separately, connecting the ground to Arduino ground, but no luck.
Using what sort of power supply? A phone charger is not a good idea, as they are all noisy, switching power supplies.
There are lots of articles on line about using low pass audio filters on DAC outputs. An active filter is best, as described in this forum thread: Suggested low pass filter for a DAC - Page 1
Thanks again. I was using a USB powered from my laptop but then tested it with a 5V power bank and there was no difference.
Those articles look interesting but are unfortunately beyond my level of comprehension. I've opted to try the MAX98357 amplifier, which takes I2S signal from the Arduino, so that I can avoid the issues with noise and interference that are associated with DAC. There seems to be a lot more information online regarding how to use this amp with the Arduino MKR Zero compared with the analogue amplifiers I previously tested.
Those use switching voltage converters, and also quite electrically noisy.
If the noise goes away when the DAC is off, then it is the primary suspect, although the amplifier power draw will increase when it is on, possibly causing other problems.
In any case, for clean audio from a DAC, a bandpass audio filter is required.