Help with DIY Spectrum analyzer IF filter - Page 1
Forum section: electronics / projects

author: Warsp
author_rank: Contributor
timestamp: November 28, 2024, 06:22:30 am
content: Hi all,I have been trying to design an audio range swept spectrum analyzer and am running into issues with my 32.768kHz crystal filter going in and out of self oscillation. I have based it off the design of a HP SA filter linked below and added my own modifications. So far I have tried reducing the Q by adding R20 and reducing the gain of each stage by reducing R1, but I am not sure if something else is at play. If anyone has any idea what could be going wrong, please let me know.-Warsphttps://xdevs.com/doc/HP_Agilent_Keysight/3580A.pdf(p.162)

author: coppercone2
author_rank: Super Contributor
timestamp: November 28, 2024, 06:27:34 am
content: I have no idea but the first thing that comes to mind is decoupling, I don't see any. I don't think just because its a transistor means that decoupling could hurt. I would try 100nF

author: Warsp
author_rank: Contributor
timestamp: November 28, 2024, 06:39:41 am
content: I have placed a few decoupling 0.1uF capacitors on the power rails and assembled the filter on a copper clad board in order to attempt to rule out noise related issues. There could be other noise sources, but I do not think this is a noise related issue.

author: ftg
author_rank: Frequent Contributor
timestamp: November 28, 2024, 08:02:52 am
content: 100nF has a rather high reactance at 32kHz, you may want to add some larger tantalums and electrolytics to the power rails.As the feedback path for the oscillation could be through the supply rail.

author: coppercone2
author_rank: Super Contributor
timestamp: November 28, 2024, 08:43:42 am
content: have you tried also just one circuit, instead of three?I always found this circuit type interesting and I have been meaning to try to build a crystal filter for a long time (for low frequencies)also, 12.5pF is small, I have no idea if its related but when you are almost in the single digit pico farad, prototyping can get hard (in general)alot of that circuit seems like it has really insensitive values but 12.5pF is touchy.. sometimes with filters its possible to rescale components to get rid of really small valuesIs it possible to rescale that stuff to turn that 12.5pF into like 50pF ?

author: Kleinstein
author_rank: Super Contributor
timestamp: November 28, 2024, 08:53:18 am
content: The amplifier part has relatively poor power supply rejection. This make coupling via the supply likely. The type of amplifier is relative to GND at the input and relative to the supply at the output. I would consider a different amplifier type or maybe feedback from the output to input (gate side).At the supply one could consider a separate RC filter for the supply for every stage (e.g. some 10 ohm + 100 nF + 10 or 100 µF).p.s.: Another possible coupling is via the inductors.

author: Warsp
author_rank: Contributor
timestamp: November 28, 2024, 09:16:39 am
content: Quote from: ftg on November 28, 2024, 08:02:52 amI added a couple large electrolytic capacitors to the power rails but the oscillation is still present.

author: Warsp
author_rank: Contributor
timestamp: November 28, 2024, 09:24:46 am
content: Quote from: coppercone2 on November 28, 2024, 08:43:42 amThe first stage works relatively well on its own, but every stage added increases the intensity of the oscillations.Quote from: coppercone2 on November 28, 2024, 08:43:42 amThe 12.5pF capacitor is actually a 5.1pF capacitor in parallel with a trimmer. The purpose of this is to neutralize the shunt capacitance present in the crystal. Page 50 of the HP manual I linked above goes into much more detail on how this works if you are interested.

author: tggzzz
author_rank: Super Contributor
timestamp: November 28, 2024, 09:38:26 am
content: A photo of your construction might yield useful information.If adding more gain stages increases the problem, that suggests coupling from later stages to the earlier stages.If you reverse the order of the gain stages, does that change the behaviour?Try inserting your finger into/onto the circuit, to see if that alters the behaviour.The coupling might be via the PSU lines.ensure the PSU wires run from the supply to the last gain stage then to the first gain stage. The large swings in later stages won't "go past" the first stagedecouple each gain stage separately, with a separate (small) resistor and capacitorEmitter and source followers can oscillate at surprisingly high frequencies. That is easily seen on solderless breadboards with long wires, but is less likely on PCB/manhattan constructions with short wires.

author: Warsp
author_rank: Contributor
timestamp: November 29, 2024, 07:18:45 am
content: I have followed tggzzz's and kleinstein's suggestions and completely revamped the power distribution in the filter, but the oscillations are still present. I have noticed however that increasing the gain of stage 2 by connecting a 0.1uF capacitor across R5 causes the filter to go into full self oscillation, while doing this on the other stages does not cause this. Another interesting thing that I noticed is that I can amplify the desired portion of the filter output by shorting C4, but this also causes the filter Q to decrease.As per suggestion, I have included a photo of the filter construction in addition to an updated schematic.

author: Kleinstein
author_rank: Super Contributor
timestamp: November 29, 2024, 11:47:24 am
content: shortening C4 essentially removes the crystal and just has the transformer as the main signal path.The input amplifier as shown also has poor power supply rejection. One should have a filtered supply at least for R4.

author: tggzzz
author_rank: Super Contributor
timestamp: November 29, 2024, 12:46:30 pm
content: In addition, I'd try:lowering the PSU filters' corner frequency from the current 6kHz. Every order of magnitude helpsshorting Q5's base to ground to check that kills the oscillation. Repeat with (all the) Q1's base. Shorting could be with a wire or with a suitably large capacitor.waving hand+fingers around the circuit to try to increase capacitive coupling from output to input. You're looking to find anything that increases the probability/amplitude of oscillation, since that can indicate where the feedback is occurring

author: moffy
author_rank: Super Contributor
timestamp: November 29, 2024, 09:30:49 pm
content: In dealing with high impedances and stray coupling you might want to try a small shielded box over the crystal filter section, decoupling the stray capacitances from the gain stages. It can be built out of small bits of PCB material.

author: shabaz
author_rank: Frequent Contributor
timestamp: November 29, 2024, 11:33:00 pm
content: I've never built a crystal filter, so I'm speculating, and could be completely wrong:At least from a birds-eye view, to me it looks like it might be very difficult to build and adjust. This circuit is even more complicated than just a single filter. After binning and finding the appropriate crystals, you've got quite a lot of adjustments to still do in the circuit (each stage appears to have at least three adjustments).Maybe it would be easier to settle on just a single bandwidth, and build a simpler filter (still difficult to do, but relatively simpler!) constructed of a chain of passive networks of crystals, with any amplification and matching going on at the overall input and output of that chain of crystals. Your bandwidth would be controlled through careful positioning of the humps (i.e. you'd need a hundred or so crystals maybe, and check them all to find the few you'd use, i.e. a test fixture would be needed for that).Some complexity would be reduced, but so would the ability to change the bandwidth (unless it was say a pluggable module).

author: RFDx
author_rank: Regular Contributor
timestamp: November 30, 2024, 05:29:22 am
content: Quote from: Warsp on November 28, 2024, 06:22:30 amReal oscillations or rather filter ringing due to the (very) narrow filter bandwidth and inappropriate high sweep rate? Did you do a standalone test with a slow manual sweep just on the passive filter stage(s)?The crystals used in the IF unit of the HP 3580 AF spectrum analyzer are certainly not comparable with the miniature clock crystals you employ. Making an almost exact copy of the IF circuit from the service manual will not give you the results you are expecting.The critical compensation capacitors (12.5pF) are imo too large and completely distort the amplitude response of the filter. The crystal static capacitance is quite small. An example is attached.Owing to the very high crystal series resistance, switching between different filter load resistances will only have a negligible effect on the actual filter bandwidth but a major effect on filter loss.

author: Warsp
author_rank: Contributor
timestamp: November 30, 2024, 09:26:44 am
content: I decided to switch the filter to a separate power source from the rest of the circuits in order to eliminate the possibility of another circuit causing issues. I also measured the noise on the power rail, and found that at most the noise ranged from +/-10mV. Most of the noise appears to be coming from other sources, so the efforts of trying to filter the power supply seem to have been somewhat successful.I was able to reduce a portion of the oscillations by adding a 1k resistor to ground after C16, effectively creating a high pass filter at the input. I also noticed that stage 2 seems to be causing issues since bypassing it with a wire causes the filter to work for the most part. When stage 2 is removed, stage 1 also stops oscillating, so their is still feedback somewhere. I can't see any change in the noise on the power rail when stage 2 is not present, but there is only so much that can be seen with an analog oscilloscope. I will continue to look into the possible issues with stage 2.Another thing I noticed is that a ~3kHz oscillation can be seen sometimes in parts of the filter and in the output. Could one of the components, such as the inductor or the transformer, be oscillating and causing some sort of cascade failure? I think this could also be a harmonic of something, but its frequency seems a little to low.

author: Warsp
author_rank: Contributor
timestamp: November 30, 2024, 09:27:42 am
content: Quote from: RFDx on November 30, 2024, 05:29:22 amI set a very slow sweep rate of around 1Hz and the oscillations were still present.Quote from: RFDx on November 30, 2024, 05:29:22 amThe reason I kept the compensation values rather large and added load resistors was that lowering the compensation capacitance caused a large decrease in gain in the desired portion of the waveform to the point where the filter became useless, and the load resistors were necessary to keep the filter from going into full self oscillation.I have however followed your suggestions since I figured out how to fix some of these issues.

author: Warsp
author_rank: Contributor
timestamp: November 30, 2024, 09:33:19 am
content: On a side note, choosing this complicated filter topology was probably not one of my brightest ideas, especially since I am still a novice at electronics and lack any sort of degree. Like Shabaz suggested, something like a crystal ladder filter should have been used, and would have greatly reduced the complexity and time used. It does seem like there is hope for the current filter to work, so this isn't a complete waste.

author: tggzzz
author_rank: Super Contributor
timestamp: November 30, 2024, 10:04:03 am
content: We all remember pushing our knowledge and understanding, creating things that sort-of worked. It is fun, and the good thing is that electronics is a wide field so it will always be possible to do thatIf you want a bandpass filter, how about making one with a Q of, say 15000 and sharp skirts of 140000dB/decade - and a sweepable centre frequency? With 10% resistors and capacitors and one simple generic ICI needed to do that back in the late 70s, to reduce noise. The dynamic range was limited, but a quick experiment with modern components leads me to believe it is not such a problem now.Here's a plot using modern components:https://www.eevblog.com/forum/testgear/ad3-or-budget-bench-setup/msg5546397/#msg5546397

author: Manul
author_rank: Super Contributor
timestamp: November 30, 2024, 10:53:16 pm
content: My two cents suggestion would be to turn inductors by 90 degrees in adjacent stages (minimize coupling) or even better - use toroidal core or other "shielded" inductors.P.S. it should be easy to test if unwanted coupling is indeed magnetic between inductors/transformers. Find a small ferrite stick and try to make it worse by introducing more coupling.

author: coppercone2
author_rank: Super Contributor
timestamp: November 30, 2024, 10:56:46 pm
content: what type of crystal is recommended for this circuit?I also thought, get rid of the zig zag.... and since its only passing a signal between stages... what if you made a seperate PCB for each stage? And used a twisted pair to carry the signal

author: Warsp
author_rank: Contributor
timestamp: December 01, 2024, 10:58:43 am
content: Quote from: Manul on November 30, 2024, 10:53:16 pmI turned the inductors and now the coupling is much lower, so magnetic coupling was obviously a big issue. I have now turned the inductors right side up in order to have the strongest magnetic fields pointing away from the other parts of the filter.Quote from: coppercone2 on November 30, 2024, 10:56:46 pmI couldn't really find anything on the internet about a suggested crystal type, but I do not think tuning fork crystals are the ideal crystal type to use.Quote from: coppercone2 on November 30, 2024, 10:56:46 pmGood point. I plan on moving at least stage 2 since the stages being so close together isn't helping matters.I also realized that their is still some coupling through the power supply, particularly through the first emitter follower which I forgot to filter. Fixing that will hopefully reduce the coupling even more.

author: Warsp
author_rank: Contributor
timestamp: December 01, 2024, 11:03:28 am
content: Quote from: tggzzz on November 30, 2024, 10:04:03 amThis whole project could have been replaced with a single device running a fft, but that wouldn't have been as fun. It is amazing what modern hardware can do.

author: tggzzz
author_rank: Super Contributor
timestamp: December 01, 2024, 05:58:00 pm
content: Quote from: Warsp on December 01, 2024, 11:03:28 amN-path filters are amazing in a different way. The only semiconductor I used in the 70s was a 4066 analogue switch.

author: LaserSteve
author_rank: Super Contributor
timestamp: December 02, 2024, 04:58:14 pm
content: I have a few leftover large cased crystals around 39 Khz that planar, thus are not forks. I can drop you one in the mail if you wish. Might make tuning easier. Forks have wonderful properties , but they have some bad modes too.Drop me a PM.Steve

author: Warsp
author_rank: Contributor
timestamp: December 03, 2024, 10:06:22 am
content: Quote from: LaserSteve on December 02, 2024, 04:58:14 pmThanks for the offer! I will probably keep this strictly as a prototype though, so the slightly crappy fork crystals will do.

author: Warsp
author_rank: Contributor
timestamp: December 03, 2024, 10:15:03 am
content: I believe I have eliminated most of the magnetic and PSU coupling, but the oscillations are still there. I grounded C4, the compensation capacitor connected to the transformer, and the oscillations decreased dramatically. I have reason to believe that there is some sort of coupling through the transformer, so I will buy a better transformer type with my next Mouser order and see if that fixes it. Thanks to anyone who gave suggestions, you guys taught me a lot of stuff about eliminating noise and coupling!