Using one potentiometer to control 2-speaker volume

Discussion in 'The Projects Forum' started by boingaon, Mar 3, 2013.

  1. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    Hello,

    I am trying to control the volume for two 8ohm speakers which will each consume a maximum of 0.3W of power from a LM4880MX amplifier. I have two questions:

    1) Can I control the volume for both of them by placing a single potentiometer between the speakers and ground? I would only use two pins on the potentiometer- the wiper and one end.

    [​IMG]

    2) I want to send the un-amplifier audio signal to my Arduino to perform signal analysis using a Fast Fourier Transform. Can I safely send the signal straight from the audio jack to the Arduino analog pin? Arduino pins are designed for 5 volts, and I read that the average Vrms for audio input jacks is about 1Vrms.

    Thank you

    [​IMG]
     
  2. crutschow

    Expert

    Mar 14, 2008
    13,033
    3,241
    1) If you connect the pot at the speakers you will get crosstalk and ruin the stereo effect between the two signals as you turn the volume down. Best is to add a stereo (dual) pot of about 5k to 10k ohm at the inputs to the amplifier (before C8 and C9).

    2) The voltage level is ok but an audio signal goes above and below ground. I don't think the Arduino can handle negative signals. You will need to add circuitry to add positive offset to the signal so it doesn't go negative.
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    The LM4880 is a 250mW max per channel amplifier. It's a headphone amplifier, not designed for standalone speakers. From the Datasheet, there would be over 10% distortion at 0.3W/300mW.

    1Vrms is the maximum input to the amplifier. The LM4880 max input without clipping is 525mV per datasheet page 5.

    For input to a microcontroller, the output of the amp could be sampled prior to the speaker coupling capacitor, you should see the audio signal biased around 2.5V (5V supply). Once through the coupling capacitor, that 2.5V DC bias is removed, leaving you with a ±2.5V max amplitude AC waveform. If you wanted to sample after the output capacitor, you'd need to re-bias the signal to be between 0 and Vdd of the microcontroller. The 2.5V signal is "clipping" level, most of your signal will be lower than that, assuming voice or music type content.

    The ground of the audio amplifier IC would also need to be connected to the ground of the Arduino board or microcontroller.
     
  4. patricktoday

    Member

    Feb 12, 2013
    157
    42
    For 2) you could add two op amp buffers, one per channel, tapping into the signal perhaps right at the outputs of U20. This will be very high impedance so it doesn't "steal" hardly any signal from the main amplifier. Then you should amplify it as close to the full 5V as possible so you can get the best resolution into your ADCs. You'd want to try to center the signal around the 2.5V mark. If you only need one channel you'd only need one op amp circuit.

    This is not the best example but this circuit is similar to what I'm describing:
    http://www.electroniccircuitsdesign...ereo-headphone-amplifier-circuit-diagram.html

    The signal applied to the ADC inputs must be between 0 and 5V (and never lower) so you must first modify your source signal to make sure it falls within that range.

    (edit: I posted this without seeing the last post. It's somewhat of a dupe :) )
     
    Last edited: Mar 4, 2013
  5. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    That makes a lot of sense. Would I simply use a voltage divider to bias the signal? I'll start searching for a more powerful amplifier.

    Could you explain how you interpreted the graphs on page 5 to conclude that the maximum input w/o clipping is 525mW?

    I was considering using a dual gang potentiometer but was not sure what resistance value would be adequate. Does it need to be logarithmic?
     
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    If you tap prior to output capacitor, the signal would be "pre-biased" due to the single supply nature of the amplifier.

    The clipping voltage at 525mV is the lower left figure on page 5. Supply voltage of 5V, following graph, clipping voltage is right between 500mV and 550mV, so It's close to 525mV.

    Audio volume controls are typically logarithmic aka "audio taper" due to the response of a human ear. With a linear potentiometer, at one volume level you'll need to turn it further to increase/decrease the volume than when at a different level. The log taper potentiometers make the transition of "turn it up a little bit" fairly uniform to human perception throughout the entire volume range.
     
  7. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    Would it be correct to say that it would be pre-biased around 0V? Can I add a biasing method such as the one shown below to bias the signal to 2.5V?

    [​IMG]

    So, is it okay to bias one of the speaker signals, but not the other? As you said, the capacitor will remove the bias, but can I be sure that the two signals will still be the same? Should I bias both just for the sake of applying the same conditions to Right/Left signals?
     
  8. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    You can bias just one without having any severe effects.

    You are essentially adding a 100kΩ in parallel with the 8Ω of the speaker. This won't change the 8Ω by a huge amount. It may change the cutoff frequency of the output capacitor by a tiny amount, but not so you would notice with your ear.

    When the added resistance is not far greater than the resistance of the item you are measuring is when the measurement changes the circuit operation.

    A good example is the old Analog VOM (Volt Ohm Meters), they used a coil movement, and had an input impedance of about 10kΩ/Volt. Circuits that had low levels and very high impedances would stop working when that "huge" 10k load was added to the circuit.

    Today, the phenomenon still happens with DMMs, though far more rarely. The input impedance of a DMM is typically > 1MΩ.

    If you think of your Arduino as a meter, it is one with a 100kΩ input impedance and 1% accuracy at best (if you use 1% resistors in your bias divider). Then the limitation is stability of the power supply in both the bias circuit and the ADC (This is where bypass caps on the IC are important), and the 10 bits of resolution.

    Sampling rate for an Arduino doesn't cover the full audio spectrum, BTW. An Arduino at 16Mhz can sample a max of 10,000 times per second, so the highest measurable frequency due to aliasing and the Nyquist limit is 5kHz. That is sampling only, no extra processing between ADC reads. If doing math on the sampled signal, the effective frequency will drop relative to the amount of code being run between samples.

    Clocking the processors faster does raise this frequency a bit, but the method of ADC in uCs (Successive Approximation) isn't "instant", though it is fast.
     
  9. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    Thanks for the insight. I believe that I have selected a proper amplifier based on your feedback. The amplifier is model LM1877 as shown here:

    http://www.digikey.com/product-detail/en/LM1877M-9/NOPB/LM1877M-9/NOPB-ND/164422

    I have taken the following picture from the component's data sheet, and it appears to be just what I'm looking for.
    [​IMG]

    I did some modifications to the circuit to add a dual-gang potentiometer, as well as a 2.5V bias before the coupling capacitor for one of the speakers (each of which is 8ohms, 1watt).

    [​IMG]

    I still have some lingering questions about this type of circuit-

    1) Pin 1 on the amplifier is called "BIAS". Correct me if I'm wrong, but it appears that this pin allows the amplifier to bias the input signal to a level above 0V (handy for circuits that are powered by a wall adapter. This way you can ground the V- pin as opposed to providing a negative voltage)

    If what I'm saying is true, then what voltage is the input biased to, and what voltage is the output biased to?

    2) Are the 1Mohm resistors values for the output bias sufficient? Are there any components that I may be missing in conjunction with them?

    3) I don't want to blow out the speakers, so I'd like to cap the power for each speaker at 1W or a little below their maximum rated value. What kind of circuit analysis must I perform to set the proper gain? I was thinking about placing a potentiometer in place of the gain resistors as a way to test the gain myself.

    Thank you
     
  10. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    You wouldn't need the 1M resistor voltage divider if tapping the output of the amplifier prior the the output capacitor. If you measure after the output capacitor, then you'd need the 1M resistors, but another capacitor would be needed to remove that bias so the speaker doesn't receive the DC.

    The bias voltage will vary based on signal input with the schematic shown. This voltage is created by the two 1Meg resistors with the center going to pin 1. It could be fixed to half the supply voltage by connecting the 2 1M resistors between Vcc and GND, with the bypass cap connected at the center point as shown.

    The power output is dependent on supply voltage. The bottom right graph on page 5 of the Datasheet doesn't show it operating at 5V. The 2W output is only with a 20V supply voltage. From other graphs, the lowest supply voltage shown is 7V, which would provide roughly 1W output maximum.
     
  11. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    What gain must be chosen to obtain those results?
     
  12. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    It depends on what your input signal is. The same table on page 5, showing output peak to peak voltage for given supply voltage can be used to give you an idea.

    If your input signal is 100mV peak-peak, and you'd like a 2V p-p output, the gain would be 20. With your input divider, you can try different gains to get the right range on a breadboard, then build permanently with what worked best.

    Without specifics on the source, that's the best I can suggest, but 20 to 40 sounds like a good place to start from what you've stated so far.
     
  13. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    The input would be from something like an MP3 player or laptop. Perhaps I should blast one of these sources at full volume while measuring on an oscilloscope to determine what kind of maximum voltage I can expect.
     
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    That is one method, but you typically won't be feeding the full volume to the amplifier, will you?

    Since you have 2 volume controls, the output level of the source, and the input voltage divider on the amp, you can attenuate the signal a great deal, or increase the signal by increasing source volume.

    This provides a lot more latitude in the required gain, just be sure that you aren't going to be driving the amplifier into clipping with too high of gain.
     
  15. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    I won't be maxing out the input, but I can't trust someone not to do so. This circuit is part of a larger circuit for a prototype product that I'm creating. The end user needs a lot of leeway built into the product because they're not too keen on following unnecessary rules like "always make sure to lower the volume on your input device before connecting it to the product".

    In regards to the volume control, I was under the impression that the dual-gang potentiometers moved both of the wipers simultaneously, giving you essentially one volume control for both speakers.

    I think what I may do is put a regular potentiometer in place of the static resistors to control & test the gain.
     
  16. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Yes, that is what the stereo pot volume controls do. They are determining volume by attenuating the signal input.
     
  17. patricktoday

    Member

    Feb 12, 2013
    157
    42
    Can't you just add a sign to the volume knob that says, "Please do not overtighten"? ;)

    You could add two diodes to each channel between the dual gang pot and the cap, one in either direction and all going to ground. That would clip the input signal at about +/- 0.7V. That would make your input predictable and would just leave the end user with some distortion if they crank up their source too much.
     
  18. boingaon

    Thread Starter Member

    May 15, 2012
    31
    0
    Very helpful. If I wanted to be snazzy and replace the analog dual-gang potentiometer with a digital one (volume control), would I put it in the same place as the analog pot as shown in the most recent circuit diagram?

    I've been looking at the specs for digital pots and their current ratings are somewhat low...

    **Additional thoughts:

    Since the current flowing through a non-inverting / inverting input of an amplifier can be considered effectively zero, I should have no problem connecting a low-current-limit digital pot... Amplifiers amplify voltage, not current. Maybe I'm jut trying convince myself why it would work...
     
    Last edited: Mar 18, 2013
  19. patricktoday

    Member

    Feb 12, 2013
    157
    42
    I completely agree! Take the maximum RMS source signal voltage you anticipate going across the digital pot and divide by the pot's resistance; this will be the current flowing through the pot. That's a slight approximation but very slight. A tiny bit of the current flows into the amplifier's input impedance. To get the precise value, imagine the wiper is somewhere in the middle of the pot; so it is as if you had one resistor connected to the input, then the bottom half of the pot's resistor in parallel to the 1 Meg input resistor you used. You can calculate it out but it's a pretty small value.
     
Loading...