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.

Why Opamp with potentiometer?

Status
Not open for further replies.
Hi,

Oh you meant the LM358? Yes that has no null inputs. We could look at ways around this i guess. Is that really a great concern right now?

The spike you were seeing is apparently due to the start up time of the LM358, at least for the model.
When op amps go out of the linear mode they sometimes take a little time to get back into the linear mode, longer than usual, because of the slew rate and any internal capacitance. During startup this shows up mostly in the first op amp, which takes time to reach normal linear mode operation as it's output starts to deliver current to the 10k resistor.
 
In this circuit If I have Dc offset voltage at the very last output, does this offset affect the gain of circuit? I mean, when I apply Vsin with amplitude of 1v to the first op amp of lower section I get sin waveform with peak of for example 10v at the final output. If this circuit has DC offset voltage for example 0.1mv. IN this case voltage output (sin waveform) that normally starts from 0v, starts from 0.1mv because of of offset voltage or not? simply put, Small or large DC offset voltage do shift the gain or not?
 
Last edited:
Hi,

Generally a small DC offset does not hurt anything. The time when it really matters is with very high gain with DC coupling, when the small offset gets amplified. It also might be objectionable in a measurement system using an ADC for example.
 
I don't know when it comes to voltage amplifiers, Is there a limit for their gain or is there a voltage amplifier that has gain of 200? You mentioned at previous post if I have a very high gain the offset gets amplified I just want to know what do you mean by " very high gain"?

By the way I checked the upper section. I had a small DC offset. it's time to assemble the whole circuit. Before measuring the entire circuit's gain Is it necessary to see the DC offset value at the very last output? one more thing how can I plot the entire's circuit CMRR vs frequency in LTspice?
 
Last edited:
Hello,

Very high really just means if the output offset is objectionable to the application then you have to do something about it, if not then you dont have to change or adjust anything. If you have an input offset of 3mv and gain of 100 then the output offset will be 0.3v. If that is objectionable then you have to fix it. Some apps will not like that while others may not care.

Not sure what you mean by 'necessary' to see the DC offset at the output.

To measure the CMRR you input the same signal to both channels and measure the output, then compare input to output.
 
Not sure what you mean by 'necessary' to see the DC offset at the output.

I assembled the upper current mirror and buffer plus the output stage. I didn't have the lower current mirror and buffer. then I measured DC offset at the very last output which was small and there was no need to change it. I am going to assemble the whole circuit and I don't know this time should I check the DC offset to see is small or large again. I did it once when I had only the upper section. In other words Is it possible the lower section (I mean the op amp with current mirror and the buffer are added) to affect the previous measured DC offset and change it too much?


To measure the CMRR you input the same signal to both channels and measure the output, then compare input to output.

I know what I have to do for measuring CMRR. but for plotting CMRR vs frequency in LTspice what should I do? Something that I comes to my mind is inputting the same signal to both channels, setting AC analysis In ltspice and measuring the voltage of last output. After running the .asc file the vertical axis shows the voltage of output and the horizental axis shows the frequency. Is this CMRR vs frequency? AS far as I know CMRR equals to Ad/Acm but I don't know how can I show this thing in LTspice.
 
Last edited:
Hello again,

Did you get it to sweep the frequency in LT Spice? If so, post the asc file and i'll take a look.
There should be a way to enter a formula that operates on the outputs.
I dont use LT Spice as much as others here so maybe you can ask this in a separate thread.
 
Hi again,

How did you get the frequency to sweep?
Maybe use a VCO?

I remembered how to set up math for the waveforms.
First do an analysis, then at the top of the waveform window you see something like "V(n018)" which would mean to plot the voltage of node 018. Well, just right click on that "V(no18)" text and it brings up the "Expression Editor" in which you can add any function you want.
For example you can enter something like this:
V(n014)/V(n018)
This would be one of the inputs (they are both the same anyway) divided by the output, in real transient time.

Because these are sine waves we might have to take the absolute value and then the average before dividing.
You also have to use 20*log(x) too in order to get it into db.

So it might be something like this:
avg(abs(V(n014)))/avg(abs(V(n018)))

to start with, however i find that the function "avg" is not available in LT Spice.
One way around this would be to rectify the input and output and average it with a low pass filter, then do the division.
 
Last edited:
I'm so sorry. this file is for AC sweep. I get negative value as CMRR. why?! As far as I know CMRR should be positive.
 

Attachments

  • Draft3.asc
    5.6 KB · Views: 135
Hi,

What are you using for the math on the waveforms?
That does not show up in the .asc file.

I tired using abs()/abs() but the waveforms have to be the same phase for that so we can read the peak as the value to start with.
That's why i wanted to take the average, but it looks like LT Spice does not have an 'average' function, it only allows you to take the average after the wave already appears on screen.
 
I changed the input voltage sources to AC with the same phase and amplitude. and then did the AC Analysis and sweep the frequency. but I'm not sure this way is right.
 
Last edited:
It is so strange that I get a negative CMRR. that's why I think something is wrong maybe in circuit or in analysis.
 
Last edited:
Hi,

Well i need to see how you are calculating the CMRR so i can see what is wrong. That's why i asked.

I did find a way to get the average of the sine wave in trans analysis, if it turns out we need that.
The idea is to use an arbitrary functional voltage source with the function "V=abs(V(n018))" (or whatever node), then use a 10k resistor and 0.1uf cap on the output to achieve the "avg" function. The result is the average value of the sine wave although it takes time to compute because we have to wait for several cycles to pass in order to get the average over all time.
 
Well i need to see how you are calculating the CMRR so i can see what is wrong. That's why i asked.


I tried using abs(V(n018))/abs(V(n008))-abs(V(n010)) in AC analysis and got 0 udB. But this is not still the CMRR. it's common mode gain vs frequency.
CMRR is Ad/Acm. I don't know doing CMRR against frequency is possible in simulator or not.
 
Last edited:
Hi,

Yes this is a little harder than most problems, but didnt you read my previous post where i talked about using the arbitrary voltage function source to do the abs() function, then use a resistor and capacitor to average? That's for transient though.

If you are doing AC then you may be able to use the "magnitude" functon which is in there some place. I can guess that you would take the magnitude of input and output and compare, but im not 100 percent sure because i never had to do that. See if you can find the magnitude function in the Help section. It might work.

I think the avg(abs()) idea would work too, but you'd have to sweep slowly so that the resistor and capacitor averaging network has time to stabilize. Maybe even a second order passive low pass, which would stabilize faster given the same smoothing.

How bad do you need to do the CMRR test?
 
Yes this is a little harder than most problems, but didnt you read my previous post where i talked about using the arbitrary voltage function source to do the abs() function, then use a resistor and capacitor to average? That's for transient though.

Yes, I read it but it was for transient Analysis. I need frequency sweep.

If you are doing AC then you may be able to use the "magnitude" functon which is in there some place. I can guess that you would take the magnitude of input and output and compare, but im not 100 percent sure because i never had to do that. See if you can find the magnitude function in the Help section. It might work.

I don't know why this simulator can't get the difference of inputs in AC analysis. when I had the two same Ac sources by measuring V(n018) the result was completely wrong. After I changed V(n018) which is the output to abs(V(n018))/abs(V(n008))-abs(V(n010)) or Vout/Vin2-Vin1 (assuming Vin1 and Vin2 are the input voltages of each channel) the result got close to what I expected. I didnt also find magnitude function.


This circuit is a differential amplifier. I must check CMRR and differential gain to see how it works.
 
Last edited:
Hello again,

Ok, i am looking into this more now. I also started a new thread asking if anyone has done this before.
There's also the possibility that the models do not model the IC well enough to actually calculate this. If there are differences in the buffers in real life for example how would we model this? In the sim they are both perfectly equal and the same. So i have a feeling we might see zero output when the inputs are exactly the same. It depends mostly on that last stage, if it is modeled to show CMRR, and then it's going to be whatever it is modeled for so it probably does not need measuring. In other words, this is something you probably have to do on a real life breadboard anyway. using real life op amps, and maybe even swapping them out for other physical packages of the same part number.


You seem to be rejecting transient analysis. I was suggesting that we sweep the frequency using a VCO and a ramp. That way we get the input frequency to change while we make the measurements. I will look into AC analysis more though.

Another thing that wont show up well in the simulation is the CMRR deterioration due to mismatch of resistors. If the output stage resistors are not matched to better than 0.1 percent there will be significant reduction of CMRR, and likewise for any resistor pair that sets any gain, such as the two current mirror pair output resistors. This happens because if the gain of either channel is different, than it's not a true differential amp anymore, and even a tiny difference can make a big difference in the CMRR because the theoretical CMRR is typically very low to begin with so it's easy to mess it up with unmatched resistors.
In fact, you might be better off investigating the deterioration in CMRR due to mismatch of different resistors than to just try to measure CMRR with perfectly matched resistors, because perfectly matched resistors will have to be hand selected through a special test, and im not sure you can get them matched better than some error like 0.01 percent or something like that (although it may be possible).
 
Last edited:
Hello again,

I just did a quick test.

What i did was attached a node label "A1" to one of the input voltage sources, then attached a node label "A2" to the very output. Then did a sim run, then clicked on A2 for the output graph display, then clicked on the text for that display, then entered:
V(A2)/V(A1)

as the function. This seems to give me the CM gain in db, and was quite low at 10Hz and got higher at 100kHz. Then i changed the value of one of the resistors on the output of ONE of the current mirror pairs by 10 percent, and the CM gain went up as expected. So this might be the simplest way to get the CM gain at least.

As from above you can see that it turns out that using the notation "V(node)" in AC analysis actually is the magnitude of course so we dont have to explicitly state 'magnitude' anywhere.

The differential gain starts out at around 20db at 10Hz and goes down to around 16db at 100kHz, so to get CMRR we'd have to manually divide.
Alternately, set up two exactly the same circuits like the one we have now, and use one for the differential gain and one for the CM gain, then divide in the waveform function setup V(v1)/V(v2). This would be possible but you'd have to copy the ENTIRE circuit with ALL elements to do this, then set one circuit to have inputs 1v and 1v, and the other to have 1v and 0v for example, then divide the outputs. That would provide a graph of CMRR vs frequency right in the simulator.
Sounds like fun huh? :)
 
Last edited:
What i did was attached a node label "A1" to one of the input voltage sources, then attached a node label "A2" to the very output. Then did a sim run, then clicked on A2 for the output graph display, then clicked on the text for that display, then entered:
V(A2)/V(A1)

as the function. This seems to give me the CM gain in db, and was quite low at 10Hz and got higher at 100kHz. Then i changed the value of one of the resistors on the output of ONE of the current mirror pairs by 10 percent, and the CM gain went up as expected. So this might be the simplest way to get the CM gain at least.

first of all let's clarify something for me. we have 2 inputs and apply same AC voltage sourses to them. You lable one of them as A1 what is the lable of the other one? we can't have 2 voltage sources with the same node lable in LTspice. I did attach a node lable A2 to the last output but when the simulation was done in graph display I had Va2 not VA2 while I put a node lable named A2 at the very output.

By the way I did this test with the lable "a2" at the output and "a1" at the one of input. the other input had no node lable. I got the wrong result as I did before. it seems that I didn't understand what you said clearly because my result is different from yours.

The differential gain starts out at around 20db at 10Hz and goes down to around 16db at 100kHz, so to get CMRR we'd have to manually divide.
Alternately, set up two exactly the same circuits like the one we have now, and use one for the differential gain and one for the CM gain, then divide in the waveform function setup V(v1)/V(v2). This would be possible but you'd have to copy the ENTIRE circuit with ALL elements to do this, then set one circuit to have inputs 1v and 1v, and the other to have 1v and 0v for example, then divide the outputs. That would provide a graph of CMRR vs frequency right in the simulator.
Sounds like fun huh? :)

It seems interesting :) but I didnt do this. first I have to solve my problem with lables. you meant I place 2 circuits in one schematic?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top