Forth Estuary Experimental Data Network
Most of what can be achieved via FEEDNET is courtesy of open source software. The sheer hard work, altruism and inventiveness of all open source authors is gratefully acknowledged here.
Streaming and Remote Control by inband DTMF.
For the benefit of other groups here is how we do our streaming.
Method 1 - Yaesu Radio FT8800
We take audio directly from the external speaker socket of a FT8800 dual band transceiver. This audio is fed into the line-in of a USB soundcard (£1.75 from ebay) which is plugged into a BananaPi single board Linux microcomputer (£28 amazon.co.uk). The Bananapi runs a Raspbian Linux Distribution. Additional software required is the Darkice source streaming package and Lame for mp3. Alsa sound library and utilites are used with a few custom scripts to provide a source feed to a commercial Icecast provider zfast.co.uk who provide a streaming distribution service at low cost. This is ideal to keep heavy traffic away from RAYNET servers. Such streaming can cost as little as £1.50 per month depending on capacity and bandwidth required.
Uploads are made to the FEEDNET website of audio recordings. One kind of recording is time accurate, the other is processed via the Sox package using its silence trimming (VOX) feature.
DTMF monitoring of the stream is provided my multimon-ng. All software is free and open source.
The entire hardware package fits in a small metal box and is powered by 5v from a USB power supply. Internet access is required.
Detailed Installation/Build Instructions.
1. Procure Hardware. One BananaPI, One CM119 chipset soundcard, One FT8800 Radio, One audio cable to connect speaker output to soundcard. These are the components we used, others can be used of course.
2. Get latest Raspbian/Banana Pi Build.
3. Open an account with zfast.co.uk for Icecast Streaming. You can always install and stream Icecast yourself but be wary of your domestic broadband uploading speed which may be one tenth your downloading speed. There are of course hundreds of alternative streaming provider also out there on the internet.
4. Update your system and install the required software for which instructions follow:
5. You need to get your soundcard capture device working. I used "alsamixer" to set levels. "alsactl store" to make them permanent. I created a file /etc/asound.conf which created a dnsoop slave to allow multiple applications to access the soundcard simultaneously.
6. Connect radio and test soundcard with "arecord". The exact command depends on your soundcard and alsa confugration.
7. Download and install Darkice with Lame support for mp3. Don't use the standard apt-get install packge. . There are lots of compile instruction on the web. Try these. https://stmllr.net/blog/live-mp3-streaming-from-audio-in-with-darkice-and-icecast2-on-raspberry-pi/
8. You will need to create your own custom /etc/darkice.cfg file to match your soundcard setup and your streaming service.
9 Install sox. Use this for trimming silence. http://www.linuxplanet.org/blogs/?cat=710
10. Install and compile multimon-ng. https://github.com/EliasOenal/multimon-ng
11. Bring it all together with the following scripts/config files:
c) hourlyrec.sh - this is run as a cron job on the hour every hour. Its purpose is to create a timestamped filename, record an hour of audio to it, invoke sox to create a silence trimmed version, invoke ftp to send them both to our public facing website where there is a small asp script to display the contents of the folder. This asp script allows point and click access to each timestamped recording.
d) I use a script called startstream.sh which is run by cron on reboot. This script runs darkice, redirecting stdout and stderr to a log file. It also runs arecord to grab the radio audio and pipes it into multimon-ng to decode dtmf then pipes the output to the next script (e) below. Note that there might be issues with the PATH when running cron. I moved the location of multimon-ng executable to /usr/bin for example to make it work.
e) pdtmf.sh is a script that parses the output of multimon-ng, idenntifying individual commands. When a command is received an appropriate script is run. In our case, at the moment this is more for demonstration and *66# uploads using FTP an image file to our web server that indicates streaming is turned on. *77# uploads a similar picture file that indicates steaming is turned off. It is an elementary change to actually make these commands halt/restart darkice. DTMF Commands can be used to send email, control hardware (relays for exmaple) or do anything that a linux computer can do. This is a very powerful radio interfacing facility. For those concerned about security (DTMF tones can be monitored and copied) we suggest making the DTMF commands single use only. The list might have hundreds of combinations and may depend on the day and time for example. For the absolutely paranoid use TOTP one time tokens such as google authenticator which runs nicely on a PI.
Method 2 - Using SDR Dongle
The Yaesu FT8800 is a useful and expensive piece of kit and it seems a little wasteful to dedicate to a receiver-only role. These days it is possible to purchase an RTL SDR receiver for £10 that covers 50Mhz up to 1750Mhz with passable performance. Most of the configuration work is identical to Method 1 as described above with the addition of:
1. Install the RTL-SDR source and compile. We are interested in RTL_FM.
2. Install snd-aloop Alsa kernel module and configure an Alsa Loopback virtual sound device. The output of the RTL SDR will be PCM audio and we want three diferent programs to make use of it - the Darkice Streamer, the Multimon DTMF detector and the arecord recording software. During testing you may want to directly monitor audio from the headphone socket too. The Loopback device will be the playback target for the SDR and can be then used as a Dsnooped capture device for the use of all the software described above that needs it. If unsure about these terms look at the Alsa wiki. You will probably need to become familiar with its contents.
3. Configure the sound and scripts to send audio from SDR to default card which is to be defined as Loopback 0,1. Create a dsnooped virtual card (mine is called "radio") based on Loopback,1,0. Create "plug" type slaves for both incoming and outgoing cards. This allows you to handle all the pcm rate conversions that will be necessary.