Simulation example: Single Sideband transceiver: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Incorporate suggested improvements)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Simulation_example:_Single_Sideband_transceiver.mediawiki -->
<!-- Simulation_example:_Single_Sideband_transceiver.mediawiki -->
= UNDER CONSTRUCTION =
This tutorial explains how a Single Sideband (SSB) signal can be generated and received. The transmitter and receiver use the filter method.
The first section of this tutorial explains how a Single Sideband (SSB) signal can be created. Rather than using any real hardware for transmission, the signal is sent via a socket to the second section of the tutorial which explains how to demodulate the received signal. The only actual hardware involved is the computer's microphone input and speaker output. In the case of a Raspberry Pi computer, which has no microphone input, an alternative is presented.


This tutorial can be performed with either GNU Radio (GR) version 3.7 or 3.8 (and later). The Graphical User Interface gnuradio-companion (GRC) is used to create a flowgraph for each section.
<code>Tested with v3.10.9.2</code><br>


== Prerequisites ==
== Prerequisites ==


* [[Guided_Tutorial_GRC|'''Intro to GR usage: GRC and flowgraphs''']]
* [[Guided_Tutorial_GRC|'''Intro to GR usage: GRC and flowgraphs''']]
* [[Sample_Rate_Tutorial|'''Understanding sample rate''']]
* [[Variables_in_Flowgraphs|'''Variables in Flowgraphs''']]


== SSB transmitter ==
== Flowgraph ==


Using gnuradio-companion (GRC) and the following Block descriptions, build this flowgraph of the transmitter section:<br>
The following flowgraph can be downloaded by clicking [[Media:SSB_demo.grc]]. Using a terminal screen, start `gnuradio-companion` and open the downloaded file.


[[File:SSB_xmt_1_fg.png|800px]]
[[File:SSB_demo_fg.png|800px]]


=== Block descriptions ===
=== Transmitter section ===


* The Options block identifies the filename for the flowgraph, a title, author, etc.
* The transmitter section is across the upper row of blocks starting with the [[Audio Source]] (your microphone).
** id: SSB_xmt_1
* The [[Band Pass Filter]] has a low frequency cutoff of 300Hz and a high frequency cutoff of 3500Hz to pass normal voice frequencies. The Gain parameter is set by the [[QT GUI Range]] block labeled "Mic gain".
** Click on File -> Save As&nbsp;&nbsp;Use the file name 'SSB_xmt_1'. the extension '.grc' is added automatically
* The [[Swap IQ]] block interchanges the Real and Imaginary components which effectively changes upper and lower sidebands.
* The microphone input is defined by an Audio Source block. The parameters are:
* The [[Selector]] block chooses which input to use, based on the [[QT GUI Chooser]] labeled "Transmit Sideband".
** Sample rate: set to 48khz (use the pull-down)
* The [[QT GUI Time Sink]] shows a 'scope trace' of the audio signal.
** Device name: for most microphone jacks built into the computer, the Device name can be left blank; for other cases, see [[Audio_Source#Device_Name]]
* The [[QT GUI Frequency Sink]] shows the frequency plot of the audio.
* For the remainder of the flowgraph, a sample_rate of 768khz is used. This value was chosen to give the 48khz audio frequency 16 samples per cycle (48000 x 16 = 768000).
* The [[QT GUI Waterfall Sink]] shows the signals on a waterfall (spectrogram) plot. The bandwidth of the audio can be seen clearly on the plot.
** Variable block
* The [[Virtual Sink]] and [[Virtual Source]] blocks provide connection points to allow a cleaner presentation of the flowgraph. They are functionally the same as drawing a line between the two points, and have no impact on the data flow.
*** id: samp_rate
*** value: 768000
* To boost the 48khz sample rate of the audio input to the 768khz sample rate, a Repeat block with an Interpolation value of 16 is used.
* The QT GUI Range block defines an Audio gain (volume) control
** id: volume
** default value: 0.5
** start: 0
** stop: 20.0
** step: 0.1
** Widget: choose whatever you like
* The value of the volume control is used as a multiplier in the Multiply Const block.
** Constant: volume
* The carrier signal (in this example is 24khz) is generated by the Signal Source block.<br>
** Sample Rate: samp_rate
** Frequency: carrier_freq
** Amplitude: 1.0
* To create a double sideband signal, the carrier signal is multiplied by the audio signal.


The Band Pass Filter creates the Single Sideband signal by passing the frequencies from 24300Hz to 27000Hz and rejecting the others. This gives a signal with only one sideband (upper) and no carrier. The audio frequencies of that signal are 300Hz to 3000Hz.
=== Receiver section ===


* For a real radio transmitter, the output of the Band Pass Filter would be fed to Radio Frequency (RF) hardware. For this tutorial, we are sending the transmit signal to a ZMQ PUSH Sink data socket connected to the receiver section.
* The transmitter signal is fed to the receiver through the [[Virtual Source]] block.
** Address: tcp://127.0.0.1:50301
* As in the transmitter section, the [[Swap IQ]] and [[Selector]] blocks choose which sideband to use, based on the [[QT GUI Chooser]] labeled "Receive Sideband".
* The paramters for the [[FFT Filter]] are set by the [[Band-pass Filter Taps]] block. Using Complex taps, the output will be only in the Upper sideband with a frequency range of 300Hz to 3500Hz.
* The [[Complex To Real]] block produces the Real part of the data stream.
* To produce a volume control, the [[QT GUI Range]] block labeled "Volume" sets a variable named 'volume' which is used in the [[Multiply Const]] block. The name "Multiply Const" block seems a little confusing because the Constant can be a variable, but it is to distinguish it from a [[Multiply]] block which multiplies two (or more) input streams together.
* The [[Audio Sink]] is the computer speaker or headphones. See "Caution" below!


=== Note for Raspberry Pi ===
== Testing ==


Since a Raspberry Pi has no audio input jack, there are two alternatives:
<b>CAUTION!</b> To avoid loud feedback, use headphones or a microphone/headset instead of the computer speaker.


# use a USB audio dongle.
<p>To start the program, click the "Execute" icon or press F6. A screen will open showing the Mic gain, Volume, sideband selections, Time, Frequency, and Waterfall displays. Both transmit and receive will be in Upper Sideband mode.</p>
# replace the Audio Source block with a Signal Source block (frequency: 600) and a Throttle block.


<p>Speaking into the microphone, you should hear yourself clearly. Selecting Lower Sideband for both transmit and receive should also work well. Note the change of the frequencies on both the Frequency and Waterfall plots.</p>


<hr>
<p>Selecting Upper Sideband on transmit and Lower Sideband on receive (or vice versa) will produce almost no sound.</p>


[[File:SSB_rcv_fg.png|800px]]
<p>To terminate the test, click the 'X' in the upper right-hand corner of the "SSB_demo" screen.
 
[[Category:Tutorials]]
[[Category:Tested With 3.10]]

Latest revision as of 21:15, 19 February 2025

This tutorial explains how a Single Sideband (SSB) signal can be generated and received. The transmitter and receiver use the filter method.

Tested with v3.10.9.2

Prerequisites

Flowgraph

The following flowgraph can be downloaded by clicking Media:SSB_demo.grc. Using a terminal screen, start `gnuradio-companion` and open the downloaded file.

SSB demo fg.png

Transmitter section

  • The transmitter section is across the upper row of blocks starting with the Audio Source (your microphone).
  • The Band Pass Filter has a low frequency cutoff of 300Hz and a high frequency cutoff of 3500Hz to pass normal voice frequencies. The Gain parameter is set by the QT GUI Range block labeled "Mic gain".
  • The Swap IQ block interchanges the Real and Imaginary components which effectively changes upper and lower sidebands.
  • The Selector block chooses which input to use, based on the QT GUI Chooser labeled "Transmit Sideband".
  • The QT GUI Time Sink shows a 'scope trace' of the audio signal.
  • The QT GUI Frequency Sink shows the frequency plot of the audio.
  • The QT GUI Waterfall Sink shows the signals on a waterfall (spectrogram) plot. The bandwidth of the audio can be seen clearly on the plot.
  • The Virtual Sink and Virtual Source blocks provide connection points to allow a cleaner presentation of the flowgraph. They are functionally the same as drawing a line between the two points, and have no impact on the data flow.

Receiver section

  • The transmitter signal is fed to the receiver through the Virtual Source block.
  • As in the transmitter section, the Swap IQ and Selector blocks choose which sideband to use, based on the QT GUI Chooser labeled "Receive Sideband".
  • The paramters for the FFT Filter are set by the Band-pass Filter Taps block. Using Complex taps, the output will be only in the Upper sideband with a frequency range of 300Hz to 3500Hz.
  • The Complex To Real block produces the Real part of the data stream.
  • To produce a volume control, the QT GUI Range block labeled "Volume" sets a variable named 'volume' which is used in the Multiply Const block. The name "Multiply Const" block seems a little confusing because the Constant can be a variable, but it is to distinguish it from a Multiply block which multiplies two (or more) input streams together.
  • The Audio Sink is the computer speaker or headphones. See "Caution" below!

Testing

CAUTION! To avoid loud feedback, use headphones or a microphone/headset instead of the computer speaker.

To start the program, click the "Execute" icon or press F6. A screen will open showing the Mic gain, Volume, sideband selections, Time, Frequency, and Waterfall displays. Both transmit and receive will be in Upper Sideband mode.

Speaking into the microphone, you should hear yourself clearly. Selecting Lower Sideband for both transmit and receive should also work well. Note the change of the frequencies on both the Frequency and Waterfall plots.

Selecting Upper Sideband on transmit and Lower Sideband on receive (or vice versa) will produce almost no sound.

To terminate the test, click the 'X' in the upper right-hand corner of the "SSB_demo" screen.