# LTSpice, how to measure attenuation in dB?

#### hrs

Joined Jun 13, 2014
236
Hi,

I want to compare the attenuation of two transmission gate schemes using a CD4066 per attached schematic. Is there a way to show the attenuation in dB in LTSpice?

As an aside, is a CD4007 an equally good candidate for audio or is a CD4066 prefered here? Since the CD4007 also has an inverter this might be nice.

#### Attachments

• 1.5 KB Views: 0

#### crutschow

Joined Mar 14, 2008
25,119
Is there a way to show the attenuation in dB in LTSpice?
Use AC analysis with an AC source AC voltage of 1, which will give attenuation versus frequency in dB.
As an aside, is a CD4007 an equally good candidate for audio or is a CD4066 prefered here?
I think the CD4066 has a lower on-resistance so would be preferred on that basis.
Note that the audio signal peak levels must stay between ground and the Vdd supply voltage.
Since the CD4007 also has an inverter this might be nice.
You do know that's a digital signal inverter, not analog.

#### ronsimpson

Joined Oct 7, 2019
720
Your SPICE file for the CD4066 etc. might not be accurate for what you are doing.
1) Simple SPICE model for CD4066 is a simple switch on/off.
2) More accurate on resistance = 100 ohms, off resistance of 10meg ohms? (I don't remember actual numbers)
3) Actually the on resistance depends on supply voltage and signal voltage. see data sheet
4) There are small capacitors across the switch. Capacitors from the digital to analog parts of the switch. Capacitors from pins to ground and supply. At 100khz and above the capacitance is more important than the resistance.

The on resistance is not just one number but has a wide range. The open resistance (leakage) has a very wide range. The leakage is more complicated than resistance.

#### hrs

Joined Jun 13, 2014
236
Use AC analysis with an AC source AC voltage of 1, which will give attenuation versus frequency in dB.
Thanks, this works! This gives more reasonable numbers than what I calculated from 20*log(Vout/vin). With 89 dB vs 104 dB @ 10V I somehow expected a bigger difference.
You do know that's a digital signal inverter, not analog.
The scheme with one pass gate and one shunt gate requires two control signals opposite of each other. The inverter could be used to generate one or the other from a single incoming control signal.

Your SPICE file for the CD4066 etc. might not be accurate for what you are doing.
1) Simple SPICE model for CD4066 is a simple switch on/off.
The model I'm using comes from Bordodynov's collection. I'll have a look at the definition but I doubt it'll make much sense to me. That said, the attenuation with this model changes with different values for VDD, so I don't think it's just a switch.

Trying to plot for different supply voltages doesn't work with the following directives:
Code:
.step param V1 5 15 1
.meas Att1 param V(out1)/V(signal)
.meas Att2 param V(out2)/V(signal)
I think the sweep parameter needs to be between {} but LTSpice doesn't let me do that with either VDD or V1. Any ideas?

#### DarthVolta

Joined Jan 27, 2015
476
OP what circuit are you working on ? I'm working on my stereo and it has analog switches too. And in LTspice I've been just drawing sw's. I guess it doesn't matter for what I'm doing. But I did at 1 point have some IC on the schematic, but never ran a sim with it, just used it symbolically. I have to try some