PDA

View Full Version : Choosing resistors for audio circuits



The Master
- 3rd June 2012, 21:33
Hi, I'm currently working on a circuit using a TDA2050 audio chip (TDA2050 datasheet (http://www.datasheetcatalog.org/datasheet/stmicroelectronics/1461.pdf)). See "Figure 1: Split Supply Typical Application Circuit" for a schematic of my circuit.

The actual resistance value isn't much of a problem. I've started with the recommended values and adjusted them to suit my circuit. The problem I have is that the datasheet doesn't appear to say how many watts each resistor should handle. I'm using 0.25W carbon film resistors as I have those in every available value but when I turn the volume up to full the 2.2Ohm resistor connected to pin 4 goes up in smoke.

How would I know how many watts this resistor needs? It's a 32W chip but I would expect most of that power to go through the speaker and theres a series capacitor in there too so I'm really not sure how to calculate it. Should I be worried about the other resistors too? So far they all look fine but I've only managed about 10 seconds before having to cut the power.

keithdoxey
- 3rd June 2012, 23:11
What impedance is the speaker ?

I normally use a 0.6W metal film resistor but it shouldnt really be taking any power under normal usage.

Are you sure you dont have some high frequency instability being introduced above the range of hearing ?

The Master
- 3rd June 2012, 23:29
The speaker is 8Ohms but I would like this circuit to handle both 8Ohm and 4Ohm speakers.

It's very possible there is some noise. I didn't have a 470nF cap to put in series with this resistor so I used the highest non-polarized one I have which is only 220nF. The datasheet does say that a smaller value may cause oscillations. I will be buying some 470nF caps and a few other values on my next order. In the mean time I will try to safely connect my scope to check for high frequency oscillations.

Thanks for you're suggestion of a 0.6W metal film resistor. I will buy a few of those and some higher values just incase / for the future. I would still like to know if there's some kind of calculation I could use to find the exact value though. I want the components to cope easily but I don't want them to be unnecessarily large.

keithdoxey
- 4th June 2012, 00:04
you shouldnt need a higher power resistor than that. With 470nF the resonant frequency of that network is around 150kHz, with a 220n it will rise to over 300kHz.

If you have another 220 then putting it in parallel with the existing one will take you to 440nf which is within 10% of the correct value.

You also say "when you turn the volume up full", depending on how hard you are driving it you could be going into severe clipping causing high frequency harmonics which are destroying your resistor as the impedance of the capacitor falls to a few ohms.

The Master
- 4th June 2012, 01:03
I tried adding a second capacitor in parallel and even a 3rd. It actually makes the problem worse.

For the volume control I'm using a 22K potentiometer with the wiper connected to Vi in the schematic, one side connected to ground and the other side connected to my PIC. Initially this did cause clipping around half way so I added an extra 22K resistor between the PIC and the pot. Now the max volume is just under where it starts to clip.

As a test I removed the ground from the left side of the pot. With the TDA2030 that would have caused a lot of noise through the speaker but on the TDA2050 it was fine until I ran the code in the PIC and that same resistor exploded violently.

As I have it now the resistor is fine until I turn the volume right up. Since this is about the limit of the chip's power before clipping and you recommend a 0.6W resistor then I think it's simply that my resistor can't cope rather than any destructive high frequencies. I will still check for those anyway just to be on the safe side but I think a tougher resistor should solve the problem.

Will a 0.6W resistor be suitable for running a 4Ohm speaker too?

keithdoxey
- 4th June 2012, 01:19
If there were high frequency harmonics caused by clipping or a "dirty" source signal then the resistor would be more likely to vapourise as it would be recieving lost of power at a lower frequency than with the original cap you had in there.

If you read the datasheet you will see that the footprint of the resistor on the PCB overlay is the same as for the other "signal" resistors so that to me implies that it isnt really taking a lot of power. The fact that you say it is worse with higher capacitor values would tend to rule out instability due to oscillation as the datasheet mentions instability as a likely side effect of too low a value for the capacitor.

You say you are driving the amp with a PIC. Do you have any RC filtering to shape the signal to more of a sine wave, if not you will be feeding it with a square wave which will cause the HF harmonics doing the damage.

What happens if you drive it with an MP3 player ? Does it sound OK and survive being played loud ?

The Master
- 4th June 2012, 11:11
I've just had a quick read of an RC circuit (http://en.wikipedia.org/wiki/RC_circuit) wikipedia page. The only thing I have like that is the 1uF capacitor at Vi and the resistors that connect to it.

It looks like I will need a series RC circuit. Do you know how I would start calculating the values for the resistor and capacitor? I found this RC calculator (http://www.bowdenshobbycircuits.info/rc.htm) but I'm not really sure what kind of output I should be looking for.

I will do a few tests on the output from my PC and see what happens.

keithdoxey
- 4th June 2012, 11:46
What frequency range are you outputting from the PIC ?

Charlie
- 4th June 2012, 12:18
Adding caps will certainly make things worse, and a 1/4 watt resistor is way too small. The math can get a little hairy, but as a first order..

The capacitor will have an impedance based on frequency Z=1/(2*PI*frequency*cap value). Rough calculation says about 339 ohms an 1KHz, and about 34 ohms at 10K. To find out how much power you need, draw a little circuit with a 2.2 ohm resistor in series with a 34 ohm resistor, and an 8 ohm resistor across all of that (if 10KHz is the highest frequency you need to worry about having a lot of energy at). Resistor series / parallel calculations will find you the total load impedance. You power supply value will tell you the biggest peak to peak signal you can put through by accident or on purpose since you could swing close to the rails. Now Ohms law (V/R) will tell you how much current is flowing in your total load. Now work out how much current is flowing in the leg with the 2.2 ohm resistor. The I*I*R will tell you how much power will be in that resistor.

To really scare yourself, work out what happens if you disconnect the speaker while things are running.

If at this point you are thinking of being super lazy and just buying a 10W resistor and forgetting about it, you might want to look up calculating the impedance of inductors, since power resistors are usually wire wound.

Isn't analog design fun?

The Master
- 4th June 2012, 12:26
I'm using the PIC's hardware PWM (output compare) module. It uses Timer2 as a reference running at Fosc/2. The PIC has a 16MHz crystal with 2x PLL enabled so I believe the PWM is running at 62,500Hz with a duty cycle of 0-100% depending on the sample. The sample rate is 44,100Hz.

kellyseye
- 4th June 2012, 12:38
Check your circuit construction to make sure the resistor is actually in the circuit properly. I reckon you've got the capacitor/resistor in parallel, not in series.

pedja089
- 4th June 2012, 13:03
You must have some filter between pic and AMP. That filter should remove carrier frequency of pwm, so you get analog signal on output ... Then you feed that signal into AMP.
AMP can't amplify PWM signal.

The Master
- 4th June 2012, 13:23
They are definately in series.

Let me check that I'm calculating this right so far.
Frequency = 62,500Hz
Using 1/(2*PI*frequency*cap value) I get roughly 5.4Ohms for the cap.
5.4 + 2.2 = 7.6Ohms total accross the resistor and capacitor.

I'm not 100% sure how to calculate how much current goes through the resistor/cap and how much goes through the speaker but since the resistor/cap is almost 8Ohms I would assume it's just a little more than half.
The supply is a 30VA 9-0-9 toroidal coil. If I understand transformers correctly then I think that would give me 3.3A max.
3.3 / 2 = 1.65A (the half going through the resistor/cap)
1.65 * 1.65 * 2.2 = 6W.

6W seems really high so I must have gone wrong somewhere.

Charlie
- 4th June 2012, 13:46
Without doing the calculations, that looks close the correct answer. Your logic is correct. The circuit you are using is for a DC powered audio amp. I think we need a whole schematic, not just the audio design reference. You certainly can not power a linear amp of that configuration from AC without rectification and filtering, which changes the max voltage.
Are you really pushing 62.5 KHz? If so, that is NOT an audio circuit, not even if you are a dog!!! What the heck are you building?

Note also that the power rating is for sustained power over time, not just instantaneous power. But an instantaneous power at a more reasonable worst case 20 KHz, max amplification (against the rails) is likely going to give you an answer expressed in Watts.
Since a more realistic audio application will see bigger powers at lower frequencies, where the cap impedance is a lot higher, and hence more of the power is in the speaker, and the fact that max volume is never sustained more than a small portion of the total time or it would be clipping, should let you get away with smaller power rated resistors. Again, without building a spreadsheet and doing the analysis properly, if this is an audio circuit, I'd guess a 1 Watt resistor would not be unreasonable, and I might use a 2W if I had one handy.

If it was for production though, I'd build that spreadsheet.

The Master
- 4th June 2012, 13:52
For the RC filter. Would a low-pass filter in the configuration shown here (http://www.electronics-tutorials.ws/filter/fil5.gif) be suitable with a 33Ohm resistor and a 100nF cap? I calculate that to allow 48,253.2Hz which is about as close as I can get to the 44,100Hz sampling frequency I'm using.

The Master
- 4th June 2012, 13:57
The 62.5KHz is only for the PWM. The actual sampling frequency is 44.1KHz. I assume that adding the low-pass filter will change those figures quite a lot.

Charlie
- 4th June 2012, 13:59
This amplifier does NOT have to pass your sampling frequency - in fact you really don't want it to. Focus on the audio spectrum (20 Hz to 20 KHz).
The values in the example are for stability of the amplifier, and I would not recommend changing them, or you are likely to have an oscillator rather than an amplifier.

Charlie
- 4th June 2012, 14:06
The filter link does not work.
Calculating the filter is also more complex than first meets the eye - you need to consider input and output impedance. As I said, a whole schematic would make it easier to help you. Feel free to send a private message if you don't want to post it publicly for some reason.

The Master
- 4th June 2012, 14:33
I've attached a schematic showing exactly how it's connected up right now.

Charlie
- 4th June 2012, 14:51
Thanks.
Just for clarification, the top "from PIC" is actually the PIC GND pin? The resistor we've been talking about is 2.2 ohms, not 2.2K as shown?

The Master
- 4th June 2012, 14:54
Yes, 1 of those lines goes to the PIC ground and the other goes directly to the output pin.

That should be 2.2Ohm sorry.

Charlie
- 4th June 2012, 15:53
It does not state if your AC supplies are Peak or RMS but a reasonable guess is that the maximum swing your output can make is going to be under 12V.
The input impedance of the circuit will be between 33K and about 50K depending on frequency. Overall gain of the circuit is about 20-ish It would help to know what the signal looks like coming out of the PIC, but a single pole filter is not really going to get rid of enough garbage for you, especially if there is a fair amount of 44 KHz stuff around. It would certainly be better than nothing. However, a couple RC stages should be able to knock it down enough to not be an issue for your amplifier and power dissipation at least.

But first, for your original question, redo your power calculation with a maximum of 12V and a maximum frequency of 20 KHz to see how much power will be in the resistor. Also, that's 12 V P-P. For sizing the resistor, it would make more sense to use RMS - call it 4.2V

The Master
- 4th June 2012, 16:23
OK, let's see how this goes.

Frequency = 20,000Hz
1/(2*PI*frequency*cap value) gives 36.2Ohms for the cap.
36.2 + 2.2 = 38.4Ohms total accross the resistor and capacitor.

30VA 12-0-12 supply gives 2.5A max.
I'm basing the current through the resistor on the difference between the resistor/cap and the speaker. I would say roughly 17% of the current should go through the resistor/cap.
2.5 * 0.17 = 0.425 through the resistor/cap.
0.425 * 0.425 * 2.2 = 0.4W.

0.4W is much better. If I used a 470nF as the datasheet suggests then I work it out to be 1.4W though which still seems a little high but it's still much better than before.

The Master
- 4th June 2012, 16:28
I'm not quite sure how RMS works with current. Using 4.2V would give around 7A using my calculation. That doesn't seem right at all.

I just noticed one of your previous edits. Yes, designing analog circuits is fun but only because I get to see an explosion ;)

Charlie
- 4th June 2012, 17:10
Treat RMS like DC. And don't forget to fix the frequency. If you are using 22nF, then that's about 330-ish ohms at 20 KHz. I think you should be seeing more like 1/2 amp than 7 amps.

The Master
- 4th June 2012, 17:23
I'm still not sure about the RMS. I'm Calculating the max current by dividing 30VA by the volts.

I just found my cable for connecting to the PC and I'm shocked. With the current setup I managed to get to the point where it started clipping and hold it there without anything blowing up.

I added a 10nF cap between the pot's wiper and ground which took a little of the sharpness off the high parts and it's sounding perfect. Now the problem is how to do that with the PIC. I will try connecting my scope up to see if I can get anything useful out of it.

How would multiple RC stages work? Couldn't the same effect be achieved using a single RC with different values?

The Master
- 4th June 2012, 17:33
I've attached the output from my scope. I can understand why the audio chip hates me. This signal is very... digital!

The Master
- 4th June 2012, 18:50
I've done a little playing around and it seems the solution was to simply add 1 extra capacitor to turn my extra resistor into an RC low-pass filter. Unfortunately it's started clipping again when the volume is on full but most of my circuits will use an internal preset to keep it just below the clipping point and the volume will be controlled digitally so that's not a major problem.

I swapped the RC filter and the pot to give the same effect but to suit my PCB layout better. I've uploaded an updated schematic and the scope readings for just below the clipping point and max volume.

I will be ordering some 470nF caps soon along with some 0.5W and 1W resistors. It's working so well now with the 0.25W that I think a 0.5W should be enough with the 470nF cap but I'll get the 1W ones as well just in case.

I know I still have pleanty to learn about audio circuits but I've learned a lot from this thread and gone from a fire hazard to a working audio amplifier so I'd like to say a big thanks to everyone who's helped me out :D

Charlie
- 5th June 2012, 01:12
Sorry I was not clear - RMS is the AC equivalent of DC in terms of work or power. DC Watts is DC Volts * Amps. AC Watts is RMS Volts * Amps.

An RC filter with series R followed by C to gnd, follwed by series R followed by C to gnd is not the same as a single RC with appropriate values. A single RC will have an attenuation slope of 20 dB per decade; 2 stages will have a slope of 40 dB per decade - double the attenuation of unwanted signals.

You can clean up your signal a lot more, although you may not care.

The Master
- 5th June 2012, 14:47
I would like to clean up the signal as much as possible. What values do I use if I have 2 RC filters? If I calculate that I need a 10K resistor and 1uF cap for a single one then do I use 10K-1uF-10K-1uF or would it be 5K-0.5uF-5K-0.5uF for 2 of them?

Charlie
- 5th June 2012, 20:51
I would like to clean up the signal as much as possible. What values do I use if I have 2 RC filters? If I calculate that I need a 10K resistor and 1uF cap for a single one then do I use 10K-1uF-10K-1uF or would it be 5K-0.5uF-5K-0.5uF for 2 of them?

Read this. http://www.electronics-tutorials.ws/filter/filter_2.html