WSPR beacon on Raspberry Pi

This was probably one of the easiest fun projects I did. Basically, the software written by Guido PE1NNZ does everything – just download. compile, and run the code. True software-defined radio!

I downloaded the source code from https://github.com/threeme3/WsprryPi and then compiled it on my Raspberry Pi using gcc. I found  instructions coming with  the code very handy.

Actually, it took me more time to setup wifi and install, and configure openntpd to ensure the date/time is always accurate as that’s crucial for WSPR. Also, as Raspberry Pi does not have RTC (realtime clock), the date/time has to be updated everytime you turn it on/off. So openntpd comes handy.

The pins 7 and 9 of the GPIO header needed to be connected to a low-pass filter (or a band-pass filter) via 1nF DC decoupling capacitor. LPF is a must because RPi output is a harmonic rich square wave. Paul Harden NA5N has a great tutorial on LPF here. I think I will reuse his schematic for a PA to improve isolation and pump up the power a bit.

I got my LPF from W8DIZ’s http://www.kitsandparts.com/univlpfilter.php – it’s very easy to build and no tuning is required.

Low-pass filter

For test runs, I used a BPF (band-pass filter) though, which requires careful tuning using signal generator but I just had one handy:

BPF

The LPF can be connected to a wire dipole or just a long wire… As GPIO pins go directly to the CPU, some isolation is a nice to have – I used an RF 1:1 transformer with somewhat 20:20 turns on a spare ferrite toroid core laying around (probably T37-6).

The first experiments didn’t go as planned – no decodes. The problem was that the crystal used by Raspberry Pi is sligthly off from required frequency – by a few hundred kilohertz only but that’s too much for WSPR.

To overcome that uncertainty, I tried sending transmissions on 40m on various frequencies between 7.039.000 and 7.041.000 Hz gradually increasing TX frequency by 100Hz in a loop  until I finally got spots. By checking the timestamp of the spot I could easily determine what was my TX frequency at that time.

The variance between TX frequency and spotter’s frequency was the exact deviation of the crystal frequency. The variance needed to be applied to the XTAL frequency constant in the wspr.c code. Or you could manually add/deduct it from the frequency you enter in the command line instead.

After the frequency was calibrated, I started getting spots!

428742_157418347761560_683321779_n

The output power is only 10 mW (3.3V peak-to-peak) so it’s really fascinating that the beacon can be heard as far as 1,200km away…

WSPR spots

I was a little upset that my position displayed on the map was slightly off. The reason was that the WSPR message is very short so it can only take 4 characters of your grid locator.

If you want all 6 characters (and more accurate pinpoint on the http://wsprnet.org/drupal/wsprnet/map) then you need to tell wsprnet.org what’s your full 6-digit locator is.

For that, I downloaded and ran the original WSPR program on my PC. My boatanchor rig drifts a bit so I used a pocket Sangean HF receiver radio instead for receive. I connected its headphones output to PC’s soundcard input. I tuned the radio slightly below 7.039MHz (as it cannot go precisely to 7.038.600) and was able to get and upload couple decodes easily.

Since that, my spots are displayed with the proper 6-digit grid locator on the map – http://wsprnet.org/drupal/wsprnet/map

P.S. Yan XV4Y put together a nice kit that uses MSP430 chip and AD9850 DDS to generate WSPR transmissions. Will check it out soon as it lowers down the cost of WSPR beacons even further.

P.P.S. Guido PE1NNZ confirmed successful QSO using his software-generated SSB signal with his Raspberry Pi. The code will be posted soon on his website.

About va3paw
Ham radio enthusiast, software developer

12 Responses to WSPR beacon on Raspberry Pi

  1. Ron says:

    Very nice article. I’ve had all these same issues in trying to get the Pi to work as a WSPR beacon. I’m using a LPF, but I’m uncertain how to connect the 1nF decoupling capacitor…could you please shed some light on this? I’ve figured out where the Pi is transmitting (off frequency) and adjusted it in the WSPR software. Still, no spots for the past month. I can see the pattern with its harmonics on my other rig located near the Pi that is running WSPR. Any advice you have would be helpful. Also, I’ve noticed the frequency drift of the Pi is significant as the ambient temperature changes. Have you had these same issues?

    • va3paw says:

      Glad you found the article helpful. I connected the capacitor in series between GPIO7 and the LPF.
      Peak the AC voltage on the out of the LPF (antenna). Must be around 3-4V – that’s 50mW.
      It also helps to check the shape of the envelope using oscilloscope.

      I didn’t have the drift issue as my pi is fairly stable warm.

      • Ron says:

        Thanks for the clarification…I’ll let you know it turns out.

  2. tubatobias says:

    Hi, thanks for this post! 🙂 This is exactly what I’m looking for as a HAM guy.
    My question: can I excecute reliably the code on a 256MB RPI as well? That’s quite important for me, as I would buy an RPI only for this project.
    73,

  3. Deacon says:

    Would it be possible to see some pictures of your Raspberry Pi connected to the LPF and the antenna?

  4. highness says:

    Any chance of getting some pictures of the Raspberry Pi connected to the LPF and the LPF connected to your antenna?

    • va3paw says:

      Hi, thanks for your comment. I don’t have anymore pictures handy but the following one by WA0UWH resembles the final product very closely:

  5. highness says:

    So, if I used this LPF from W8DIZ’s http://www.kitsandparts.com/univlpfilter.php I wouldn’t need to worry about tuning the output from the Raspberry PI?

  6. tubatobias says:

    made a small module for this: http://rfsparkling.com/qrpi/

    73,
    Zoltan

Leave a reply to Deacon Cancel reply