RS-Decoder for Radiosonde's in Ubuntu Linux.


rs41s
Vaisala RS-41

A radiosonde is a small weather sensor package that is typically attached to a weather balloon.
As it rises into the atmosphere it measures parameters such as temperature, humidity, pressure, GPS location etc, and transmits this data back down to a receiver base station using a radio signal.
Zilog's RS-Decoders is a free open source radiosonde decoder for Linux and it supports a wide range of radiosonde protocols.
Together with an RTL-SDR it is possible to receive radiosonde signals, and decode them using RS-Decoders.

This tutorial covers some tricky points like setting up audio piping in Linux CubicSDR or GQRX , and getting the GPS data into a virtual COM port to use with FoxtrotGPS.



Dependencies

      imet 
      Intermet I-Met 1AB             

Make sure you have sox, perl, gpsd, and pulseaudio installed.

sudo apt-get install sox

sudo apt-get install perl

sudo apt-get install pulseaudio

sudo apt-get install pavucontrol

sudo apt-get install gpsd gpsd-clients

Compile Decoders

                 rs41 
          Vaisala RS-41  SGP                  

Download Decoders and Script

And skip this part.

Or create manually

Download the decoders or just do a git clone

wget https://github.com/rs1729/RS/archive/master.zip

git clone git://github.com/rs1729/RS.git

Compile decoders DFM-09/RS-41 or any other you need.

cd RS/demod/mod
gcc -c demod_mod.c
gcc -c bch_ecc_mod.c

echo "Compiling Mod DFM09/RS41"
gcc rs41mod.c demod_mod.o bch_ecc_mod.o -lm -o rs41mod
gcc dfm09mod.c demod_mod.o -lm -o dfm09mod

cd RS/imet/
gcc imet1rsb.c -lm -o imet1rsb
gcc imet1ab.c -lm -o imet1ab
gcc imet1rs_dft.c -lm -o imet1rs_dft

Put compiled rs41mod and dfm09mod files in a folder decoders or smth.
Also put pos2nmea.pl (NMEA perl script) from folder RS/tools in the folder!

Scripts, Setting up Virtual ports

      rs92 
              Vaisala RS-92             
Know we need to create a bunch of scripts..

Example DFM:

Create new file dfm.sh with content:

#!/bin/bash
echo "DFM Log" > /home/decoders/dfm09_`date +%Y%m%d%H`Z.txt
sox -t pulseaudio default -t wav - 2>/dev/null | ./dfm09mod --dist -vv --ptu --auto 2>&1 | tee -a /home/decoders/dfm09_`date +%Y%m%d%H`Z.txt | ./pos2nmea.pl > /tmp/virtualcom0
exit

Save it.

Making Virtual COM Port.

Create new file vp1.sh with content:

#!/bin/sh
echo "Creating Virtual Com Port: 0 and 1"
socat -d -d pty,link=/tmp/virtualcom0,raw,echo=0 pty,link=/tmp/virtualcom1,raw,b4800,echo=0
sleep 2

Save it.

vp1

Create new file vp2.sh with content:

#!/bin/sh
echo "Start GPSD on Virtual Com Port"
sleep 2
killall gpsd
gpsd -D2 -b -n -N /tmp/virtualcom1
sleep 3

Save it.

vp2

Create new file vp3.sh with content:

#!/bin/sh

echo "Start GPS Pipe on 2947"
sleep 3
gpspipe -R localhost:2947
sleep 3

Save it.

vp3

Create new file dfm_gps.sh with content:

#!/bin/sh

xfce4-terminal -T vp1 -e ./vp1.sh --tab -T vp2 -e ./vp2.sh --tab -T vp3 -e ./vp3.sh --tab -T dfm -e ./dfm.sh

Save it.


So much fun, know RS41 !

Create new file rs41.sh with content:

#!/bin/bash
sleep 1
sox -t pulseaudio default -t wav - 2>/dev/null | ./rs41mod --ecc2 --crc -vx --ptu 2>&1 | tee -a /home/decoders/rs41_`date +%Y%m%d%H`Z.txt  | ./pos2nmea.pl > /tmp/virtualcom0
exit

Save it.


Create new file rs41_gps.sh with content:

#!/bin/sh
xfce4-terminal -T vp1 -e ./vp1.sh --tab -T vp2 -e ./vp2.sh --tab -T vp3 -e ./vp3.sh --tab -T rs41 -e ./rs41.sh

Save it.

         dfm06 
      Graw DFM-06        


chmod 755 all created scripts :)

Add username to dailout Group for COM port access/permissions:

sudo adduser <your_username> dialout

Make permissions for COM ports:

sudo chown -R <your_username:your_username> /tmp/virtualcom0

sudo chown -R <your_username:your_username> /tmp/virtualcom1

When you got errors, run ./vp1.sh so the virtual ports are accessible in /tmp for setting chown permissions.


Note:

This tutorial was written using Ubuntu 16.04, on 18.04 you might have to change:

sox -t pulseaudio default into sox -t alsa default
If a wav error happens.

What does it all mean:

rs41mod -h
rs41mod [options] audio.wav
  options:
       -v, -vx, -vv  (info, aux, info/conf)
       -r, --raw
       -i, --invert
       --ths <x>    (peak threshold; default=0.7)
       --iq0,2,3    (IQ data)

dfm09mod -h
dfm09mod [options] audio.wav
  options:
       -v, -vv
       -r, --raw
       -i, --invert
       --ecc        (Hamming ECC)
       --ths <x>    (peak threshold; default=0.6)
       --json       (JSON output)

--ecc2 now also gives the output after each block how many bits the error correction has corrected. 
--ptu temperature Info
--dist is like ecc, but only blocks that belong to the same frame are taken, i. if errors occur, the frame is discarded / Inversed used for DFM06/09.

Install Driver         


Install RTL-SDR-Blog Driver (or any other):

git clone git://github.com/rtlsdrblog/rtl-sdr-blog.git
cd rtl-sdr-blog/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/
echo blacklist dvb_usb_rtl28xxu >> blacklist-rtl.conf
echo blacklist rtl2832 >> blacklist-rtl.conf
echo blacklist rtl2830 >> blacklist-rtl.conf
sudo cp blacklist-rtl.conf /etc/modprobe.d/

For list of improvements visit: https://github.com/rtlsdrblog/rtl-sdr-blog

SDR Radio programs

      imet4 
          Intermet I-Met 4             


Install Gqrx, 3 options:

sudo apt-get install gqrx
You get an old Gqrx version in Ubuntu 16.04 and no updates.




Follow Install Gqrx SDR on Ubuntu Linux and add PPA for install.

Or fast way (without GNU Radio setup) Download Gqrx Appimage:
chmod a+x Gqrx-2.11.5-x86_64.AppImage
And run,

./Gqrx-2.11.5-x86_64.AppImage


CubicSDR, build from source or use Appimage
chmod a+x CubicSDR-0.2.5-x86_64.AppImage
And run,

./CubicSDR-0.2.5-x86_64.AppImage

cubic

Virtual Audio setup

      dfm09 
                     
                        Graw DFM-09                

Some virtual audio can be setup:

Adding these lines to this file ~/.config/pulse/default.pa:

load-module module-null-sink sink_name=VBCable_A sink_properties=device.description="VBCable_A"
load-module module-null-sink sink_name=VBCable_B sink_properties=device.description="VBCable_B"


Will always load the desired NULL sinks on starting the pulseaudio sound server.
Removing sinks that had been loaded by pactl or pacmd, i.e. without settings in our default.pa can most quickly done by pulseaudio -k

This command will kill the running pulseaudio instance, to instantaneaously respawn it (in a default set up) using values defined in the default.pa.
Start SDR App tune in on WX-Station that launches DFM/RS or any Radiosonde you prefer.

audio

audio2

Dont forget PVAControl to setup the Virtual audio!

GPSD Setup

      o3 
             Vaisala RS-92 Ozon                  

In order to use gpsd with the decoder, we have to disable the service.

So it can be manually started:

sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket

Should you ever want to enable the default gpsd systemd service you can run these commands to restore it:

sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket

Start script ./dfm_gps.sh or ./rs41_gps.sh

It will execute the script in 4 tabs terminals(vp1/2/3 and the chosen decoder).
The sleep commands are inserted so other processes( socat/gpsd) dont start before the decoder.


It will create with socat 2 pairs of Virtual Com Ports, 1 out other in, execute binary file.
NMEA data will be shown in vp2/3 tab and the decoder.

As long as the socat (Terminal vp) is running, you have a pair of VPs open.

They are named virtualcom 0 and 1 so they stay static and no dev/pts/ number change.

Get it all Running

Need some GPS Applications to show Radiosonde position:

sudo apt-get instal foxtrotgps

Will install older FoxtrotGPS version from feed.



For newer versions build from source:
Dependencies - https://www.foxtrotgps.org/build.html
Download source on FoxtrotGPS website.

 

Insert extra Maps for FoxtrotGPS.
Open FoxtrotGPS, goto Info Icon 3th screen, Map type's New:



http://tile.memomaps.de/tilegen/%d/%d/%d.png


For Thunderforest maps sign up free at their website to get api-key and insert it into the links below:

Example:

thunderforest_api_key = 123

https://tile.thunderforest.com/pioneer/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/cycle/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/transport/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/landscape/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/outdoors/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/transport-dark/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/spinal-map/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/neighbourhood/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/mobile-atlas/%d/%d/%d.png?apikey=12

Install Navit.
sudo apt-get install navit

It's recommended to follow this excellent guide about navit:

http://ozzmaker.com/navigating-navit-raspberry-pi/

Download Offline Navit OSM Map's:

http://maps3.navit-project.org/


Tune in on a Radiosonde, run scripts.


Start FoxtrotGPS or Viking GPS to show Radiosonde current location and track.

vik

Foxtrot gpsd-port: 2947


fox