# Given a linear Vin, what frequency to assume as a differentiator input?

#### atferrari

Joined Jan 6, 2004
4,748
I intend to design a differentiator stage. I measured "all" possible input signals, so to speak, getting the highest rate of a linear signal (steadily increasing) of 265mV in 60 seconds.

If I do 265/60 = 4,42 mV/sec, could I consider my input signal as a triangle of 4,42mV pk - pk / freq= 0,5 HZ?

#### LvW

Joined Jun 13, 2013
1,749
No - the unit "Hz" is reserved for sinusoidal signals only. All other periodic signals are specified with its repetition rate.
Question: What is the purpose of the circuit - and are there no requirements for a specific input signal wave form?

#### atferrari

Joined Jan 6, 2004
4,748
No - the unit "Hz" is reserved for sinusoidal signals only. All other periodic signals are specified with its repetition rate.
Question: What is the purpose of the circuit - and are there no requirements for a specific input signal wave form?
No signal wave. Just a varying voltage as mentioned, for a PID controller.

So, posing again my question: a differentiator is designed assuming an input frequency. Could you suggest what value to use based on the expected input as described in the OP?

#### Ian0

Joined Aug 7, 2020
9,489
No - the unit "Hz" is reserved for sinusoidal signals only.
Really? So saying that your computer has a 4GHz processor is wrong?

#### Ian0

Joined Aug 7, 2020
9,489
I intend to design a differentiator stage. I measured "all" possible input signals, so to speak, getting the highest rate of a linear signal (steadily increasing) of 265mV in 60 seconds.

If I do 265/60 = 4,42 mV/sec, could I consider my input signal as a triangle of 4,42mV pk - pk / freq= 0,5 HZ?

View attachment 242501
Rin and Cf should both be zero.
As it is a virtual earth, the maximum feedback current should be Vout(max)/Rf.
The maximum input current is given by: I = C.dV/dt
Therefore:
Vout(max)/Rf = C.dV/dt
C.Rf = Vout(max)/(dV/dt)

(The output is inverting, so a negative output voltage will represent a positive rate of change of voltage at the input)

#### Papabravo

Joined Feb 24, 2006
20,992
Really? So saying that your computer has a 4GHz processor is wrong?
At 4 GHz. it can be difficult to tell the difference between a sinewave and a square wave.

#### Papabravo

Joined Feb 24, 2006
20,992
For the chosen values you could do an AC sweep in a simulator to gain some understanding of what is happening. I'll do it for you if you're not a simulation aficionado.

#### Ian0

Joined Aug 7, 2020
9,489
At 4 GHz. it can be difficult to tell the difference between a sinewave and a square wave.
Better say "cycles per second" then, just to be on the safe side.

#### Papabravo

Joined Feb 24, 2006
20,992
For the chosen values you could do an AC sweep in a simulator to gain some understanding of what is happening. I'll do it for you if you're not a simulation aficionado.
It turns out that your input is effectively DC and the output is microvolts.

#### Ian0

Joined Aug 7, 2020
9,489
It works out at 1.8MΩ and 1000uF -- that op-amp is going to be working at maximum gain throughout the audio band - it will need a really quiet op-amp, and no noise on the input signal.

#### Papabravo

Joined Feb 24, 2006
20,992
Rin and Cf should both be zero.
As it is a virtual earth, the maximum feedback current should be Vout(max)/Rf.
The maximum input current is given by: I = C.dV/dt
Therefore:
Vout(max)/Rf = C.dV/dt
C.Rf = Vout(max)/(dV/dt)

(The output is inverting, so a negative output voltage will represent a positive rate of change of voltage at the input)
Cf can be non-zero to attenuate the high frequency response in a practical circuit. The input frequency is so low that there is virtually no gain at all.

#### atferrari

Joined Jan 6, 2004
4,748
Rin and Cf should both be zero.
As it is a virtual earth, the maximum feedback current should be Vout(max)/Rf.
The maximum input current is given by: I = C.dV/dt
Therefore:
Vout(max)/Rf = C.dV/dt
C.Rf = Vout(max)/(dV/dt)

(The output is inverting, so a negative output voltage will represent a positive rate of change of voltage at the input)

My questions:

Vout(max), is it the voltage value I pretend at the output? I know that to get a high value, Rf could become huge. Any rule of thumb?

The expresion dV/dt, is it what I got dividing 260mV/60s = 4,42 mV/s?

I fear to ask this: why making Rin and Cf, zero? Have seen both explained as a must for practical differentiators?

#### Papabravo

Joined Feb 24, 2006
20,992
Here are some additional differentiator simulations in case you are interested.

#### dcbingaman

Joined Jun 30, 2021
1,065
No signal wave. Just a varying voltage as mentioned, for a PID controller.

So, posing again my question: a differentiator is designed assuming an input frequency. Could you suggest what value to use based on the expected input as described in the OP?
All PID control loops have to be tuned. So it depends on the 's' domain 'plant' it is controlling. You can accomplish both the integral and proportional gain with one amplifier you drop remove Cin to accomplish that the P gain is Rf/Rin and the I gain is determined by Cf and Rin. If you want a differentiator you need only Cin and Rf. To implement complete PID control loop send the D and the PI to a final summing amplifier stage.
For tuning, start with a system that is all proportional only, increase P gain until you start to get oscillations, reduce it back some so that a step function has no overshoot. Next add I gain to eliminate following error. Finally add D gain for stabilization. Not all PID control loops require the D part. (Differentiator part).

If this is for a new circuit design for PID control I would recommend an ADC / Microcontroller or FPGA followed by DAC. Then do all the P I and D gains in software/firmware. This is much more flexible than using fixed parts tuned to the system.

Last edited:

#### Ian0

Joined Aug 7, 2020
9,489

My questions:

Vout(max), is it the voltage value I pretend at the output? I know that to get a high value, Rf could become huge. Any rule of thumb?

The expresion dV/dt, is it what I got dividing 260mV/60s = 4,42 mV/s?

I fear to ask this: why making Rin and Cf, zero? Have seen both explained as a must for practical differentiators?
I used Vout(max) = 8V, being a reasonable estimate of what a TL072 might manage off a 9V supply,
For a true differentiator Rin and Cf would be zero. Rin would put an upper limit on the high-frequency gain, but above the 1/(2πRin.Cin) frequency, it would no longer be a differentiator, it would just simply be an amplifier with a gain of Rf/Rin.

With Rin and Cf non-zero, what you have is a bandpass filter. Below f=1/(2πRin.Cin) it's a differentiator, above f=1/(2πRf.Cf) it's an integrator, and in the middle it's an amplifier.

#### dcbingaman

Joined Jun 30, 2021
1,065
If you want to simplify things and make this easier to tune, I would recommend 3 op amps, one set for integration one for differentiation and one for proportional gain. Send all outputs to one summing op amp. Then when you go to tune this you will not be changing all three parameters by some degree due to the interactions of the components with one op amp.

Last edited:

#### MrSalts

Joined Apr 2, 2020
2,767
If you want to do it even more simply, just use one OpAmp, and an ADC - do the entire PID in software. Tune the PID with fuzzy logic after putting the device though it's paces and expected edges of operating conditions.

#### dcbingaman

Joined Jun 30, 2021
1,065
I used Vout(max) = 8V, being a reasonable estimate of what a TL072 might manage off a 9V supply,
For a true differentiator Rin and Cf would be zero. Rin would put an upper limit on the high-frequency gain, but above the 1/(2πRin.Cin) frequency, it would no longer be a differentiator, it would just simply be an amplifier with a gain of Rf/Rin.

With Rin and Cf non-zero, what you have is a bandpass filter. Below f=1/(2πRin.Cin) it's a differentiator, above f=1/(2πRf.Cf) it's an integrator, and in the middle it's an amplifier.
If you want to simplify things and make this easier to tune, I would recommend 3 op amps, one set for integration one for differentiation and one for proportional gain. Send all outputs to one summing op amp. Then when you go to tune this you will not be changing all three parameters by some degree due to the interactions of the components with one op amp. The other option is one op amp for PI and a separate one for D. By changing Rf on the PI op amp, you only effect P gain. By changing Cf on the same circuit you only effect I gain and D gain resides on its own op amp. Select Rin say at 10K on PI then only adjust Rf and Cf for PI gain. Don't forget a lot of times you do not need the D term for many PID control applications.

#### dcbingaman

Joined Jun 30, 2021
1,065
If you want to do it even more simply, just use one OpAmp, and an ADC - do the entire PID in software. Tune the PID with fuzzy logic after putting the device though it's paces and expected edges of operating conditions.
Absolutely! This is by far the best solution for any modern PID control system. In fact it stands true for most Analog systems. Convert to digital, do all the processing you need and convert back to analog.

Last edited:

#### Ian0

Joined Aug 7, 2020
9,489
Absolutely! This is by far the best solution for any modern PID control system. In fact it stands true for most Analog systems. Convert to digital, do all the processing you need and convert back to analog.
Given the very low values of dV/dt, digital seems the best solution to me.