Pushbutton IQ Recorder with descriptive filenames: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
==Assumptions==
==Assumptions==
* GNURadio 3.10+
* GNURadio 3.10+
* directory <code>/home/<username>/data/iq_captures</code> is present on filesystem (the flowgraph will automatically find your <code>/home/<username> path</code>
* directory <code>/home/<username>/data/iq_captures</code> is present on filesystem (the flowgraph will automatically find your <code>/home/<username></code> path
==Goals==
==Goals==
====Create a File Sink with Dynamic Information in the Filename====
====Create a File Sink with Dynamic Information in the Filename====

Revision as of 05:26, 4 January 2023

Application

When doing field work, capturing Raw I/Q for post processing is a helpful way to get the best signal quality of a capture while spending minimal time in a non-lab environment. Changing filenames manually for every capture can be laborious and subject to user error. Furthermore, starting and stopping a flowgraph can be tricky if we are tuning the SDR frontend parameters to find optimal level/frequency/sample rate. If a non-descriptive filename is used such as capture_file.cfile it does nothing to describe the situation to the user during the analysis stage as it doesn't include any information about the RF samples we've captured. This is critical to the post-analysis process.

  • What was the sample rate?
  • What was the Center Frequency?
  • When was it recorded?
  • What gain setting did we use?
  • What were we even trying to capture?

These are all questions we ask after the fact, especially if a lot of time has gone by since we did the recordings.

One way to address this is to include those pieces of information in the filename

Introduction

Assumptions

  • GNURadio 3.10+
  • directory /home/<username>/data/iq_captures is present on filesystem (the flowgraph will automatically find your /home/<username> path

Goals

Create a File Sink with Dynamic Information in the Filename

  • timestamp of recording
  • radio parameters
  • User Input Note for clarity

Only Record the file on an User Input Trigger

  • Define User Input as Momentary Switch in GUI
  • Set Conditional Statement in File Sink Block

Content

The flowgraph for this tutorial is shown below along with the GRC file needed if you would like to test it out. This flowgraph is intended for use by anyone with GNURadio 3.10+ installed. It does not use an actual SDR frontend which allows users to test without hardware, but that also means that the values for center frequency and gain are merely representative so, when changed at runtime they won't be reflected in the synthetic spectrum when running the flowgraph. The aim of this tutorial is merely to demonstrate the mechanism. For an example that uses real hardware, try https://github.com/muaddib1984/wavetrap

Pushbutton iq recorder whole graph.png

Pushbutton IQ Recorder


Create Synthetic Spectrum for the Flowgraph

This screenshot shows the blocks used to generate some synthetic spectrum with intermittent narrowband carriers:

Pushbutton synth signal.png

This is what the simulated spectrum looks like when running in GNURadio:

Synth spectrum plot.gif

Create a File Sink with Dynamic Information in the Filename

In the following example we will: Use some Pythonic methods to leverage the Runtime Callbacks in our flowgraph which will allow the filenames to change dynamically based on timestamp and radio parameters.


File:.png

This portion of the flowgraph:

  • one
  • two
  • three


Timestamps

SDR Frontend Information

This section of the flowgraph is shown here:

File:.png

The parameters for the File Sink are shown here:

File:.png File:.png File:.png

User Input Note to Describe the Capture


This part of the flowgraph is shown here:


File:.png


[[File:]]


Example:

Only Trigger Recording on User Input

Using python conditional statement, we can send the I/Q samples to /dev/null until the record button is pressed (and held). When the record button is pressed, the I/Q samples will begin streaming to a file with a timestamp and radio parameters of the flowgraph's state at the time the button was pressed. When released it will send the samples back to /dev/null

/dev/Null or Filename with Python Conditional Statement

Here is a brief demo of the flowgraph in action:

File:.gif

Prerequisites