Simulation example: Narrowband FM transceiver

From GNU Radio
Revision as of 02:47, 12 January 2021 by Duggabe (talk | contribs) (initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is a work in progress

This tutorial explains how a Narrowband FM (NFM) signal can be generated and received. Rather than using any real hardware for transmission, the signal is sent via a socket from the transmit section to the receive section. 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, three alternatives are presented.

This tutorial can be performed with GNU Radio (GR) version 3.8 and later. The Graphical User Interface gnuradio-companion (GRC) is used to create a flowgraph for each section.

Prerequisites

NFM receiver

Flowgraph

Using gnuradio-companion (GRC) and the following Block descriptions, build this flowgraph for the receiver section:

NFM rcv fg.png

The GR version 3.8 file can be found at [1] Copy and paste it into a local file as `NFM_rcv.grc`

Block descriptions

Data is received from the transmitter via a ZMQ_SUB_Source at a sample rate of 576kHz. It is filtered to a bandwidth of 6kHz and decimated (reduced) by a factor of 3, giving an output sample rate of 192kHz. A Simple_Squelch mutes the audio when the input is less than the squelch level. The NBFM_Receive block demodulates the input and produces an output sample rate of 48kHz which matches the desired audio rate. The Multiply_Const block implements a Volume control.

NOTE: Change the address of the ZMQ_SUB_Source to `tcp://127.0.0.1:49203` so it will connect to the transmitter.

Test receiver section

To test the receiver, generate and run the flowgraph. After a few seconds, a GUI window will open showing Volume and Squelch controls as well as a waterfall spectrum display. Note that the waterfall will not be running since there is no input data. To terminate the process cleanly, click on the 'X' in the upper corner of the GUI rather than using Control-C.

NFM transmitter

Flowgraph

Using gnuradio-companion (GRC) and the following Block descriptions, build this flowgraph for the transmitter section:

NFM xmt 1 fg.png

The GR version 3.8 file can be found at [2] Copy and paste it into a local file as `NFM_xmt.grc`

Block descriptions

TO DO

Note for Raspberry Pi

Since a Raspberry Pi has no audio input jack, there are three alternatives:

  1. use a USB audio dongle and a microphone
  2. use a USB headset with microphone
  3. use a USB webcam with microphone

Testing

When using GRC, doing a Generate and/or Run creates a Python file with the same name as the .grc file. You can execute the Python file without running GRC again.

For testing this system we will use two processes, so we will need two terminal windows.

Terminal 2

  • Open another terminal window.
  • change to whatever directory you used to generate the flowgraph for NFM_rcv
  • execute the following command:
   python3 -u NFM_rcv.py
  • After a few seconds, a GUI window will open showing Volume and Squelch controls as well as a waterfall spectrum display.

Terminal 1

  • going back to the GRC window, since you just finished building the `NFM_xmt.grc` flowgraph, you can just do a Run. After a few seconds, a GUI window will open with the Audio gain control and the GUI Frequency Sink.

Speaking into the microphone should show a change in the pattern on the QT GUI Time Sink. The level of modulation can be adjusted with the transmit gain control. You should hear your voice from the speakers. The speaker volume can be adjusted with the receive volume control.

To terminate each of the processes cleanly, click on the 'X' in the upper corner of the GUI rather than using Control-C.

What do to next

TO DO