### BatchDrake

Hacking, HAM Radio (EA1IYR), DSP, physics and more

# Automatic GRAVES monitoring with QStones

After some good feedback from my post about GRAVES and stonealert, I decided to invest some time on cleaning the code and providing a more handy user interface for the whole thing. Since I have been postponing Qt for years now, I decided to get rid of my prejudices and code a bit in C++. I named the result QStones, a Qt GUI for the algorithm discussed in my previous post, based on Suscan core library (yes, now it is also a library!) and Gqrx’s plotter widget (I have no shame, I know).

QStones allows you to perform automatic GRAVES echo detection from the soundcard, IQ captures, WAV files and any previously saved Suscan source profile. For each echo event, an I/Q sample view, Doppler chart and power plot is provided. The saved events can be stored in Matlab / Octave script files for posterior processing.

This is, however, an extremely early release of this application. As such, many features are still missing and may not work as expected, although I made my best effort to keep the detection code working out of the box.

## Building QStones

QStones requires Qt 5.7 or newer, including Qt module QtCharts. Prior to version 5.7, QtCharts was only available in the commercial releases of Qt, and therefore it’s unlikely many distros include this package.

You will also need to compile and install the latest versions of Sigutils and Suscan, as they were extensively modified to have C++14 compatibility and this heinous hack awesome feature I named “baseband filters” (which is basically an API to read and tamper samples as soon as they are received by the source and before they are channelized and distributed among any inspector). It also fixes the Suscan’s throttling problem for good, and installs a Suscan shared library in the system to make it available to other programs.

Once you gathered all the ingredients, clone the latest version of the code from my repo and run qmake:

% git clone https://github.com/BatchDrake/qstones
% cd qstones
% qmake


Please ensure you are running Qt 5’s qmake and not Qt4’s. It’s rather common that desktop distributions link the qmake command to qmake-qt4. If after confirming that you are using Qt5’s qmake you get an error like this:

error: Unknown module(s) in QT: charts


It means that your system does not have the development files for QtCharts and you may need to install the latest open source version of Qt from their website.

If everything went alright, just type:

% make
% ./qstones


And a splash screen should pop up for a while as sources are detected and loaded, and then the main screen included above should show up.

## Capturing stuff

The quickest way to start playing with this is to tune your receiver to 143.049 MHz in USB mode, plug it to the audio input of your computer and click the play button. This will start QStones in soundcard mode. Echoes will be heard around 1000 Hz (that’s what the Offset spinbox in the right is for). If you don’t have a receiver around, you can go directly to this YouTube video and use pavucontrol to forward YouTube’s audio output to QStones by setting QStones’ capture device to Monitor.

If you have existing audio captures or WAV files, you can configure them by clicking on the card button in the toolbar above.

## Saving data

Since this release lacks most of the interesting features I had in mind, the main use case is to save an existing chirp and analyze it with Octave. If you click on the save button in the main toolbar and save the corresponding .m file, after loading it in Octave you will have the following variables:

• START: Relative time from the beginning of the capture of the first sample, in seconds
• SAMP_RATE: Sample rate of the capture
• MEAN_SNR: Averaged SNR (buggy!)
• MEAN_DOPPLER: Averaged Doppler
• X: Samples of the chirp, frequency-shifted to DC by an amout specified by the offset spinbox in the GUI
• PN: Averaged power at the output of the narrow filter
• PW: Averaged power at the output of the wide filter
• SNR: Estimation of the SNR (buggy!)
• DOPPLER: Measured Doppler shift, in $ms^{-1}$

Some beautiful chirp in relative speed units, analyzed from Octave

## Limitations and disclaimers

The SNR calculation is broken. I think this is because the filters I’ve chosen (Butterworth IIR filters, because they were already there) and sometimes the power measured at the output of the wide filter is smaller that the power measured in the narrow filter. This should never be happening and I will definitely have to look into it. As soon as I have a trustworthy SNR estimation, I could use it to adjust a moving average filter in the Doppler data to reduce the dispersion due to the relative power of noise getting into the discriminator.

Also, the splash screen of this application is not entirely on my own, is based on a CC picture by a guy whose contact I’ve lost. I have the contact details at home (I’m on a holiday trip as a type this), I will acknowledge his authorship as soon as I get back home.

I will leave this project on hold for a while as I have other duties to attend to (i.e. college exams), but in the mean time any feedback will be always welcome. Also, there is a big meteor shower coming up next week (the Geminids) and the Quadrantids next month. It would be an awesome opportunity to test QStones in real time.

Stay tuned!