Saturday, November 3, 2012

WSPR on a Raspberry Pi using Raspbian

I revisited this topic in my jan 28 2013 blog wspr-on-rpilapdock-under-raspian.html. The method below does not work due to issues with the "latest" revision of software on the svn. It works fine if revision 2840 is used

 Having got WSPR and WSJT working on my Ubuntu laptop, the next challenge was to get WSPR working on the more restricted  Raspberry Pi

First discovery was that a new version of the RPI image was available so that was downloaded and installed. At installation time I took the opportunity to overclock the board at 1GHz and in the same menu allow the memory space to fill ALL the memory card (if you dont you only have 2GB to use, even on a 16GB card!
Searching the internet I came across a blog "Compiling WSPR on a Raspberry Pi" at  I also found some improvement pointers at

the "merged" steps (before I forgot how I did it) are:-

sudo apt-get update

sudo apt-get install build-essential subversion python2.7-dev python-numpy python-imaging-tk python-pmw libportaudio2 portaudio19-dev libsamplerate0-dev gfortran cl-fftw3 python-dev hamlib-utils

svn co

cd wspr

./configure --with-portaudio-include-dir=/usr/include --with-portaudio-lib-dir=/usr/lib/arm-linux-gnueabihf

To make sure the hardware floating point processor is used (speeds up decode), the Makefile created by configure needs editing.

vi Makefile (edit wouldnt work on my machine on this file)
make sure line 5 reads:-
FFLAGS = -g -O2 -fno-range-check -ffixed-line-length-none -Wall -Wno-character-truncation -Wno-conversion -Wtabs -fPIC -mfloat-abi=hard
make sure line 9 reads:-
CFLAGS = -Wall -O0 -g -Wall -O0 -g -mfloat-abi=hard

sudo make 

programme created, now to consider hardware:-

The RPI has an audio output but no audio input. Some have used $5 USB soundcards, but I   did not have one in my collection. Fortunately I still had the I-MIC which I used with my Ipad to run ISDR. A web search revealed this should work with the RPI without any software updates. 
Plugging in the Imic it appeared in the list of audio playback and recording devices:- 
aplay -l **** List of PLAYBACK Hardware Devices **** card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: system [iMic USB audio system], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0

arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: system [iMic USB audio system], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

time to launch WSPR:-


The usual screen for WSPR3.0.1 appeared which looked like success. I selected the imic as   audio in and audio out source in options

Hooked it up to the K3 and got decodes!

Time to try Transmit. I usually key the transmitter via the radio RS232 port but although the RPI has an RS232 port it needed a level converter which I did not have. I resorted to   using the K3 VOX with success and my signal was successfully decoded:-

2012-11-03 16:10  G4FRE  14.097139  +1  0  IO82uc  5  IX1CKN  JN35pr  995  132 
 2012-11-03 16:10  G4FRE  14.097140  +3  0  IO82uc  5  EA2COA  IN83  961  184 
 2012-11-03 16:10  G4FRE  14.097113  -22  1  IO82uc  5  GW7PEO  IO83gh  156  330 
 2012-11-03 16:10  G4FRE  14.097110  -23  0  IO82uc  5  VK3GMZ  QF22sf  17060  70 
 2012-11-03 16:10  G4FRE  14.097129  -9  1  IO82uc  5  LB1A  JP50mt  1264  35 
 2012-11-03 16:10  G4FRE  14.097121  0  0  IO82uc  5  OH2MUI  KP10wj  1843  50 
 2012-11-03 16:10  G4FRE  14.097181  -8  0  IO82uc  5  EW6BN  KO45hm  2047  67 
 2012-11-03 16:10  G4FRE  14.097112  -2  0  IO82uc  5  LY2BOS  KO24or  1833  70 
 2012-11-03 16:10  G4FRE  14.097118  -25  0  IO82uc  5  VU2LID  MJ88lm  8527  93 
 2012-11-03 16:10  G4FRE  14.097096  -24  0  IO82uc  5  G4SFS  IO81qf  100  193 
 2012-11-03 16:10  G4FRE  14.097097  -9  -1  IO82uc  5  LA9JO  JP99gb  2177  22 
 2012-11-03 16:10  G4FRE  14.097086  -20  0  IO82uc  5  ON7KB  JO21ei  466  98 
 2012-11-03 16:10  G4FRE  14.097104  -20  1  IO82uc  5  DG0OPK  JO50gq  903  95 
 2012-11-03 16:10  G4FRE  14.097129  -21  0  IO82uc  5  DV1VHK  PK04ll  10830  55 
 2012-11-03 16:10  G4FRE  14.097104  -11  0  IO82uc  5  OH2MZA  KP20kf  1890  51 
 2012-11-03 16:10  G4FRE  14.097101  -5  0  IO82uc  5  OK/AD6XP  JN89ff  1355  96 
 2012-11-03 16:10  G4FRE  14.097115  -21  0  IO82uc  5  DU1MGA  PK04  10830  55 

One thing I did discover during the above process was that although the RPI sets its clock via NTP this only happens if the internet connection is available at boot time. If you   connect the internet lead after boot time the clock will be off
The observant will have noticed I did not add "dwc_otg.speed=1" to cmdline.txt as recommended by VK2MEV. I did try it once, but when booting,  the RPI didnt find the keyboard or USB mouse and hence wouldnt let me log in. I had to resort to removing the phrase from the SD card using my windows laptop to get it to boot properly


  1. Hi there,

    Thanks for the report that forcing low USB speed breaks some USB keyboards/mice. The USB sound card I use needed or WSPR didn't decode anything. Since I only access the RPi via SSH/VNC the keyboard issue wasn't noticed. I'll update my post accordingly.

  2. Hello,
    thanks for the easy instructions. My first attempt wasn't successful. The compilation failed with this message:

    wspr0.o: In function `wspr0':
    /home/pi/wspr/wspr0.f90:16: undefined reference to `wspr0init_'

    Not sure what to do next. My programming skills are not that great.
    73, Mike VE3YXA

  3. Hi Mike. I also get this same error, on my standard PC; I think it's something that Joe Taylor has done with the code, and not directly related to the RPi stuff.

    George, M1GEO.

  4. I just commented out line 16 and 17 as it seemed to be about the commandline version of the program. I have no idea what the long term effects of this are, but in the short time, it worked and the program graphically runs. This looks like a much newer version of the old WSPR program (called WSPR4 r2874).

    George, M1GEO.

  5. Hi,
    I had problems as well. I kept getting an error message, 'TCIError :no display name and no $DISPLAY environment variable.'
    After six attempts I asked my son for advice and he got WSPR going by starting the desktop and using LX Terminal. (I had been using command line instructions from boot). WSPR 3.9 works but is not very stable - lasts about 15-25 mins. Everything including the mouse works very slowly even though I have overclocked to turbo!
    Chris, G0IMX

  6. Hi again. I have sorted my problems from the last post. It was my USB soundcard causing the problems. I now have a recommended LOGILINK USB soundcard and WSPR works really well with the script above. Thank you for posting this page!
    Chris G0IMX