Electrical – A question on adding noise and low-pass filer in Ltspice

cutoff frequencyhysteresisltspicenoiseschmitt-trigger

I’m planning to implement the following Schmitt-trigger circuit:
enter image description here
(left-click to enlarge)

I made some updates with the great suggestions of jonk in my previous question:Some questions on optimizing a Schmitt trigger to eliminate possible glitches.

But now I have two points bothers me regarding these kind of circuits here:

1-) First of all, I just learned that one can add a noise to a signal as in the following way by using behavioral current:

enter image description here
Above a white noise is added to a 4Vpp 10Hz sinusoid.

But in my circuit the switch causes the input signal so wherever I add this current source I get very weird results. I just want to add around 2Vpp white noise to the inverting input of the comparator(Schmitt-trigger in this case) to see the effects of hysteresis band. How can I establish it in this case? How can I add the noise so that it adds up to the signal at inverting input?

2-) Second might sound a bad question for many of you but lets say I want to block frequencies for the signals arriving to inverting input higher than 900Hz. Would you calculate the cut off frequency just by using R9 and C1? Or R7, R9, R10 should also be taken into account when calculating low pass filter’s cut off effect here? (By the way it seems to me in hysteresis equations the resistors connected to the inverting input should not have effect on hysteresis thresholds)

Best Answer

For your first question: the voltage source has specified a resistance. In parallel with it, there's a current source which, by default, outputs a 0.5Vpp signal (the white() function). This means that this current is generated onto the (now) parallel resistance, Rser, resulting in a R*I amplitude. Therefore, Rser will set the amplitude of the noise. In your case, \$R_{ser}=3 => 3 * 0.5 = 1.5V_{pp}\$. If you need \$2V_{pp}\$, simply add an \$R_{ser}=4\Omega\$.

For your second question: the white() function generates a flat bandwidth that starts dropping at around 2*f_specified, when it's some 6dB lower. That's why you have white(2*f*time). So, the easiest approach would be to simply set your noise source for white(2*900*time). If, on the other hand, you need a lowpass filter, then, besides the obvious R8+C1, you also have R7+R_CE(Q1), to which you can also consider R8+R10+R(D3). D1 and D2 also have some parasitic capacitances, but they won't matter here. Still, R8||[R10+R(D3)] will make a voltage divisor with R7, soo they won't matter as much, provided you keep R9 much larger than R7 parallel with the whole dynamic resistance (impedance) of Q1&co. A 10k should be fine. Then, a simple 1st order is calculated with: \$\omega=2\pi{f}=\frac{1}{RC}=>C=\frac{1}{2\pi{f}{R}}=\frac{1}{2\pi{900}*{10k}}=17.68n\$. Choose an 18nF. To berify this, here's what LTspice has to say:

schem

The input is reduced a bit by the previously mentioned divisor, plus there's a minor "shelf" filter due to interaction, while the final RC does the job.


Edit: Forgot to add that for your noise to be correctly displayed and calculated in LTspice, you'll need at some 10 times its highest bandwidth, so if your highest frequency of interest is 9kHz, then make your timestep as 1/90kHz. As per the suggestion in the comment, you can use a behavioural source, directly, incorporating the signal and the noise. For my part, unless it's just some quick sketch, I'd advise to only use behavioural sources when they absolutely cannot be replaced, as they have an inherent dynamic range loss (for orders of magnitude difference) due to their calculation "on the fly" of any point that is time-dependent, and they add quite the burden of computation, even when used with the undocumented flag nojacobi. Of course, the choice is entirely yours.

I'll add one more thing: for noise and, in general, for "delicate" low/high frequencies, .opt plotwinsize=0 should be a must, to preserve the waveshape.