Saturday, July 25, 2015

How to Talk to Radio-Sky Spectrograph

Solar flare recorded on our very first radio spectrograph at the Lanihuli observatory on Oahu.  This is the ten minute (approx) view.  A more detailed one minute view is also available.  The frequency in MHz is displayed on the right.
Radio-Sky Spectrograph (RSS) was designed specifically to display solar and Jupiter radio spectra. When we (Richard Flagg and I) designed our first HF spectrograph, the FS200 (still operating  more that 10 years later at the Windward Community College Lanihuli Observatory in Hawaii), we  limited ourselves to 200  "channels" or frequencies for each "scan" or "sweep".  We also tried to obtain 10 scans per second.  These parameters were arrived at based on an educated guess as to what we could physically accomplish consistent with goal of seeing Jupiter S and L Bursts in some detail.  The FS200 is a sweeping type spectrograph as opposed to the more modern approach of using an FFT to derive a spectrum from a software defined radio or SDR.  Our system needed to save about 2000 two-byte samples per second.  Although back then this seemed like a lot of hard drive space, today saving a couple hundred megabytes per day is not a big deal.

In live mode, RSS provides two views of the same spectrum with different time scales.  This is useful for seeing the last minute of data and the last 10 minutes of data (depending on the sweep rate). For Jupiter this was optimum for seeing how the storm was progressing overall, and in detail.  It also turned out to be a good compromise for solar activity. We have found it better to have frequency on the Y axis and  time on the X. This is not the usual format for other SDR programs.  We use high frequency at the top in contrast to many scientific displays which chose the opposite convention for some reason I have never understood.

You can measure the slope of any feature on the spectrogram with just a couple of clicks.

Most SDR programs provide very useful waterfall spectral displays, but I only know of one program other than RSS that allows you to save the reduced spectrum data, and I don't think it is out yet.  Most programs provide for saving the entire bandwidth that the SDR is processing, often millions of samples per second.  This is great for communications because you can go back and demodulate any signal in the bandpass from the saved signal, however, it is currently impractical for long periods of time to save that much data. For our radio astronomy purposes, we don't need all of that data unless we want to do some kind of imaging or interferometry.   Within the next couple years RSS is scheduled to provide support for saving files in NASA's CDF format which is a scientific standard. RSS has turned out to be a very practical display and file saving tool for event based radio astronomy.  RSS is free and can be downloaded here.  If using Win 7 or up I suggest you run tRSS as administrator so that Windows doesn't get mad about it writing to the program directory. You can use the program in Client Mode to view live spectra from other RSS users. Unfortunately, the help is minimal and out of date, but there is a group of people working on creating a manual for RSS.

Sold! How do I use RSS with my receiver?

If you want the functionality that RSS provides but you do not have one of the receivers RSS supports, you can send your data to RSS over a TCP connection as long as you format it properly.  This assumes you know how to get reduced spectral data from your receiver (or can reduce the raw data ) and  that you know how to do a little programming in Python, Java, VB, or whatever.

Your program must act as a TCP server and listen for a connection on port 8888 of the loopback address   Configure RSS under Options /Radio to RTL dongle receiver. When you press the Start Button in RSS, it will attempt to connect to your custom software server. Your program should accept the connection and send this string back to RSS.

"F " & CenterFrequencyHertz & "|" &"S "& BandwidthHertz & "|" & "O " & OffsetHertz & "|" & "C " & NumberOfChannels & "|"

For example: F 21000000|S 5000000|O 0|C 500

This would tell RSS that the center frequency of the observation is 21 MHz.  The bandwidth is 5 MHz, so the display will run from 21 + 2.5 to 21 - 2.5 MHz,  or 18.5 MHz to 23.5 MHz. The O is for the offset and is useful for when a downconverter is used.  Here O is set to zero.  Finally, C denotes the number of channels.  This is currently limited to 100 - 512 channels. Each of these parameters is separated by the pipe symbol "|".

The data itself is in two byte binary format.  Each sample is sent as a binary word with LoHi byte order and should be restricted to 12 bit digitization.  The data is sent with the highest frequency first, descending to the lowest.  At the end of each sweep two FE hex bytes (254 decimal) are sent. and the next sweep begins. There are no timestamps.  RSS keeps track of the time and assumes an even sweep rate.

If you run into trouble just contact me at radiosky (at) radiosky (dot) com.  or via the comments. I would love to know if you write something that can send your spectra for display to RSS. Perhaps, you would like to share it with others.