How the Hardware Setup Should Look.

Connect the RTL-SDR input to the raspberry pi and connect radio antenna source to the RTL-SDR input so that we can see real radio data in our program. Make sure to elongate the antennas fully so that you can receive a strong radio signal.

Antenna set Up

Take your first radio data

We are going to open up your newly installed GNU Radio using a command in the terminal:

  • Type: gnuradio-companion and click enter
  • You are welcome to visit the links below to learn more about the GNU Radio and the blocks we are about to create.
    Tutorials
    More info

    1. After gnuradio opens, we will make a simple flow chart

    I also modified my default Variable box to a Value: 1M, but this is only a personal preference.

  • Click the white magnifying glass in the top right of your screen and use the search engine on the right to locate the RTL-SDR Source block and QT GUI Sink.
  • You can connect the blocks together by dragging one connection to the other.

  • Finding RTL-SDR Block

    RTL_SDR Block

    Finding Sink Block


    GUI Sink Block

    Connecting the blocks to each other so that they can interact.

    Connecting the Blocks
    2. Set the correct variable numbers to change how frequently we will sample data.

  • Double click on the variable block and type in 1000000 and select okay.
  • We also want to change the center frequency to 100,000,000.

  • Double click the QT GUI Sink and change the Center Frequency (Hz) to 100000000 and select okay.

  • 3. Now we can save the block formation in your raspberry pi

    We want to save the block sheet with the title LastName-Date.

  • File - Save - Documents Folder - Title your file - Save

  • 4. Now that this file is saved, we can generate and execute to collect data.
  • Click Generate shown below and wait 10 seconds before clicking Execute.
  • Where to Find the "Execute" and "Generate" Flow Graph Buttons.

    Genterate the Flow Graph
    5. A new window will pop up that displays incoming radio data.

    We want to look at what frequencies are being displayed. You can view the data in multiple ways.

  • Click on the box beside Display RF Frequencies
  • Click on the tabs at the top of the screen to view the data in “Frequency”, “Waterfall”, “Time Domain”, or “Constellation” display.

  • This is the data that we collected.
    First Data Set
    Congratulations, you have collected your first radio data set!

    Create a Spectrum Flowchart and Save the Data

    Now that you've familiarized yourself with gnuradio, it's time to create a more complex flowchart. The goal of this flowchart is to create a spectrum estimator, which will help us observe which frequencies our radios can record. The final part of this lesson goes over how to save and locate your recorded data.
    1. Start off with creating a new flowchart.

    This flow chart will be named LastName-recorded-Date

  • Click the page icon with the plus at the top of your screen shown below.

  • First Data Set

    2. Change the settings in the Option block to run and collect all the data we want.
  • Double click the Options block.
  • In Generate Options, Select 'No GUI'
  • In Run Options, select 'Run to Completion'.
  • First Data Set

    3. Change the variable block to use in future blocks.
  • Double click the variable block.
  • Rename the ID 'samp_rate' and set the value to 2e6 (2 million).
  • Press ‘apply’ and ‘OK’ to close the box.

  • First Data Set

    4. We are going to add the 'RTL-SDR Source' block and change some values inside.

    Lets add the block first.

  • Use the search bar as we have done before and double click on the ‘RTL-SDR Source’ block.
  • change the 'RF Gain' to '45' (you might have to scroll down to see this option).
  • Set the 'Sample Rate' to 'samp_rate'. Click ‘apply’ and ‘OK’.
  • First Data Set
    First Data Set

    5. We are going to create a new variable to use in blocks in the future.

    Create a variable block and name it 'veclength' as shown below.

  • Search Variable in the search bar and double click to use it.
  • Double click on the Variable block to change the values.
  • Make the value: '1024'.
  • Click ‘apply’ and ‘OK’.
  • First Data Set

    6. Now we will add a 'Head' block.

    This block will limit the amount of data that will be processed.

  • Use the search bar again to find Head and double click to use it.
  • Set 'Num Items' to '10240000'.
  • Click ‘apply’ and ‘OK’.

  • Connect the head block to the 'RTL-Source' block.

  • Click on the little blue box that reads ‘out’ on the 'RTL-SDR Source' box and drag to the ‘in’ on the 'Head' box. An arrow should now connect the two.
  • First Data Set First Data Set

    7. Create new blocks and use the variable 'veclength'.

    Add a 'Stream to Vector' block.

  • Use the search bar to find the block 'Vector' and doubke click to use it.
  • Set 'Num Items' to 'veclength' and click ‘apply’ and ‘OK’.
  • Click on the 'Vector' block and drag to connect it to the 'Head' block.
  • First Data Set

    Add an 'FFT' block. This will convert the data into a Fast Fourier Transform.

  • Use the search engine to find FFT and double click to use it.
  • Set the 'FFT size' to 'veclength' and click ‘apply’ and ‘OK’.
  • Connect to the 'Stream to Vector' block.

  • Add a 'Complex to Mag^2' block. This block makes all the data values real by squaring the complex numbers.

  • Set ‘Vec Length’ to ‘veclength’ and click ‘apply’ and ‘OK’.
  • Connect to 'FFT' block.
  • First Data Set


    Add an 'Integrate' block. This reduces the data size by averaging every 100 items into one item.

  • Set ‘Vec Length' to 'veclength'
  • Set 'Decimation' to '100'.
  • Change ‘IO Type’ to ‘Float’.
  • Click ‘apply’ and ‘OK’.
  • Connect to 'Mag^2' block.
  • First Data Set

    Finally, add a 'File Sink' block. This will write the data into a file on your computer.

  • set 'Vec Length' to 'veclength'.
  • Change ‘IO Type’ to ‘Float’.
  • Specify where you want the file to be written in by clicking on the three dots icon next to ‘file’.
  • Click ‘apply’ and ‘OK’.
  • First Data Set


    Here is how the final flowchart should look:

    First Data Set

    8. Generate and Execute your flow chart.
  • Press the blue 'Generate' button.
  • Press the white play button to ‘Execute' the flow graph.
  • First Data Set
    9. Double check your data was written in the desired location.

    We will get to see all of the contents/folders in your current location on the computer.

  • Open up your terminal.
  • Type: ls. Stands for Directory Listing (l = lowercase L)
  • Type: cd Documents
  • cd *space* [insert location] allows you to go into any directory to see what is in it.

    For example: I started by typing ls into my terminal and pressed enter. This will show me the contents of the place I’m located on my computer. If I don’t remember exactly where I put the saved data, but I know the way to find it, I then find a file that would help me navigate closer to my desired data using cd [the place I want to go]. For example here is the code I used to find my “Waterfall Tutorial” file that I used to download my data to:

    *At the bottom you will see that once I located my file, I typed ls -lh to see how big my file was. The fact that it is 400k (400 kilobytes) tells me that I have located my file. To see why this is, proceed to the next tutorial below "Is Our Data Size Correct?"

    First Data Set

    Is our Data Size Correct?

    Congratulations, you have created your first complete flowchart! Now, how do you know that the amount of data you collected was correct and that this experiment went according to plan? Let’s go through what each block does and how much data it takes in so that we can check that we did everything correctly. Before we start I want to make clarifications between some vocabulary I will be using in this section.


    Sample: This is how much data is collected per second. In this tutorial we chose 2,000,000 or 2 x 106. In each of our ‘samples’ we collect 2 numbers.

    Bit: Short for “binary digit”. This is the smallest unit of data in a computer. A bit has a single binary value of 1 or 0.

    Byte: Equal to 8 bits.

    Kilobyte (kB): Equal to 1024 bytes. (Try not to get this confused with the normal 1000=kilo).

    Vector: In this context a vector is how we will be organizing our data so that we can process it in a following step.

    Integers: In binary, integers (whole numbers that aren’t a decimal or fraction) take up 32 bits worth of data.

    Complex 32: *Need help on this*

    Float 32: *Need help on this*


    RTL-SDR Source: This controls how much data we initially take in from the telescope itself. We set a parameter of 2 million samples per second. For each sample that we take, we get 2 numbers. For each number we use 32 bits of data. If we do a quick calculation we see that we are taking in 1.28 x 108 bits per second.
    Data Size
    Head: This block limits the total number of samples that will be collected, in this case 10,240,000 or 1.024 x 107. From this, we can calculate how much time our total data collection should take.
    Data Size
    If your data collection took around this time, it’s another indicator that our data collection probably went smoothly.
    Stream to Vector: We usually call whatever is input and output of a block an “item”. This block takes 1024 samples (input as individual items), and outputs them as one item vector of 1024 samples. We do this because in order to complete the next task (fast Fourier transform) we need a certain amount of samples at a time to complete this calculation. Here is what our item number looks like before and after our “stream to vector”:
    Data Size

    FFT (Fast Fourier Transform): This block takes our data and finally puts it into a form (sin and cos waves) that is useful for us to use. Each vector is considered a time with a certain frequency. This allows us to have a graph with axis of time and frequency.
    Complex to Mag^2: So far we have had two numbers per sample: a real and imaginary (complex) number. This block takes our real and complex numbers, squares each of them, and adds the values. This changes our input of a complex 32 to a float 32.

    This implements the following function: (real number in)^2 + (complex number in)^2 = new single number real output
    Data Size
    Integrate:This block reduces the data size by averaging every 100 values into one value. We can take out current bit value and divide by 100.
    Data Size
    According to our previous calculations, the program is supposed to run for 5.12 seconds, so we will multiply our bits per second by 5.12 seconds.
    Data Size
    We will now do a few conversions so that we can put this value into kilobits.

    Converting bits to bytes:
    Data Size

    Converting bytes to kilobytes:
    Data Size

    Congratulations, you completed this tutorial and proved that the amount of data you received is correct.

    Take data with installable package


    While using GNUradio can be a great way to understand how data taking works and allows you to look at your data in real time, another method to take and save data is by using the installable CHART package at the CHART GitHub repository. with installation instructions in the readme.md file.

    Upon installing the package, the data taking process can be started from the daq folder, with the python script freq_and_time_scan.py. The appropriate syntax is to type
    python freq_and_time_scan.py --argument=value --argument=value --etc

    Current arguments and their defaults are as follows:

    Argument Default Value Type  Docstring
    --scan_period 0.001 Float  Time between a scan and the next, in hours.
    --total_time 0.001 Float  Total time for all scans, in hours.
    --freq_i 1410. Float  Starting frequency, in MHz.
    --freq_f 1430. Float  Ending frequency, in MHz.
    --df 1. Float  Frequency tuning step size, in MHz.
    --sleep_time 5. Float  Sleep time between checks for next scan time, in seconds.
    --veclength 1024 int  Vector length (number of channels) for spectrum estimation.
    --samp_rate 2. Float  Sample rate of the radio, in MHz.
    --int_length 100 int  Number of samples per integration.
    --int_time None Float  Integration time, in seconds. Overrides the --int_length argument
    --nint 500. int  Number of integrations per file.
    --data_dir None str  Data directory. Defaults to current working directory.

    A recommended example call for a simple 21cm observation as a test is as follows (all one line):
    python freq_and_time_scan.py --freq_i=1390 --freq_f=1450 --nint=20 --int_time=0.5 --data_dir='path/to/directory'


    Use the GUI to collect data

    A G.U.I stands for a Graphical User Interface. Directly communicating with the command line can be hard to understand. Because of this, we have created an easy interface to interact with when taking data.

    All you need to do is open the CHART_GUI file located on your desktop. If you wish to view what is happening behind the scenes, click Execute in Terminal.

    This is what you should see when it executes.



  • Enter the parameters you want to use for taking data
  • Tip: You can use all the default parameters by clicking the slider at the bottom. If you do not change a value in a text area, the default parameter will be used as shown below.


  • The Enable Bias-T option should only be used if you know FOR SURE that you are using a Bias-T
  • You can close this window pop-up and continue after evaluating your situation.



  • Write a short description explaining what you are looking at in the sky.
  • Enter your username for Jupyter Hub, the location you are taking data, trial of the day in this location, date in the format month.day.year, and current time.
  • Tip: You can use system date and time if the time in the upper right corner of your screen is correct. You can also use it when you are connected to the internet.


  • Click Start
  • Tip: You can stop the trial at any time by clicking Stop. Once Start is re-enabled, the data has been taken and you can now take more data.

    If you receive an error as shown below, change your trial number to continue.



    Once you have finished taking data and are connected to the internet, open Jupyter Hub and sign in.

    You will need to upload all the files in .zip format to be imported into the database. The GUI has already zipped the files for you so you don't have to. We will use a database to search for files later when you want to analyze data.

  • Click the data folder
  • Click Upload
  • Find and open the zip file you want to upload. The file should include the correct location, date, trial and time.
  • Click Upload again next to the file in Jupyter Hub
  • Continue this process until you have uploaded all the files you want.