FreeDV Beacon

A few months ago John, VK5DM/3IC, approached me with the idea of setting up a FreeDV beacon. He offered to set up the radio, antenna, computer hardware, and Internet connectivity in Sunbury, a semi rural location NW of Melbourne. I have written the software, based on the FreeDV API and some code lifted from the FreeDV GUI program.

The beacon gives people testing FreeDV “someone to talk to”, and will encourage FreeDV activity. It’s also useful for me to have an automated receiver on an interstate (650kms/400miles) path for FreeDV development.

The beacon listens to a HF radio. When a FreeDV 1600 signal is detected, it starts parsing the text message. When it receives a “trigger” word, it will transmit a reply. A signal report consisting of the SNR and Bit Error Rate (BER) is sent in the text message of the reply. The beacon also records the incoming radio signal and decoded speech to wave files which are posted on a web site.

The first FreeBeacon (VK3CHN) is running on a Raspberry Pi with USB audio and RS232 dongles connected to a surplus Codan radio. VK3CHN is the callsign of a “silent key” friend of Johns, who was well known locally for his experimental work. His family asked that his callsign be kept in use for experimental activities.

Here’s an example of decoded wave file logged by the beacon. The received modem signal is also recorded by the beacon and posted. These files were generated from a transmission at my location 650km away that was logged by the beacon. Conditions were marginal, a SSB contact over the same path was readability 4.

Try It!

The beacon is up and running on 7.177MHz, you can trigger it using FreeDV 1600 with “VK3CHN” in your transmit text message. Pls email John (john_at_bungama_dot_com) for the web site URL – it’s on a home ADSL connection so bandwidth is limited.

FreeBeacon Software

Here is the freebeacon software including installation instructions.

Thanks Richard Shaw for adding cmake support to the project.

FreeDV on a Raspberry Pi

I’m one of the few people on the planet who hasn’t used a RPi until now. I like the way it can drive a keyboard and HDMI monitor directly. It’s very nice to have an “embedded” system with the full apt-get repositories and the ability to compile on the machine itself, rather than cross compiling on a host. It’s so small it ends up dangling in the air on the end of USB and Ethernet cables.

Here is a test of decoding 120 seconds of FreeDV 1600 on my Lenovo X220 laptop (i5-2520M CPU @ 2.50GHz):

david@penetrator:~/freebeacon$ time ~/codec2-dev/build_linux/src/freedv_rx 1600 freebeacon_test.wav /dev/null

real	0m1.188s
user	0m1.184s
sys	0m0.004s

And the Rpi model B (ARMv7 Processor rev 5 (v7l)):

pi@raspberrypi ~/freebeacon $ time ~/codec2-dev/build_linux/src/freedv_rx 1600 freebeacon_test.wav /dev/null

real	0m17.862s
user	0m17.560s
sys	0m0.040s

In both cases it’s running on a single core, and libcodec2 is compiled using -O2 optimisation. The Rpi is 17.8/1.2 = 15 times slower than my laptop but a FreeDV 1600 decode still runs 17/120 = 15% of the single core – comfortably in real time. Fast enough.

I developed Freebeacon on my laptop using a “Rig Blaster” USB sound device, then moved to the RPi. On the RPi I discovered clicks in the audio that took a few hours to debug. Eventually I fixed the problem by tweaking the PortAudio Pa_OpenStream() call below (n48 line):

err = Pa_OpenStream(
  &stream,
  &inputParameters,
  &outputParameters,
  fssc,
  n48,         /* changed from 0 to n48 to get Rpi audio to work without clicks */ 
  paClipOff,    
  NULL,        /* no callback, use blocking API */
  NULL ); 

I’ve hit similar issues on the FreeDV GUI program, the buffer size negotiated between the end user, PortAudio, and the underlying Linux sound system seems important.

The software can use RS232 DTR/RTS to key the transmitter PTT. My USB to RS232 serial cables worked on my laptop but not on the RPi. Not sure why, I could toggle the lines on the RPi with the stty command, so it must be a configuration or driver issue. Does anyone have any suggestions? Another USB RS232 cable John supplied worked just fine. Oh Well.

There is also a command line option to use the RPi GPIOs to key the transmitter.

Tips and Tricks

During set up it’s useful to play sound files out of your sound card. Sox “play” can be used on the non-default sound device:

$ AUDIODEV=hw:1,0 play freebeacon_test.wav

Use “aplay -l” to list the sound card/device

We used alsamixer to set the levels. You can change sound cards with F6. This didn’t work on all ssh clients, notably one used from Windows wouldn’t pass the function keys.

In the freebeacon repository there is a test file freebeacon_test.wav that can be used to test the beacon. As a first step play this file out of another laptop into the freebeacon sound card. Set the trigger string on freebeacon to “hello”. Check that your freebeacon gets sync, a reasonable SNR, and you see “Tx Triggered” when the text string is received.

It is recommended to use a 8kHz mono sound file for the transmit source audio wave file. You can convert any wave file to 8kHz mono using sox, for example:

sox vk3chn.wav -r 8000 -c 1 vk3chn_8kmono.wav

To pass your transmit audio through FreeDV 1600 and listen to the output quality on your default sound device:

~/codec2-dev/build_linux/src$ ./freedv_tx 1600 ~/Desktop/vk3chn_8kmono.wav - | ./freedv_rx 1600 - - | play -t raw -r 8000 -s -2 -

Or to save the result to a wave file:

~/codec2-dev/build_linux/src$ ./freedv_tx 1600 ~/Desktop/vk3chn_8kmono.wav - | ./freedv_rx 1600 - - | sox -t raw -r 8000 -s -2 - ~/Desktop/vk3chn_freedv1600.wav

This is useful to check sound quality before activating the beacon.

On receive watch out for the overload level, and reduce your radios AF gain or the sound card input gain if it’s hard up against 32767. Something like 5000-10000 is fine. It’s not critical, as long as you are not clipping.

The “-v” option is very useful for testing. Watch for the “sync” flag as a valid FreeDV signal is detected, and the “tx Trigger” when a txt message is received.

More info in the freebeacon README.

Next Steps

It would be great to have other people set up some more Freebeacons. In particular on 14.236MHz to log traffic and measure propagation.

Freebeacon only builds on Linux however it could be modified to run on Windows. If you are interested in setting up a Freebeacon on Win32 please let me know.

Many other ideas are in the freebeacon README. I would love to see some C code patches submitted with your ideas!

6 thoughts on “FreeDV Beacon”

  1. I would love to try a Win32 version of this.

    Might be a nice way to generate a little extra activity when things are slow on the air.

    Many thanks, Walter/K5WH

  2. Walter – Richard and I have added some support for Win32 but we need someone to try building and testing it.

    – David

  3. David,

    Would this be something that could be used similar to the way FreeDV is used today, with support for Hamlib and the sound card devices?

    ie.. by using this it could connect to PowerSDR the same way FreeDV does today. (not at the same time of course)

    I’m not familiar with the build process for the code, but I can certainly test it as it’s available.

    many thanks as always, Walter/K5WH

  4. Hi Walter,

    ATM it doesn’t use Hamlib, guess that could be added. It has support for DTR/RTS PTT keying, and the GPIO pins specific to the RPi.

    Yes it supports sounds cards just like FreeDV, except you only need one and it’s set via the command line.

    Cheers,

    David

  5. Thanks for that David..

    So is the win32 support ONLY for the RPI then via the windows10 IOT headless image?

    Or is it for other windows platforms as well?

    thanks, Walter..

Comments are closed.