How do I use one pot to mix two signals?

Started by xorophone, November 30, 2016, 04:37:24 PM

Previous topic - Next topic

Processaurus

Quote from: ElectricDruid on December 01, 2016, 03:49:32 PM
If you wanted an active solution, you can do this with one 8-pin dual op-amp:



Pots 10K, say, Rs all 100K.

The pot controls a mix of the blue signal and an inverted copy of the red signal. At the top of the pot, the red signal is cancelled by the inverted copy, so you get only blue signal. At the bottom, there's no cancellation, and no blue signal, so you get only red signal.

It's a clever trick I saw somewhere once, and I keep finding uses for it.

HTH,
Tom

Hi Tom, I breadboarded this blend circuit and ran into a worrisome problem: Input A didn't null out when the pot is all the way on the B side. I thought it was just because the gain wasn't matched perfectly between the positive and negative versions of the A signal, but even after trimming it in to max rejection, I would get this high frequency bleed on the transients. I tested it with a triangle wave for B and square wave for A, and got these sharp, big spikeys when the square wave would change polarity. I think the problem was a little phase shift between the two copies of A and them not nulling out. I would worry that with the phase shift + mix there's comb filtering to A as it gets blended away.

Have you used this for audio and had a chance to look at it on the scope? I could see it working fine for synth stuff with CV mixing. I used Lm358 opamp, can try something fancier if opamp choice is crucial?

Rob Strand

#21
QuoteI tested it with a triangle wave for B and square wave for A, and got these sharp, big spikeys when the square wave would change polarity. I think the problem was a little phase shift between the two copies of A and them not nulling out. I would worry that with the phase shift + mix there's comb filtering to A as it gets blended away.
Any phase shift drastically prevents cancellation.   You can get similar problems on circuits like U1 on their own.

Ideally you would put a delay equalization stage in the top part of the circuit which has the same phase-shift characteristics as the U1 stage.  That could be an opamp.

Another method is to add delay by putting a low-pass in the top wire between the input R and input A.  The inverting U1 input resistor needs to connect directly to Input A, before the filter.   This method needs some fiddling to get the gains and phase right.
 
An easy tack-on solution is to use a phase lead-newtork.


You need to make sure the feed impedance is low enough. 

Notice how the cancellation extends way up in frequency instead of getting progressively worse with frequency.    By the same token the cap needs to be chose to match the delay of the U1 stage.  I've given a formula but that assumes the GBW is exactly known.   I've set the cap for 1MHZ as the GBW for the opamps in the simulation is 1MHz.  Some circuits go so far as to use an adjustable cap for Cx!


Another form of fizz on the LM358 is crossover distortion.  That probably won't cancel.
You can try adding a pull down resistor for single supply ckts.

10k is shown here but people have used lower values depending on the circuit.
https://electronics.stackexchange.com/questions/341843/adding-a-resistor-to-reduce-crossover-distortion-in-an-lm324-lm358

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Processaurus

#22
Quote from: Rob Strand on January 17, 2022, 12:53:38 AM
QuoteI tested it with a triangle wave for B and square wave for A, and got these sharp, big spikeys when the square wave would change polarity. I think the problem was a little phase shift between the two copies of A and them not nulling out. I would worry that with the phase shift + mix there’s comb filtering to A as it gets blended away.
Any phase shift drastically prevents cancellation.   You can get similar problems on circuits like U1 on their own.

Ideally you would put a delay equalization stage in the top part of the circuit which has the same phase-shift characteristics as the U1 stage.  That could be an opamp.

Another method is to add delay by putting a low-pass in the top wire between the input R and input A.  The inverting U1 input resistor needs to connect directly to Input A, before the filter.   This method needs some fiddling to get the gains and phase right.
 
An easy tack-on solution is to use a phase lead-newtork.


You need to make sure the feed impedance is low enough. 

Notice how the cancellation extends way up in frequency instead of getting progressively worse with frequency.    By the same token the cap needs to be chose to match the delay of the U1 stage.  I've given a formula but that assumes the GBW is exactly known.   I've set the cap for 1MHZ as the GBW for the opamps in the simulation is 1MHz.  Some circuits go so far as to use an adjustable cap for Cx!


Another form of fizz on the LM358 is crossover distortion.  That probably won't cancel.
You can try adding a pull down resistor for single supply ckts.

10k is shown here but people have used lower values depending on the circuit.
https://electronics.stackexchange.com/questions/341843/adding-a-resistor-to-reduce-crossover-distortion-in-an-lm324-lm358

Thanks for the tips, I didn’t know about the crossover distortion in the 324/358 family. I was using it single supply so I’ll try the resistor to ground and see if that improves.  Good idea about copying phase shift on the split off signal A that goes to the second opamp, that makes sense. The cap stuff I’ll give a try, for production circuits a cap is cheaper than an opamp. I might trust the opamp more, because it is going through an identical circuit, but if the A signal nulls out completely it proves it is identical.

Edit: The simulation work is nice. What are the two lines on the graph, the blue and the green?

Rob Strand

#23
QuoteI might trust the opamp more, because it is going through an identical circuit, but if the A signal nulls out completely it proves it is identical.
Opamps have tolerances like resistors and caps they aren't as exactly equal as you might think.   However, opamps from the same package or batch would be expected to be close.

QuoteEdit: The simulation work is nice. What are the two lines on the graph, the blue and the green?

The simulation shows how much of signal A leaks through to the output when the  "pot" is set to the position where no signal A should come out.  The green is the circuit at it is now, at low frequencies the signal A leakage is low (-89dB) but as the frequency increases more of signal A leaks through (-35dB at 10kHz).  So you would expect to hear highs of signal A coming through a bit.   The reason it gets worse is the phase shift of opamp U1 gets more and more and the two signal A paths don't cancel.   The blue trace is when the phase lead network (Rx+Cx) is added to equalize the phase shift.   The improvement is clear (in theory) as there is very little  signal A leaking through, it stays below -90dB upto 20kHz or so.

This of course assumes the resistors have been tweaked to get good cancellation.  The thing is, even if you adjust the resistors for the best cancellation the unmodified circuit still "mysteriously" leaks some high frequencies through and that's because of phase shift  No matter what you do with the resistors they resistor never quite do it.   With the mod it fixes the underlying problem of the phase mismatch.

There's some really cool tricks people have come up with over the years to reduce opamp phase shift, like this one,

https://www.analog.com/media/cn/technical-documentation/application-notes/an-107.pdf

I think I saw the circuit used in some Hewlett-Packard equipment.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Vivek

Does a MN pot count as one pot,

And can it be used to do what you want ?

Processaurus

Quote from: Vivek on January 17, 2022, 07:19:33 AM
Does a MN pot count as one pot,

And can it be used to do what you want ?

Not here, but it is an interesting part. I had to look it up, it is a dual pot that does a full 1:1 blend in the middle:

QuoteM taper: 0% to 100% output voltage from 0% to 50% rotation (linear). 100% output voltage from 50% to 100% rotation.

N taper: 100% output voltage from 0% to 50% rotation. 100% to 0% output voltage from 50% to 100% rotation (linear).

Full output for both outputs at 50% rotation (center detent).

Processaurus

Quote from: Rob Strand on January 17, 2022, 05:32:52 AM
QuoteI might trust the opamp more, because it is going through an identical circuit, but if the A signal nulls out completely it proves it is identical.
Opamps have tolerances like resistors and caps they aren't as exactly equal as you might think.   However, opamps from the same package or batch would be expected to be close.

QuoteEdit: The simulation work is nice. What are the two lines on the graph, the blue and the green?

The simulation shows how much of signal A leaks through to the output when the  "pot" is set to the position where no signal A should come out.  The green is the circuit at it is now, at low frequencies the signal A leakage is low (-89dB) but as the frequency increases more of signal A leaks through (-35dB at 10kHz).  So you would expect to hear highs of signal A coming through a bit.   The reason it gets worse is the phase shift of opamp U1 gets more and more and the two signal A paths don't cancel.   The blue trace is when the phase lead network (Rx+Cx) is added to equalize the phase shift.   The improvement is clear (in theory) as there is very little  signal A leaking through, it stays below -90dB upto 20kHz or so.

This of course assumes the resistors have been tweaked to get good cancellation.  The thing is, even if you adjust the resistors for the best cancellation the unmodified circuit still "mysteriously" leaks some high frequencies through and that's because of phase shift  No matter what you do with the resistors they resistor never quite do it.   With the mod it fixes the underlying problem of the phase mismatch.

There's some really cool tricks people have come up with over the years to reduce opamp phase shift, like this one,

https://www.analog.com/media/cn/technical-documentation/application-notes/an-107.pdf

I think I saw the circuit used in some Hewlett-Packard equipment.



Thanks for the tips and simulation, I messed with the breadboard some more but no joy.  The phase lead RC combo had no benefit here, at least with my version with 100K R's and 10K pot.  I tried a few versions, 330 ohm + 33pF, 3.3K with 33pF, 330ohm with 330pF, 3.3K with 330pF.  No effect from the smaller capacitors, the larger capacitors just made it oscillate.  I also tried a non inverting opamp follower on the A side, but that didn't help duplicate the phase shift, maybe the phase shift is different using the inverting configuration.  Note, this was all single supply, 9v. I suppose I could have tried two inverting followers in a row, on the A side, but then we have a 4 opamp blend...

The one thing that sort of improved bleed was switching from LM358 to TL082, but it didn't solve the problem, just less phase shift.  Just as much bleed, but a little higher frequency.



I'm giving up on this circuit, because with 10 minutes of breadboarding I got the "dumb" circuit, the simple two opamp followers  feeding each end of a pot, to work beautifully.  Each side ate 1/2 voltage in the center. Interestingly with the LM358 there was some bleed in the form of a little ugly crossover distortion, from the square wave with the pot panned to the triangle side.  I was wondering if this might have something to do with the issue you mentioned, but a 10K load resistor to ground didn't help anything. This distortion doesn't happen with the TL082, it could sink the current from the other opamp through the 10K pot just fine.  I imagine going larger on the blend pot, like 50K, would make less current leak through the pot, so less current for the opposite opamp to fight to keep its output accurate.


Rob Strand

#27
QuoteThanks for the tips and simulation, I messed with the breadboard some more but no joy. 

QuoteThe phase lead RC combo had no benefit here, at least with my version with 100K R's and 10K pot.  I tried a few versions, 330 ohm + 33pF, 3.3K with 33pF, 330ohm with 330pF, 3.3K with 330pF.  No effect from the smaller capacitors, the larger capacitors just made it oscillate.  I also tried a non inverting opamp follower on the A side, but that didn't help duplicate the phase shift, maybe the phase shift is different using the inverting configuration.  Note, this was all single supply, 9v. I suppose I could have tried two inverting followers in a row, on the A side, but then we have a 4 opamp blend...

It's likely there's an even deeper issue causing it.

FYI:
Upfront, the square wave if quite aggressive and the signal has frequency components outside of the audio range.  So while you can see things getting through on the oscilloscope those frequency components won't be present with audio signals.  With any form of phase equalization it's likely the matching will only go up to some maximum frequency so even if every is working we woul still *expect* to see something getting through on the oscilloscope.  The way to test the phase matching part is working is to use a sinewave say at 10kHz then tune the cap to cancel at 10kHz.   If that works you know the idea is working and it is unrealistic to *expect* full cancellation with the square wave, especially at the edges.

There's a even bigger issue with square wave testing.   Slew-rate limiting.   The output of U1 is an inverted versions of signal A and is at full level.   It's extremely likely U1 will slew-rate will with a square-wave input.   When that happens it's almost like U1 has no output, and then there's no cancellation signal.   No matter what phase-compensation is in place you cannot fix this situation.   Testing at 10kHz [SINEWAVE], and at a level which doesn't cause slew limiting will also prove this.

I really think the issue in your case is slew-rate limiting because all the phase compensation methods did nothing.

So if every thing looks good with at 10kHz [SINEWAVE] but falls in a heap with a square-wave you know it's one of the above cases.  You might expect a very small improvement when you add the extra non-inverting opamp.

As for the oscillation issue.   Yes that can happen.  The 330 ohm resistor helps but you might need to add a cap across the 10k (or 100k) feedback resistor; 330R for 10k feedback is  equivalent 3k3 for 100k feedback resistor.   For 100k feedback resistors you would need very small caps like 3pF to 4pF for the compensation cap.     For the TL074/TL084 the cap is even smaller.  With such small caps the theory falls apart because there's stray capacitances everywhere and things do not work like the schematic.  From that perspective 10k resistors are better.

A faster opamp would be expected to have less problems but it's still possible to cause it to slew-limit with a wide-bandwidth square-wave input.   The same problem is there just on a different time scale.

QuoteI'm giving up on this circuit, because with 10 minutes of breadboarding I got the "dumb" circuit, the simple two opamp followers  feeding each end of a pot, to work beautifully.  Each side ate 1/2 voltage in the center. Interestingly with the LM358 there was some bleed in the form of a little ugly crossover distortion, from the square wave with the pot panned to the triangle side.  I was wondering if this might have something to do with the issue you mentioned, but a 10K load resistor to ground didn't help anything. This distortion doesn't happen with the TL082, it could sink the current from the other opamp through the 10K pot just fine.  I imagine going larger on the blend pot, like 50K, would make less current leak through the pot, so less current for the opposite opamp to fight to keep its output accurate.
Yes, those simple circuits (as jim and merlin posted) are much more robust.   When you set the pot to one side or the other selected signal path has to come out and the non-selected signal is blocked by a voltage divider.   It doesn't need *cancellation* of two signals - that's where the problems creep in because everything needs to match-up for cancellation to occur.   The thing ElectricDruid's circuit gives is a *grounded* single-ganged pot.

For crossover distortion you can try smaller resistors.   You can also try a resistor to +V instead of ground although I'm pretty sure the resistor to ground was a bit better.     You might still be seeing some slew-rate limiting as well, it will be worse on the LM358 for sure.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

PRR

#28
> Interestingly with the LM358

The LM358/LM324 is a terrible audio opamp. Only in pedal-world (where signals are small and loads are light) could you even stand to listen to one. I didn't know better but first time I put audio through a LM324 I knew in a minute that I had a Real Problem (concert that night).

Find the datasheet. The output is push-pull emitter followers. With zero bias. The VAS has to slew three Vbes to sing from push to pull. Actually in 9V-world loads 10K and higher will swing from the 50uA current source, but it runs out of juice real fast. NFB tries to make it cross-over quick but it is basically a not-fast process and prone to slewing through crossover for most of the audio band.

Using it as one side of a blend for triangles or squares is bringing-out the worst of the cheap chip's crossover and slew. Just don't do that. As I think you have said, a '072 is same-price and miles better.

  • SUPPORTER