User:Duggabe: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
(complete section 1)
Line 1: Line 1:
<!-- AM_tutorial.mediawiki -->
<!-- AM_tutorial.mediawiki -->
The first section of this tutorial explains how an Amplitude Modulated (AM) 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.
The first section of this tutorial explains how an Amplitude Modulated (AM) 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.


Line 12: Line 11:
== AM transmitter ==
== AM transmitter ==


Using gnuradio-companion (GRC) and the following Block descriptions, build this flowgraph of the transmitter section:
Using gnuradio-companion (GRC) and the following Block descriptions, build this flowgraph of the transmitter section:<br>


[[File:AM_transmit_fg.png|900px]]
[[File:AM_transmit_fg.png|900px]]
Line 25: Line 24:
** 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]]
** 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]]
* For the remainder of the flowgraph, a sample_rate of 768khz is used. This value was chosen to give the 48khz carrier frequency 16 samples per cycle (48000 x 16 = 768000).
* For the remainder of the flowgraph, a sample_rate of 768khz is used. This value was chosen to give the 48khz carrier frequency 16 samples per cycle (48000 x 16 = 768000).
** Variable block<br>
** Variable block
    id: samp_rate<br>
*** id: samp_rate
    value: 768000
*** 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.
* 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
* The QT GUI Range block defines an Audio gain (volume) control
Line 39: Line 38:
** Constant: volume
** Constant: volume
* To create an AM signal, the carrier signal is multiplied by the audio signal plus one. The constant 1 creates the carrier when no audio is present.
* To create an AM signal, the carrier signal is multiplied by the audio signal plus one. The constant 1 creates the carrier when no audio is present.
** Add Const block<br>
** Add Const block
    Constant: 1.0
*** Constant: 1.0
* The carrier signal (in this example is 48khz) is generated by the Signal Source block.
* The carrier signal (in this example is 48khz) is generated by the Signal Source block.<br>
** Note: there is no correlation between the audio sample rate and the carrier signal frequency.
** Sample Rate: samp_rate
** Sample Rate: samp_rate
** Frequency: 48000
** Frequency: 48000
Line 60: Line 60:


=== Test transmitter section ===
=== Test transmitter section ===
To test the transmitter, generate and run the flowgraph. 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 volume control.


== AM receiver ==
== AM receiver ==

Revision as of 20:32, 10 April 2020

The first section of this tutorial explains how an Amplitude Modulated (AM) 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.

Prerequisites

AM transmitter

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

AM transmit fg.png

Block descriptions

  • The Options block identifies the filename for the flowgraph, a title, author, etc.
    • id: AM_transmit
    • Click on File -> Save As  use the file name 'AM_transmit'. the extension '.grc' is added automatically
  • The microphone input is defined by an Audio Source block. The parameters are:
    • Sample rate: set to 48khz (use the pull-down)
    • 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
  • For the remainder of the flowgraph, a sample_rate of 768khz is used. This value was chosen to give the 48khz carrier frequency 16 samples per cycle (48000 x 16 = 768000).
    • Variable block
      • 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: 1.2
    • start: 0
    • stop: 10.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
  • To create an AM signal, the carrier signal is multiplied by the audio signal plus one. The constant 1 creates the carrier when no audio is present.
    • Add Const block
      • Constant: 1.0
  • The carrier signal (in this example is 48khz) is generated by the Signal Source block.
    • Note: there is no correlation between the audio sample rate and the carrier signal frequency.
    • Sample Rate: samp_rate
    • Frequency: 48000
    • Amplitude: 0.5
  • The QT GUI Time Sink gives a visual representation of the transmitted signal.
    • Number of Points: 4096
    • Sample Rate: samp_rate
    • Number of Inputs: 2
  • For a real radio transmitter, the output of the Multiply block would be fed to band-pass filters and then to Radio Frequency (RF) hardware. For this tutorial, we are sending the transmit signal to a ZMQ PUB Sink data socket connected to the receiver section.
    • Address: tcp://127.0.0.1:50001

Note for Raspberry Pi

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

  1. use a USB audio dongle as is shown in the flowgraph.
  2. replace the Audio Source block with a Signal Source block and a Throttle block.

Test transmitter section

To test the transmitter, generate and run the flowgraph. 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 volume control.

AM receiver

Block descriptions

Testing