WSPR RX with the Banana PI

WSPR receiver with the Banana PI as a fully automated console solution

(Translated into English by: DL8CQ)

This WSPR console installation requires no manual operation. After switching on the ARM computer is instantly operating as a WSPR receiver, receives via the sound card, decodes the WSPR spots and loads them up to wsprnet.org.

Install operating system and prepare:
This process is described HERE .

Steps to fully automated WSPR receiver (without GUI):

  1.  Finished installation as described
  2. Download K9AN decoder and make
  3. Switch on the receiver and create a recording manually
  4. Decode this recording
  5. Create a cron job
  6. Create the record scripts
  7. Create the decoder scripts

The K9AN decoder:

This WSPR decoder is a command line program. It receives as input a .wav file which contains WSPR signals. As output the decoded WSPR information will be displayed.

First, you download this software to the home directory:

cd /home/bananapi

Next, open the website https://github.com/k9an/wsprcan in a browser.
Click "Download ZIP" to download the software. You will find it in /home/bananapi and unpack it entering:

unzip wsprcan-master,zip

and compile the program with: 

make 

The finished file k9an-wsprd is now available. With a WAV file containing WSPR data you can test it already. 
I had only succeeded if this file was recorded with 12000 bps. WAV files from a Windows PC were not decoded.

Testing of the decoder:

The Banana PI has a microphone. Although the line-in is available, it is not easily accessible. Therefore the first tests can be done by adjusting a WSPR frequency at the transceiver and a pair of headphones is connected. Put them on top of the BananaPI in a way that the microphone is receiving the sound. That's completely enough for a good WSPR reception (no, that's not a joke, it works really well!)

To make an audio recording on Linux, you use the following command:

arecord -d 112 -f S16_LE -r 12000 -t wav test.wav

It is now recording for 112 seconds. You start recording with the start of a 2-minute WSPR passage, e.g. at the beginning of an even minute.

If the recording is finished, you can listen to it using: 

aplay test.wav

To decode afterwards: 

./k9an-wsprd -f 10.1387 test.wav 

after a short time the call sign is displayed (if there is one in the recording).

A .wav file that I recorded by myself for a first test can be downloaded HERE. It contains 6 call signs from the 30m band.

Where are we now? We can

a) Record a wav file with WSPR signals. 

b) Decode the call sign with the K9AN decoder.

Automatic WSPR receiver:

So far we had done everything by hand. Now the system should be set up so that the complete WSPR reception including the upload of spots to wsprnet.org works automatically. The following steps should be done only do if you have already successfully seen WSPR data manually, as described previously!

Start the recording every 2 minutes:
WSPR messages take 2 minutes and start to each even-numbered minute. So we have to start recording the audio file using a cron job. To do this (as root) the following cron job is added (with crontab -e, how to do this in detail you can find easily on the Internet). So you copy the following line into the crontab:

# Start WSPR Recording at every even minute 

0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * * /home/bananapi/wsprcan-master/record

That will call the following script "record" every 2 minutes.

The Record script

DOWNLOAD the record script here

The cron job executes every 2 minutes the following script:

#!/bin/bash 
cd /home/bananapi/wsprcan-master/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") 
arecord -d 112 -f S16_LE -r 12000 -t wav /home/bananapi/wsprcan-master/wav/wspr_${DT}.wav 
./decode $DT & 
fi

First, the number of wav files is determined because there may be more than one record, if the decoder has taken longer than 2 minutes. We accept a maximum of 2 simultaneous wav files to avoid overloading the CPU.

So, if not more than 1 wav file exists, a new recording is started. We record 112 seconds at a bit rate of 12000, that works best with the decoder.

If the recording is finished, the decoder will be triggered as a background process (&), because the next recording is already running. Therefore always a recording and a decoder work at the same time.

The WSPR decoder:

DOWNLOAD the decoder script here.

I opted for the decoder of K9AN because it is easy to compile, needs little resource and provides an excellent result when decoding, often better than the original K1JT decoder.

./k9an-wsprd -f 0.4742 /home/bananapi/wsprcan-master/wav/wspr_${1}.wav >>spots
rm /home/bananapi/wsprcan-master/wav/wspr_${1}.wav
curl -F allmept=@/home/bananapi/wsprcan-master/wsprd.out -F call=CALLSIGN -F grid=QTHLOCATOR http://wsprnet.org/meptspots.php > /dev/null;

First, the decoder is called. Please make sure you enter the correct WSPR frequency, call sign and the QTH locator, otherwise you may feed the WSPR website with faulty spots! After decoding the wav file is deleted.

The decoded WSPR data is stored in the file 'spots' for following up and in the file wsprd.out in a format which is suitable for uploading to wsprnet.org.

The upload is done with the command curl, in the given notation. Please enter callsign and QTH Locator.

Directory structure:

To make sure that the programs find everything needed, the following structure should be maintained (or you change the scripts):

All programs are stored in:

/home/bananapi/wsprcan-master

where you create a subdirectory 'wav':

/home/bananapi/wsprcan-master/wav

here the sound recordings are generated.

Ramdisk:

If you have concerns that the records overwhelm the SD card, you can create the subdirectory 'wav' as a ramdisk as follows:

As root, you open the file: 

/etc/fstab

and there enter the following line:

tmpfs /home/bananapi/wsprcan-master/wav tmpfs nodev,nosuid,size=10M 0 0

Now you have a 10MB partition in RAM and the SD card is no longer used for wav files.