Need simple formula for opamp integrator

Thread Starter

Mrdouble

Joined Aug 13, 2012
107
I was hoping somone can give me a "easy math" formula to calculate integration of a square wave.
The integrator circuit is driving by a couple transistors in a astable clock formation.
I need the integrator (opamp, capacitor, resistor) to make a triangle wave but due to my limited math ability I'm having a heck of a time finding out the right cap and resistor combo. All the formulas are calculus in nature and I got my butt kicked in calc class:D

I would prefer to just have the formula but if it's dependent on knowing the math Ill take the solution too lol.

Ok , here's the specs for my triangle wave gen

The square wave is 5 v at .7ms as per oscilloscope
The outputs buffered by an opamp

Please dontmake suggestions about easier way to do this. I sure there are Much easier ways but this is my design (good or bad ) and since this project is about learning from my mistakes ,I've had tons and thus learned tons
 

mcasale

Joined Jul 18, 2011
210
If your square wave is a positive voltage, the integrator will just saturate at one of the rails. You want it to go positive and negative, which you can do by putting a capacitor in series with the input.

The other way is to reset the integrating capacitor with some signal at the end of each pulse.

..... and I agree that a schematic would be helpful.
 

bountyhunter

Joined Sep 7, 2009
2,512
Easy way is to use the formula:

I = C dv/dt

dV/dt is the ramp rate of the triangle wave. The value of "I" is determined by the resistor in series with the cap. You want the dv/dt rate to match the time interval of the square wave so the triangle wave height will be appropriate.
 

Thread Starter

Mrdouble

Joined Aug 13, 2012
107
Thanks for all the ideas and the formula from bountyhunter

Heres a pic but the values are just thrown in. In truth i need a 2 second ramp signal
 

Attachments

ramancini8

Joined Jul 18, 2012
473
Here are some problems that I see with the circuit shown:
1. change the 741 to a CMOS op amp (TL08X,etc.).
2. Vo(U2)/R5 is the charging current and the op amp saturation voltage is not stable. You need to clamp the output voltage of U2.
3. The current in R5 charges C3 during the period that U2's output is high, thus C3 must be fully charged before U2 switches.
4. C3 must be fully discharged when the output of U2 is low. This indicates a FET across C3.
5. If these design problems are troublesome you can change the circuit to use two transistors to accomplish the same thing. one transistor is a current source tacked to Vcc feeding the capacitor, and the other transistor's base is connected to Q1 through a suitable resistor and the collector/drain is attached to the capacitor. When the transistor is on (Q1's output high) the capacitor is shorted to ground. The current source charges the cap when Q1 is low.
 

Thread Starter

Mrdouble

Joined Aug 13, 2012
107
Thankyou ram, I do like the idea of transistors. As for the rest... I'm a life long hobbiest but no where near your level so it'll take a couple days for the rest to sink in. Hopefully :D
 

Thread Starter

Mrdouble

Joined Aug 13, 2012
107
I've have looked all over the web and in my "the art of electronics" and I still have no clue as to what clamping the opamp out put is. Can you give me a link o give me an idea? When I think of a clamp I think of a diode to bring a signal .7v higher. I don't think that's what Ram meant by stabilizing the op amp. I'm really not understanding what is meant by saturation not being stable as it never goes into saturation. It's just a square wave fed from the transistor oscillator

Thanks for all your guys help
 

Ron H

Joined Apr 14, 2005
7,063
You're a hard guy to help, because you just want a formula, and a formula is not going to solve your problem.
Your circuit won't work as drawn, no matter what values you plug in. It has multiple problems. Let us know if you actually want suggestions on how to make it work.
 

Thread Starter

Mrdouble

Joined Aug 13, 2012
107
I completely understand. Right now I'm just working on stabilizing the buffer output. I'll gladly take a hint

Thanks
 

Thread Starter

Mrdouble

Joined Aug 13, 2012
107
UNCLE!!
UNCLE!!
If someone would be nice enough to give me the circuit it would be greatly appreciated.
Thank you
 

Ron H

Joined Apr 14, 2005
7,063
You need to understand how an integrator works.
If you put a positive step of current into a capacitor, the voltage across the cap will rise at a linear rate. Likewise, if you put a negative step of current into a capacitor, the voltage across the cap will fall at a linear rate.
In calculus, the integral of a step is a linear ramp. Hence, the capacitor voltage is the integral of the current through it.
Note that, as long as the current is applied, the cap will continue to charge. To get it to discharge, you must reverse the current direction.
An op amp integrator works by converting the square wave input voltage into current, then applying that to the feedback capacitor.
To make a triangle wave, the + and - currents must be identical in magnitude, and the duty cycle must be exactly 50%, i.e., the each complete cycle of the current square wave must return the voltage on the cap to exactly the same voltage as at the beginning of the cycle. Otherwise, the cap voltage will rise above the voltage that can be sustained by the accompanying circuitry, which in your case is the ± saturation voltage of the op amp.
The typical basic function generator (square and triangle waves) does this by putting a Schmitt trigger and an integrator in a feedback loop. When the triangle reaches the positive threshold voltage of the Schmitt trigger, the Schmitt changes state abruptly, causing the output of the integrator to ramp down until it reaches the Schmitt's negative threshold. Then the cycle repeats.
With the scheme you have posted, there is no simple way of guaranteeing that the multivibrator duty cycle will be exactly 50%. Furthermore, the square wave to the integrator must swing symmetrically around the voltage on the +input of the integrator, which yours doesn't do.
Why don't you try Bill Marsden's circuit, then come back with more questions?

Attached is a simulation of an integrator which does not have a 50% duty cycle. Note that the op amp saturates after a few cycles.
 

Attachments

Top