Saturday, August 20, 2016

Low cost 2.7GHz antenna analyser

Since starting to receive ADS-B signals on 1090MHz I was wondering how well my home made antenna was tuned to that frequency.

I spotted an analyser for AU$236 that covers up to 2.7GHz on Aliexpress here and it seemed worth a try. Here it is with a simple dipole that is reasonably tuned to 1090MHz.

It's advertised as "Antenna Analyzer N1201SA SWR standing-wave meter Talent instrument Impedance tester 140M~2.7GHz" and I'm very happy with it.

The unit contains a re-chargeable battery and is simply re-charged with a USB cable. The knob at the top makes it easy to tune the lower and upper range frequencies.

Output level is -18dBm and it seems on frequency as far as my UHF transceiver is concerned.

There are two modes, one with figures displayed and the other which draws a graph as you see above.

If you need to work in the GHz range, I recommend this little analyser. It turned out my home built antenna for 1090 was a little low and resonant at 1083.3 - not too far off.

Thursday, August 04, 2016

WSPR decoding on a headless Raspberry Pi

At last Sunday's ARNSW Home Brew group meeting, Peter, VK2EMU handed me a Raspberry Pi a USB audio dongle and my mission instructions... to set up the Pi to decode and report WSPR spots in a headless configuration.

In the end I've built on the excellent work by DJ0ABR.

I had trouble recording the 118 seconds of audio at a sample rate of 12000 samples per second as it produced buffer overruns. Instead I've used the rec command from sox to record at the native sample rate of the USB audio dongle and then convert the file using sox.

I've pretty much used the code and scripts as supplied, with some modest improvements here and there.

Source code for the decoder is from here. This is a fork of the original code which has gone and been integrated into wsjt-x. I have forked it here and added my versions of the record and decode script and the simpler crontab. I've fixed a few things and pushed those changes to my fork of the code so I'd recommend that as a starting point.

Here's some spots on reported from the raspberry pi:

Install a library you'll need:

sudo apt-get install libfftw3-dev

In the directory with the Makefile, type "make" to build the software.

The USB audio dongle is a low cost one called "3D Sound". I found that it picked up lots of hum until a junkbox audio transformer was wired in line.

Find the USB audio card with:
   cat /proc/asound/cards
and then create /etc/asound.conf with following:
   defaults.pcm.card 1
   defaults.ctl.card 1

# set audio levels
alsamixer # graphical in terminal

To allow the pi user access to the audio devices:

sudo nano /etc/group

and add the sound group to the pi user. You'll need to log out and back in for this to take effect.

To test the recording you can record while showing a level meter like this:

arecord -vv -fdat test.wav

Press Control-C to end the recording.

There are two scripts: record and decode. record is called from a cron job every two minutes to record 118 seconds of audio, convert it and kick off decode.

I installed in /home/pi/wsprcan

Here's my version of record:

# WSPR Audio Recorder Script by DJ0ABR
# record WSPR signal at every even minute
# called by cronjob
# number of files in wav folder
cd ${BASEDIR}/wav
file_num=$(ls -1 --file-type | grep -v '/$' | wc -l)
cd ..
if [ "$file_num" -le "1" ] ; then
        DT=$(date -u +"%y%m%d_%H%M")
        echo recording to ${RECFILE}
        #arecord -d 114 -f S16_LE -r 12000 -t wav ${RECFILE}
rec -V1 -c 1 -t wav ${RECFILE} trim 0 118 &>/dev/null
echo "converting sample rate..."
sox ${RECFILE} -r 12000 /tmp/out.wav
echo removing ${RECFILE}
echo moving /tmp/out.wav to ${RECFILE}
mv /tmp/out.wav ${RECFILE}
        echo "running decode on ${RECFILE}..."
        ./decode ${DT} &

Here's my version of decode:

# Script for the K9AN WSPR decoder, by DJ0ABR
# ===========================================
# use the k9an decoder to get the spots out of the wav sound file
# the file 'spots' is used for storing all the spots and debug information
# the file wsprd.out contains the current spots in the format for
# wsprdsum.out is used as a temporary storage if the upload fails


echo decoding >> spots
echo "decoding: /home/pi/wsprcan/wav/wspr_${1}.wav"
./k9an-wsprd -f 14.0956 /home/pi/wsprcan/wav/wspr_${1}.wav >>spots

# the wav file is processed, delete it (it should be in a ram disk folder if an SD card is used !)
rm ${BASEDIR}/wav/wspr_${1}.wav

# check if spots are available
FILESIZE=$(stat -c%s "${BASEDIR}/wspr_spots.txt")
echo data size= $FILESIZE >> spots
if [ $FILESIZE -ne 0 ] ; then

        # add the spots to a temporary file used for uploading to
        echo add to wsprdsum.out >> spots
        cat ${BASEDIR}/wspr_spots.txt >> ${BASEDIR}/wsprdsum.out

        # upload the spots
        echo upload by curl >> spots
        # ping helps curl to contact the DNS server under various conditions, i.e. if the internet connection was lost
        ping -W 2 -c 1 #> /dev/null;
        curl -m 8 -F allmept=@${BASEDIR}/wsprdsum.out -F call=${MYCALL} -F grid=${MYGRID} > /dev/null;

        # check if curl uploaded the data successfully
        # delete only if uploaded
        if [ $RESULT -eq 0 ] ; then
                # data uploaded, delete them
                echo Upload OK, deleting >> spots
                rm wsprdsum.out
        echo curl result: $RESULT , done. >> spots

Please replace VK2TPM with your call and grid square.
The crontab file:

# Start WSPR Recording at every even minute 
*/2 * * * * /home/pi/wsprcan-master/record

To see what's going on you need local email. I installed postfix and mutt for this. There's a log file called spots that shows what's going on and any decodes:

0648 -15 -2.5  14.097089 -2  K6PZB CM88 37 
0648 -20 -2.9  14.097099 -2  VK8ZI PH57 23 
0648 -24 -2.7  14.097116 -2  KD6RF EM22 37 

data size= 222
add to wsprdsum.out
upload by curl
Upload OK, deleting
curl result: 0 , done.
0650 -23 -2.6  14.097048 -2  K5XL EM12 33 
0650 -20 -2.1  14.097072 -2  AL7Q BP40 37 
0650 -19 -2.7  14.097158 -2  JA5NVN PM74 33 

data size= 222
add to wsprdsum.out
upload by curl
Upload OK, deleting
curl result: 0 , done.

So far I haven't used the ram disk but that's probably a good idea in the long term.

I also tried VisualWSPR which looks hopeful but crashed on startup for me. 

Wednesday, June 08, 2016

What's inside an SDRPlay

I love tuning around HF with an SDR display, it's great to see the whole band in one go.

The recent v0.1.20-alpha update to CubicSDR works very well on MacOS and in particular with the SDRPlay. These things just look like a black plastic box and I haven't seen any pictures of the internals so here you go:

As you see not much there, but it has 8 automatically switched input band pass filters. Full technical information is here.

It interfaces with SDR software via SoapySDR:

And works really well.

Saturday, June 04, 2016

ADS-B Plane tracking with RTLSDR and Raspberry Pi

It's raining this weekend in Sydney so it's a good time to tinker with things indoors. Thanks to Ross, VK1UN for the tip, I'm now able to receive the location beacons from planes and plot them like this:

ADS-B transmits information about a plane and its position and speed on 1090MHz.

The hardware is a Raspberry Pi 3 and a low cost RTLSDR dongle. The software provides both a terminal live listing of what's been received and the amazing map you see above (which updates live).

Excellent instructions are here. All credit to David & Cecilia Taylor for the excellent job. I'm not uploading any data but rather am just watching what I can receive locally.

The command I run to produce this is:

./dump1090 --quiet --net --phase-enhance --net-http-port 8080&

And then I forward port 8080 from my router to the IP of the raspberry pi.

To run interactively on a terminal do this:

./dump1090 --interactive --net --phase-enhance

On the terminal you get a text version like this:

I found that the Terratec RTLSDR didn't need a powered hub on my pi which is powered from a modern iPhone charger. The antenna is the small TV vertical just sitting near a window facing south and it works amazingly well.

Ross, based in Melbourne, has been making co-linear antennas from coax and is doing much better than me at receiving both numbers of planes and distance. Check this out:

Update: Dramatically improved antenna

Under the direction of Ross, VK1UN, I've built an improved external co-linear antenna.

I'm using RG6 75ohm coax. The segments are 11.2cm long cut like this:

The segments are pushed together simply by pushing the centre of one under the insulator of the next.

The antenna is on the balcony pushed up a plastic pipe.

Previously the furthest plane I could receive was about 85km away, now I've seen planes over 300km away. I'm also seeing more planes.


I've neatened up the antenna by purchasing some 25mm pipe and an end cap - about $5 all up.

Saturday, May 14, 2016

40m doublet antenna - excellent

This weekend some antenna work. I've put up an open wire fed "doublet" antenna for 40m and of course all bands up from that. The centre insulator is made from a piece of perspex.

The open wire ladder line runs down to the shed and terminates to a 4:1 balun I previously used for an off centre fed antenna. From the balun it goes into a transceiver with internal tuner that is able to tune it on all bands from 40m up.

The tree holds a few other antennas including an inverted L for 80m, and one end of a half G5RV.

So far my observation is that noise is low and signals are big, it's great to have the flexibility of multiple bands in one simple antenna.

Sunday, May 01, 2016

Fifi SDR control app for MacOS

One of the intriguing things about the Fifi SDR is that as well as I/Q output via an in-built USB sound device it also has the ability to demodulate built right in and that audio output appears as an additional sound device.

The Fifi SDR can be controlled using the same API as a Softrock so I've started work on a native MacOS app that can control the frequency, bandwidth, demodulation mode and play through the audio. It's pretty rough so far but looks like this:

The code is based on rockprog and Apples AVRecorder sample.

So with just the Fifi box and this software you have a simple radio that tunes all of HF and plays through your Mac's audio. If you want the full, waterfall style, experience then I recommend DSP Radio which also supports Fifi.

You can download the alpha app here. As I haven't signed it you will need to right click (control click) and choose Open the first time to open it.

Be careful not to choose built-in audio from the input device and turn up the volume or you'll get feedback. Speaking of feedback, let me know if you find this useful.


Build 2 has the following improvements:

  • Automatically selects the FiFi audio device if found
  • A button to set the frequency directly
  • A tuning slider - I'm still experimenting to get this working nicely.
On my device anyway, the frequency is off. I'll have to look at how to fix this.

Saturday, April 02, 2016

Fifi SDR - like a Softrock but with a built-in sound card

The nicest way to tune around is with a software defined radio. Being able to see a wide area of a band and simply click on the active signals is superior to spinning a dial up and down. This weekend a Fifi SDR arrived from Germany. They cost around 140 Euros from Funk so in a different bracket to the low cost RTLSDR devices.

This radio looks to the computer like a Softrock and frequency is controlled using the i2c USB interface to the Si570 clock oscillator. It has I/Q audio out but much more convenient is the built-in USB audio device which can do up to 192kHz. The USB audio worked without any extra driver install.

While it's a kit, all the hard stuff is done for you and you're just left to solder a few connectors, plug in a transformer and construct the case. Here's how it comes.

It's a nice snug fit in the excellent quality metal case.

It worked on first power up and I'm using it with SDRSharp and other software without too much messing around. Here's a few videos showing how it looks tuning around 40m.