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

So it turns out a ground loop was the problem after all.

As soon as my friend plugged this thing in, all the buzzing went away:

All that is is a 1:1 transformer.

I still have no idea why simply disconnecting the ground on the RCA cable didn't work if that works.

Btw, he'd also hooked up an iPod to the amp yesterday with the Mighty going but no RCA cable to it, and there was no noise. That seems to confirm that the issue wasn't (purely) a voltage drop at the battery caused by the LED drivers. It may be they are still injecting noise into the line of course but the amp is capable of filtering it without the ground loop there. I don't know.

No, the problem wasn't a ground loop (although you did have one), it was noise on the ground line to the microcontroller (and hence on the output to the amplifier) caused by the LED switching current. Inserting the transformer between the output and the amplifier means that it is of little consequence if the amplifier and microcontroller grounds are at different potentials.

dc42:
No, the problem wasn't a ground loop (although you did have one), it was noise on the ground line to the microcontroller (and hence on the output to the amplifier) caused by the LED switching current. Inserting the transformer between the output and the amplifier means that it is of little consequence if the amplifier and microcontroller grounds are at different potentials.

I understand that the design of my LED modules could be better. I don't disagree with you that the noise is originating from them. And I'm sure your suggestion would help mitigate the issue. But the boards have already been made. I would have had to modify 300 PCBs to solve the problem your way, and the design of the boards, with surface mount parts on one side, and the pads for my through hole pins for power and data on the other, would not have made it an easy task to stick an inductor on there. Also my customers are getting impatient. They'd rather buy a ground loop isolator than wait another week for me to fix the boards.

I do appreciate the suggestions. And I will have to order a new batch of boards in a couple months if these things continue to sell. So I may redesign the boards at that point to include your suggested changes. (Note to self: Add a 10K pulldown to prevent them from lighting up for a moment when I apply power, as well.)

But I'm not sure I agree with you that the problem is the LED modules.

While it's true they generate the noise I'm hearing, the real problem is that I'm hearing that noise. The noise itself would not be an issue if I couldn't hear it. The noise doesn't affect the function of the board in any other way that I can tell.

And the fact of the matter is, that even if I got the LED modules to be whisper quiet, I'd still have noise problems. My board is designed to drive servos as well. Those generate 10x as much noise as the LED modules do.

So what makes more sense? To redesign my audio circuit to have ground loop breaking circuitry, so that it doesn't matter if the amplifier and microcontroller grounds are at different potentials, or to stick capacitors all over the board to try and remove every possible source of noise from whatever might be attached to the board? One solution might require a single tiny op-amp. The other might require several large capacitors which may not fit within the 2x2" footprint I have to work with. I was barely able to fit everything on the board as it was.

Inserting the transformer between the output and the amplifier means that it is of little consequence if the amplifier and microcontroller grounds are at different potentials.

Unfortunately, I still don't have a good picture in my head of what is going on here. I get the idea of amplifier and microcontroller being at different potentials. You can be standing on the ground at sea level, or on a mountain, and your feet won't be at the same height. 0V at the amp may not be the same as 0V at the microcontroller. But I don't get how that leads to noise on the amp. And I don't get how breaking the ground loop solves the problem. I would think that the amp would measure the voltage of the positive line on the RCA cable relative to the negative line on the RCA cable and use that to determine the output at the speakers. Since those would be both originating at the Mighty it shouldn't matter if 5V and 0V there are at a higher potential than the 5V and 0V on the amp. But it seems that the amp instead assumes the two grounds are the same, and just connects its ground to the RCA ground. That seems like a bad assumption to make to me. I made that assumption in my design because I didn't know any better. I just looked at 20 different schematics showing how to add a line out in an audio circuit, and implemented something similar after simulating the circuit to make sure it functioned as I expected.

Anyway, I'm just glad the issue is resolved now. Now I just gotta resolve that damn bootloader issue again. The fix that I thought worked only worked with one particular SD card. Since I have no idea how the hell I would add a diode to my circuit with the card slot being surface mount and the pins being on the front where the card is inserted, and I really don't want to modify 200 boards, I've decided to try a different bootloader. Hopefully it won't have the same issues. (It should be noted that even puling up that pin I shouldn't did not correct the issue with the new cards, leading me to believe there may be a bug in the previous bootloader.)

But it seems that the amp instead assumes the two grounds are the same, and just connects its ground to the RCA ground. That seems like a bad assumption to make to me.

No, that's how it's done. A common mantra around here is "tie ALL grounds together" because everything needs to know what +5v is in relation to (for example.) Same goes for audio. If you lift the ground of the RCA, you no longer have a circuit. It's just a spurious input with no reference.

Now, in your case, the RCA shield and the PSU ground come from the same place -- your power supply. So, it would in theory still work. Also, in theory, you do have a ground loop between the amp and Mighty. One path is from the RCA shield output on the Mighty to the amp input. The other is from the Mighty to the PSU to the amp power input. This is unavoidable, because if we assume the amp PSU ground is the same as the RCA shield ground, and don't tie them together at the amp, then what happens when you plug your amp in to a PSU, and feed audio from a battery-powered iPod instead of the Mighty? There's no path from the iPod ground to the amp.

If all your grounds are firm and low-impedance, there will be little potential voltage difference between the audio and PSU grounds, so the loop "shouldn't" cause a problem. What you're dealing with isn't necessarily a ground issue. These things can be tricky. I'm fighting a similar issue on a plate amp I built for a powered speaker with a microcontroller for inactivity power-off. Very faint high-pitched "bzzzzzzzzzzzz". Annoying.

SirNickity:
No, that's how it's done. A common mantra around here is "tie ALL grounds together" because everything needs to know what +5v is in relation to (for example.) Same goes for audio.

If I had a multimeter and I touched one probe the the RCA - and the other to the RCA +, it would be able to read the voltage even though the multimeter's ground is not connected to the circuit. I see no reason an amp should need to share ground over an audio input to determine the voltage difference. And TI does have a document showing various "ground loop break circuits" for both input and output. And of course the transformer worked.

So that may be how it's done, but I question why it's done that way. Perhaps it has something to do with reducing interference? Or maybe it's just a cost reduction measure, keeping things simple? I don't know. I do know professional audio equipment circumvents this issue and the interference issue by using a differential setup though.

Single-ended (ground + signal) inputs always require the ground to be connected. You can't have a circuit with one wire -- that defies the definition of a "circuit." There has to be a return path. It may not be immediately obvious -- like, with your setup, the amp's ground lead is derived from the same source as the audio ground. It can also be floating, like you achieved with the isolation transformer. That's the same result you'll get with another AC-powered device that has a separate PSU from your amp, or a battery-powered device. But with either isolated device, if you don't connect the RCA shield, you'll lose the return path and get nothing (but maybe noise) on the input.

Differential inputs work a little differently, in that the potential measurement is between the hot and cold. They reference each other. The "ground" is only there as a shield, and thus, can be lifted on one side to receive RF noise and shunt it to ground. (Acting like an antenna, as someone pointed out earlier.)

In your multimeter example, you're grounding the negative probe. Try measuring the voltage at the RCA output with just the red probe, leaving the black probe lying about on your workbench. That's what you get in your circuit if you don't ground the RCA terminal. So, that's why it's always done that way. :slight_smile:

SirNickity:
In your multimeter example, you're grounding the negative probe. Try measuring the voltage at the RCA output with just the red probe, leaving the black probe lying about on your workbench. That's what you get in your circuit if you don't ground the RCA terminal. So, that's why it's always done that way. :slight_smile:

That's not what I get in my circuit if I don't ground the RCA terminal.

If my amp and my microcontroller are both connected to the negative terminal of my battery, and in my circuit, they are, then in theory, ground should be the same on both devices, and I should not need another ground wire in the RCA cable to perform a measurement on it.

If the amp and microcontroller are NOT connected to the same battery, then of course there is no shared ground, and a single wire for the audio connection is insufficient, and mimics your example.

Now going back to my first example, note that I said "in theory". Obviously the reality is that the microcontroller's ground is at a different potential level than the amp. But why should that mean we can't make a measurement of the input without having a ground loop?

A multimeter measures potential difference. So in theory, if I touch my black probe to one wire with 1V, and my red probe to another with 5V, I should read 4V. Note that neither of those is ground. Yet I can still measure the difference between them. And that difference is what matters. The magnitude of that difference tells me enough to know where to position my speaker cone. That's how differential inputs work.

My problem seems to have been caused by my grounds being a different potentials on my two devices, so current flowed from one to the other and carried noise along with it. But if the amp only measured the potential difference between the + and - input, it wouldn't matter if the - input was at a different potential than it's ground. All that would matter is that it is at the right potential level RELATIVE to the + input... just as with a differential input where + and - swap places.

I tried something new with the circuit today because I have an amp to test with again. I placed ceramic capacitors on both + and - RCA lines. But this did nothing to help with the noise.

The thing is, I don't understand why it didn't help. I've been told this is a way to break a ground loop. And it certainly should block any DC current from flowing, just as the transformer in a ground loop isolator does. So why didn't it help with the noise like the transformer did?

A transformer is really just a couple inductors, right? So might the inductance be doing something to filter the noise? I'm not sure how this could be, since the noise is smack dab in the middle of the audio range and filtering out those frequencies would filter out audio frequencies as well I'd imagine and affect the sound of the output. But I have not noticed any change in the audio with the isolator in place.

I intend to add some more filtering to my LED modules when I do a second run of them, but I would really like to be able to emulate what this transformer is doing without using a huge transformer on my board when I redesign it, in case my changes to the LED modules are inadequate.

I missed your last reply, so let me back the conversation up a couple days first.

I think you might be assuming "Ground" is somehow special. It isn't, it's just a reference point. You can probe any two points in a circuit with a multimeter and get a measurement. Ground isn't any different in this regard, it's just that normally ground is the reference on which everything else is based. So, when you say something is "+5v", that's 5v above ground. Ground is only 0v because you're comparing it to itself, so the difference should very well be 0v.

Differential is a special case because it doesn't reference ground, it references another signal line. Electrically, it's still a measurement between two points, it's just that neither of those points are (necessarily) ground. Single-ended inputs imply that the reference is ground, and requires the system and input grounds to be tied together.

Again, in your case, the amp system and input grounds are tied together in two places: The PSU and the RCA input jacks. So you have a loop. It doesn't mean there's any appreciable current flowing through that loop, it just means there is one. That's not a problem in and of itself, and not something to be "fixed". The problem is when there's a difference in potential between those two ground points. The best way to fix that is to ensure the two ground points have low impedance paths back to the PSU ground. (Easier said than done sometimes.)

If you take away the RCA shield, you're causing the amp to reference the PSU ground as the audio ground (since they're connected internally anyway). The audio signal will then be referenced against a ground that is not at the exact same potential as the device creating the output (the Mighty), so there will be noise which is the difference between ground as the Mighty sees it and the (PSU) ground as the amp sees it. Using a signal ground (RCA shield) will attempt to force them (the grounds) to the same potential, at the risk of causing current to flow down the path of least resistance, which may alternate as the load changes.

Ceramic caps across the input will shunt noise, but it will do so as a high-pass filter with a high cutoff frequency. Typically, you would use, say, a 30pF cap. This dumps RF noise straight to ground, but noise throughout (and even well above) the audio band will not be affected. It can still be helpful if the audible noise is a lower harmonic, but that's a long shot.

The transformers help probably (not 100% sure -- comments welcomed) because the path through it becomes high impedance. Noise is going to take the easiest path to the point of lower potential (Ground again), which will probably be elsewhere.

Weird. I could not get my board to power down just now with the power switch. The power switch switches +5v to a logic level mosfet to turn the board on. I traced the issue to the RCA cable. It was plugged into the amp, which was off but connected to the same battery as the Mighty.

I can't for the life of me figure out how the mosfet could turn on to allow power to flow. The pin that controls it is not attached to anything but a switch on the board which is off, and some pins for an external switch which is what I was using to switch it. So the +5v had to have been coming from somewhere else. But there is no connection to +5v from the RCA cable. The + RCA line goes to the DAC output.

My schematic and layout are in this post btw:
http://arduino.cc/forum/index.php/topic,150336.msg1129683.html#msg1129683

[edit]

Oh wait, my mosfet doesn't switch 5V, it switches ground. And the RCA cable carries ground from the amp. DUH.

Oh I forgot to mention... I just tried disconnecting the ground to the Mighty and allowing the RCA to carry the ground, thus eliminating the ground loop, but I still get the noise. So it seems it isn't the ground loop at all causing it. Yet a transformer between the Mighty and the Amp in the RCA line fixes the noise issue. It's gotta be the inductance or something. Like I said before I also tried caps on both + and - RCA lines and that ought to break the ground loop as well but that didn't help with the noise either.

I think you're beginning to learn a painful lesson on why you don't produce a PCB in large numbers until you've had a chance to run it through the wringer for a while. :wink: You know what they say ... in theory, there's no difference between theory and practice. In practice, there is. Having a schematic and a prototype that works is only half the battle. (Guess how I know...)

I agree with you that the noise is probably not caused by a ground loop. Trying to alleviate the noise using techniques intended to fix ground loops is just going to be a waste of time. There were some good suggestions a while back on trying to isolate the high current loops using capacitance and such. Did you try that? I know it's not what you want to hear based on board layout, but if you can, test the theory anyway. If for no other reason than to prove it wrong and move on to something else. Do whatever you have to do to get a large cap on the power rails near your LEDs and see what happens.

SirNickity:
I think you're beginning to learn a painful lesson on why you don't produce a PCB in large numbers until you've had a chance to run it through the wringer for a while. :wink:

Well I didn't really have a choice.

I raised the $16K to produce the boards in May of last year (actually $14K since Kickstarter and Amazon took a chunk) and then I realized my original design wasn't going to cut it and redesigned the whole thing virtually from scratch, upgrading the 328P to the 1284P, increasing the available IO ports, changing the power LED to an indicator LED, redesigning the audio circuit to provide better isolation from noise in the power and ground planes (apparently I didn't do a good enough job), moving all the LED drivers off the main board (driven by the realization that with a proton pack, at least one on the board would end up being wasted, and it was more efficient to create modules that could allow ribbon cables to be plugged in), and finally just before shipping, I had to remove the voltage regulator from the board and replace it with the mosfet because I realized I'd screwed up the power dissipation calculations and the regulator was going to melt the board to slag.

I stupidly assumed that if I followed the recommended layout for the TLC5947 exactly that that would provide adequate noise suppression. And I didn't encounter anyone who'd mentioned having this sort of problem with them. And as for the audio circuit, I did the same, following the schematic, and looking at how others designed their line outs. I tried my best to isolate that portion of the circuit from noise, but information on how to properly isolate the audio portion of a circuit is hard to come by.

Anyway, I finished the redesign at the end of September and many folks were expecting the boards for Halloween and I thought maybe I could still put together something in that time, but obviously that didn't happen. Programming them and working out the kinks with the audio by moving the LED drivers to their own data bus, and then getting an SD card based bootloader to work took several more months, and I've finally just started to ship them. Yes, I've had to ship them with the audio problem. My customers are willing to purchase a ground loop isolator, but not willing to wait any longer.

Which is what they'd be doing (waiting) if I had not had the PCB house press full steam ahead in October because it took till now to find most of the issues and I still don't have a solution for the audio issue. I've got some suggestions I can try but I don't know they'll fix the problem for certain. And even if they do fix the current problem, what of all the noise that is generated when I power servos? Fixing the LED drivers isn't going to fix that. I haven't yet tested the servo noise issue with the ground loop isolator. I suspect it will greatly reduce the noise, but not eliminate it completely, as has been the case with the LED drivers. A combination of greatly eliminating and attempting to reduce it seems like the best course of action. It's not like I have tons of space on the board to add big capacitors.

So I really had no choice in the matter.

I agree with you that the noise is probably not caused by a ground loop. Trying to alleviate the noise using techniques intended to fix ground loops is just going to be a waste of time. There were some good suggestions a while back on trying to isolate the high current loops using capacitance and such. Did you try that? I know it's not what you want to hear based on board layout, but if you can, test the theory anyway. If for no other reason than to prove it wrong and move on to something else. Do whatever you have to do to get a large cap on the power rails near your LEDs and see what happens.

Oh, I believe them when they say it's the LED modules causing the noise, but modifying them at this point is not going to happen. That is something that will have to wait for a redesign. Right now, I am starting to ship the boards as is because with the ground loop isolator they work good enough for their intended purpose. Adding more capacitance is something I will try when I have some time and before I get the next batch manufactured, assuming there is a next batch.

But assuming it is high current loops in the LED drivers... What would the isolation transformer on the RCA line be doing to fix that, and how might I replicate that without a big transformer? (big relative to my tiny 2"x2" board I mean) If it were simply that the board's ground was at a different potential than the amp, and I'm sure that's true as well, I would have expected the capacitors on the RCA cable to do something, but they didn't do a thing.

You have a large pulsed current flowing from the battery to the LED boards, via the microcontroller board. Because of the resistance and inductance of the power supply lines, this means that the ground on the microcontroller board carries a small pulsed voltage relative to the battery negative terminal. The line output from the microcontroller board is referenced to the microcontroller board ground, therefore this small pulsed voltage gets added to the line output (as viewed relative to the battery negative terminal, and hence the amplifier ground).

The transformer fixes the problem because you feed the difference between line output and microprocessor ground to the primary (thereby cancelling out that small pulsed voltage) and this gets reflected at the secondary.

Here are some suggestions to reduce or eliminate the problem:

  1. You really should provide adequate power supply bypassing on the LED boards. Without this, your boards may also generate RFI. I think you need at least 1000uF between +5V (the positive supply to the LEDs) and the ground pin of the TLC5947. 2200uF or 4700uF would be better. An inductor in series with the incoming +5V on the LED board (as discussed earlier) would be the next step.

  2. Include a small PCB-mounting audio isolation transformer on the microcontroller board.

  3. In the diagram in your original post, you have a ground connection to R11, R12 and JP7. If you choose not to include a transformer, then make provision on your board to separate this ground from the main ground on the board, with a jumper connecting them together. When using a common supply, remove the jumper. This way, the voltage divider will be referenced to the amplifier input ground instead of the microcontroller ground, so at the same time as reducing the signal voltage, the divider will reduce the noise voltage passed to the amplifier. Removing the jumper will eliminate the ground loop too.

  4. Use thick wires between the microcontroller board and the battery (to reduce resistance), and ensure the power and ground conductors are in the same cable, or twisted around each other (to minimize the area they enclose and thereby minimize the inductance).

You have a large pulsed current flowing from the battery to the LED boards, via the microcontroller board. Because of the resistance and inductance of the power supply lines, this means that the ground on the microcontroller board carries a small pulsed voltage relative to the battery negative terminal.

I don't understand. Is it because the ground plane and wires act kind of like a capacitor as power flows in and the battery is unable to discharge them back to 0V quickly enough that the ground potential of the board fluctuates as the LED modules draw power? Is that why you suggested I use larger wires? Because with less resistance the battery will be able to pull the ground plane back down to 0V (relative to the battery ground) more quickly?

The transformer fixes the problem because you feed the difference between line output and microprocessor ground to the primary (thereby cancelling out that small pulsed voltage) and this gets reflected at the secondary.

Makes sense.

So am I right in assuming that the reason putting a cap in series with the RCA's ground pin didn't work, was because the fluctuations on the ground were AC in nature, and could pass right through the cap?

  1. You really should provide adequate power supply bypassing on the LED boards. Without this, your boards may also generate RFI. I think you need at least 1000uF between +5V (the positive supply to the LEDs) and the ground pin of the TLC5947. 2200uF or 4700uF would be better. An inductor in series with the incoming +5V on the LED board (as discussed earlier) would be the next step.

I will, when I have a new batch of boards made.

  1. Include a small PCB-mounting audio isolation transformer on the microcontroller board.

Not gonna happen.

  1. The boards need to be really small. I'd never be able to fit a transformer on there and still fit the board where it needs to go. (Handheld costume props.)

  2. All audio transformers filter out some frequencies, but most I've looked at don't provide data on what frequencies they're good for, and I don't know how to calculate that.

  3. They tend to be fairly expensive and many aren't stocked in large quantities on Digikey.

  4. I don't want to stick this big ugly thing on my beautiful surface mount board:

That's one of the cheaper ones available in large quantiies, and one of the few that actually provides data on the frequencies it handles but it's still too big, and ugly, and it only handles down to 100hz which means I'd lose all the bass in my audio, so that's no good.

As a last resort I could make my own ground loop isolator cables with a custom PCB and heat shrink the thing. That wouldn't be too bad but still, a costly solution, labor intensive, and I'd lose frequencies I want to keep.

  1. In the diagram in your original post, you have a ground connection to R11, R12 and JP7. If you choose not to include a transformer, then make provision on your board to separate this ground from the main ground on the board, with a jumper connecting them together. When using a common supply, remove the jumper. This way, the voltage divider will be referenced to the amplifier input ground instead of the microcontroller ground, so at the same time as reducing the signal voltage, the divider will reduce the noise voltage passed to the amplifier. Removing the jumper will eliminate the ground loop too.

This sounds like an excellent solution and is something I may be able to try out with a little surgery on one of my boards.

I wish I didn't need to use a jumper to do it... Don't really have room for a switc. Perhaps I could just require the user to tie the board and amp grounds together at the power input if they choose to run them on separate power sources? 95% of them will choose to run them off the same battery, so if I could get away without adding a jumper to the board that would be nice.

  1. Use thick wires between the microcontroller board and the battery (to reduce resistance), and ensure the power and ground conductors are in the same cable, or twisted around each other (to minimize the area they enclose and thereby minimize the inductance).

I'll make that suggestion to my customers, but I have no control over what they do there. The first guy I gave a board to connected the amp up with like 28 AWG wire.

Thanks for all the suggestions. I think I have a little better understanding of what's going on now at least and I can try out tying those grounds together on the line out and see how that works. If that works that will be perfect.

scswift:
I don't understand. Is it because the ground plane and wires act kind of like a capacitor as power flows in and the battery is unable to discharge them back to 0V quickly enough that the ground potential of the board fluctuates as the LED modules draw power?

No, as he said, the ground traces act like an inductor. They're unable to change instantly. With DC pulses, the voltage (in theory) goes from 0v to +5v instantaneously, then after the PWM delay, back to 0v instantaneously. In real life, that just can't happen. But, the fatter and shorter those traces are, the closer to the ideal behavior you will get.

scswift:
So am I right in assuming that the reason putting a cap in series with the RCA's ground pin didn't work, was because the fluctuations on the ground were AC in nature, and could pass right through the cap?

No, my last answer to this still stands. You formed a very high-frequency lowpass filter. You probably eliminated the MHz-region noise adequately, but it takes big caps to filter low frequencies. Of course, if the noise is already in the audio band on the RCA cables, a low enough filter will remove audio as well. That's why the proper fix is to prevent the LF (audible range) noise from leaving the source of that noise at all.

I sympathize with your quandary. Prototyping electronics is often an expensive process, but it has to be done. Real-world constraints affect performance in big ways. Data sheets and example schematics are never enough to tell you what is really going to happen. Out of a couple thousand dollars spent at fab houses, I'm not sure I have even a single project where the first PCB was ready for mass distribution. I am nowhere near confident enough in my engineering ability to even consider promising a product before I have a completely-built prototype that I'm able to put hands and scopes on. Although, sometimes I can hack it or live with it enough to use it, but I still go back and touch-up the design just in case I ever have spare room on a future PCB order.

I know this is an old thread, but I'm in the process of redesigning this board now, and I have a question about something DC42 said a few posts back:

In the diagram in your original post, you have a ground connection to R11, R12 and JP7. If you choose not to include a transformer, then make provision on your board to separate this ground from the main ground on the board, with a jumper connecting them together. When using a common supply, remove the jumper. This way, the voltage divider will be referenced to the amplifier input ground instead of the microcontroller ground, so at the same time as reducing the signal voltage, the divider will reduce the noise voltage passed to the amplifier. Removing the jumper will eliminate the ground loop too.

While I don't entirely understand how this setup is supposed to work, it sounds plausible, and it's the simplest and cheapest solution I've found, so I guess I'll have to try it out.

But one thing bothers me.

If this is caused by noise from the LEDs, why does it all work fine when the amplifier has its own power source?

Also, I did some tests today with one of the kits. Here are the results. In all tests, the amplifier is being powered from the same power source as the kit.

  1. Audio cable directly to amplifier - Loud screeching over audio which is much quieter than normal.
  2. Audio cable to amp via ground loop isolator - Normal audio, with hardly any LED noise.
  3. Audio cable with only + line connected - Same as #1.
  4. Audio cable with only + line connected w/ ground loop isolator - Same as #1
  5. Audio cable with only - line connected to + output terminal - No audio, as expected.

I tried #3 because the amplifier shares a ground with the board, and connecting only the + pin should break any ground loop. Yet the result was the same. That indicates to me that the issue isn't actually a ground loop.

And DC42 did say:

The transformer fixes the problem because you feed the difference between line output and microprocessor ground to the primary (thereby cancelling out that small pulsed voltage) and this gets reflected at the secondary.

Which seems to make sense. If the microcontroller's ground is at say, -2.5V relative to the amplifier's ground, and it's 5V rail is at 2.5V relative to the amplifier's ground, then that's still a 5V difference between its ground and 5V rail. So I can see how that would be carried across the transformer coil, since the secondary's ground is referenced to the amplifier.

I'm still having trouble grasping what his voltage divider solution does though.

Hm.. if the divider normally drops 5V to 1V... but the 5V relative to the amplifier is 2.5V... and the ground of the amplifier is at 0V relative to itself... then wouldn't the voltage divider change 5V to 0.5V, from the amplifier's point of view?

Still, if the board is at a potential 2.5V below the amplifier, that would make 1V into -1.5V.

And I just tested it with my multimeter... got a weird result too.

I disconnected the audio connector from the board, leaving it connected directly to the amp. No isolator. I then touched the negative prove to the negative side of the audio connector, and the positive probe to the ground side of my audio output.

The meter read 0.33V when reading volts, and when reading millivolts it fluctuated between 0.25V to 0.35V.

So the microcontroller's ground appears to be at a HIGHER potential than the amplifier. I'd expected the ground would be lower. I don't know why I expected that, but I figured that's what high current draw from the LEDs would do to it. I guess it's somehow pulling it up though? Or maybe the amplifier's higher current draw is pulling it down?

Either way, there's around a third of a volt difference in ground potential between the two devices, and the ground of the microcontroller does seem to be varying. Unless that's the amp. Perhaps I should have tried to measure the two relative to the power input jack as well.

Anyway, I'm not sure what to make of this. If the ground of the microcontroller is 0.3V higher than the amp, and its 5V rail is as well, and the voltage divider reduces 5V to 1V relative to the microcontroller ground, then that 1V would be 1.3V by the amplifier's reckoning.

I'm not sure if that means it should be louder though. The volume of an audio signal is determined by how much it varies, not the DC offset. And it should still vary just as much. So why does it end up being quieter?

None of this makes sense. :frowning:

I did some more tests today. In my previous tests I was probing the output of the DAC with my amplifier ground referenced voltage divider, but I had not disconnected the original voltage divider from the circuit, so there may have been noise getting in through there since there was a path through the original voltage divider to ground.

This time, I removed the 470 ohm resistor from the board.

So whereas in my original circuit I had something like this, with the SJ1 jumper soldered to connect the voltage divider to the microcontroller ground:

In the new circuit I removed the 470 ohm resistor to disconnect all that from the DAC line out, and then recreated the circuit, minus the connection to the microcontroller ground by leaving SJ1 open.

I did not have a 47uF ceramic cap on hand, so I used an electrolytic cap in it's place with the + side towards the DAC.

I also tried the circuit with and without the C19 bypass cap in place.

Results?

After connecting the amplifier to the + and - line out, and making sure the polarity was correct, I probed the DAC output pin with the input to the breadboarded voltage divider and... no improvement. It sounded exactly the same as before. Loud noise over quiet audio.

I then tried connecting the amplifier directly to the board, without a voltage divider.

The results of that:

+amp to +micro = loud noise
+amp to -micro = loud noise
-amp to +micro = no sound
-amp to -micro = quiet noise

In no case did I hear any audio of course because without the 470 ohm resistor in place there was no connection to the DAC's line out. But there is still a connection to ground through the + output since the voltage divider circuitry is still there. So it makes sense that I'd hear the noise with this set up.

But what does not make sense to me is why the amplifier ground referenced voltage divider isn't helping at all. I was told this setup would cancel out the noise much like the transformer in the ground loop isolator.

Any ideas what's going on or what I should try next?

I can't use a transformer. I can't require the amplifier to be on it's own battery. There is a TI headphone amp chip that's supposed to help with ground loops but it's not cheap and I don't really have space on the board for it. I'm really hoping to find a cheap solution for this.

You might find this interesting, found here