How do I calculate the values for an LC or PI filter?

I have used this calculator in the past for RC filters:
(Sample)RC Low-pass Filter Design Tool - Result -

For 1000hz and a 47uF capacitor, it says my resistor should be 3.3 ohms. That seems high. I don't know for certain, but given my speaker is 4 ohms, I think if I stuck a 3.3 ohm resistor in series with it not only would the resistor have to dissipate half the power which think would be something like 1.25W, but my volume would also be halved. Neither of those is desirable. I'd have to use a huge 4700uF cap to get the resistor value down to where it wouldn't affect my volume much and where it wouldn't dissipate too much power for a large surface mount resistor to handle.

Of course I could be way off here. But I think I've got the numbers right.

You misunderstand me. You don't want to put a lowpass filter on your speaker. You want a lowpass filter on the Vcc line providing power to your audio section.

Power should not be daisy-chained, either. If you run Vcc to the LEDs and then to the audio amp, all the voltage noise on the LED's power wire appears on the audio section's Vcc line. If you run Vcc to the audio amp and then to the LEDs, some of the voltage noise and all of the current noise appear on the audio section's Vcc line.

Same goes for the grounds. Don't daisy-chain, that can create something called a ground loop, which no amount of (realistic) filtering can remove.

Another alternative is to use a separate voltage regulator for the audio circuits. Preferably a linear regulator, still well-bypassed. Your grounds should still follow the recommendations above.

Note that Resinator's chart shows a 50dB peak at the resonant frequency. 50dB. That could be catastrophic.

Proper selection of effective LC lowpass filter values in a power filter takes some math. Otherwise, it is like running across the street with your eyes shut. Maybe you'll be OK, or maybe not.

polymorph:
You misunderstand me. You don't want to put a lowpass filter on your speaker. You want a lowpass filter on the Vcc line providing power to your audio section.

The audio section of my original circuit contains a DAC and a 3W amplifier. Sometimes the 3W amplifier is used, sometimes an external amplifier is connected to the line out. The fact that the 3W amplifier is there though means that the supply for the analog circuit has to be sufficient to supply the speaker, unless I ran the on board amplifier off the unfiltered supply, which would likely wreak havoc.

(I say 3W because that is how TI refers to the part, but since the speaker is 4 ohms, not 3 ohms the output should be more like 2.5W with this amplifier.)

So yes, I get that the lowpass filter should be on the Vcc line. But the Vcc line has to supply 2.5W to the audio portion of the circuit to drive that small amp when it is in use.

Power should not be daisy-chained, either. If you run Vcc to the LEDs and then to the audio amp, all the voltage noise on the LED's power wire appears on the audio section's Vcc line. If you run Vcc to the audio amp and then to the LEDs, some of the voltage noise and all of the current noise appear on the audio section's Vcc line.

My original post linked at the top of this thread has my board's schematic. The power is not daisy-chained, if by daisy chained you mean wired in series.

Did you look at the link I gave you for ground loops? Same idea for avoiding power loops. Daisy-chained power isn't a series connection. Hmm... if you have ever done house wiring, outlets are daisy-chained.

Anyway. Yes, you'll have to use a large bypass capacitor with a low value resistor on power running to your audio circuits.

Daisy-chained power isn't a series connection. Hmm... if you have ever done house wiring, outlets are daisy-chained.

So you mean parallel then, but are asking if I have a single 5V rail which the amplifier and LEDs are branching off of.

Not exactly. I have a 5V plane on top, and a ground plane on the bottom which are broken up by traces, and the analog portion of the circuit is isolated from these except at a single point about a quarter of an inch from where power is siphoned off for the LEDs.

Anyway. Yes, you'll have to use a large bypass capacitor with a low value resistor on power running to your audio circuits.

These boards are the size of a credit card. They have to be small to fit where they need to fit. I can't stick a giant 4700uF capacitor on there, and that seems like a horribly inelegant solution anyway.

Show me the layout on the PCB?

Did you read that link I gave you about ground loops?

Daisy chaining is when you run the Vcc line to each power consuming device along a line. So power supply to first circuit, then to second circuit, then to third circuit, etc.

This is an example of daisy chaining an AC adapter for powering guitar effects pedals:

I'm not sure how that wiring diagram in the other thread fits with this, I didn't see an LED circuit there.

Do you have an oscilloscope? Do you have experience using it?

Hey guys,

So I'm back at work on this part of the circuit.

I was originally leaning towards the PI filter because it seemed simple enough to implement, but when looking for a suitable inductor I realized during my original search I must have mistakenly selected nH instead of mH,, because the inductors I found this time around were much larger and more expensive than what I found before.

I would like to keep my design small, because even though the board I'm working on now has room to spare, the next board I'll be designing has to be as small as possible.

I decided to look into that RC filter that was suggested as an alternative, and plugged some values into this calculator:
http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

If I plug in 1khz and 100uF I get 1.6 ohms for my resistor.

Good so far, but I was warned that doing this would cause a voltage drop, and that I should take care to make sure that's acceptable. I selected such a large capacitor because I have no idea how to calculate the voltage drop here, but I figured the smaller the resistor the better. Still, if I could get away with a smaller capacitor, so that I could use a tiny ceramic one instead of a hulking electrolytic, that would be great.

In my audio circuit, I have these two chips:

At best I can guesstimate, the DAC is probably not going to draw more than 25mA, but the absolute max on the input is 50mA so it may be wise to assume that.

The amp, well that's going to be powered by something less than 5V, the voltage drop will determine that. But assuming 5V and a 4 ohm speaker, with 10% harmonic distortion as a worst case, that looks to be about 2.75W max. Which with a 5V supply gives 550mA.

So worst case, this portion of the circuit would be drawing 600mA.

Now, I have no idea if this is correct or not, but I'm thinking I should plug that into R = E / I, and that gives me 8.3 ohms for the resistance of this portion of the circuit.

Then I think I would use the voltage divider equation to determine what my voltage drop would be:

Here, I would set R2 to 8.3 ohms, as that represents my audio circuit in the worst case, and R1 would be the resistor in my low pass filter.

R2 / (R1 + R2) would then = .89 if R1 = 1 ohm.

And if R1 = 1.6ohms, which was the value calculated for the 1khz LPF, then I get .84, which multiplied by 5V gives me 4.2V. That's quite a voltage drop.

The thing is, if the voltage drops, then the current the amp is putting into the speaker would as well, so that's probably incorrect. Perhaps I should just use the 4 ohms for the speaker as my resistance?

In that case, R2 / (R1 + R2) would be 4 / (4 + 1.6), which is .71, which is even worse actually. And I doubt that is correct either since I think the speaker resists the flow of electricity more than its impedance implies.

Anyway I'm totally confused here. All I can really say for certain at this point is the circuit would probably work but be quieter than it should be if the voltage drop is really that large. Even in my worst case there, that's still 3.5V and that's still more than the amp and DAC need. Except... I'll be talking to them with 5V logic and they may not like that with Vcc being lower than expected. :confused:

As for the schematic and layout of my board, here those are:
http://mightymicrocontroller.com/Mighty-schematic-full.png
http://mightymicrocontroller.com/mighty-layout.png

The DAC and amp are in the lower right hand corner, isolated from the power and ground planes except at one point.

The LEDs on this board are driven by TLC5947's that are on little modules connected to the LED pins. Those boards only have a couple small decoupling caps on them, 10uF, and 0.1uF.

The power is supplied by a separate 5V switching regulator which has 220uF caps on the inputs and outputs.

I get noise on the audio from the LEDs when they dim, due to the PWM, and I also get noise when I drive any other modules off the pins on the left side of the board with PWM.

But that's when connecting a speaker to the 3W onboard amp. If I connect an external amplifier to the line out pins, all hell breaks loose and the quiet PWM noist turns into a loud screeching that overpowers the rest of the audio... unless I stick a ground loop isolator... which is just an audio transformer, in between the board and whatever external amp I'm using. Then I just get the quiet PWM noise.

I had one suggestion to break the connection from my line out voltage divider to reference that to the amp's grounf to solve that isolator issue, and I haven't tried that yet, but that wouldn't solve the primary issue which is that pwm noise that's getting into the audio subsystem in the first place.

Given the PI filter with its inductor seems easier and the inductor will take up the same space as a 100uF cap, I would be inclined to go that route... were it not for the fact that those 1mH inductors appear to have resistances in the range of 3-6 ohms, which I think it's safe to assume would result in a far worse voltage drop than the 1 ohm resistor that still seems too large:

http://www.digikey.com/short/0nvrc

So, I'm not sure what to do at this point. I could use a larger capacitor to make the resistor smaller but my boards need to be small. A linear regulator might do the trick, but I was hoping to use a switching regulator in the next iteration of the boards to allow for a 16v input. And that adds a lot of cost.

Perhaps adding a resistor to Vcc on the LED drivers is the key? I don't need 5V for those. And I have room on there for a 100uF capacitor. I think someone suggested such an approach in the earlier thread to "get the current flowing around there". Just a question of what wattage that resistor needs to be. Can't calculate that since I don't know how much voltage it will drop.

One approach you have not attempted yet is to lower the input impedance of your amplifier to reduce the pickup of the noise.
I would use the transformer and load the output side with something like a 4K7 resistor going into your amplifier.

One approach you have not attempted yet is to lower the input impedance of your amplifier to reduce the pickup of the noise.
I would use the transformer and load the output side with something like a 4K7 resistor going into your amplifier.

I don't understand what you mean.

In case there's any confusion, when I mention an external amplifier, it is a battery powered class D 20W amplifier running from the same 12V power supply as the board's external 5V switching regulator.

There is also a 3W on board amplifier which runs from the same 5V supply which powers the logic and LEDs.

There is no transformer in this setup other than the one which is inside the ground loop isolator, and the goal is to get rid of the ground loop isolator. I don't want to use a transformer as these boards need to be super small, transformers are expensive, and I've yet to find a transformer that will work across the whole audio range.

I don't understand what you mean.

What is hard about putting a 4K7 resistor across the input?

Grumpy_Mike:

I don't understand what you mean.

What is hard about putting a 4K7 resistor across the input?

I didn't understand what you meant earlier when you said load the output side of the transformer with a 4K7 resistor.

I'm also not sure what this is supposed to accomplish. I don't want the transformer there. And I don't want to have to create special audio cables for every kit I ship with a resistor spliced in parallel.

The amplifier and isolator are also currently inside an enclosure which is difficult to get open and close back up again, so while I may try this at some point to see if it does anything, unless there's a compelling reason why I need to do this to solve the overall issue, which is that I'm stuck with that ground loop isolator / transformer in the first place, I'm not itching to open the shell up to try that out.

I did try putting a 1.5K resistor across the line out (I don't have a 4.7K and I figured the smaller the better anyway), aka, the input to the transformer, as that is outside the shell and easily accessed, and that didn't seem to do anything. Perhaps that's exactly what you expect would happen, but if adding a resistor can't be done on the output side, then I would prefer not to use that approach. Can you imagine Apple selling an iPod and telling their customers they have to stick a resistor on the line-in to their portable speaker amps to make them work?

Actually, I could imagine Apple selling their customers an expensive cable to do just this, but that's not the point. :slight_smile:

I'm looking for a nice, clean, non-kludgy, miniaturized solution that doesn't involve any big ugly expensive through-hole transformers that look like they came out of a 1980's telephone.

This is what my boards look like by the way:
http://www.mightymicrocontroller.com/wp-content/uploads/2013/04/jimpack14.jpg
http://www.mightymicrocontroller.com/wp-content/uploads/2013/04/jimpack16.jpg

You can see how little room there is there with that all installed, and that's a relatively large space, as far as where these boards end up being used (nerf guns and tricorders and such don't have a whole lot of space inside). That's version 1.0, and for version 2.0 I want to make it even more compact and ditch those 2.54mm headers in favor of more compact 2mm versions.

This was a concept of such a board using an Xmega:


I decided that I don't have the luxury of spending months trying to figure out how to port a bunch of Arduino libraries (like WaveHC and Servo) that use timer interrupts to the Xmega though, so I have to redesign that around the Mega1284 I'm using in the current model. (Then again, it might take less time to port the libraries than redesign the board... But with the Zero coming out soon, I feel like I'd be wasting my time getting familiar with the Xmega.)