Decoding meteorological probes with Raspberry Pi


    There is a C program collection for decoding meteorological probes from the developer nicknamed "Zilog80" on Github for a while now. For this package, nicknamed "darksidelemm" wrote a framework program in python language. This is a relatively usefull and good program.

My modifications:

    Of course, there are a couple of deficiencies beside its benefits. First of all, since I'm using a yagi antenna mounted on a rotator, it was necessary to rotate the antenna to the correct position. The rotating commands go to the rotator through a USB-COM converter. Since the most common AZ-EL rotator is the Yaesu G-5400 or G-5500 that uses the GD232 protocol, GS232 has been implemented in this program as well.
    The next plus service with which the program was expanded is a warning message if you are nearby the probe. The settings can be used to determine the distance between which you can go and start try to "hunting down" the probe. If the probe is already in decline path, and the distance is less than the set, the console displays a warning message that it is time to prepare the necessary equipment and pay attention to the location of the probe's touchdown. This warning may be more prominent with a little hardware expense based on the wiring diagram found here. Every time a warning message is appear on the screen, a short beep is heard, and the LED stays on until the next boot or the next sonde launch time.
     The program has been expanded with a "blacklist". In this list you can give the frequencies that we know are not from a probe, but from some local sources - perhaps from the receiver itself. Typically, such a false signal can be found on radios with the R820T2 tuner at 403,2 MHz. This blacklist will speed up searching for probes, because the program will not analyze the signals that you know are not a valid data from probes.
    The next feature that has been built into the program is the so called "white list". If this list is not empty, the program will only search the probes on the frequencies listed.
    The original program did not work with the variable gain. Any value was entered in the rtlsdr_gain parameter, the radio was always set to maximum sensitivity. This omission has also been removed.
    As this program
decodes the position of RS-92 radiosondes significantly better, it is practical to use it on the field also to help the search. If the program detects that it is an RS-92 radiosonde, then it pulls down the ephemeris, or almanac data from the internet, which is nessesary for determining the position. However, the internet is not always avaliable in the field. The original program  stops to work without internet connection. This is why the program has been modified and will use the last valid ephemeris or almanac data file for decoding the coordinates. Of course, for the sake of the better position, these data must be as fresh as possible, so it is advisable to get them before starting on the field.
    After starting the program, it will try to find a radiosonde as many times as the value set in the "search_attempts" parameter. If it does not have a result after that many attempts, it will switch to sleep mode. It will wait until the next radiosonde start time, which is 12 hours a.m and 12 hours p.m. in the winter. (In the summer, the radiosondes are started according to the winter time - ie in 01:00 a.m. and 01:00 p.m. local time.) The launch times can be specified with the parameter "launch_time" in the "station.cfg" file. This operation is valid if the program is started without the parameter t or if the parameter t is set to 0 (see text at the end).
    The rate of uploading the radiosonde's position to
the iGate system is defined by the "upload_rate" parameter. If the speed of the radiosonde is greater than 20 m/s or the height is less than 10000m then the program will send data to iGate (aprs.fi) twice as often than the time specificied by the mentoined parameter. If the height is less than 2000 m, the frequency of sending is doubled again. But the time is never decreased below 10 sec.
    In order for these new features to work, you must set the appropriate parameters in the "station.cfg" file. Primarily our own position and altitude. If a rotator is used, it must be enabled. At the same time as the rotator is enabled, you can also set the position of the antenna to use when searching the radiosonde. We can run several tests (when radiosondes are not flying) to see what are the frequencies that regularly appear in the search list but does not come from radiosondes. These can then be put on the "blacklist". Do not forget to set the "time_zone" parameter, which is needed for the program's correct wake-up time.
    If we set zero for the search_attempts parameter, the program will search the sondes continuously ignoring the -t and launch_time parameters.

Instructions for installing the program:

This package runs under raspbian. The last stable version can be used. It works fine under Jessie and the newest Strech also.

It is preferable to use the lite version so the graphical interface does not load the processor unnecessarly.

Installing the required software:

If you want to run on an earlier installed system, it is advised to upgrade
(this update takes a while):

If you use a fresh op. system skip these 3 lines
sudo apt-get upgrade
sudo apt-get update
sudo reboot

You can install the program automatically with file install.sh:
wget www.om3bc.com/docs/RS/install.sh
chmod a+x install.sh

If the entire program package is already installed and you only want to reinstall the RS program itself: rs-install.sh
wget www.om3bc.com/docs/RS/rs-install.sh
chmod a+x rs-install.sh
./rs-install.sh


or manually:

sudo apt-get install rtl-sdr
sudo apt-get install sox
sudo apt-get install python-numpy
sudo apt-get install python-serial
sudo apt-get install python-crcmod

For some of the newer operating systems, some are already part of the system.

  The install steps of the RS program:

mkdir RS
cd RS/
copy and unpack the autofile.tar.gz
file into the RS directory

gunzip autofile.tar.gz
tar -xf autofile.tar
rm autofile.tar

open the configuration file:

nano station.cfg.example
set the parameters
save it as station.cfg - without .example

launching:
python auto_rx.py 2>error.log

If it does not start, then in error.log you can see what's wrong.

for automatic startup (if you're interested):

sudo nano /etc/rc.local
Before the line exit0 should be entered:

#RS
sleep 10
sudo -u pi /home/pi/RS/start.sh &
or for running in "screen"
sudo -u pi /home/pi/RS/start_sc.sh &

save the changes: CTRL X / Y / Enter

You must make .sh files executable:

cd RS/
sudo chmod a+x *.sh


If necessary then:

sudo chmod a+x rs_detect
sudo chmod a+x rs41mod
sudo chmod a+x rs92mod
sudo chmod a+x dfmmod
sudo chmod a+x m10mod
sudo chmod a+x m12mod
sudo chmod a+x reset_usb

To keep the display from darking out after a while:

sudo nano /boot/cmdline.txt

there is one long line in it. Add to end of line:

consoleblank=0

save it

The startup can be done without parameters or by specifying a parameter. Usage parameters are:
-t timeout - time of running the program in minutes. If you do not hear a radiosonde at the set time, the program stops
-f frequency - if you set a specific frequency, then the program will only search the radiosonde at this frequency
-c config_file - If you do not want to use the standard station.cfg file, you can specify the file name here
example: python auto_rx.py -t 180 2> error.log results in the program searching for the radiosonde for 3 hours. If you find a radiosonde during that time, it will start decoding. If the radiosonde is not found during the set time, the program stops.
Default value for parameter t is 0.

If you want to see the radiosonde
we're followig on the aprs map, we need to get access to the iGate network first. Based on this, the parameters aprs_user and aprs_pass must be set. Another option is to use the ukhas maps. I do not recommend the ukhas map for two reasons. One that it requires a separate configuration, the other is that the website was not designed for this purpose anyway.

Pre-compiled, modified program for Raspberry Pi2 or Pi3:

imagefile of SD card

full install

program only

autofile.tar.gz

wiring diagram

The original programs are avaliable here:

https://github.com/rs1729/RS

https://github.com/darksidelemm/RS

Special thanks to HG5APZ and my son, for the translate this text.