# Op-amp integrator response to square wave

simulate this circuit – Schematic created using CircuitLab

I would like to study the frequency responce of this op-amp integrator to a square wave. By setting a frequency of 10KHz and the pp-amplitude of the in-voltage to 340mV I obtain a triangle output wave with a pp-amplitude of 244mV. Now, according to my prevision I should have an output of 161mV, in fact Vout=(-1/R1 C1)*integral(vin dt)=-(Vin/(2 f R1 C1)) that is the integrator formula for a square wave. I have already checked this value by expanding in fourier series the square wave and by trasforming each harmonic through the transfer function. The op-amp is TL081. Even if it is not shown in the circuit scheme, the op-amp is powered through +15 and -15 DC sources.

Can someone help me out? [EDIT: corrected the extra factor 2 as signalled by Olin Lathrop]

Screenshot of the oscilloscope:

• With what?????? Commented Nov 21, 2015 at 21:53
• Opamps without power aren't guaranteed to do anything useful. This really should be obvious. Commented Nov 21, 2015 at 21:56
• With any tips that could be useful for understanding why the expected value of vout is so different from the measured one. Op-amp is powered by +15 and -15 DC sources. Commented Nov 21, 2015 at 21:58
• Screenshot of the oscilloscope Commented Nov 21, 2015 at 22:42
• I just understand what is the problem thanks to @RespawnedFluff comment: those overshoot peaks are "hidden" by the square wave in the screenshot and the oscilloscope vpp-measure takes them into account. Commented Nov 21, 2015 at 23:11

I'm not entirely sure how to answer the why question, but simulation reproduces the same result; first the big picture:

But if you zoom in there are tiny little overshoot peaks in there...

which are actually pretty close to those measured. TL081 model is from TI, which is actually a very basic one... yet it predicted the overshoot pretty well.

Alas while I'm not completely sure what actually causes them, thanks to discussion below with the OP, all fingers point to the slew rate of the TL081. If I lower the slopes of the square wave by 3 orders of magnitude (from 1ns to 1us), then the output spikes go away (in simulation), but I also get some DC bias on the output (once it stabilizes):

Yeah, the datasheet slew rate for TL081 is 13 V/us. So in 1ns (first simulation) it would only be able to swing its output by 13mV, not enough to react to 25x greater input swing. Basically the output gets briefly pulled (up or down) by the input via the feedback resistor before the opamp can react to correct that. Actually it almost works like a voltage doubler during those spikes. Another way to check this is to measure the time span of the spikes. In [the first] simulation those spikes last 240ns (=4.15MHz), which is comparable to the 3-4MHz bandwidth of the TL081 (I note that the old datasheet said 4MHz but the new one says 3MHz.)

• In this case the input switches between -0.34V and +0.34V. When it is at -0.34V the pulse is long enough for charging the capacitance, at this point Vin sunddenly switches to +0.34 (in a period of time <<RC) but the voltage across C cannot change instantaneously and neither can the output of the op-amp because it behaves itself as an integrator. Commented Nov 21, 2015 at 23:30
• @gilgamesht: it sounds to me like you could contribute your own answer at this point (which is totally ok here). It definitely seems due to the [slow] slew rate of TL081. If I decrease the ramps to 1us, the overshoots go away, but then I get some DC bias too. Commented Nov 21, 2015 at 23:35
• i.imgur.com/p3JuHyv.png Commented Nov 21, 2015 at 23:40
• Thank you @Respawned Fluff, you solved my problem. I have not totally taken into account the possibility that the square wave could have hidden those spikes. Commented Nov 21, 2015 at 23:42
• Yep, this ironic phenomena of having a little bit of differentiator in the integrator is kind of well known. See Chapter 6 of Analog Devices OpAmp Handbook, p 6.180 for example. analog.com/library/analogDialogue/archives/39-05/… Commented Nov 22, 2015 at 1:14

Not only is your opamp not powered, so nothing it does should be a surprise, but your calculations don't make sense either.

You have 340 mVpp square wave in, so 170 mVp. That divided by R1 means the current is either + or - 170 µA thru the integrating capacitor. (170 µA)(50 µs)/(51 nF) = 167 mV, which is how much the capacitor charges or discharges each half-cycle, which means the output should be 167 mVpp triangle.

• I forgot to mention the fact that even if it is not shown in the circuit schematic the op-amp is powered through +15 and -15 DC sources. I have just edit my first post. Ok, I there is an extra 2 factor, but this does not solve the problem. Commented Nov 21, 2015 at 22:11