Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

CMRR in LT Spice

Status
Not open for further replies.

MrAl

Well-Known Member
Most Helpful Member
Hello there,

Anyone try this yet in LT Spice?

The problem is we have an AC input (like 1vac or something) and that feeds an amplifier which gives us an output voltage, and we want to sweep the frequency and calculate the CMRR (common mode rejection ratio) vs frequency.

Thanks :)
 
That should be easy - just by strapping the two inputs together and plotting the output (with a .ac).
It all depends, through, upon how accurately the manufacturer has modeled their components. I'm pretty sure that modeling methodologies vary quite considerably between manufacturers, but they normally don't give much info on what behaviours are modeled.
Just try some models and see what happens!
 
Assuming you have a amp with two inputs. (differential inputs)

I think most spice amp models are not built good enough to give useable results.

Tie both inputs together and feed a signal in. At high frequencies the signal will pass through. At low frequencies the signal should not be at the output.

It will be interesting to see if the spice results is the same as the graph in the data sheet.
 
Hmm. But there is a big variation between data sheets as well.
 

Attachments

  • 358ds.png
    358ds.png
    36.1 KB · Views: 993
  • 358.png
    358.png
    103.8 KB · Views: 1,108
If you tie the two inputs together the input offset voltage can cause the amp to saturate which would give a wrong CMRR, thus you need to be certain that the amp isn't saturated before doing the test. Looks like that's the purpose of the first circuit that ronv posted.
 
Hi,

Thanks for the replies, but let me clarify the question.

We have a special design two input amplifier that is a differential amp. It can tolerate two inputs being the same without causing a problem with the DC offset, so we are not worried about the DC offset.

The whole question is about setting it up in LT Spice because we need to divide the input by the output, but it'is really an AC signal so it gets a little strange. When we divide a DC signal by another DC signal it's not a problem, but dividing an AC signal by another AC signal gets a little strange because we cant really do that for a couple reasons. One is that the wave goes through zero, which means eventually we get the conditions of x/0 which will either generate an overflow or a very high value, even though it might be correct everywhere else. Second and even more important, the waves may not be exactly in phase due to some phase shift in the amplifier. That would mean all the results would be off by some factor related to the phase shift. Can we compensate for this with a scaling factor? Maybe, but i was thinking maybe someone already came up with a better idea.

Another idea for example is to take the absolute value of both waves, then average the result, then do the division. But that's in the time domain and im not sure that's the best way to do it either. Maybe in AC analysis? This is why i was asking about this because i thought there might be someone here who already has "been there" and "done that".

So it's not about setting up the circuit itself, we just apply the same signal to both inputs and measure the output, but we need to be able to graph the CMRR vs frequency.

And yes there may be a restriction in the models that prevent finding any practical results, but i was guessing we would find that out once we had a reasonable setup figured out.
 
So is the problem with spice or real life?
It seams the problem is "divide by 0". I don't understand why you want to divide. "divide two signals"
Can you send a schematic.
Do you want a graph of CM signal verses frequency? (for the real amp)
 
I think this does what you want, using the circuit that ronv posted.
Do an AC analysis with the input source's Small Signal AC Analysis Amplitude set to 1V, then plot the output voltage v(out), then right-click the plot title and change the plot function to '1/v(out)'.
For any other input Amplitude value a, change the plot function to a/v(out) instead.
CMRR sim.gif
 

Attachments

  • CMRRtest.asc
    1.6 KB · Views: 521
Using Alec_t's circuit. The resistors need to be the same value. Change any one resistor by 5% and see what happens. There will not be any -80db. You are testing the resistors more than the amplifier.

The fist one of these I built, three decades ago, I used .1% resistors.
 
Hi again,

ron:
Yes the measurement will be more what the resistors are than anything else, that's probably more important than what the op amps are doing i bet. In fact, this will probably be a better test for getting all the resistors to be the same value than for real life CMRR :)

alec:
Well, that would work and that's a good idea, but the factor 'a' changes also with frequency (gain being frequency dependent), so what it looks like we might end up doing is creating TWO identical circuits, one with one set of inputs both set to 1v each, and the second circuit with one input set to say 1v and the other to say 0v, so the first circuit will provide us with the common mode gain while the second circuit will provide us with the differential gain, and then we can do the division:
v(VoutD)/v(VoutCM)
where VoutD is the differential output and VoutCM is the common mode output.
Of course any mods in one circuit will have to be modded in the other circuit too when it comes to testing.

Amazingly, this is going to take something like 10 op amps and 8 current mirrors :)
We're talking about this in the other thread about the potentiometer, but then the question came up as to how to test for CMRR.
I suspect this wont related perfectly to real life anyway though, unfortunately.
 
but the factor 'a' changes also with frequency
Not in the sim I posted. a is the input AC voltage amplitude, which is a given. So the plot of a/v(out) is in fact a plot of v(in)/v(out), i.e. the CM gain reciprocal (which as I understand it is the CMRR). LTspice has done all the necessary division and dB calculation arithmetic :).
 
[With regard to 'a' changing with frequency]
Not in the sim I posted. a is the input AC voltage amplitude, which is a given. So the plot of a/v(out) is in fact a plot of v(in)/v(out), i.e. the CM gain reciprocal (which as I understand it is the CMRR). LTspice has done all the necessary division and dB calculation arithmetic :).

Hi alec,

Oh i have not doubt that 'a' does not change in your simulation, it's clear that it is a defined source with constant AC amplitude. But in the calculation of CMRR we not only need to calculate the common mode gain, we also need to calculate the differential gain, and then perform the division:
DiffGain/CMGain

and DiffGain is not a constant factor over frequency but usually gets lower with increasing frequency as i am sure you know. So in effect we have:
VdiffGain(f)/CMGain(f)

showing more clearly this dependency on the frequency f.

So point 1 is that CMRR is not the input voltage divided by the common mode voltage it is the differential gain divided by the common mode gain. It is the ratio of two GAIN's.

Point 2 is that the differential gain is not equal to the input voltage times any constant factor, unless the gain is perfectly constant over all frequency and that's not very typical at all.

For example, the VcmGain (common mode gain) goes UP with frequency, while the differential gain VdiffGain goes DOWN with frequency.

For the circuit in question, the differential gain doesnt change THAT much with frequency so your estimate of a/CMGain is reasonable at least to some degree. For this circuit the gain is about 10 at f=10Hz and is about 6 at f=100kHz, so to see the two extremes we could do just two such 'a':
a/CMGain=10/CMGain
and
a/CMGain=6/CMGain

and that may be good enough, so your good idea still has merit i believe.

What we intended to do is plot the CMRR over the frequency of interest, but the only way to do that is to have a function that actually calculates differential gain over frequency, but it may also be replaceable with a curve fitted function for example. I thought the easiest way would be just to recreate the entire circuit again but change the input excitation such that we could measure diff gain as well as CM gain, then just divide.

When i first stated this i had no idea how to do this, but now it is becoming more clear. I havent had to worry about this too much in the past.
 
CMRR is not the input voltage divided by the common mode voltage it is the differential gain divided by the common mode gain.
Oops. You're quite right. I mis-remembered the cmrr definition :oops:.
I thought the easiest way would be just to recreate the entire circuit again but change the input excitation such that we could measure diff gain as well as CM gain, then just divide.
Seems a good approach. Since the AC analysis plots are already in dB, can we take advantage of that to reduce the gain division to a dB subtraction? I'll have a play with LTS .....
 
Oops. You're quite right. I mis-remembered the cmrr definition :oops:.
Seems a good approach. Since the AC analysis plots are already in dB, can we take advantage of that to reduce the gain division to a dB subtraction? I'll have a play with LTS .....

Hi alec,

No problem, it's been so long since i did this kind of thing i had to look EVERYTHING up again ha ha.
Yes we'll have to look at the db subtraction too, when LT Spice internally converts to db.
I wouldnt mind getting a regular voltage output in volts once in a while too for some tests, instead of db. Perhaps you can find out how to do that also. I usually work with transient analysis so much of this is unfamiliar ground for me.
 
Right. Think I've cracked the CMRR plotting. It's just a matter of plotting V(df)/V(cm):
CMRRplot.gif

Edit:
To change the Y-axis units: right-click on the axis, select Manual Limits, select units in the pop-up box.
 

Attachments

  • CMRRtest2.asc
    2.4 KB · Views: 355
Last edited:
Hi alec,

Yes, that works i think. The circuit we have is much larger so it's harder to create a second circuit, but what the heck it's just spice :)
 
The circuit we have is much larger so it's harder to create a second circuit
Nah. Zoom out. Press F6. Click and drag a box round circuit 1. Paste as circuit 2. Bob's your uncle :).
 
Assuming you have a schematic displayed in LTS, to copy all/part:
1) click 'View'
2) click 'Zoom back'
3) press F6
4) left-click and drag a marquee around a screen area you wish to copy
5) move the marquee to a blank screen area
6) left-click to paste into that area
7) 'Bob's your uncle' = UK expression meaning 'job's done'.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top