Practical Integrator / LT-Spice

Thread Starter

Sparky

Joined Aug 1, 2005
75
Greetings,

I’ve playing with integrators and differentiators in LT-Spice.

I first went to my old electronics text book (Sedra and Smith) and placed an op-amp down with a capacitor in the feedback path and had my RC combination = 1.
(R = 100k and C= 10u / R = 10k and C = 100u)

I sent in a 1v peak-to-peak sin wave (quick and simple).
“On paper I should get a 1v peak-to-peak” cosine wave out”

With the combination R = 100k and C = 10u:
Well, I get a sinusoidal wave out but in the micro-volt range. (+120uv to -240uv)

It was recommended to put a large resistor in the feedback path. The result had a sinusoidal wave but again in the 200’ish micro-volt range peak-to-peak.

With the combination R = 10k and C = 10u and w/o the large R in feedback:

Well, I get a sinusoidal wave at essentially the positive rail – centered around 13.98v a couple micro-volts peak-to-peak.

Inserting the large resistor in the feedback path. The result had a sinusoidal wave centered around 24.3mv but again in the 200’ish micro-volt range peak-to-peak.

Next,
I tried simulating a differentiator. R = 10k and C = 10u.

Again, driving a sine wave in 1v peak-to-peak, I get a signal hammering rail-to-rail (looks like a square wave)

I found the recommendation for a “practical differentiator” to place a capacitor in the feedback path. After placing this capacitor in the feedback path it worked, I get a 1v peak-to-peak sinusoidal out. (I assume cosine.)

So I get a practical differentiator to work.

Any suggestions for the integrator?
Schematic is attached.

Thanks
Sparky
 

Attachments

Ron H

Joined Apr 14, 2005
7,063
Ignoring the 10Meg feedback resistor, Vout=-Vin*(Zf/Zs),
where Zf=1/(jωC), Zs=source resistor (100k).

Vout=-Vin/(jωRC)=-Vin/(j2πfRC)
When f=1kHz, RC=1,
|Vout|=Vin*1.59e-4
When Vin=1, |Vout|=159uV
 

Thread Starter

Sparky

Joined Aug 1, 2005
75
I see you are using the gain equation – seems obvious and since I selected a sinusoidal wave, the impedance equations apply and the gain equation falls into place.

I have now created a piece-wise linear input where V = time. I ran the simulation for 2 seconds and my output is (Vin)^2 divided by 2. I spot checked a few points and the simulation was spot on (Vin)^2 divided by 2.

So – the integral operation works.

The textbooks state that with a capacitor in the feedback loop the output is 1/(RC) * the integral of Vin.

Can you explain further the correlation between these 2 examples – I see that when I select and sine wave, the frequency determines the impedance of the capacitor and the gain equation applies.

Alos why does my differentiator (again in LT-Spice – I’ve not built anything) work? Meaning, it returns a 1v peak-to-peak sinusoidal. Shouldn’t the gain equation apply the the differentiator also?

Can I integrate Vin = sin and get Vout = cos 1v peak-to-peak?

Thanks again
Sparky
 

Ron H

Joined Apr 14, 2005
7,063
I see you are using the gain equation – seems obvious and since I selected a sinusoidal wave, the impedance equations apply and the gain equation falls into place.

I have now created a piece-wise linear input where V = time. I ran the simulation for 2 seconds and my output is (Vin)^2 divided by 2. I spot checked a few points and the simulation was spot on (Vin)^2 divided by 2.

So – the integral operation works.

The textbooks state that with a capacitor in the feedback loop the output is 1/(RC) * the integral of Vin.

Can you explain further the correlation between these 2 examples – I see that when I select and sine wave, the frequency determines the impedance of the capacitor and the gain equation applies.
My CRC handbook says
∫sin(x/a)dx=-a*cos(x/a).
Therefore,
∫sin(ωt)dt=(1/ω)cos(ωt)
if ω=2π*1kHz, ∫sin(ωt)dt=1.59e-4*cos(ωt), which is the same answer we got with the gain equation (with RC=1).

Alos why does my differentiator (again in LT-Spice – I’ve not built anything) work? Meaning, it returns a 1v peak-to-peak sinusoidal. Shouldn’t the gain equation apply the the differentiator also?
Vout=-RC*d(Vin)/dt and d(sin(ωt))=ω*cos(ωt)
This means that, with RC=0.1 and Vin=1, Vout=628V, which is why you got the rail-to-rail square wave. You must have put an equal-valued cap parallel with the feedback resistor in order to get 1V out. This is not a differentiator.
A better differentiator adds a resistor in series with the cap, and nothing in parallel with the resistor. Make the resistor≈Rf/10, where Rf is your feedback resistor. In practical circuits, this will prevent possible oscillation problems, and also limit the gain of high-frequency components of your input signal.
Can I integrate Vin = sin and get Vout = cos 1v peak-to-peak?

Thanks again
Sparky
Sure. You just have to scale RC to get unity gain. The same goes for the differentiator. If you can't figure out the values, let us know.
 

Thread Starter

Sparky

Joined Aug 1, 2005
75
Ron H, thanks so much!

makes sense now, I was looking over the frequency coefficient term "ω".

In my head, I was saying "from calculus I remember the integral of sin is -cos." So I picked as a quick input source a sine wave and wasn't going deep enough with the actual math.

I should have written out the math, maybe I would have seen it, maybe not - forest for the trees.

Thanks again
-Sparky
 

Ron H

Joined Apr 14, 2005
7,063
Ron H, thanks so much!

makes sense now, I was looking over the frequency coefficient term "ω".

In my head, I was saying "from calculus I remember the integral of sin is -cos." So I picked as a quick input source a sine wave and wasn't going deep enough with the actual math.

I should have written out the math, maybe I would have seen it, maybe not - forest for the trees.

Thanks again
-Sparky
It was a good refresher for me, too.:D
 

Thread Starter

Sparky

Joined Aug 1, 2005
75
Ron H and others,

Now playing with a differentiator …

I’ve confirmed this differentiates Vin = (time) to Vout = -1v.

When I apply Vin = 0.000159 sin(ωt) (@1kHz). I do not get a 1v peak-to-peak. I get 120’ish mV peak-to-peak.

When I apply the gain equation – (Zf/Zin) = 10k/(1/2πfC) = (10k)/(1.592) = 6283,
Vout = -6283*0.000159*cos(ωt) = cos(ωt).

This is in LT-Spice.

Thoughts?

Thanks for your help.
Sparky
 

Attachments

Ron H

Joined Apr 14, 2005
7,063
Ron H and others,

Now playing with a differentiator …

I’ve confirmed this differentiates Vin = (time) to Vout = -1v.

When I apply Vin = 0.000159 sin(ωt) (@1kHz). I do not get a 1v peak-to-peak. I get 120’ish mV peak-to-peak.

When I apply the gain equation – (Zf/Zin) = 10k/(1/2πfC) = (10k)/(1.592) = 6283,
Vout = -6283*0.000159*cos(ωt) = cos(ωt).

This is in LT-Spice.

Thoughts?

Thanks for your help.
Sparky
This is with 10k and 100uF, right? When I simulate it, I get 1V at 1kHz, as i should. What kind of op amp are you using? Can you post a schematic?
 

Thread Starter

Sparky

Joined Aug 1, 2005
75
Thanks

Yes the resistor should be 10k and the capacitor should be 100u.

The op-amp is from list of parts in LT-Spice, it's a LT1001.

I've tried variations of this circuit - 1) your recommendation of having a series resistor in series with the cap, 2) another suggestion was to have a cap in the feedback and so forth, I'm not able to get a 1v peak to peak (yet).

Since you can get it to work in your simulation and this circuits differentiates a linear input to a constant, is this a simulation problem?

I've attached a word document showing a screen-shot of the schematic and within the file is an image of the output.

I've also attached the LT-Spice file.

Thanks
-Sparky.
 

Attachments

Ron H

Joined Apr 14, 2005
7,063
You will probably be surprised to learn that you need a wideband op amp to get the differentiator to work properly. Run an AC analysis to see what's going on. Get rid of the series input resistor and the shunt feedback capacitor. Run the sim again. Then try your sim with an LT1223. I know this has to do with phase margin, but I haven't analyzed the circuit to determine what the required op amp parameters are (and don't know if I can :().
 

Thread Starter

Sparky

Joined Aug 1, 2005
75
And there it is!!

Ron H - thanks again!!

After replacing the LT1001 with your suggestion - the LT1223, the differentiation function worked. I get almost 1v peak to peak sinusoidal.

I was talking with hgmjr about seeing a differentiator or integrator in a text book. The book describes how it works but when you simulate what's in the book you discover that quite a bit of detail is left out of the "2 paragraphs". It's a little frustrating.

This was just for fun with me and I admit nobody is using analog computing to solve differential equations so I guess I shouldn't complain too much when a text book doesn't provide all the information regarding an integrator or differential function.

My next step – I think I’m going to simulate some differential equations – real practical.

Hmmm:rolleyes:
 
Top