PWM tone heard on ground plane of connected audio device

I'm using the PWM outs of the Teensy 2.0 to dim LEDs through a resistor. The Teensy's ground plane is connected to the ground plane of a Moog Werkstatt-01 synthesizer as I'm using the analog ouputs of a 16-bit DAC (being controlled by the Teensy via SPI) to send control voltage to the Werkstatt. I'm actually hearing the tone generated by the PWM controlled LEDs through my speakers when the LED is brightened. This tone is approximately 3.92KHz and I know it's coming across the ground plane, as it is heard when the volume on my audio mixer is all the way down, and it doesn't change in volume with a change of my audio mixer volume fader. I also took the tip of the TRS connecter going to my studio monitor speakers, and touched it to various ground points of my system (Werkstatt, Teensy components, mixer, etc) and the tone was heard in the speaker. Also, the tone disappears if Iuse my Ebtech Hum Eliminator (audio isolation transformer) to connect the Werkstatt to my mixer.

How can I alleviate this PWM noise/tone from my ground plane?

Thanks,
lqbert

One straightfoward solution: increase PWM frequency. Preferably higher than the maximum frequency response of whatever audio equipment you're using; if not, at least above 30 KHz.
Slightly below 20 KHz you may hear something like a CRT TV noise.

Great idea! I’ll look into that. Would that affect overall performance of the other code running on the Teensy?

I’m wondering, though, why this noise is present on the ground? I’d like to understand what’s happening and learn better design practices for future reference.

Thanks!

lqbert:
Would that affect overall performance of the other code running on the Teensy?

It shouldn't unless it's emulated by software.

PWM is usually driven by a timer; which uses the same clock signal as the CPU, but operates without it (although it still requires the CPU but just to issue certain commands, and then the timer keeps working by ifself).
If for some reason that specific timer also triggers some interrupts, overall performance might be degrated, but just a little bit (considering how fast a Teensy is anyways).

lqbert:
I’m wondering, though, why this noise is present on the ground?

I'm not gonna give you any scientific explaination, because anything I would say is pure guessing.

However, what I can tell you is that I have the same issue with my WAV player project: the SCK pulses of the SPI port leak through the audio output (even thorough a low-pass filter). It doesn't sound noticeably loud, but somehow I managed to diminish it a little by using the opposing GND pins of the Arduino (Nano) board; one for the SD card module, and the other for the audio output jack.
The SPI clocks at 8 MHz, so there shouldn't be a way I can hear that. I have a little suspicion it's because of how TMRpcm works, but I have to test my hypothesis by playing a silent audio file and recording the output with a PC (or by analyzing it with a decent oscilloscope, if I had one).

The only "guess" I can say about your problem is because maybe it's a side-effect of switching a low-impedance output near a high-impedance output.
You may find another answer on the good-quality PC soundcards, they don't "leak" (at all) the switching noises despite of the digital nature of the system.

I'm wondering, though, why this noise is present on the ground?

Mainly it is due to bad layout and insufficient supply decoupling.

Digital switching ground return currents are being transfers to the audio ground. This is due to insufficient electrical separation of the two ground planes. Star wiring on the ground is important to help reduce this.

You may have both devices individually grounded to mains earth, thus forming a ground loop, depending
on how they are each powered.

Any wiring taking current to or from the LEDs should not be part of this loop, as that directly injects
the switching signal into the circuit via the IR losses in the wiring.

Ideally there should be no ground loop as that picks up mains hum.

Its certainly worth first improving the decoupling of the DAC - add some series resistance (50 ohms or so)
into its analog +ve supply and good decoupling after that resistor (100uF or more). Then the DAC output won't be affected by noise on the Teensy supply rail.

Ensure the ground wire from the DAC analog ground to the Moog is direct between them and is not shared with
the ground for the LEDs (it should be the only ground connection linking Teensy and Moog).

If the DAC has both digital and analog grounds connect them at or before the big decoupling cap on the
analog supply - you don't want digital currents flowing in the decoupled analog section.

Thanks Grumpy_Mike and MarkT...

MarkT: just to be sure I’m clear, the PWM tone is heard on the studio monitors even with the volume of the mixer all the way down. The noise volume doesn’t increase when increasing mixer volume. It’s only present when the ground/shield is connected from the mixer/speakers through the moog to the teensy/DAC system. Does this clarification change your recommendation?

The DAC only has one ground pin (AD5668).

Doesn’t the ground of the Moog need to be at the same reference as the ground from the DAC and Teensy for the CV being provided by the DAC to the Moog to be correct/consistent? If I just break the ground connection, the noise would go away, but wouldn’t it still be present in the Teensy/DAC system and possibly make my CV not as clean as it could be?

Thanks... I’m looking into re-engineering based on your suggestions.. problem is, it’s akread mostly built :frowning:

lqbert

Doesn't the ground of the Moog need to be at the same reference as the ground from the DAC and Teensy for the CV being provided by the DAC to the Moog to be correct/consistent?

Yes

If I just break the ground connection, the noise would go away, but wouldn't it still be present in the Teensy/DAC system and possibly make my CV not as clean as it could be?

No one is suggesting you just break the ground. Electrically they must be at the same potential but the routing must keep the ground currents as separate as possible.