My First Software Defined Radio (SDR) Receiver - 3rd Section
Demodulation
1st Section - Capture Stage
2nd
Section - Downconverter
3rd
Section - Demodulation
Appendix - Spectrogram
Demodulation process diagram:
Demodulation
3.1 - .wav File
We start with the file: radio-downconverter-28000-sps-162-khz.wav that we previously obtained using baudline in the previous article.
You can download it here: Download Page
File Name: radio-downconverter-28000-sps-162-khz.wav.gz
(!)
Size: 4298000 bytes
Rate: 28000 Sps
Duration: 2 min 34 sec
Range: 154492 Hz to 168464 Hz
Acquired: 00:30h 06-June-2004
Location: Tarragona (Spain)
(!) Due some reason, the IExplorer don't save correctly the file name on the hard disk and writes ".wav.wav" at the end of the file name. If this happens you should rename it and write ".wav.gz" at the end of the file name to be uncompress with a ZIP tool.
We will use two different programs: Linrad and SDRadio in the demodulator stage. Linrad is a complex tool designed for experienced operators and SDRadio is a compact program, easy to use. Both give us the same result (demodulate) but in different ways.
With Linrad we can process directly the .wav file under Linux where we made the previous conversion but SDRadio runs under MS Windows and we must "cable" the output signal to another PC (see previous diagram).
3.2 - SDRadio
SDRadio (http://www.sdradio.org/) is an excellent demodulator program which uses a sound card as input under MS Windows. Do not require previous configuration, just select your line-in in the Windows mixer and run SDRadio.
I've played the .wav file with the original signal from my Linux machine as follows:
# sox -t .wav radio-downconverter-28000-sps-162-khz.wav -t ossdsp /dev/dsp3
(/dev/dsp3 is my Sound Blaster sound card)
Using a sound cable I've connected the output (Line Out) to the input (Line In) in the MS Windows PC (see previous diagram).
In the Windows machine select the active sound input:
And start SDRadio:
Now, just press Rx, select the AM mode, center the carrier and adjust the bandwidth.
3.3 - I/Q
SDRadio works with a complex signal as source, I mean that it uses one side from the stereo as I component and the other side for the Q component. The .wav file is a real signal (mono) and the SOX command sends the same sound to both sides of the audio output. Does it really work?. Yes, it really does. I've listened perfectly the broadcast station thru my speakers.
3.4 - AM, USB, LSB
In the AM mode the station is perfectly demodulated but also can be listened (with enough quality) in the USB and LSB mode. ¿Double side band?.
3.5 - Can I demodulate in realtime with SDRadio the baudline output?
Maybe, but it needs a power machine which permits work with baudline in realtime. The method could be:
# sox -t .wav radio-capture-896000.wav -t sw - | ./baudline -stdin -samplerate 896000 -stdout | sox -r 28000 -w -t sw - -t ossdsp /dev/dsp3
( /dev/dsp3 is the Linux machine sound card output )
3.6 - Linrad
Linrad (http://antennspecialisten.se/~sm5bsz/linuxdsp/linrad.htm) is a SDR amateur tool with professional capabilities. Is specially designed to work with weak signals and CW but it has AM, SSB and FM modes too. The main advantage in case is Linrad permits to process the resulting .wav file directly under Linux.
3.7 - Can I connect Linrad directly to the Bt878A?
Linrad can connect to any sound device under Linux but it give compatibility problems when trying to connect to the btaudio module. The main problem is: the module do not implement the OSS function SNDCTL_DSP_SETFRAGMENT.
3.8 - Non-realtime .wav process
Once we have installed Linrad and configured to use our sound card as output, we can demodulate the signal using the .wav file. First, we create a file called adwav in the the Linrad's root folder. The adwav file should include just one line with the .wav path and name and another name for the parameters file (whatever we like). You can create the adwav file this way:
# echo "radio-downconverter-28000-sps-162-khz.wav radio-downconverter-28000-sps-162-khz.par" > adwav
Start Linrad. In the main menu we select the option "2=Process first file named in 'adwav'". The first time, the programs ask for the demodulation parameters and starts spectrum analyzer windows and the demodulator.
Help Wanted to complete this point!
Are you a Linrad expert?
3.9 - Can I capture with SOX and demodulate with Linrad at the same time?
I think so. Linrad do not have the sdtin option but we can use a fifo file this way:
# cd linrad
# mkfifo fifo.wav
# echo "fifo.wav fifo.par" > adwav
# ./linrad
Linrad starts, then we select the option to process the .wav file.
Now we open another console in Linux (CTRL+ALT+F2) and:
# cd linrad
# sox -r 896000 -w -t ossdsp /dev/dsp1 -t .wav fifo.wav
Come back to the Linrad console (CTRL+ALT+F1). If everything works, we're now processing the signal with just few seconds delay.
In my experiment, I could not verify this method because Linrad says: "Out of memory. Try less demanding parameters" in every configuration I've tried.
3.10 - Demodulate with baudline
Update 09-2004 eMail from Erik Olson (Excerpt of the original email)
... |
- Credits:
Erik Olson
Michael Oexner
Eduardo Alonso
Luis Padilla
Gerd Knorr
- Author:
Juan Domenech Fernandez
http://www.domenech.org
v0.2 14-november-2004
v0 11-june-2004