I think I've got a ground loop messing up my audio. Help!

dc42:
The buzzing is presumably the PWM signal to the LEDs.

Oh, I'm fairly certain of that. The sound goes away if you disconnect the ribbon cable going to the LED modules.

You haven't said how the LEDs are connected

The LEDs are driven by a couple of TLC5947 LED drivers on individual modules which are chained to the main board using a couple of 6 conductor ribbon cables. One is around 6in long, the other is around 8ft long. I've been told disconnecting the 8ft one, or the board attached to that module with most of the leds on it makes the noise go away. So rather than the data or clock causing the issue, it may be the current draw.

but you need to be make sure they don't share a common ground wire with the output signal or power supply. If the Mighty has 3 ground pins, then use one for the power in, one for the LED grounds or LED driver grounds, and one for the audio out.

I'm not sure I understand. There's a power connector on the board for 5V and ground in. The ribbon cable connector for the LED modules has a ground pin to get ground to the LEd modules. And the Line-Out connection has a ground pin as well. Both the Line-Out and LED grounds are connected to the ground on the main power connection which then goes to the battery ground via a 5V regulator. I have included my schematic and layout below.

You also need good decoupling of the power to the LEDs, to decrease the amplitude of the LED switching current in the ground side of the power input.

Each LED module has a 10uf and .1uf cap between VCC and GND. These were what were recommended in TI's datasheet. I don't know if you consider that sufficient or not.

Other options include:

  • Increase the PWM frequency you are using for the LEDs to more than 20KHz.

I am already sending data to the LED modules at 8mhz, it's impossible to send the data any faster. I am only sending an update 60 times a second though. The noise doesn't seem to be some kind of 60hz hum though.

Now that you mention it though, I seem to recall in testing that the sound went away when I set the LEDs to a 100% duty cycle. Which indicates to me that the noise may be generated by the LED driver chip itself, and I have no control over its speed.

  • Add an audio transformer between the line output of the Mighty and the amp. You can get these from the major component distributors. A standard 600 ohm 1:1 transformer should do the job.

This is what the ground loop isolator my friend is picking up today has inside it. I have a feeling it will solve my problem, since the noise does go away when you power the amp and Mighty from separate power sources.

Anyway, as I mentioned above, here is the layout of my main PCB:
http://mightymicrocontroller.com/mighty-layout.png

And here is the full schematic of my board:
http://mightymicrocontroller.com/Mighty-schematic-full.png

I'm not sure if I should have put an inductor or voltage regulator between the analog and digital portions of my circuit. Someone suggested a regulator, but that alone would not seem to isolate the ground, and one article I read said they typically don't reject noise over 100hz. If that's true then it seems like a regulator would be useless. As for an inductor, I didn't really have the space for one, and I didn't know if it was necessary, and I didn't know if I should use one for power, or ground, or both.

I should note that it's much too late to change the design of these board I have now, but I hope to do a second batch soon, so any suggestions for improvements would be appreciated. I do have an issue with servo noise getting into the audio circuit I need to deal with at some point as well.