Close

Superheterodyning Technique

A project log for Affordable Spectrum Analzyer

Analyze electrical signals using a raspberry pi with a user interface designed for students, hobbyists, and other beginners.

dan-kislingDan Kisling 07/10/2016 at 19:400 Comments

This log is going to get a bit more technical than some of the other logs. Don't get discouraged from the language or the techniques used. The more sophisticated input method (spoiler alert) turned out to be not as good as the simple one. This log is here to describe this superheterodyning technique to those who are interested. By no means is this log entry something that needs to be understood in order to build your own spectrum analyzer. I find this stuff interesting, so I included it for others who might feel the same way.

Let's start this log by talking about sampling. Nyquist sampling states that we need to sample at least twice the frequency of the highest frequency we want to capture. Or, at least, this is how most people understand Nyquist sampling. But the truth lies within the details. In fact, you need twice the frequency of the total bandwidth you would like to capture. To explain this point, lets talk about a 10KHz bandwidth signal starting at 150kHz. So that signal lies completely within 150kHz and 160kHz. One might believe that you would need to sample at 300kHz minimum in order to capture the signal without aliasing, and they are correct. If you sampled at 100kHz, for example, and you just displayed your FFT from 1kHz to 100kHz, you would see your signal (backwards) from 40kHz to 50kHz. But there's something magic to that: we actually did capture all of our information, it's just in the wrong place and backwards. We would get into trouble if we had a 60kHz bandwidth, as the signal would fold on itself when sampling at 100kHz. But as long as our input bandwidth is low enough and we know how to correct the signal, we can use this to our advantage.

This is where we get fancy. Now lets multiply the input signal by a sinusoidal oscillator. This effectively allows us to move our signals frequency in the frequency domain. Add into the mix a very sharp band pass filter. With these two elements, we can take a large bandwidth and section it into smaller bandwidths. For example, take a 30KHz bandwidth signal. Multiply it by a sinusoid at one frequency (we'll end up calling this a local oscillator), and then pass it through a 10kHz bandpass filter (the filter always filters the same frequencies), and then sample it. Then change the local oscillators frequency by 10kHz. Run that signal though the same bandpass filter, and then sample it. Finally, move the oscillator one more increment of 10kHz before placing it through the bandpass filter and sampling it. What we have done is allowed ourselves to take a 30kHz bandwidth signal, and sample it 3 times and each time we just need a 10kHz bandwidth requirement in order to fulfill our Nyquist criteria. There is a great deal more I could say about this matter, such as the particulars about the filters and other bandwidth requirements, but I think this post will suffice for now. As I said earlier, this log entry is not actually necessary in order for one to recreate our spectrum analyzer.

This method of multiplying by an oscillator to move the signal to a higher frequency is more or less what superheterodyning is. Read up on superheterodyne radios if you want some more info on this kind of stuff.

The bottom line is this method allows us to take a large bandwidth signal and divide it into smaller bandwidths which allows us to sample at slower speeds. Ultimately, we hoped this would allow us to capture large bandwidths on the raspberry pi, as we were concerned with how we were going to sample at such a high speed.

A whiteboard sketch of our signal processing idea

If you followed that explanation above, great. It's a bit easier to see graphically. I may upload a video explanation later at some point.

As you'll see in the next log, we will create hardware that incorporates this method, but also allows us to override it and take samples in a much simpler method.

Discussions