What am I doing Wrong? Please help me with my LTSpice Problem: is mdB milli-dB? - Page 1
Forum section: electronics / projects

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 07:28:47 pm
content: I don't quite get this sweep of the output of my Twin-T 50-Hz notch filter. I should see 60-dB attenuation, but it looks like I am seeing almost no attenuation, just milli-dB's and Milli-degrees?Is the sweep displaying milli-dB?

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 08:06:15 pm
content: Back to the drawing board!

author: palpurul
author_rank: Regular Contributor
timestamp: May 05, 2018, 08:21:18 pm
content: Yes, it's practically a buffer at this frequency range.

author: Neilm
author_rank: Super Contributor
timestamp: May 05, 2018, 08:39:26 pm
content: I just simulated it and got totally different results.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 09:08:12 pm
content: How come your's works and mine don't, we both have the same circuit and so what's the diff?My graph is at the output of the opamp.

author: PA0PBZ
author_rank: Super Contributor
timestamp: May 05, 2018, 09:22:27 pm
content: Quote from: SuzyC on May 05, 2018, 09:08:12 pmThe only difference I can see easily is that you are using µf and µF, Neilm is only using µ. Not sure if that is the problem here but I know LTSpice can be picky.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 09:26:14 pm
content: So, I changed the labeling of caps to match yours, no more 'f''s but with the same wrong result!Using ver 4.23I

author: PA0PBZ
author_rank: Super Contributor
timestamp: May 05, 2018, 09:40:05 pm
content: Quote from: SuzyC on May 05, 2018, 09:26:14 pmCan you post the LTSpice file?

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 09:45:39 pm
content: Thanks, the .asc is attached.

author: gamalot
author_rank: Super Contributor
timestamp: May 05, 2018, 10:06:02 pm
content: Your voltage source is wrong, clear the DC value filed (2.5V)

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 10:54:51 pm
content: It seems to me that a rail to rail single supply opamp's input pint can't handle a negative input voltage, so I biased the input just as it would be in my circuit so that the negative excursion of the sinewave would not force the input pin negative.I removed the bias voltage and this is what I get now, still quite different from what you show.But, thanks! It is really close except for the axis scaling.But why isn't it necessary to bias the opamp to keep the input voltage window within the rail to rail voltage range?

author: gamalot
author_rank: Super Contributor
timestamp: May 05, 2018, 11:04:03 pm
content: Quote from: SuzyC on May 05, 2018, 10:54:51 pmI didn't find any difference between yours and Neilm's, they give exactly the same results.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 05, 2018, 11:12:39 pm
content: Thanks gamalot and PAOPBZ and everyone else for your very generous help!

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 06, 2018, 12:22:17 am
content: Well, you actually have a very low Q factor, this is why you're observing this.Two reasons for this: first, you probably kind of goofed (don't worry, that happens to everyone!). A twin-T notch filter has a R/2C 2R/C topology. And,well, 2*39k is not equal to 68k. Seems obvious, but it took a while to just see this. We have all been fooled.Then, you have 100 nF instead of 2*47n. There, it's obviously not a mistake, because 100 nF is the closest standard value. But it will also degrade your Q-factor.And finally, with a closer match for the R/2C 2R/C, you can get an higher Q by increasing the values of the resistors (and then lowering the values of the caps accordingly), at least by 10 times, or more.With too high a Q though, the twin-T network will be much more sensitive to deviations from the ideal R/C values, so that would also be a problem.Attached is the LTSpice file with the modified values.You may want to lower a bit the resistor values that I tried here, because as is, you will see that its very sensitive to a mismatch, for instance for the 2C capacitor, so with real tolerances, it wouldn't work.Try changing the 940 pF cap to 1 nF, and see that it goes bonkers (and it's only a few percent more). So yeah, this is just to show you the way.But now you have to tweak those values to find the right compromise. Good luck.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 06, 2018, 03:50:04 am
content: SiliconWizard, thank you much for showing me how unstable these notch filters can be.I ran your notch .asc and was totally shocked by how sensitive the notch is to value drift. When I changed the 940pF to 945pf, attenuation changed from around -40dB to instead a filter output amplification of 12 dB!So I can think this type of notch filter is too unstable and expensive to build since the temperature coeff. of the 940 cap must be very low and the need to have around .1% precision resistors and capacitors is also likely too expensive.Is there a better way to make a notch filter that is more practical to build that is stable?

author: Bassman59
author_rank: Super Contributor
timestamp: May 06, 2018, 04:15:55 am
content: Quote from: PA0PBZ on May 05, 2018, 09:22:27 pmLTSpice doesn't care if you include the F in capacitance. It accepts u, μ, uF and μF as the same thing.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 06, 2018, 03:09:07 pm
content: Quote from: SuzyC on May 06, 2018, 03:50:04 amWell, notch filters in general require high-precision components. You can take a look at this TI AN:http://www.ti.com/lit/an/slyt235/slyt235.pdfIt's targeted at higher frequency notch filters, but I think you can find valuable information in it.You can find precision resistors (< 1%) for reasonable prices. As for the capacitors, the added benefit of using higher resistor values is that you can use low-values capacitors. Then you can pick precision ceramic caps that areC0G. Since it will be more difficult to find the right C/2C combination, you can use 2 caps in parallel for the 2C value. It will still be much closer to the ideal value, even with the doubled tolerance.Still, you may want to chose lower values for the resistors, which will give you lower Q, and thus wider bandwidth, because it will be very hard to get 50 Hz exactly.Also, I don't know what your application is. We can suspect it is for mains supply hum rejection. If so, you have to realize that a 50 Hz notch filter is by no means an ideal solution. In real environments, mains hum usually contains harmonics (100 Hz, 150 Hz, ...) and after attenuating the 50 Hz freq, you'll find out that you still get annoying buzzing noise. What would be your end application?

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 06, 2018, 09:47:44 pm
content: Thanks again SiliconWizard!I am dealing with used washing machines that I have re-purposed to tumble-polish semi-precious stones until the kyotes come home. The tach output on the universal motor that tows the tub is a tiny generator mounted on the rear shaft of the motor that pickups AC power freq. groans from the struggling motor at very slow speeds, like when starting up with a big load or rocks that move around in piles in water, and this gives my microcontroller fake news, bad tach readings, which confounds my dang motor control program. The harmonics are not a problem, far as I reckon.My idea is to tweek each twin-t bootstrap filter using three trim pots to get it to play in tune best I can. I figure it can't be that hard. I got me a big pile of pretty red .1uf poly film caps around that I can to use to quiet the growls.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 06, 2018, 11:14:59 pm
content: Oh I see! Well, I don't know about harmonics - you'd have to see for yourself if they would be a problem in your setup. You could still get harmonics due to the motor controller itself.Anyway, could you not do this filtering in software (I don't know what kind of signal you get)?The trim pots should enable you to get something working. I wouldn't necessarily recommend this if you were to manufacture a lot of these, but for a small series, that's manageable. If you can, I'd still recommend using C0G capacitors which are a lot more stable (temperature and voltage-wise).

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 07, 2018, 02:24:54 am
content: The observed:Harmonics of 50Hz are much smaller in amplitude than the 50-Hz chatter of the motor with rapidly changing phase angles during motor start with a large load. The tach generator seems to act like a microphone due to the vibration created in this case and picks up the motor growl.The tach output is clipped by back to back 1n4184 diodes and harmonics riding the crests of the tach signal are clipped past .75V amplitude and most of the harmonic components ride the crest of the tach waveform and are clipped off when viewed on a scope.The tach signal is fed to an RC low-pass signal with a 3dB cutoff at about 4KHz and and some additional attenuation of high freq. harmonics is accomplished by a .1uF cap placed across the tach input connector. The tach signal is then fed to a schmidt-trigger comparator to produce the 5V level that feeds an RBIE input on the MCU to develop a tach tick for each half-wave of the tach motor output.It turns out, that (observation by scope) that even with only -20dB of 50-Hz attenuation by a notch filter, the residual harmonic signal amplitude is found to be below( by a factor of two of) the schmidt-trigger hysteresis threshold I have set. When the motor is actually moving fast enough to produce 100 tachs per second, the amplitude of the tach output is more than double the growl P-Pamplitude.So what about software to do this job:The tach motor gives 8-sinewaves per motor shaft revolution. Each shaf revolution is pully reduced to the main tumbler by a ratio of 10/1. When the tub has completed one revolution, then the tach has output 160 half-cycle tach ticks. If the tub is slowly rotating at .25 RPS.then the freq. of the tach signal would be 160 tachs/4 Sec or 40 ticks in one second. A 50-Hz tach signal would give precisely 100 false tach ticks per second, so one would think that it would be certainly possible to distinguish the good tachs from the bad tachs.But the real problem is the amount of time available in a single interrupt service routine that needs to service four different interrupts during each 100uSec periodic interrupt. Time of operation counter, water level pulse width sensor, and also PC laptop to MCU controller communication, Line freq. 10mSec ticks must be accurately captured for phase control of the motor.If the MCU was fast enough, there possibly be time enough time in a 100uSec ISR to attempt to use SW to accurately tell the good ticks from the bad.IN my software rock rocker, each tach period ticks gives a speed result by counting the number of 1.6uSec ticks per tach tick. SW would have to be aware that during a slow start of the motor that a sudden decrease of tach period to steady 10mSec/tach ticks ticks is an anomaly. It would have to detect that a somewhat steady train of 10mS tacks, occurring suddenly from a ramp up of speed from a stalled motor condition would mean that false tach ticks periods are being reported and the target motor speed has not been reached and the ISR should instead feedback to the PID motor control routine that it has encountered a stalled condition.But do I have time enough to do all this with a 200nSec instruction clock using an 100uS periodic ISR and yet have enough time to do all the rest of the housekeeping?

author: mikerj
author_rank: Super Contributor
timestamp: May 07, 2018, 11:20:47 am
content: Perhaps easier to forget the tachometer/generator and stick a few magnets on the drum pulley and use a hall sensor?

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 07, 2018, 02:40:23 pm
content: The mere size of the drum pulley means that I would have to paste 80 magnets on this nylon faux Ferris Wheel to get the same resolution afforded to my MCU controller by the existing motor tach.It just doesn't rock. Matching t's rocks.I think I have now constructed a twin-t notch filter that works very well, and it was much easier to make the t's sing in tune than I first thought.I now realize that a twin-t notch filter is a beautiful device which loves symmetry and perfect matches in both values and ratios.Next I realized that the non-standard values for resistors and capacitors to create this symmetry of design is really very easy to achieve just by matching and doubling up/paralleling of the individual parts required.So nice to do when one has a pile of same-valued temperature stable caps and resistors on hand.It's also notable that Linear Tech, Maxim and Texas Instruments would have you to believe that you need to use an expensive opamp when an ordinary LM358 in a bootstrap twin-t circuit will work just as well with a high Q at these low notch frequencies.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 07, 2018, 03:26:33 pm
content: Beware: Fake Twin-T CircuitsLost several hours of my life trying to get this circuit to work.If one googles "pictures of notch filter circuits", the one that stands out so well, because it is presented in bright colors, is the first notch circuit example presented by the website and this circuit is touted as being both simple working well. It uses only two capacitors and two resistors to tune the frequency and uses only one opamp.Attached is the link to this worthless circuit.http://www.radio-electronics.com/info/circuits/opamp_notch_filter/opamp_notch_filter.phpFake News. LTSpice it and and you can see..it just doesn't work!There is no link on the website to contact them to report this problem.

author: SuzyC
author_rank: Frequent Contributor
timestamp: May 07, 2018, 04:16:24 pm
content: On the other hand, the black hole filter shown on:http://www.circuitstoday.com/band-stop-filterIs simple and works perfect!