Spectrum Analyzer Pt. 1 - Planning and Sweep Generator

Posted on July 6, 2018

To get better at building RF circuits, I decided it would be fun to build a (probably terrible) low frequency spectrum analyzer. I began buy sketching out a general layout for the different functional blocks I would need.

The spectrum analyzer works essentially by sweeping a filter along the input signal, and using an oscilloscope in X-Y mode to display the spectrum by feeding the sweep voltage to the X input and the filter output (rectified preferably) into the oscilloscope Y input. In practice however, it is much easier to shift the frequency and sweep it through a fixed filter than to make a tunable filter with a fixed passband width.

  1. First, my input signal (0-15MHz) is fed into an switched attenuator to make sure I don’t distort my mixer outputs

  2. Next, the signal goes through a low pass filter to remove any images before the signal is mixed

  3. I then mix the signal with a 57.7MHz LO to create a signal that is between 57.7MHz and 72.7 MHz (the odd value is because my VCO has an odd frequency range, and I’m targeting a 10.7MHz IF in the next mixer)

  4. I then filter out the lower sideband of the mixer output with a 57.7 MHz high pass filter. The steepness of the filter isn’t too critical here (I hope) because I have a decent amount of room below my final IF for extra products to appear.

  5. The signal is then mixed with my swept 47-62MHz VCO. The VCO’s sweep will change which frequency of the input appears in the passband of the bandpass filter

  6. The signal passes through a narrow bandpass filter to give a sharp response on the spectrum output

  7. The signal then passes through a logarithmic RF detector to give a logarithmic graph on the spectrum analyzer. The output of this stage is fed to the oscilloscope Y axis input

The VCO has two stages:

  1. A ~100Hz sawtooth signal is generated by the sweep generator. This signal is also fed into the oscilloscope X axis input.

  2. The output of the sweep generator is used as the control signal for the voltage controlled oscillator. The oscillator output is fed into the second mixer as the LO.

Sweep Generator

The circuit for the sweep generator is essentially the same as w2aew’s 3 transistor sawtooth generator, with the component values changed so that it will work at 5V with the transistors I have. The schematic is shown below:

(the VCO will be covered in another post when I get the part)

The basic principle of operation is that Q1 and R16 and R17 form a constant current source which causes the voltage across C14 to rise linearly. When the voltage across C14 (marked by ramp) reaches 2.5V + Q2’s Veb, Q2 will turn on and allow current to flow into the base of Q3, causing it to turn on as well. The two transistors will stay on until Vramp is almost 0, at which point both transistors turn off allowing C14 to charge up again, generating a sawtooth wave.


Before I began soldering, I drew a rough sketch of the layout I wanted for my circuit. I wanted to do a manhattan style build, so I drew in square pads where I needed to solder component leads together.

I then glued on some squares of copper clad fiberglass in the arrangement I had drawn out in my sketch.

I then soldered in R16 and R17. I have a large stockpile of surface mount resistors and capacitors so I tried to use them as much as was practical in this project. Unfortunately, I didn’t have any 3K resistors (surface mount or otherwise), so I put 3 10K resistors in parallel.

I then installed C14, however, as I didn’t have any 10nF capacitors on hand, I paralleled 2 2.2nF capacitors to give me 4.4nF. It later turned out that 10nF was far too little capacitance, so the difference between 4.4nF and 10nF was not really an issue here.

I then installed Q1, making sure that the flat of the transistor was on the left, putting the emitter to the top of the image.

Next, I installed the remainingn pads from my sketch above

I installed Q2 and Q3 next, substituting a MPSA42 NPN transistor in place of the 2N3904 because I had more of them. Also, in the sketch I drew the flat on Q3 on the wrong side, it should be to the right, putting Q3’s emitter to the bottom of the image.

I then installed R19 and R20, using a through hole resistor for R19 because I needed to connect between the top left pad and the bottom right one. I forgot to get a good picture of R20, it’s easier to see in the next picture.

Finally, I attached power leads to the board, connecting +5V to the top right pad, and ground to the ground plane.

With the circuit complete, I connected it to a 5V power supply and hooked up my oscilloscope, with channel 1 connected to Q1’s collector, and channel 2 (bottom, and evidently inverted (oops)). The sweep on channel 1 looks ok, with some distortion on the bottom. However, as the frequency counter on the top right shows, at 5.6kHz the sweep speed is far too fast, and will not give time for the spectrum analyzer to work properly.

Channel 1 - top, .5V/div, channel 2 - bottom, 2V/div - 50us/Div

To fix this, I replaced C14 with a 100nF surface mount capacitor, as a larger capacitor will take longer to charge up, giving a longer sweep time.

Channel 1 - top, .5V/div, channel 2 - bottom, 2V/div - 0.5ms/Div

Hooking the circuit back up to the scope, the sweep frequency has dropped by a factor of 20, and most of the distortion on the sawtooth has gone away. Also, with the proper polarity on the Y input, some negative pulses are visible whenever Q2 and Q3 discharge C14. The sweep frequency of 280Hz is still a bit high for my purposes, but it is close enough that I can adjust it later if need be.


I decided after this post to add a switchable sweep speed to the sweep generator by switching the capacitor values.

By connecting C1 and C2 to ground via the switch, the capacitance at the collector of Q3 is increased, lengthening the time it takes to charge up the capacitance.

I began by attaching another pad next to C14, and cutting a split in it with a knife, so that the two legs of the switch could be separated.

I then attached C1 and C2 by soldering 3 100nF capacitors to one side of the split pad, then soldering in a 2.2nF electrolytic capacitor.

Finally, I soldered a 2 position DIP switch to the two halves of the pad and ground.


C14 connected

C2 and C14 connected

C1, C2 and C14 connected

All images - Ch1 - top, 0.5V/div, Ch2 - bottom, 2V/div, 10ms/div

I set my oscilliscope similar to before, but with a horizontal sweep of 10mS/div and captured an image of each capacitor setting. I also recorded the frequency measurement of each switch setting, shown in the table below.

Capacitors Connected Capacitance Frequency
C14 only 100nF 275Hz
C2 and C14 400nF 71.7Hz
C1 and C14 2300nF 13.0Hz
C1, C2, and C14 2600nF 11.5Hz

Stay tuned for part 2!