EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: DavidAlfa on January 05, 2025, 08:17:01 pm

Title: Please check my audio mux- any good?
Post by: DavidAlfa on January 05, 2025, 08:17:01 pm
What do you think about the attached circuit? In my simulations it's doing great.

I'm fine with my current bluetooth mod, but hey I couldn't spend the entire Christmas eating and drinking!
So - with great effort - I made a CD emulator (https://github.com/deividAlfa/Alfa-166-CD-Changer-Unilink-Emulator), mainly for fun, but it might actually be a small niche market, perhabs I could sell few dozens.
There's very few options available, all >100€ (>170€ with old BT, no APTX).
I already have a working prototype full of wires and solder blobs, but with JLCPCB there, I'll probably build a board.

My intention is to use Bluetooth (Balanced output, 200mVpp total) and MP3 decoding (UDA1334A I2S DAC, 900mVpp, unbalanced).
They're currently working, but I have to hardwire it. So I came with this mux circuit.

I know these muxes are not lineal with small signals, but it'll probably work fine keeping it biased at least at 1.5Vdc?
The BT outputs 100mVpp, the DAC does 1.3Vpp.
Title: Re: Please check my audio mux- any good?
Post by: BrianHG on January 05, 2025, 09:38:16 pm
The negative feedback input of the op-amp is super sensitive.
I mean, insanely so.

Move R5 and R10 to inbetween the 4052 and the op-amp's inputs lowering the super gain sensitivity.
Change R11 and R6 to ~13.4k.

This way, when pin 13 of the 4052 feeds the - input pin 2 of the opamp, the gain on that wire will not be in the million range and any internal cross-talk inside the 4052 between switched off inputs (usually capacitively bridged cross-talk in nature) will not be amplified that million fold.

Note that your design is ok, my above recommendation just avoids directly feeding an op-amp's negative input directly with no series resistance at all.

ALSO, because of the way you have things wired, you will need a negative supply for the opamp's and the VEE on the 4052.  Otherwise, you will need to create a false GND everywhere, or create a 1/2 VDD bias voltage.
You are relying on the 1/2 vdd bias you created at pin 3 on the opamp, because of the way you wired your inputs and switches, you will get occasional 'POP' sound when switching inputs.
Title: Re: Please check my audio mux- any good?
Post by: Analog Kid on January 05, 2025, 09:52:32 pm
Dunno if this will help you or not, but I came up with this simple analog switch that seems to work quite well, in an IRL simulation:

[attachimg=1]

Might actually be more linear with small signals than your proposed scheme.
You'd have to work out the selection logic with some digital gates, but that shouldn't be too difficult.
Title: Re: Please check my audio mux- any good?
Post by: edavid on January 05, 2025, 11:11:53 pm
1. You should at least use a 74HC4052 mux.

2. You need DC bias on the mux inputs to avoid pops when switching (high value resistor to supply midpoint).

3. You would probably be better off connecting the single ended input to the inverting input of the op amp.

4. What do you think R11 and C7 are doing?  I think you should just connect the mux inputs to the supply midpoint.

5. What is the purpose of C8?

6. What is the purpose of R12?

7. The 10uF caps are shown as nonpolarized - if that means you are intending to use MLCCs, bad idea.

8. I think you are asking for trouble by using such a fast op amp, and it's really not needed.
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 05, 2025, 11:20:38 pm
Edit: this is old news too, new circuit in the following posts!

The negative feedback input of the op-amp is super sensitive.
I mean, insanely so.

Move R5 and R10 to inbetween the 4052 and the op-amp's inputs lowering the super gain sensitivity.
Change R11 and R6 to ~13.4k.

This way, when pin 13 of the 4052 feeds the - input pin 2 of the opamp, the gain on that wire will not be in the million range and any internal cross-talk inside the 4052 between switched off inputs (usually capacitively bridged cross-talk in nature) will not be amplified that million fold.

Note that your design is ok, my above recommendation just avoids directly feeding an op-amp's negative input directly with no series resistance at all.

ALSO, because of the way you have things wired, you will need a negative supply for the opamp's and the VEE on the 4052.  Otherwise, you will need to create a false GND everywhere, or create a 1/2 VDD bias voltage.
You are relying on the 1/2 vdd bias you created at pin 3 on the opamp, because of the way you wired your inputs and switches, you will get occasional 'POP' sound when switching inputs.

Thanks. It's been ages since I last designed anything analog. *sigh*

Did some reading: http://www.geofex.com/article_folders/cd4053/cd4053.htm (http://www.geofex.com/article_folders/cd4053/cd4053.htm)

Biasing everything seems to do the trick? I also simplifed few things out, lowering the gain and removing the resistors for the balanced inputs.
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 05, 2025, 11:28:26 pm
1. You should at least use a 74HC4052 mux.
I know. This is is just the rough concept.

2. You need DC bias on the mux inputs to avoid pops when switching (high value resistor to supply midpoint).
Yep I just read that a tad ago - see my previous post.

3. You would probably be better off connecting the single ended input to the inverting input of the op amp.
But it would invert the signal.

4. What do you think R11 and C7 are doing?  I think you should just connect the mux inputs to the supply midpoint.
Yep, my bad. Noticed that later on.

5. What is the purpose of C8?
To limit the bandwidth and prevent possible HF oscillations...

6. What is the purpose of R12?
To provide a small DC load. I'm not pro but I know unloaded op-amps can do weird things....
So I load it in DC and AC (Before and after C5).

7. The 10uF caps are shown as nonpolarized - if that means you are intending to use MLCCs, bad idea.
They're just generic capacitors for the simulation...

8. I think you are asking for trouble by using such a fast op amp, and it's really not needed.
I don't know what are the common ones for audio.
Definitely I don't want a prehistoric 741 nor the OP37, etc, it would be a lot of trouble at 5V as these can't swing completely to V+ or V-.
So I searched something Rail to Rail and low noise.
Again this is just the draft, I didn't look deeply after the parts yet.
Title: Re: Please check my audio mux- any good?
Post by: edavid on January 06, 2025, 12:15:46 am
2. You need DC bias on the mux inputs to avoid pops when switching (high value resistor to supply midpoint).
Yep I just read that a tad ago - see my previous post.
You don't need R29 and C7, just connect to REF.

Quote
3. You would probably be better off connecting the single ended input to the inverting input of the op amp.
But it would invert the signal.
Why does that matter?

Quote
5. What is the purpose of C8?
To limit the bandwidth and prevent possible HF oscillations...
It's too small to make any difference.  The real fix is to use a slower op amp.

Quote
6. What is the purpose of R12?
To provide a small DC load. I'm not pro but I know unloaded op-amps can do weird things....
So I load it in DC and AC (Before and after C5).
Not true, most op amps have the best performance when unloaded (LM324 can be the exception).

New problems:

1. You left out the resistor for the op amp inverting input

2. You don't need C17, R30, C18, R31
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 12:30:17 am
1. You left out the resistor for the op amp inverting input
Which one?
R11 maybe? That's there on purpose, the input signal is too large.

You don't need R29 and C7, just connect to REF
2. You don't need C17, R30, C18, R31
Thanks, now I see it, the inputs are all biased so there's no need to bias the outputs too.

And yeah, I know there isn't much difference but I prefer to keep the original polarity, it doesn't complicate the circuit anyway.
I'll remove the loads then!

About the BW, if you check audio op-amps from TI, lots have 10MHz+, so I don't think it'll be a problem.
I'm currently using a TSH114 I had lying around since ages ago, it's 100MHz yet the audio signal looks perfectly clean (And sounded well, too).
Title: Re: Please check my audio mux- any good?
Post by: Analog Kid on January 06, 2025, 12:30:55 am
Quote
3. You would probably be better off connecting the single ended input to the inverting input of the op amp.
But it would invert the signal.
Why does that matter?

Inverting audio signals isn't a good thing if you're trying to preserve existing phase relationships.
Title: Re: Please check my audio mux- any good?
Post by: edavid on January 06, 2025, 12:35:55 am
1. You left out the resistor for the op amp inverting input
Which one?
The one you need to avoid having infinite gain, as BrianHG explained  :-//

P.S. Do you actually get any benefit from using both outputs from the Bluetooth chip?
Title: Re: Please check my audio mux- any good?
Post by: edavid on January 06, 2025, 12:38:39 am
Inverting audio signals isn't a good thing if you're trying to preserve existing phase relationships.

Which is something that car audio system designers don't worry about, for good reason.
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 12:48:28 am
Neither they did for my car  :).
Did some testing, the head unit output starts dropping at 17KHz, then shows nyquist aliasing at 18.5KHz (Normal behavior for pure sinewaves and ADCs), but at 19KHz it already outputs 1/3rd of the normal amplitude and barely anything at 22KHz .

The input signal was stable, so it's the unit ...
Not happy about that, but it uses a DSP, so unless there's a filter at the input I won't be able to do much about that.
Title: Re: Please check my audio mux- any good?
Post by: BrianHG on January 06, 2025, 12:55:10 am
The negative feedback input of the op-amp is super sensitive.
I mean, insanely so.

Move R5 and R10 to inbetween the 4052 and the op-amp's inputs lowering the super gain sensitivity.
Change R11 and R6 to ~13.4k.

This way, when pin 13 of the 4052 feeds the - input pin 2 of the opamp, the gain on that wire will not be in the million range and any internal cross-talk inside the 4052 between switched off inputs (usually capacitively bridged cross-talk in nature) will not be amplified that million fold.

Note that your design is ok, my above recommendation just avoids directly feeding an op-amp's negative input directly with no series resistance at all.

ALSO, because of the way you have things wired, you will need a negative supply for the opamp's and the VEE on the 4052.  Otherwise, you will need to create a false GND everywhere, or create a 1/2 VDD bias voltage.
You are relying on the 1/2 vdd bias you created at pin 3 on the opamp, because of the way you wired your inputs and switches, you will get occasional 'POP' sound when switching inputs.

Thanks. It's been ages since I last designed anything analog. *sigh*

Did some reading: http://www.geofex.com/article_folders/cd4053/cd4053.htm (http://www.geofex.com/article_folders/cd4053/cd4053.htm)

Biasing everything seems to do the trick? I also simplifed few things out, lowering the gain and removing the resistors for the balanced inputs.

In this new circuit, R1, R2, C17, C18 are not needed.  R30 and R31 are only needed if you use the 'disable' for the 4052, or, you select switch positions #2 and #3 for the 4052.

Without a series resistor in the place of C17, the negative input of the opamp will be shorted to your virtual ground, or R_IN1_N when selected.  This will generate maximum infinite gain on the opamp.

Again, looking at your original schematic, I would place a 3.6k resistor in place of C17 and C18 to match your original circuit.

As others mentioned, not sure of the purpose of R12.  You are pulling down the output of the opamp directly, ever so slightly lowering it's maximum V high output level.
 
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 01:04:42 am
Yes, I might use the remaining positions to mute the output...
Why restore the resistors?

I simply reduced the gain, while increasing the amp input signal, less noise, all good?
Title: Re: Please check my audio mux- any good?
Post by: BrianHG on January 06, 2025, 01:17:16 am
You have a 100k feedback from the opamps output to the negative feedback input.
In your circuit, you short the negative feedback to GND through a 1uf cap.

Think of the 1uf cap as a 0 ohm resistor at high frequencies, like those above 100hz.

Now, apply the opamp's gain calculation where the output has a 100k to the negative input and the negative input has a 0k to GND.  What is the gain of said circuit?

Remember, if you had a 100k feedback resistor from opamp output to - input and another 10k resistor from the - input to GND, your circuit gain would be 10x the input signal at the + input.  If the other resistor was 100k, then the gain would be 2x the input signal at the + input.

But your circuit has a 0k resistor from - input to GND.
Now, what would be the gain in your circuit with that short to GND?
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 01:24:50 am
P.S. Do you actually get any benefit from using both outputs from the Bluetooth chip?
They're different inputs, one is BT, the other is a DAC from the mp3 decoder :)
I don't even know which BT module I will use yet!

Brian, yep, I noticed I messed everything up. Fixed! (Hopefully)

Edit: All this time I was having weird issues confusing me (Mostly Gv not following the resistor ratios).
I was my fault for choosing cmos logic for the test, the simulator was fully recreating the high Rds when powering the 4052 with only 5V!
Switched to a 74HC4052 and everything worked as it should!
The 74VHC4052AFT (https://docs.rs-online.com/21bc/0900766b816231c5.pdf) (Toshiba) is dirty cheap (8 cents in low volume!) and has much lower RDS than other 4052s, 24-37 ohms.

I modified the single ended input, having 1.3Vpp I felt uncomfortable lowering the bias that much (Maybe meaningless), so I divided it, 0.7Vpp should be safe.
I can always adjust the gain or change/remove the input divider.
Since the inputs might be biased, better to not load the DC part, right? So I added a dc-blocking cap and placed the resistor.

Initially I thought on changing R2 to 10K, but that would cause some cross-talk in the bias network.

Instead of flooding the thread with pictures, I'll be deleting old ones, also updating the first post for newcomers.
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 12:09:26 pm
Hmm I might have overlooked something... The bluetooth module can also output to i2s...
So I could simply switch the digital signals and use a fixed op-amp!
Title: Re: Please check my audio mux- any good?
Post by: Terry Bites on January 06, 2025, 02:29:25 pm
Input_1 only needs dc blocking and biasing once. Why two caps?
R4,C3 seem so have no function. Nor do R11,C10.
L1 is adding inductance that you dont need.
A local voltage regulator and maybe a ferrite is a more effective way to clean the supply.
Focus on keeping the blutooth RF out of the input side. Use small common mode chokes.

and the other stuff pointed out by others.

Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 03:23:51 pm
Input_1 only needs dc blocking and biasing once. Why two caps?
To reduce the ac component only, without pulling from input nor the amp bias, see below.
I wasn't sure if the high level input was dc biased, so assume it will.

R4,C3 seem so have no function. Nor do R11,C10.
Since Input 1 is single-ended, R4 and C3 adjust the gain for IN-, otherwise it becomes a voltage follower.
R11 and C10 are used to filter any DC bias at the input before the resistor divider, see above.

L1 is adding inductance that you dont need.
Maybe.... But I don't think it'll cause issues with those caps, it's a very low power circuit so large current trasients.

A local voltage regulator and maybe a ferrite is a more effective way to clean the supply.
Focus on keeping the blutooth RF out of the input side. Use small common mode chokes.
I changed my mind and I'll scrap the BT output, it's a bit noisy anyways, I'll use I2S instead.
Title: Re: Please check my audio mux- any good?
Post by: DavidAlfa on January 06, 2025, 03:32:35 pm
So the next idea is to switch I2S signals on the fly - forget the audio mux.
Sorry for the headache, at least I learned a bit and refreshed the ideas :).

The DAC can be placed away for the BT module and shielded as required.
I'll use the PCM5102A in the end, it's better in everything, SNR, dynamic range, etc... And has a mute input!

I think I'll feed the amp directly through the 1MHz step down converter, the choke should easily remove the noise.
In any case 1MHz will hardly affect the audio? Will get filtered along the chain.
Or better to run a linear reg from the car's 12V? The power will be very small so there won't be any heating issues.