Differentiators and Integrators

Approaching new ideas using multiple engineering tools

In this course, our overall goal is to develop practical understanding of some basic concepts from and instrumentation in a five step process that incorporates most aspects of engineering problem solving.

1. Collect relevant basic knowledge from math, physics, chemistry, etc. 2. Develop an ideal model and use the model to predict system behavior (paper and pencil analysis) 3. Apply simulation tools (e.g. PSpice) to predict system behavior based on the ideal model incorporating the characteristics of real components. 4. Build and test a prototype system (e.g. experiment with an actual circuit, measurements taken with the Mobile Studio) 5. Develop a practical model and establish its limits of applicability

The approach we take does not follow this process in a step-by-step manner. Rather it can begin at any step (e.g. start with the experiment) and generally must loop through the cycle many times to achieve a satisfactory practical model that can be used to predict the performance of a real world system. Prof. Kevin Craig (formerly a professor here in MANE) used the diagram below to show the general characteristics of the Engineering System Investigation Process:

1 K. A. Connor The process above can be represented with this simple cycle diagram, even though it is not really very accurate. The problem with a diagram like this is that it appears to be step-by-step, but we really can start at any point and cycle through it many times and jump to any of the other steps until we achieve our goal of developing a useful, practical model of the system of interest.

Math & Science Info

Practical Ideal Model Model

Experiment Simulation

The broad outlines of our approach can be seen in our investigation of two systems configured using op-amps – Differentiators and Integrators.

Integrators

1. From basic calculus and basic circuits, we know that a system that integrates a function should have some time-varying , current or other signal as an input and produce an integral with respect to time of the input signal at its output. Put most simply, t Vt()= 2 Vtdt () . This establishes the overall goal for the system. Basic circuit out ∫ in t1 analysis (e.g. loop and node equations, Ohm’s Law, etc.) provide the tools to analyze whatever integrating system we come up with. 2. The ideal op-amp integrator is configured as shown below. From basic circuits and the t Vtin () properties of ideal op-amps, we find that Vtout ()=−dt + Vinitial using: ∫0 RC

2 K. A. Connor 3. If we choose R=1000Ω and C=1µF, then the output should have the same magnitude as a sine wave input with ω=1000 or f=159Hz. The output phase should be 90 degrees rather than zero if the input is a sine function and the output is a cosine. Setting this up using PSpice with components we have in our parts kits, we get the following circuit. 0

V2 0 9Vdc

U1 7 3 5 + OS2 V+ 6 Ri OUT 2 1 V - 4 OS1 Rload 1k V- V uA741 1e6 Vin VOFF = 0 VAMPL = 1 FREQ = 1k V1 9Vdc

0 0 0

Cf 1uF If we perform an AC sweep from some low frequency to some high frequency, 16V

14V

12V

10V

8V

6V

4V

2V

0V 10Hz 30Hz 100Hz 300Hz 1.0KHz 3.0KHz 10KHz 30KHz 100KHz 300KHz 1.0MHz 3.0MHz 10MHz V(Vin:+) V(Rload:1) Frequency

we see that the output magnitude equals the input at f=159Hz as expected and appears to be inversely proportional to frequency, also as expected because (for input amplitude tt Vtin () sin(ωt ) cos(ωt ) cos(ωt ) equal to 1V), Vtout ()=−dt =− dt = = . Changing ∫∫0 RC 0 ()()1036 10−−ω 10 3 ωRC the plot to show phase, we see that the phase shift is indeed 90 degrees up to around f=10kHz.

3 K. A. Connor 100d

80d

60d

40d

20d

0d 10Hz 30Hz 100Hz 300Hz 1.0KHz 3.0KHz 10KHz 30KHz 100KHz 300KHz 1.0MHz 3.0MHz 10MHz P(V(Vin:+)) P(V(Rload:1)) Frequency

The AC Sweep shows that this configuration should integrate at f=1kHz, so we can also try transient analysis at that frequency in preparation for building and testing this integrator. To be sure that we are in steady-state, start the simulation at a large time. Unfortunately, even doing this does not produce an output that is the integral of the input. 10V

8V

6V

4V

2V

0V

-2V 100.0ms 100.2ms 100.4ms 100.6ms 100.8ms 101.0ms 101.2ms 101.4ms 101.6ms 101.8ms 102.0ms 102.2ms 102.4ms 102.6ms 102.8ms 103.0ms V(Vin:+) V(Cf:2) Time

Since we have done the simulation correctly, there must be something practically wrong with the ideal model. A little research turns up the concept of the Miller Integrator in which a large is placed in parallel with the feedback . Miller figured this out in the early part of the 20th century when he realized that the op-amp did not have the required negative feedback at DC (zero frequency). By adding the large resistor, the feedback is maintained even when the capacitor is an open circuit at low frequency. (Note that this step requires us to go back to the background information collection step, so we are already out of the step-by-step sequence.) The new circuit looks like

4 K. A. Connor 0

V2 0 9Vdc

U1 7 3 5 + OS2 V+ 6 Ri OUT 2 1 V - 4 OS1 Rload 1k V- V uA741 1e6 Vin VOFF = 0 VAMPL = 1 FREQ = 1k V1 9Vdc

0 0 0

Cf

1uF

Rmiller

100k and the plot of the input and output now looks correct. 1.0V

0.5V

0V

-0.5V

-1.0V 100.0ms 100.2ms 100.4ms 100.6ms 100.8ms 101.0ms 101.2ms 101.4ms 101.6ms 101.8ms 102.0ms 102.2ms 102.4ms 102.6ms 102.8ms 103.0ms V(Vin:+) V(Cf:2) Time

Just for completeness, let us try this at 159Hz to see if the input and output have the same

5 K. A. Connor magnitude (note that we have to simulate for a longer time to reach steady-state). 1.2V

0.8V

0.4V

0V

-0.4V

-0.8V

-1.2V 600ms 601ms 602ms 603ms 604ms 605ms 606ms 607ms 608ms 609ms 610ms 611ms 612ms 613ms 614ms 615ms 616ms 617ms 618ms 619ms 620ms V(Vin:+) V(Cf:2) Time 4. For the experiment, it is necessary to use the Miller Integrator configuration. Also, we have to take into account the gain at DC or the op-amp will saturate at either the positive or negative rail voltage of 9V. This will be left to the reader, but it will be necessary to

try different values for R, C and RMiller to realize integration while still having finite gain at DC.

5. The practical model will be the Miller Integrator with the limits on R, C and RMiller established above.

One issue that is not addressed explicitly in the two diagrams at the beginning is experience. As one works with some system or with similar systems, one acquires experience that makes learning about the new system easier and also suggests issues to be considered. Of course, experience is acquired by progressing around the cycle but other experience is just as important.

To complete the cycle, here are some experimental performance plots for the integrator (sine, square and triangular wave cases). The first three are for 100Hz. Green is input, blue is output.

6 K. A. Connor

The next one is 10kHz. Note that this has at least one more flaw than the 100Hz signal.

However, it appears that the circuit is doing quite a good job of integrating.

7 K. A. Connor Differentiator

1. From basic calculus and basic circuits, we know that a system that differentiates a function should have some time-varying voltage, current or other signal as an input and produce a derivative with respect to time of the input signal at its output. Put most d simply, Vt()= Vt (). This establishes the overall goal for the system. Basic circuit out dt in analysis (e.g. loop and node equations, Ohm’s Law, etc.) provide the tools to analyze whatever differentiating system we come up with. 2. The ideal op-amp differentiator is configured as shown below. From basic circuits and d the properties of ideal op-amps, we find that Vt()=− RCVt () using: out dt in

3. If we choose R=1000Ω and C=1µF, then the output should have the same magnitude as a sine wave input with ω=1000 or f=159Hz. The output phase should be 90 degrees rather than zero if the input is a sine function and the output is a cosine. Setting this up using PSpice with components we have in our parts kits, we get the following circuit. 0

V2 9Vdc

U1 7 3 V+ 5 + OS2 6 Ci 0 OUT 2 1 V - 4 OS1 Rload 1uF V- Vin V uA741 1k VOFF = 0 VAMPL = 1 FREQ = 159 V1 0 9Vdc 0 0

Rf 1k For this circuit and frequency, the ideal op-amp configuration should produce the following mathematical result. d d Vt() =− RCVt( ) =−10−−33 sin(ωωωωtt )=−10 103 cos( )=− cos(t ) =−RC cos(ωt ) out dt in dt

From the following plot, we can see that this is exactly what the circuit does.

8 K. A. Connor 1.0V

0.5V

0V

-0.5V

-1.0V 100ms 102ms 104ms 106ms 108ms 110ms 112ms 114ms 116ms 118ms 120ms 122ms 124ms 126ms 128ms 130ms V(Vin:+) V(U1:OUT) Time

Note that we did the transient response first this time. If we try the AC sweep, we will see something remarkable that will very likely make this configuration somewhat useless in practice, unless we make some kind of modification. 12KV

10KV

8KV

6KV

4KV

2KV

0V 10Hz 30Hz 100Hz 300Hz 1.0KHz 3.0KHz 10KHz 30KHz 100KHz 300KHz 1.0MHz 3.0MHz 10MHz V(Vin:+) V(U1:OUT) Frequency

Note the huge peak just above the frequency of 10kHz. This occurs because practical differentiators are inherently unstable and have a natural frequency at which the system is very sensitive to noise. Much of the time, the components used (e.g. the op-amp itself) have secondary characteristics that suppress this unstable behavior, but usually we can see it in the output. The effect may not be big (if noise is small) but it should still be suppressed in some way (in the experiment). 4. For the experiment, it may be necessary to try something inspired by the Miller Integrator, where an additional component was added to the circuit. Here the problem is the behavior above 10kHz, so it might be a good idea to filter out the higher frequencies. A capacitor in parallel with the feedback resistor will short out the feedback at high frequencies, which is what we are looking for. Unfortunately, this may distort the desired

9 K. A. Connor differentiation, so it may take some time to find the right circuit components. If you need this capacitor, use the smallest one that suppresses the noise. 5. The practical model may be differentiator with the feedback capacitor added or it may be the ideal configuration, depending on the frequency considered.

Summary – Now having gone through the process a couple of times, let us see if we can simplify it a little to help clarify what we are doing. First, we note that we need some sort of goal or purpose for our process. In the two examples considered the goals were to realize a practical integrator or a practical differentiator from simple circuit components and a 741 op-amp. Note that both the integrator and the differentiator systems have limitations in terms of power, dynamic range, frequency, etc. This is true of any engineered system. We require some kind of spec to be set for the design and then we can choose the individual components that give the performance we required for a specified range of inputs and outputs. Since the first cycle diagram did not really show how things worked as we moved from step-to-step either in or out of sequence, the following modified diagram may turn out to be better. We will have to try it out to be sure, however.

Math & Science Info

System Experiment Model

Simulation

I am not sure I really like this diagram either, but it at least has only one modeling function and shows that each step communicates with all of the others. No matter what we do, it is necessary to identify all essential steps, but the path of discovery is harder to represent.

10 K. A. Connor