Wednesday, July 31, 2024

Add A Tuning Dial To The QT Frequency Sink

While making an AM Radio with GNURadio Companion, I was in need of a way to indicate the tuning frequency on the QT GUI Frequency Sink. Here is a simple way to do it.

AM Radio Design Background

Briefly, the design was to make a AM Radio Tuner which samples and displays the entire AM Radio band at once. The AM radio band in the United States extends from 540 to 1,700 kHz and is channelized into 10 kHz steps. The tuning delta frequency of 1,160 kHz (1,700-540 = 1,160 kHz) allows for a simple and convenient 1,200 kHz RTL-SDR sampling rate, thus allowing the entire AM Radio band to be sampled and displayed at once (see figure 1).

Figure 1 - Setting the RTL-SDR sample rate to 1,200 kHz allows the entire AM band to be “sucked in” and displayed at once. A Frequency Xlating Filter block is then tuned +/- 580 kHz in 10 kHz steps to select each AM Station Individually.

Using an RTL-SDR type radio and the simplified flowgraph in figure 2, the sampling rate was set to 1,200 kHz and the tuned frequency was set to 1,120 kHz (the center of the AM Band). During operation, there is no change in the RTL-SDR settings. Instead, we use a “Frequency Xlating FIR Filter” block as a channelizer to tune to each radio station. A QT GUI slider controls the main tuning of the channelizer to +/- 580 kHz in 10 kHz steps. This then allows any station to be tuned in and the frequency display always stays the same, only the channelized filter moves around invisibly in the background selecting the proper frequency for further processing (demodulation, filtering, etc.).

Figure 2 - Simplified Flowgraph of the AM Radio. By adding another Signal Source to the main frequency sink, a tuning indicator may be implemented that tracks the Frequency Xlating Filter blocks tuned frequency, thus providing a visual tuning indicator.

Tuning Indicator Implementation

To add a tuning indicator, I simply added a “Signal Source” block connected to another input to the main QT Frequency Sink block as diagrammed in Figure 2.

The sampling rate is set to the same 1,200 kHz as the RTL-SDR and the frequency of the source is controlled by the same QT Slider as the channelizer and was simply an equation that mapped the to the actual frequency being tuned.

The Source Amplitude was adjusted to get the tuning indicator in the proper position vertically as shown in figure 3.

Now I have a tracking “Tuning Indicator” that shows on the main QT Frequency Sink display what station is being tuned in, as shown in Figure 3.

Figure 3.A - When zoomed out you can see that the tuning indicator is just another signal superimposed on the frequency sink display.

Figure 3.B - When the display is set to just show the AM band signals the tuning indicator is conveniently scaled off the top and the bottom of the screen, mimicking just a couple of vertical lines to indicate where the Frequency Xlating Filter and hence, the AM radio is tuned.

Figure 3.C - When zoomed in Horizontally, the Tuning indicator nicely frames the actual tuned AM Station.

Drawbacks

There is one drawback to this approach. If you use averaging in the QT Frequency Sink block, each time you change the channelizer frequency slider, the tuning indicator source will also change, requiring re-averaging onto the display. This results in some lag for the tuning indicator to catch up with the averaging.

To overcome this, one can use the FFT Block to separately FFT and average the AM radio signals, then FFT the tuning indicator source (without averaging), and finally use a generic QT Graph Sink to display the results.

This discrete FFT Block approach works, but adds quite a bit of complexity to the flowgraph.


No comments:

Post a Comment