Need Op-Amp integrator math help - Page 1
Forum section: electronics / beginners

author: skysurf76
author_rank: Regular Contributor
timestamp: April 25, 2013, 12:56:08 am
content: Been working on this for a couple hours and just keep going around in circles.The problem: With an input square wave of 1kHz at 10v peak to peak (+-5) with no DC offset, find the peak to peak output voltage of the integrator.I'm including a scan of my work with all the pertinent information. The numbers just don't make sense no matter what I try. The setup I did on the scan seems to make sense to me, but clearly the answer shouldn't be negative. I don't know how to go about figuring out what the peak values will settle at.

author: GK
author_rank: Super Contributor
timestamp: April 25, 2013, 01:08:16 am
content: Vc = (Ic/c)tIc = Vin/Ri

author: skysurf76
author_rank: Regular Contributor
timestamp: April 25, 2013, 01:13:18 am
content: Quote from: GK on April 25, 2013, 01:08:16 amOk I think I see what you're saying. I was focusing only on the integral at the top of my scan. Thats what was given in the lab manual and I assumed it should be sufficient to solve the problem. I'll try approaching it using what you suggested.

author: Rufus
author_rank: Super Contributor
timestamp: April 25, 2013, 01:52:22 am
content: I think it will be helpful to rememberQ = CV = IT.

author: skysurf76
author_rank: Regular Contributor
timestamp: April 25, 2013, 02:24:21 am
content: I'm going to have to just skip this problem for the time being. I simply cannot get my head around it. I actually built the circuit in the problem and got the results I'm attaching. I've tried thinking through it but it just doesn't make sense. This is a major brain bender.The following is the output of the op-amp integrator I assembled as in the scan in the first post of this thread. 16V plus and minus rails on the op-amp, 15k ohm input resistor, and a 560nf cap. 1kHz +-5V square wave with no DC offset at the input. 20 volts peak with a +16V rail on the op-amp? Laws of physics are being broken here.

author: GK
author_rank: Super Contributor
timestamp: April 25, 2013, 02:44:58 am
content: I think you need to double check your grounding. Also, either select a much lower value cap or lower the input frequency. Another thing; don't expect a basic integrator circuit like this to practically generate a triangle wave from a square wave input. The rise and fall times will never be perfectly identical and the op-amp output will just trend to one of the supply rails, generally before you have a chance to blink. However you can input a low frequency square (or rectangular) waveform and observe the integrator alternately slew from saturation against one rail to the other.

author: c4757p
author_rank: Super Contributor
timestamp: April 25, 2013, 02:50:18 am
content: Is that the output with a square wave input? Looks like you've made a differentiator instead of an integrator. Have you swapped R and C?

author: skysurf76
author_rank: Regular Contributor
timestamp: April 25, 2013, 03:12:58 am
content: Quote from: c4757p on April 25, 2013, 02:50:18 amYep, I went back and checked my circuit and I had a ground in an input.Attached is what I get now...What I don't understand is why the average output settles up at 15.2V. It also looks like my answer of .167V from the integral in my very first post is reasonable now, although the sign is still wrong.

author: c4757p
author_rank: Super Contributor
timestamp: April 25, 2013, 03:18:49 am
content: Quote from: skysurf76 on April 25, 2013, 03:12:58 amYou have pretty much no control of this. The integral builds up over time without ever being reset, so any offset caused during circuit startup will be kept. Try adding a very high value resistor across the capacitor to roll off the frequency response a bit on the low end.

author: GK
author_rank: Super Contributor
timestamp: April 25, 2013, 03:19:14 am
content: Quote from: skysurf76 on April 25, 2013, 03:12:58 amI told you in my previous reply.

author: Rufus
author_rank: Super Contributor
timestamp: April 25, 2013, 03:22:28 am
content: Quote from: skysurf76 on April 25, 2013, 02:24:21 amIt is far from complicated but perhaps you don't understand the op-amp operation. The op-amp has -ve feedback through the capacitor and will do whatever it can to keep the voltage between + and - inputs essentially zero.If the + input is 0v so will be the - input which makes the current in Ri Vi/Ri. The op-amp input is high impedance so the current in Ri can only flow into C.Q = CV = ITYou know the current, you know the time (half cycle of the input) you know the capacitance.It isn't a real world circuit. Small offsets and bias currents will quickly send the op-amp output towards one rail or the other. If for example the op-amp has 1uA of bias current on the -ve input CV = IT still applies, and the op-amp output will ramp at 2v/s.

author: skysurf76
author_rank: Regular Contributor
timestamp: April 25, 2013, 03:30:17 am
content: Quote from: GK on April 25, 2013, 03:19:14 amI'm sorry GK, I see it now. I read your post but missed the last sentence. I've been going at it for about 10 hours and my eyes are starting to glaze over. I apologize.That actually makes perfect sense to me. When you turn it on depending on the offset error of the op amp the strongest rail will push the output up to the limit of the rail because over time that rail is just putting more and more charge onto the capacitor.So even though the input is going back and forth between +5 and -5 unless the op amp is perfectly balanced (which it won't be of course) the stronger rail will put just a little more charge into the cap than is drained when the input swings the other way and this error gradually builds till it hits that rail.And THEN once it does hit the limit of that rail I should be able to use the integral in my first post to find peaks.

author: skysurf76
author_rank: Regular Contributor
timestamp: April 25, 2013, 04:08:44 am
content: Thank you so much Rufus, GK, and c4757p. I really appreciate you guys taking time out of your day to help. I apologize for seeming kind of hair brained when I post on these forums asking for help. Usually I've been grinding out homework for hours by the time I post, and I make simple stupid mistakes and don't read things thoroughly. I need to work on that.Anyway, this is my second time asking for help on these forums, and as usual I'm not disappointed. Ironically at the very end once I understood what was going on I finally realized the mistake I made in my original post. If you look at my little graph I made at the top right of the scan you'll see I didn't draw the output as inverting the input. Thats why the signs were wrong. I worked out the full correct solution and I'm attaching it to this post.The ironic thing is that in this thread I have learned that the theoretical outcome I got with math isn't even realistically possible.

author: GK
author_rank: Super Contributor
timestamp: April 25, 2013, 05:12:21 am
content: Quote from: skysurf76 on April 25, 2013, 04:08:44 amI still remember having the exact same problem years ago. My Prentice Hall text book, in a "system application" section in the "basic op-amp circuits" chapter, showed a simplified function generator schematic in which a triangle wave was produced simply by an integrator driven by a square wave generator. I built in on breadboard and just couldn't get it to work as the op-amp output just kept slamming against the negative rail. The same text book also showed complementary bipolar audio amplifier power output stages "ideally" biased by a diode for each Vbe, with no emitter degeneration. I assembled one of those too. BOOM!Two classic text book examples of presenting concepts with excessive simplification.As for generating triangle wave by integrating a squarewave source, it can be done, but a negative feedback servo loop is required. See:https://www.eevblog.com/forum/projects/home-brew-analog-computer-system/?action=dlattach;attach=35299andhttps://www.eevblog.com/forum/projects/home-brew-analog-computer-system/msg170229/#msg170229