### Author Topic: Integrator and Differentiator circuits  (Read 8915 times)

0 Members and 1 Guest are viewing this topic.

#### MONODA

• Contributor
• Posts: 22
##### Integrator and Differentiator circuits
« on: May 03, 2012, 01:52:35 pm »
Hi, today I decided to play around with some integrator and differentiator circuits using op-amps. It's the first time I've built these circuits so I didnt know entirely what to expect. I THOUGHT I should expect that when fed a square wave input, I would get a triangle wave output in the integrator and spikes in the differentiator. What I really got was quite similar to this but with a few peculiarities.

I was giving the opamp +15 Vcc and -15 Vee but for some reason the voltage clipped off at around 10 V... Also, the triangle wave output would slowly get shifted up in voltage as time passed.

For the differentiator, I noticed a significant amount of oscillation in the voltage after every spike and I cant seem to think of any explanation for it.

Any information would be much appreciated.

#### amspire

• Super Contributor
• Posts: 3633
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #1 on: May 03, 2012, 02:22:48 pm »
Some circuits and waveforms would be good, but what you got sounds OK.

If there is even the slightest DC offset in the squarewave, or in the opamps, an integrator will drift. You need to add a big resistor across the capacitor such as a 10MOhm resistor to prevent the drift.  Not quite sure what you mean by clipping at +/- 10V. If you didn't get flat tops on the triagnular wave, then you did not get clipping.

The oscillation on the differentiator can be a few things. It could be:

• The feedback circuit on the opamp is not stable - hard to tell without more information
• The ringing was always there on the squarewave, but the differentiator amplifies it considerably
• The opamp does not like a pure capacitive input and the input circuit is ringing- a small series resistor will cure this.

Richard.

#### nick.sek

• Regular Contributor
• Posts: 59
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #2 on: May 03, 2012, 02:23:14 pm »
Which op amp are you using the 741?

#### Kremmen

• Super Contributor
• Posts: 1270
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #3 on: May 03, 2012, 02:29:01 pm »
The clipping may have a number of root causes. One that comes to mind is that the components were dimensioned so as to hit some limitation of the op amp you were using. The slow creep can be explained by op amp input bias current that has no ground path. Then the only way of providing that bias curent is from the integrator cap charge, naturally impacting the cap voltage.

The differentiator is underdamped and therefore exhibits an oscillatory response. Again probably a question of component dimensioning.

If you can provide the actual circuit diagrams you tested, it would make commenting easier.

There is a saying that i am fond to quote for some reason: There is a difference in theory and practice, and it is this: In theory, theory and practice are the same thing but in practice, this is not the case.
Nothing sings like a kilovolt.
Dr W. Bishop

#### MONODA

• Contributor
• Posts: 22
##### Re: Integrator and Differentiator circuits
« Reply #4 on: May 03, 2012, 02:43:04 pm »
Thanks a lot amspire. I didnt think of posting here till after I had taken apart the circuit and put my scope and func gen (which actually arent really either of thosethings, Im using an NI MyDAQ). Im not so sure what you mean by "Doesnt like a pure capacitive input". Could you be more specific?

nick.sek, Yeah Im using a 741.

Hey Kremmen, that makes sense but Im not so sure what you mean by dimensioning. Could you clarify that?

As for the circuit diagrams:

#### Kremmen

• Super Contributor
• Posts: 1270
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #5 on: May 03, 2012, 04:24:29 pm »
What i mean with dimensioning is that you cannot just pick any component values whatsoever and expect the circuit to keep on working like an ideal model. Now that i know you are using that crap old 741 i stress this point. 741 is so far from an ideal op amp that you actually need to be extra careful in your component dimensions. A 15 V source will push just 32 uA thru a 470k resistor. The 741 could have something like 0.5 uA input bias current so your integrator will be way off right there already. Combine that with max output swing of little over +/- 10V and what you have seen is what you are going to get. Dump the 741 and insert a good quality rail-to-rail op amp and things will be radically different.
Out of curiosity i ran your integrator circuit in NI Multisim that happens to have a 741 model. It won't even start properly integrating with your component values, but just ripples near the - rail.

Edit: Oh yes, and regarding your differentiator - again yours is an ideal circuit. In practice the source rising edge, if fast enough, will pass right through the cap, overwhelming the input stage of the amp. There is no way the output could swing high enough to drive a corresponding current through the 470k resistor, and the result is that virtual ground is lost. The - input of the amp bounces somewhere high and comes back only gradually when the cap charges through the feedback resistor. The response will be oscillatory since the amp is driven into saturation and is practically guaranteed to overshoot on recovery.
Try putting a resistor in series with the cap to limit inrush and it will behave better. Say something like 10k or so. Actually, the differentiator initial step can be calculated just from the normal inverting amp ratio R2 / R1. So in fact your input resistance should be higher than 470k if you drive the differentiator with +/- 15V pulses. Only that way will the amp swing be enough to maintain virtual ground in the - input.
« Last Edit: May 03, 2012, 04:44:25 pm by Kremmen »
Nothing sings like a kilovolt.
Dr W. Bishop

#### amspire

• Super Contributor
• Posts: 3633
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #6 on: May 03, 2012, 04:53:33 pm »
Thanks a lot amspire. I didnt think of posting here till after I had taken apart the circuit and put my scope and func gen (which actually arent really either of thosethings, Im using an NI MyDAQ). Im not so sure what you mean by "Doesnt like a pure capacitive input". Could you be more specific?
A square wave is not a great waveform to test a differentiator as you get huge volts/second risetimes. In your circuit, lets say you had a 1V p-p squarewave with a 1uS rise time. That would means a 1000000V/s slew rate which for your circuit should produce a 1000V 1uS pulse on the opamp output. The opamp cannot manage the 1000V and it cannot manage the 1uS. So to get anything meaningful out of the 741 opamp, you want to slow down the rise and fall times with a RC circuit attached to the squarewave generator. A 1mS risetime would be good.

The integrator should give a 1V p-p output with a 10V p-p squarewave input at 5Hz with a 1mS rise and fall time. Even if the squarewave has zero DC content, the opamp input offset and bias current will cause the output to drift up or down.

A dc feeback path will help. Say a 1Meg resistor on the output to a 47uF cap to ground. Then another 1meg resistor  from the cap to the inverting input. This will hopefully stop the drift without affecting the integrator waveform.

Quote
nick.sek, Yeah Im using a 741.

The 741 should be able to output up to +/-14v so I am puzzled by the problem. At 5Hz, to get over a 20v p-p output from the integrator, you must be inputting something like a 200V p-p square wave input. Is that right?

Makes me wonder exactly what you are sending to that differentiator.

Richard.
« Last Edit: May 03, 2012, 04:57:55 pm by amspire »

#### MONODA

• Contributor
• Posts: 22
##### Re: Integrator and Differentiator circuits
« Reply #7 on: May 03, 2012, 11:33:45 pm »
Awesome, thanks guys!

Amspire, i was outputting a square wave around 2 V amplitude.

Another odd thing i noticed was that if i increased the frequency of the wave beyond around 6 Hz, the output would quickly go into saturation, Any ideas?

#### amspire

• Super Contributor
• Posts: 3633
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #8 on: May 04, 2012, 12:39:11 am »
Is that -1V to 1V or 0v to 2V for the square wave?

#### vk6zgo

• Super Contributor
• Posts: 3969
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #9 on: May 04, 2012, 01:53:09 am »
Are you specifically looking at OpAmp versions of Differentiators & Integrators,or you just interested in the basic concepts of these kinds of RC circuits?

If the latter,I would suggest leaving the active devices out & just build the passive RC networks.
Even though they are affected a bit by the generator output impedance,they will look very much like the theoretical
representation.
As soon as you put active devices into the mix,there are,as others have pointed out,complicating factors.

#### MONODA

• Contributor
• Posts: 22
##### Re: Integrator and Differentiator circuits
« Reply #10 on: May 04, 2012, 02:55:16 am »
Cool, I'll try messing around with the passive circuits.

Vpp was around 4 V, so +2V to -2V

#### amspire

• Super Contributor
• Posts: 3633
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #11 on: May 04, 2012, 10:15:39 am »
Cool, I'll try messing around with the passive circuits.

Vpp was around 4 V, so +2V to -2V

If you apply +2v to -2v 5Hz square wave to your integrator, it will produce a 0.212V peak to peak triangular wave. You will be nowhere near clipping. If you are getting +/- 10V, then something is wrong - the wrong resistor, capacitor, or the opamp is connected wrong.

However, your circuit has nothing in it to set the DC level for your comparitor, so the output is very unlikely to be sitting near 0V.  I did mention a way to  get the DC bias above.  Lots of circuits that employ integrators like triangular wave oscillators and dual slope A/D converters automatically maintain the output voltage within the correct operating range. In your case, the output voltage can be anything.

Passive RC integrators can produce decent results as long as the output amplitude is a lot smaller then the input amplitude. So the 470K resistor connected to the 2uF capacitor to ground will give a reasonably good result at 5Hz. The opamp circuit will give a far more precise result once the DC bias problem is solved.

Richard.

#### vk6zgo

• Super Contributor
• Posts: 3969
• Country:
##### Re: Integrator and Differentiator circuits
« Reply #12 on: May 04, 2012, 11:17:19 am »
Cool, I'll try messing around with the passive circuits.

Vpp was around 4 V, so +2V to -2V

If you apply +2v to -2v 5Hz square wave to your integrator, it will produce a 0.212V peak to peak triangular wave. You will be nowhere near clipping. If you are getting +/- 10V, then something is wrong - the wrong resistor, capacitor, or the opamp is connected wrong.

However, your circuit has nothing in it to set the DC level for your comparitor, so the output is very unlikely to be sitting near 0V.  I did mention a way to  get the DC bias above.  Lots of circuits that employ integrators like triangular wave oscillators and dual slope A/D converters automatically maintain the output voltage within the correct operating range. In your case, the output voltage can be anything.

Passive RC integrators can produce decent results as long as the output amplitude is a lot smaller then the input amplitude. So the 470K resistor connected to the 2uF capacitor to ground will give a reasonably good result at 5Hz. The opamp circuit will give a far more precise result once the DC bias problem is solved.

Richard.

Conceded,but if the OP is really just interested in seeing if RC networks work like they do in the book,the passive circuits give a fairly close approximation to the textbook waveform.
Before the common use of Op Amps,passive RC networks were widely used.
With tube or discrete transistor circuitry,there was usually adequate gain & dynamic range to meet the requirements you have quoted above.
Op Amp Differentiating & Integrating circuits are definitely a better deal for the designer,though,replacing several stages with one device.
For just playing about,the passive circuits allow a more realistic choice of frequency for the input square wave than the poor old "741".

• Newbie
• Posts: 4
##### Re: Integrator and Differentiator circuits
« Reply #13 on: May 07, 2012, 09:30:32 pm »
The differentiator is an inherently marginally stable circuit i.e. it is on the verge of dynamic instability and will often oscillate. Even if it is not actually oscillating the response will have ringing responses to inputs. To understand the operation of this circuit you may, for example, refer to an appropriate book such as  ISBN 978-0-521-68780-5, section 5.6 Differentiators. What is needed, as some others above have indicated, is an additional small resistor in series with the usual input capacitor, which acts as a damping control for the second order response function of the circuit. The optimum magnitude of this additional resistor Ri may be calculated from the formula:

Ri = Square root (4 x Rf /omegaT x Ci)

Where Rf is the feedback resistor, omegaT is the transition frequency of the op amp open-loop response (where the response crosses unity gain: note omega is angular frequency) and Ci is the input capacitor. As an example say Rf=10k (10^4), Ci=10n (10^-8), omegaT=10^7 then Ri=630ohm, and allowing for errors in your parameters it will probably be necessary to increase this a bit, depending on the observed signal response.
If you are going to do much electronics it is most desirable you learn something about how to analyze circuits. The reference above will require some effort to understand but it also provides a copy of the PSpice student version which can be of considerable assistance in understanding and designing systems. You may also look at section 5.5 integrators.
Another book of wide interest and practical assistance can be downloaded from:

http://www.analog.com/library/analogdialogue/archives/philbrick/computing_amplifiers.html

Smf