WSPR beacon on Raspberry Pi
May 31, 2013 6 Comments
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.
For test runs, I used a BPF (band-pass filter) though, which requires careful tuning using signal generator but I just had one handy:
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!
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…
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.