Running headless WSPR on the Raspberry Pi

I’ve tried a few times to compile and run WSJT on the Pi in order to decode JT65 mode transmissions – I think I got close, but I ran into other issues with the soundcard configuration that has tripped me up, like configuring WSJT to listen and transmit to my soundcard’s inputs and outputs.

I’ve seen some other posts on getting WSPR running, so this looks like it’s more possible.

From going through the WSJT dependencies, I’d already installed all the libportaudio and python-* dependencies. If you’re following this from scratch through, I’d start with George Smart’s article here. To get a working config I followed George’s article first and then picked up LX3KR’s article here to get the soundcard config working – I also wanted to run WSPR in headless mode, so I picked up the steps at this point:

cp WsprMod/w.so WsprModNoGui/

I’m not sure the suggestion for the .asoundrc file worked for me, as referencing the input as 2#audio and output as 3#radioconv in the WSPR.INI didn’t work.

At this point I did some guessing. When wspr starts up, it writes a list of audio devices to audio_caps file in your wspr dir. Here’s what mine looks like with my Rigblaster Advantage attached:

pi@raspberrypi ~/amateur_radio/wspr $ cat audio_caps
0    1    2       0       0  RIGblaster Advantage Audio: USB Audio (hw:0,0)
1  128  128       0       0  sysdefault
2    0    2       1       0  front
3    0    2       1       0  surround40
4    0    2       1       0  iec958
5    1    2       0       0  spdif
6  128  128       0       0  default
7    0    2       1       0  dmix

So I’m guessing the Rigblaster is device 0 and sysdefault is 1.

From the suggested config in WSPR.INI, it configures the in and out like this:

AudioIn 2#radio
AudioOut 3#radioconv

2 and 3 don’t seem to match up with anything I’m seeing, but since the other earlier step changed the USB sound card devices to be default, I set these instead:

AudioIn 1
AudioOut 1

Before starting up wspr I also ran alsamixer and set the vol and mic levels to be roughly 3/4 volume.
Now when starting up it looks like wspr sees my devices and off it goes:

pi@raspberrypi ~/amateur_radio/wspr $ python wspr_nogui.py 
******************************************************************
WSPR Version 3.00_r2326, by K1JT
Run date:   Thu Apr 17 05:14:05 2014 UTC
setting g.Win32
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
Audio config ok
2014 Apr 17
05:14:06
Rx Noise: -30  dB

The last few lines repeat for a minute or so then it starts reporting the actual volume level. You want to adjust the radio volume or volume on the Rigblaster so that the level is close to 0db. +/- a few doesn’t seem to make much difference.

The other values I changed are:

PctTx 0

This is percent tx time. Leave it at 0 for rx only, otherwise change to a %age of time value that you want to send your own transmissions. I changed it to 5.

iband 2

This represents the band you’re listening to, counted from the list of freq values. 600m is 1, 160m is 2 and so on.

Start it up and off you go!

python wspr_nogui.py

7 Replies to “Running headless WSPR on the Raspberry Pi”

  1. I am attempting to get WSPR running headless on a PI too.
    Previously I had followed George Smart’s article but ran into trouble with the swap file and really wanted a headless solution. then I found the article by LX3KR as you did and thought that would be the answer. But I could not get it working. Tonight I found your paper and thought I finaly had it. But…

    I have everything set up just as you have though I am using a K1JT 30m WSPR receiver. My results match yours right up to line 315 in the screen shot above. then instead of “Audio config ok” on line #16, I get “Segmentation fault” and wspr crashes. Since it does crash I do not have a audio_caps file to review.

    I have checked everything multiple times and even started a second time from scratch. Still the “Segmentation fault” happens both with your changes to the .INI file and before. Any suggestions would be appreciated.

    Fred, WA1DLZ

  2. I’m not sure what to recommend for the seg fault, but maybe posting to the WSJT group on Yahoo Groups might get an answer?

    Re. the swap file – I initially ran in headless mode and it runs ok, but out of curiosity I started it up in gui mode and got the ‘cannot map zero space pages’ error and so was thinking about setting up the swap file, but I remembered somewhere about setting the main memory vs video memory split in /boot/config.txt, using gpu_mem=16 which sets the video memory to the lowest level. This in itself was enough for me to run in either gui or headless mode ok without needing a swap file.

    Hope you can get an answer for your segmentation error.
    73, Kevin KK6DCT

  3. Hi Kevin,
    Wspr-headless working now. I had to get a new NOOBs SD to solve the problem. Apparently my local downloaded copies were all corrupted somehow.But received signals are showing up at WSPRnet so now on to other things. Thanks for your posting and comments.
    Fred WA1DLZ

  4. I am planning to run this on a RPi-0, Is there any problems you’ll forsee in running it on Pi-0.

    Thank you Kevin, for this.

  5. I am also interested in using the RPi to generate WSPR packets for direct Tx for which there are codes available. Can I combine both these so that I could copy WSPR using a SSB Rx and Tx WSPR using RPi ?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.