Page 1 of 1

Software defined radio (SDR)

PostPosted: Sun Oct 28, 2012 3:13 pm
by acg2010
As a follow up to my question in the General section of this forum
acg2010 wrote: Has anyone considered trying to make a SDR with Flowstone?

Beside the necessary broadband radio receiver hardware (readily available), seems like all that would be needed would be a spectrum display or waterfall display with persistent scrolling, necessary filters (lowpass, highpass, bandpass), a way to select part of the spectrum maybe similar to the SynthMaker frequency splitter module, and a way to play the resulting waveform using a wave player module. Iam probably over simplying it and some parts (algorithms) might have to be coded.

I have reviewed the internet literature and you can find many SDRs already, most programmmed in C++ or even java (on-line versions). There is one good article on programming a simple version of SDR in Max/MSP.

Seems like a simple broadband radio receiver could be developed (like the Flowstone board) and sold as a kit along with the software similar to Funcube.

...just an idea.


Here is my quick and dirty attempt at an SDR. Caution, I was getting 100% CPU spikes the longer the schematic was in use.

It consists of a wave player loaded with an example test wave file of captured CW signals across the frequency spectrum (found on the internet), feed into a frequency splitter to act as a frequency range selector, then into a variable state filter which acts as a sort of upper side band, lower side band, band pass filter to remove interferring signals/noise. Outputs are shown on a FFT display and trogluddite's waterfall display (from the SynthMaker forum).

The way it should work in theory is that a narrow frequency range is selected from the full spectrum signals using the frequency splitter, then further enhanced with the filter. Signals are determined by monitoring the displays and looking for peaks and intensities.

It sort of works. I was able pull out a single CW morse code signal. Obviously this needs a lot more work such as the waterfall display would need to be more persistent and scroll more upwards than at an angle, the FFT display, waterfall display, and frequency spliter would all need to be lined up on on top of the other with accurate frequency ranges, the frequency splitter needs a way to select a more narrower range of frequency, AM signals would need to be de-modulated, etc. FYI - I had to delete the wave file otherwise it was too large an fsm file to upload. The test wave file can be found here: https://sites.google.com/site/g4zfqradi ... r_software

Re: Software defined radio (SDR)

PostPosted: Wed Nov 07, 2012 5:50 am
by acg2010
Yes, after considerable research into SDR I have over simplyfied SDR. As you know, the SDR hardware receiver/transciever converts broad band radio waves to two signals: I (in-phase) signal and the Q (quadrature) signals. After passing through a sound card the signal is digitized to a wave file. Typically for CW signals, no demodulation is necessary, so in my example, I was just lucky. If it had been full frequency spectrum, my simple set up would not have demodulated AM, FM, or SSB bands.

My question is: How does one go about recreating the I and Q signals? Since Q is just a 90 degree phase shifted I signal, can one just take the resulting digitized wave file, phase shift it by 90 degrees, subtract it from the original signal and therefore end up with the I and Q signals?

Based on internet resources demodulation would be a simple math function:

AM demodulation = sqrt ((I*I) + (Q*Q))
FM demodulation = -Tan (Q/I)

Re: Software defined radio (SDR)

PostPosted: Wed Nov 07, 2012 9:05 am
by trogluddite
Hi again,acg,
To do the 90deg phase shift, you need something called a 'Hilbert transform' - this takes a regular audio waveform and outputs two copies which have a precise 90deg phase difference for all frequency components; effectively a real -> complex converter (as opposed to a time delay shift, which can only be 90deg at one specific frequency).
It's usually implemented by a carefully tuned series of all-pass filters. Martin Vicanek wrote a really good one a while ago (in SM) that should port over to FlowStone no problem. I've been using it in some single side-band frequency shifting algorithms, and it is very accurate across a really wide range of frequencies.

Have to go to work now, but I'll try and remember to post an example when I get in tonight.

Re: Software defined radio (SDR)

PostPosted: Wed Nov 07, 2012 8:11 pm
by trogluddite
As promised, here is the Hilbert function module. Seems to have translated to FS no problem. The two outputs are 90deg offset from around 10Hz up to nearly Nyquist, IIRC.
Hilbert Transform.fsm
(1.27 KiB) Downloaded 1410 times

Note that I have extensively optimised this in assembly - as a consequence, it will only work with mono signals. Also, take care if combining the outputs with the original input signal - I seem to recall that works by shifting two copies of the signal by +45 and -45 respectively, so the "Real" output is not in phase with the original.
I believe that Martin ported the original algorithm from a public DSP resource, so it is open-source and non-copyright so far as I am aware.

Re: Software defined radio (SDR)

PostPosted: Thu Nov 08, 2012 5:27 am
by acg2010
Thanks trogluddite.

My research had pointed at using the hilbert transform as well and I had tried some of the modules from the SynthMaker forum based on your wok and others but could not quite get it to work. Your version here seems to allow sound to pass thru. Now I just need to add the math for demodulation and tweak it some more and try it out with a wave file containing AM and FM bands.

-acg2010