Chris Thompson - AC2CZ - Amateur Radio Station

Remote Ground Station with FoxTelem on the Raspberry Pi

FoxTelem RaspberryPi I had quite a bit of fun making FoxTelem work on a Raspberry Pi using the FunCube Dongle as the SDR. I've captured the steps I took here. Let me know if you see any issues or if your experience is different.

First of all, I have only tested this on a Pi3. It might work on other Pi computers. I don't guarantee this is the best setup, but it works. Also I used an FCD Pro Plus, but it will probablly work with an RTL-SDR if you are using FoxTelem v1.06 or later.

I am running the default Debian based OS on the Pi - Raspbian - setup using the online instructions. If you already have an OS installed you can check which like this:
cat /etc/issue
Raspbian GNU/Linux 8

Power

Brownouts are an issue with the Pi and can cause it to reset. Make sure you have a power supply that can deliver enough current. I used a 2.5A PSU from CanaKit

The Pi has 4 USB ports. In theory they can supply 1.2A of current. Initially I use a powered USB Hub because you can get weird resets if power usage is too high. I have since fixed my crashes and power usage was not an issue. You can plug the FCD directly into the PI.

Headless Connection

I setup the Pi initially with a keyboard and monitor plugged into the USB ports. I just borrowed the ones from my desktop. I did that just long enough to enable the VNC server, which is pre-installed on recent versions of Raspbian. Then I connected from VNC. I had used X11 previously but it was not stable enough.

There are online instructions to setup VNC if it is not included with the OS that you have, or you can follow my instructions in the instructions in the grey box.

Burns Fisher (WB1FJ) sent me a note pointing out that "the 'approved way' to setup VNC with Jessie and later is to use sudo raspi-config and then "Interfacing Options" to turn on the VNC server.

He further notes "that if you start the server automatically via raspi-config, you get the same screen that the local video screen has. If there is nothing plugged into the HDMI port, the size defaults to tiny. You can change that in raspi-config. Depending on the video device it is possible that this is using separate memory from the general RAM and would give better performance. It might be better anyway if it uses the video chip's hardware acceleration. The only issue (or advantage) is that you are sharing views with the local hardware."

Overclock

I overclock the Pi to 1.3GHz as follows:

In /boot/config.txt, edit as root with sudo and update:
#uncomment to overclock the arm. 700 MHz is the default. arm_freq=1300
Save and reboot

Get current running freq to check its working:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

At first I also followed advice online and set sdram_freq=550. I do not recommend that as it caused strange crashes. I saw no performance decrease when I set it back to the default.

I put a spot of heatsink compond on the CPU and stuck a small heatsink to it. It is just one of those designed for a TO-220 package. I fixed it in place with some epoxy, as you can see from the image at the top of the page. I also have a small surplus fan mounted at the back of the box. It was initailly noisy, but a small resistor in series slowed it down to the point where it is not audible, but there is still enough air movement to cool the Pi.

Software Dependencies

You can start by updating the pi and seeing if that includes the latest java:
sudo apt-get update
sudo apt-get dist-upgrade

Those two commands above took a couple of hours to run on my new Pi. Since then the updates run in a few mins.

The FCD needs liblibudev.so, so run:
sudo apt-get update
sudo apt-get install libudev-dev
sudo apt-get install libusb-dev
sudo apt-get install libusb-1.0-0-dev

In /usr/lib/arm-linux-gnueabihf I did this:
sudo cp /lib/arm-linux-gnueabihf/libudev.so.1.5.0 liblibudev.so

It also needs the udev rules:
wget https://raw.github.com/csete/qthid/master/funcube-dongle.rules
sudo cp funcube-dongle.rules /etc/udev/rules.d/
wget https://raw.github.com/csete/qthid/fcdpp/funcube-dongle-proplus.rules
sudo cp funcube-dongle-proplus.rules /etc/udev/rules.d/

New versions of Raspbian should have Java8 installed. It's really really important that you use Oracle Java. I dislike Oracle and would embrace OpenJDK, but Oracle Java is much faster on the ARM processor. OpenJDK will not work, at least not with Java7/8. Hopefully this changes in the future. If you run "sudo apt-get install default-jre" I think it installs openjdk-7.

You should be able to get the latest oracle java 8 with:
sudo apt-get oracle-java8-jdk

If that does not find the package, then you can use:
apt-cache search and use java as the package name, or Oracle. That should give a list of available packages.

Configuring FoxTelem

Set FoxTelem to run in DUV mode. If you set it to Auto then it runs two decoders at once and it may be too much CPU usage.

Autorun

I initially setup FoxTelem to run at boot. Assuming you are using the user "pi", edit:
/home/pi/.config/lxsession/LXDE-pi/autostart

Add a line to run foxtelem script at startup. Make sure the script does a cd to the dir that FoxTelem is in

With that said, it is not robust enough. If FoxTelem crashes for some reason then you stop collecting telemetry until you notice. See the section "Making it Robust" below for a solution.

Knowing the IP address

If the PI is at a remote location and the ISP can change the IP address, then you need a way to know what the IP address is. If you are using VNC, so you can configure RealVNC to connect even if the IP address changes. But if you can't connect, then you don't know what is wrong or what address the Pi is responding to. So I use a python script that stores the IP address on my website. Then I can look there to find the IP and remote into it with ssh or VNC. There are probablly other solutions, but I did that as follows:

Grab the master branch for ipgetter as a zip using wget
wget https://github.com/phoemur/ipgetter/archive/master.zip

Code a short python script that is something like this:

import ipgetter
import datetime
from ftplib import FTP
IP = ipgetter.myip()
name='qth.html'
f = open(name, 'w')
f.write("<html><head><title>My QTH IP</title></head><body>")
f.write("<b>My QTH</b>
")
f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
f.write(" UTC")
f.write("<br>")
f.write(IP)
f.write("<br>")
f.write("</body></html>")
f.close()

ftp = FTP('www.server.com')
ftp.login('USER','PASSWORD')
ftp.cwd('www')
ftp.cwd('ip')
ftp.storlines('STOR qth.html', open(name, "r"))

Add a crontab entry:
0 5 * * * /usr/bin/python /home/pi/python/ipget/myip.py

Making it robust

The PI has a habit of becoming disconnected from the Wifi. With a headless machine you then don't know if it is working. It seems to be because the Wifi hardware gets powered off and then it has a hard time reconnecting. I did this to prevent the power off:
sudo iw dev wlan0 set power_save off

I used to have a lot of crashes where the PI froze. I thought it was power issues and finally concluded it was an issue with the SSD frequency that I had changed.

Now I see some occasional java VM crashes. I am researching those.

I wanted the Pi to automatically restart FoxTelm if it crashed. I researched the watchdog and found it to be quite complex, so I never installed it. Instead I created a cron entry that watches to see if FoxTelem is running and restarts it if it is not. It is based on the robust scripts from the Fox Server.

Copyright 2001-2021 Chris Thompson
Send me an email