1

I have got the following Schmitt trigger circuit implemented already on a breadboard. As seen, the input signal at the non-inverting and inverting terminals of the op amp is the same, but with the addition of a RC circuit in the inverting terminal. In this way, I am comparing the input signal with a delayed version of the same signal such that I can identify peaks. I got the idea from here.

schematic

simulate this circuit – Schematic created using CircuitLab

I wanted to obtain its transfer function so as to analyse more carefully the influence of the RC network (and ultimately, the circuit itself). I obtained an expression for \$H(w)\$, created some code in Matlab to plot the transfer characteristic (magnitude and phase) of the circuit, and also implemented the circuit in TI-Tina simulator. Using the Tina's AC analysis, I also plotted the transfer characteristic... and my Matlab results differ from Ti-Tina's results.

Here the results from Matlab:

Results from Matlab

And here the results from TI-Tina:

Results from TI-Tina

For this reason I wanted to ask whether the following set of equations to obtain \$H(w)\$ is correct.

The voltage \$V_{+}\$ is:
\begin{equation} V_{+} = V_{in}\dfrac{R_{f}}{R_{1} + R_{f}} + V_{o}\dfrac{R_{1}}{R_{1} + R_{f}} \end{equation}

Considering admittances, \$V_{-}\$ is \$V_{-} = V_{in}\dfrac{G_{2}}{G_{2} + sC_{1}}\$. Putting \$s = jw\$ and \$R_{2} = 1/G_{2}\$, we have:

\begin{equation} V_{-} = V_{in}\dfrac{1}{1 + jwC_{1}R_{2}} \end{equation}

As \$V_{+}=V_{-}\$, the following expression can be obtained:

\begin{equation} V_{o} = V_{in}\dfrac{1-jwC_{1}R_{2}R_{f}/R_{1}}{1 + jwC_{1}R_{2}} \end{equation}

Therefore,

\begin{equation} H(w) = \dfrac{V_{o}}{V_{in}}=\dfrac{1-jwC_{1}R_{2}R_{f}/R_{1}}{1 + jwC_{1}R_{2}} \end{equation}

Any insights? I would appreciate your help. Many thanks.

If useful, the code I've used in Matlab is:

%--- We fix Rf and R2 and vary C1
R1 = 10;
Rf = 10e6;
R2 = 10e3;
C1 = [1 10 100 1000] .* 1e-9;

opts = bodeoptions;
opts.Title.String = '';
opts.Title.FontSize = 12;
opts.Xlabel.FontSize = 12;
opts.Ylabel.FontSize = 12;
opts.TickLabel.FontSize = 10;
opts.FreqUnits = 'Hz';
opts.Grid = 'on';

H = [];
for i=1:length(C1)
    H = [H tf([-C1(i) * R2 * Rf / R1,1],[C1(i)*R2,1])];
end

figure
hold on
for i=1:length(C1)
    bodeplot(H(i),opts);
end

legend_t = cell(length(C1), 1);
for i=1:length(C1)
    legend_t{i} = sprintf('C=%snF', num2str(C1(i) * 1e9));
end

legend(legend_t);
title({'Transfer function of Inverting Schmitt Trigger', ...
    sprintf('Rf=%dMOhm, R1=%dOhm, R2=%dkOhm', Rf/1e6, R1, R2/1e3)});
sigur_ros
  • 23
  • 4
  • 4
    A Schmitt trigger is a non linear circuit. $H(\omega)$ is describes the transfer of a linear circuit. So you cannot use $H(\omega)$ to describe the full behavior of this circuit. The simulator assumes a certain DC-state of the circuit and linearizes that state, that's the bodeplot you get. But that cannot fully describe the behavior of the circuit. – Bimpelrekkie Feb 01 '18 at 16:59
  • Ah! It is true, it is a non-linear circuit! and somehow I had missed it! Therefore, I guess the only chance to understand the circuit is to look at its transfer characteristics (i.e., histeresys, input offset, etc.)? – sigur_ros Feb 01 '18 at 17:07

1 Answers1

0

As already told by others, its not useful to apply linear frequency analysis to this, heavily non-linear circuit. Do time domain simulations with different input signals to see the behaviour.

A qualitative analysis of one, probably interesting case:

If the time constant R2 * C1 is so long that it virtually kills all variation of the Vin, you have only the average Vin at he inverting input of the opamp. This can make the circuit useful as a level detector with self-adjusting treshold.

If Vin has long periods of "no change" and the idle Vin is far from the average Vin of the active periods, you get errors when the changes start, because there's wrong average in C1.

BTW. Your Rf and R1 give only about 3uV hysteresis. I bet it's useless for anything practical. You should have bigger R1 or smaller Rf or both. The hysteresis = (R1/Rf)*Output peak to peak swing.

  • Thanks @user287001, the case you point out is interesting indeed. One question, what do you mean with "you get errors when the changes start, but there's a wrong average in C1."? – sigur_ros Feb 01 '18 at 18:09
  • @sigur_ros Lets assume your signal is noisy and its amplitude varies, you need a schmitt trigger. Let's assume the signal has bursts of positive pulses which you want detect, but between the bursts the signal is long time =0V plus the noise. The treshold slides to 0V and you can finally detect some noise peaks. When a burst starts, the treshold is at first too low, it takes some time until the treshold rises to the average. Some low voltage states can be left undetected in the beginning. –  Feb 01 '18 at 19:43
  • @sigur_ros I added a notice that can be interesting. –  Feb 02 '18 at 01:20
  • thanks for pointing this out. In fact, I was looking into how to best choose the values of Rf and R1, and I had come across one of many sources like this that explain such issue. – sigur_ros Feb 02 '18 at 12:12
  • Hi @user287001, I hope you're still around! My question is about: "If the time constant R2C1 is so long that it virtually kills all variation of the Vin, you have only the average Vin at he inverting input of the opamp.This can make the circuit useful as a level detector with self-adjusting treshold." How does time R2C1 relate to "variation" of Vin? We set the hysteresis to a given range, and when Vin is close to the min range value, the circuit responds as a level detector and not a peak detector. This seems to be related to your answer, but would you know how I could quantify "variation"? – sigur_ros Sep 20 '18 at 09:01
  • @sigur_ros History: I used the same circuit with high enough hystersis and time constant to extract pulses which had got DC offset and some unwanted lowpass filtering. the Treshold setttled automatically to the right value and an usable rectangular pulse train came out if the peak to peak amplitude of the signal was large enough to overcome the hysteresis. Try to describe what functionality you aim to get. Words quantify the variation is far too vague. –  Sep 20 '18 at 09:43
  • Thanks @user287001. The functionality of the circuit is somewhat similar to what you describe. We aim to get the max and min peak values of Vin when its amplitude is larger than the preset hysteresis. When the amplitude of Vin is very large (high peak value), the rectangular pulse happens very close to the true peak value, which is what we want. But when the peak value is just above the hysteresis, it triggers a pulse, but much later than when the signal reaches the peak. I tried adjusting the RC constant, but it doesn't solve the issue, and I kind of wanted to understand why this happens. – sigur_ros Sep 20 '18 at 12:09
  • @sigur_ros your current circuit as peak detector actually needs short time constant. It outputs HIGH if the input voltage grows fast enough. To flip the state to LOW the input voltage must fall fast enough. The needed rate can occur much later than the peak. –  Sep 20 '18 at 13:22