Go Down

### Topic: Line Level (Read 3950 times)previous topic - next topic

#### scswift

##### Apr 27, 2012, 12:31 pm
Hey guys,

I'm using this amp in my design:
http://www.ti.com/lit/ds/symlink/tpa6211a1.pdf

And I'm using the single-ended input reference design in Fig. 30 on Pg. 14.

My DAC will be outputting 0..5v and I've selected 40K resistors on the input of the amp to give me a gain of 1.0, so with the differential output the voltage will swing from -5v..+5v.

I will want my project to be able to attach either directly to a speaker, or to an external amp, so I need to convert my output to line level.   I was gonna just adjust the volume in software to reduce the voltage, but I decided I'd get better sound quality with a voltage divider and it would also allow me to connect both a speaker and amp to the board at the same time without sacrificing volume on the speaker.

Anyway, according to this Wikipedia article line level for consumer audio appears to be around 0.447V peak:
http://en.wikipedia.org/wiki/Line_level

I also found this page showing how to set up a voltage divider to convert to line level:
http://www.epanorama.net/circuits/speaker_to_line.html

It divides the voltage by 10, which if I'm not mistaken, would result in a voltage swing of -0.5v...+0.5v from my amp.  And that seems like the right result, but I found this post by Grumpymike where he tells someone to divide the voltage by 5 instead:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264497247

So which is correct?  Should I use the 1K or the 2K resistor?  And do you think 5v is close enough to .447v or is the extra voltage going to cause clipping or something?

I've also been reading about DC blocking capacitors. I guess I would just stick one in series with one of the outputs?  It sounds like those are to protect speakers, but the TI datasheet doesn't seem to include one, and I'm not sure I understand why it would be needed at all.  I don't think it's needed for the amp either.  What do you think?  Should I include one?  And if one is needed, what would be a good value to use?  I may be outputting audio at up to 44khz sample rate.

#### scswift

#1
##### Apr 28, 2012, 12:19 pm
Well after doing a lot more reading up on this, I'm not sure I can use a voltage divider on my differential output.  I'm also not sure there would be any advantage to connecting an amp to the differential output.

I think what I should do is connect the external amp directly to the single ended output from the dac, and put a voltage divider on that.  I'm not sure if I need a dc blocking capacitor on there though.  I'm still not clear on what those are needed for.  I do know that I should make sure the current is limited though in case someone connects a speaker, but the 10K resistor in the voltage divider should do that job nicely.

The only downside I can see to this is that I think I'll lose the benefit of a "balanced output":
http://www.ians-net.co.uk/articles/balanced_lines.php

I think balanced output is another word for differential output, and if that is useful in keeping noise out of the lines, it would be much better to have that on the lines going to an external amp than to the speaker for my application, since the amp may be up to 6 feet away from my board.

#### scswift

#2
##### Apr 28, 2012, 12:22 pm
Oh, and I also realized when doing the voltage divider calculations that I won't end up with .5V if I use a 10K and a 1K resistor, I'll end up with .455V, which is damn close to the .447V line level in that Wikipedia article, so it should be fine.

#### DVDdoug

#3
##### Apr 30, 2012, 09:22 pmLast Edit: Apr 30, 2012, 09:31 pm by DVDdoug Reason: 1
Quote
Anyway, according to this Wikipedia article line level for consumer audio appears to be around 0.447V peak: http://en.wikipedia.org/wiki/Line_level
The key word here is around   I get just under 1V peak (~.7V RMS) from my laptop's headphone output, and about 2V peak (~1.4V RMS) from my CD player's line-out.   And of course, the voltage is only constant with test-tones...  With music or voice, the voltage jumps all over the place!

The "line-level" signal going to a power amp (to a speaker) is usually volume-controlled, and unless you are listening at full-volume, it can be 1/10th or 1/100th of what Wikipedia lists, depending on the gain of your power amp and depending on how loud you are listening.

Quote
I was gonna just adjust the volume in software to reduce the voltage, but I decided I'd get better sound quality with a voltage divider and it would also allow me to connect both a speaker and amp to the board at the same time without sacrificing volume on the speaker.
I recommend an analog volume control  (i.e. a potentiometer = a "pot").   One advantage is that, with the volume turned-down, you are less-likely to get an accidenal-unpleasant "blast".   In theory, you loose quality either way, but you shouldn't notice the quality loss, because it's happening at low levels.  You should only notice the quality loss if you re-boost the volume.  With analog, you lose signal-to-noise ratio, and with digital, you loose bits of resolution.

The differential (AKA "bridged") output means that you don't need output capacitors.     It also means that you can't use stereo headphones, which require a common ground, shared by left & right.

Fig 30 on the datasheet shows you how to make a single-ended input.

If you need a DC blocking capacitor, there is information on page 16 for calculating the correct value.   If your capacitor is too small (not enough uF) the bass will be reduced.   You can generally use a higher-value (More uF) capacitor than you calculate with no trouble.  As you may know, the capacitive reactance (impedance) of a capacitor depends on frequency (and capacitor value).  For a series (DC blocking) capacitor, you'd like capacitive reactance to be less than the amplifier's input impedance, or less than the the speaker impedance on the ouptut.

#### scswift

#4
##### May 01, 2012, 04:13 pm
Thanks for the info.

The reason I've got software based volume control is because I don't expect many users will want to reduce the volume.  The onboard amp is only 2W, which is pretty loud, but not extremely loud.  The venues where my board will be used will also be kinda noisy, so they'll generally want to leave it at full volume.  But, if they do want to adjust the volume, they can always attach a pot to an analog port and adjust the volume that way.  So the option is there.  And it doesn't take up extra space on a board which I'm trying to make as small and flexible as possible.

Also, analog volume control on the amp's input, (which I have configured as single ended, since that is what my DAC outputs) would be easy enough but that would not solve my problem... being able to connect a speaker and external amp at the same time.  For that I need a speaker out and line out port each with different voltage levels.  GrumpyMike suggested a "differential attenuator" but I have been having a hard time figuring out how to set one of those up.  I've found a lot of different designs for them but they all talk about reducing decibels rather than voltage and have impedance in their calculations, and though I found some equations for calculating dbV or whatever they used, I can't be sure the decibel reduction I calculated is correct for getting me down to the voltage I need and I don't know what I'm supposed to to with the impedance in the calculations.  So I'm a bit lost.

I also can't stick an analog volume control on the amps output cause that's differential and I don't know how to make that work.  If I did, then I'm probably know how to make the attenuator I need, since both are surely a kind of voltage divider.

As for DC blocking capacitors, again, I don't know if I need them on the amps output.  But on the input I have a capacitor in series because that's how the single ended input was setup, and I think it was part of a LPF, but I forget.  But anyway the input to the amp on my board should be fine.  I'm just concerned about the output.

In regards to the line level and DC blocking though... I was looking at an amp on Sparkfun to see how it functioned so I could determine if it expected a differential or single ended input, and I found some people complaining about the MP3 shield not working properly with it, and Sparkfun pointed them to this document:
http://www.sparkfun.com/datasheets/Widgets/MP3Trigger/vs10XXan_output.pdf

On page 8, fig 3.2, they show a "simplified line out" connection for the MP3 shield.  Unfortunately they don't really go into detail about how or why they chose the values they did for the capacitors they have or what all the capacitors are for.  They also don't even include values for some of the capacitors.  But it looks promising.  And there's some other useful information in the document about ground loops causing problems.  I'm a bit confused about how one would wire that ground connection with the 47nF capacitor though.  I'm pretty sure I can't ground my whole analog circuit through a capacitor.  But perhaps that ground it and the other capacitors are going to isn't the mp3 shield's ground but rather a connection to the amp's ground.

#### DVDdoug

#5
##### May 01, 2012, 10:01 pm
I think you are at the point where you should jump in, buy some parts (if you don't already have them) and start experimenting/prototyping!  If you buy a few extra resistors, you can experiment with different gains/attenuations.  It's a good idea to make some calculations, but with audio you might not know how loud it's really going to be...   Even calibrated sound systems (such as movie theater systems) have volume/level controls so that they can be adjusted/calibrated.

Just connect your optional amp to the DAC output (with a blocking capacitor) and you don't need a differential attenuator.   Since that signal is single-ended, you can use a regular voltage divider or pot to bring the signal down to "line level".   Or if the amp has a volume control, you can just feed-in the "slightly hot" signal (slightly higher than normal line-level) and you'll be fine!

It's no problem connecting your home-made amplifier and another one to the DAC at the same time.

Quote
I don't know if I need them on the amps output.
You don't need them for the speaker.

If you want to connect another amplifier to the differential output of the amp you build, YES, you need a blocking capacitor.    Just use one-side of the differential output and put a capacitor in series.  Connect the additional amplifier's (single-ended) input to the capacitor, and connect its input-ground to your amplifier's ground.  (One-half of the differential output won't be used.)

Quote
I've found a lot of different designs for them but they all talk about reducing decibels rather than voltage
Decibels are a ratio.    The basic formula in relation to voltage* or signal level is 20 x log(V2/V1).   Sometimes V1 is a known reference...  For dbV, the reference is 1V.  A couple of ratios that are handy to remember, are that  6dB is a ratio (or factor) of two, and 20dB is a ratio of ten.  Reducing 5V down to 1/2 volt is a -20dB change.   If you amplify 0.5V up to 5V, your amp has a gain of 20dB.

If you want to convert the other way, from dB to a ratio, it involves raising a number to the power-of-10 (the opposite of a logarithm), and you can look that up.

Quote
I'm a bit confused about how one would wire that ground connection with the 47nF capacitor though.  I'm pretty sure I can't ground my whole analog circuit through a capacitor.  But perhaps that ground it and the other capacitors are going to isn't the mp3 shield's ground but rather a connection to the amp's ground.
I'm not familiar with that device at all.  Somewhere, all of the grounds need to be connected directly together.   That is, the gound(s) on the DAC circuit need to be connected to the ground(s) on amplifier circuit.  On a regular hi-fi amplifier, that common ground is on the RCA input jack, which has one signal wire and one ground/shield wire.

* With power the formula is 10 x log(P2/P1).    This is basically because when you double the voltage, you also double the current (assuming constant resistance/impedance), which means you quadrupal the wattage.     A +6dB change is double the voltage, or 4 times the power.

#### scswift

#6
##### May 01, 2012, 11:10 pm

Just connect your optional amp to the DAC output (with a blocking capacitor) and you don't need a differential attenuator.   Since that signal is single-ended, you can use a regular voltage divider or pot to bring the signal down to "line level".   Or if the amp has a volume control, you can just feed-in the "slightly hot" signal (slightly higher than normal line-level) and you'll be fine!

It's no problem connecting your home-made amplifier and another one to the DAC at the same time.

Well, the issue with that is twofold.

1) I don't even know yet if external amps want a single ended or differential output.  I suppose, looking at how I wire a single ended input to my amp, that if I do something similar to that, and send one output to ground via a DC blocking capacitor that that might achieve what I want, but I'm not sure about it, nor am I sure whether I should do that to the + or - output or if that even matters either.  Hell, I'm not even sure if it matters if I plug the + or - into the + or - on the external amp. With a differential output I assume it does not matter. but with a single ended, it might.

(Reading the rest of your post, it sure sounds like differential vs single ended input to another amp doesn't matter, but I've been reading so many documents, and there's talk of consumer audio using single ended, and how to design your amp to be able to handle both single and differential and I don't know if the amp designer has done that...  But looking at the differential vs single ended input on my amp, the schematic does not look so different.  The single ended is just referenced to ground I guess.  I'm not super confident about how op amps behave yet though so I'm uncomfortable doing something without being sure it's the right way.  It's all too easy to make something that seems like it works only to have it blow up in your face later.)

2) If I do that, I lose the benefit of differential output when using twisted pair for noise cancellation.  Honestly, I don't even know if I should be worried about this since the wires will only be 6-10' long and I don't often see twisted pairs used for even very long speaker cables, but I've seen twisted pair used for much shorter lengths of servo cable so I really don't know when I should be worried about noise.

Of course prototyping would answer some of these questions, but I've still got a month of work to do assembling some other circuits I have before I'm gonna be able to get to that, and I'd like a solid point to start from.

Quote
If you want to connect another amplifier to the differential output of the amp you build, YES, you need a blocking capacitor.    Just use one-side of the differential output and put a capacitor in series.  Connect the additional amplifier's (single-ended) input to the capacitor, and connect its input-ground to your amplifier's ground.  (One-half of the differential output won't be used.)

Okay.  I'm still a little fuzzy on why exactly the DC blocking capacitors are needed though.  AC or DC I'd think the same amount of power is going through the circuit, so I don't get why DC is really bad.  Also not sure why a simple resistor to limit current isn't used.

Quote
I'm not familiar with that device at all.  Somewhere, all of the grounds need to be connected directly together.   That is, the gound(s) on the DAC circuit need to be connected to the ground(s) on amplifier circuit.  On a regular hi-fi amplifier, that common ground is on the RCA input jack, which has one signal wire and one ground/shield wire.

Hm, so you're saying an RCA input is single ended, and the ground/shield wire of it is just connected directly to my board's ground and my amp's output has one side wired to ground via a dc blocking capacitor, and the other side goes to the center pin on the RCA jack.

Seems like that makes sense.

But... What does this all mean for a differential output?  Single ended seems convenient with the ground connection right there.  But with differential you still need one more connection for the common ground right?  That would explain the ground pins in that schematic on page 8 here:
http://www.sparkfun.com/datasheets/Widgets/MP3Trigger/vs10XXan_output.pdf

But why the heck does the left side of that have "out" written on it, when the right side is the MP3 shield, and the left side is the external amp?  Shouldn't those be labeled as inputs?  Also, I have no idea what the gbuf pin is.  But the external amp does go to ground and I guess it can be assumed the MP3 shield goes to ground somewhere as well.

I'm just confusing myself now though.  Going back to the RCA input, it seems convenient, but it seems like I wouldn't just stick the signal and gnd pins from that into the + and - pins on the external amp... I would have to go to the + and gnd pins on the external amp.  And the - pin on the external amp, and the - pin on my internal amp would both need dc blocking capacitors to ground.

So really, the RCA connection is only simpler than the differential setup if you have an RCA jack on both ends already wired up properly, enagaging those DC blocking capacitors on one side of the single ended output when needed (or having them on all the time if you don't need a differential input/output).

So am I understanding this right?  If I have a differential output from my board, and I plug the + into this amp, and connect the grounds:
http://www.sparkfun.com/products/9612

Do I still need do place a DC blocking capacitor on that amp's - input going to ground?

If that's the case, it seems like it would be less confusing to the end user to just tell them to plug + into + and - into - and connect the grounds of their batteries.  And then I just have to worry about ground loops and figure out how to avoid them.

Thanks again for the help btw.  It's hard figuring this stuff out when I don't have any way to know if what I think is right is actually right.

#### scswift

#7
##### May 02, 2012, 04:17 amLast Edit: May 02, 2012, 04:29 am by scswift Reason: 1
Btw, the reason I worry so much about the noise and stuff is I now these guys who have been using these sound chips with this cheap 7W amplifier and they have had no end of problems getting them to work together.

Here's the schematic for that amp:

I don't know how much of the complaining is a result of the sound chip outputting 3v and they want to crank the amp up all the way but that means the voltage on the input ends up being over line level and is overloading it, and how much is a result of the sound chip being this cheap PWM output thing, and how much may be due to some kind of ground loop forming, but I just had a friend hook one of those sound chips up to this amp, and he wired the + output to the amp's WIN pin, and the - to the amp's G pin and said his sound was really quiet.

I think this the sound chip being used, but the seller encases it in resin so people can't tell for sure:
http://www.elechouse.com/elechouse/images/product/MP3%20WT588D%20USB%20module/WT588D%20CHIP&MODULE%20DETAILED%20INFORMATION.pdf

If I'm reading that right, the PWM + - output is differential.  I told him to try connecting just the + side to the amp and then wire the grounds together and he said that was louder but really noisy.  He's gonna be picking up some resistors and caps  so we can try a few more things, but I didn't know what values to suggest.  I guess we'll try 1K-10K and .1uf ceramic caps. I thought sticking them on the - pin of the sound card and/or the G pin on the amp might get a single ended output working, but I was kinda just fumbling around in the dark as I didn't have schematics for either when I made the suggestions.

Go Up

Please enter a valid email to subscribe

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy