Tuesday, May 7, 2013

How to do AFSK, PSK DTMF demodulation on Linux / Raspberry Pi using your RTL dongle

How to do AX25, AFSK, DTMF, POCSAG and PSK demodulation on Linux.

(RTL 2832U  receiver) Where can I get a RTL dongle http://www.giga.co.za


RTL 2832U


Using the programs multimon, sox, mkfifo, rtl_fm, git and RTL 2832U receiver you can demodulate the following modulations.

AX.25 (https://github.com/EliasOenal/multimon-ng/blob/master/README.md)
  • 1200 Baud AFSK
  • 2400 Baud AFSK (2 variants)
  • 4800 Baud HAPN
  • 9600 Baud FSK (G3RUH)
POCSAG
  • 512 Baud
  • 1200 Baud
  • 2400 Baud
Miscellaneous
  • DTMF
  • ZVEI
  • SCOPE

1) Download the following Library by using git
git clone https://github.com/EliasOenal/multimon-ng.git

cd to the multimon directory
cd multimon-ng
run the command make
mkdir build
cd build
qmake ../multimon-ng.pro
make
sudo make install

If you want to get this working on Raspberry pi you need to use the following

qmake --version qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory 
alias qmake="$(find /usr -name qmake | grep qt5)" 
qmake --version QMake version 3.0 Using Qt version 5.3.2 in /usr/lib/x86_64-linux-gnu


Command line options. (here is the help file) multimon-ng [options] [input_file]

sudo sudo multimon-ng -h
multimon-ng  (C) 1996/1997 by Tom Sailer HB9JNX/AE4WA
             (C) 2012-2014 by Elias Oenal
available demodulators: POCSAG512 POCSAG1200 POCSAG2400 FLEX EAS UFSK1200 CLIPFSK FMSFSK AFSK1200 AFSK2400 AFSK2400_2 AFSK2400_3 HAPN4800 FSK9600 DTMF ZVEI1 ZVEI2 ZVEI3 DZVEI PZVEI EEA EIA CCIR MORSE_CW DUMPCSV SCOPE

Usage: multimon-ng [file] [file] [file] ...
  If no [file] is given, input will be read from your default sound
  hardware. A filename of "-" denotes standard input.
  -t <type>  : Input file type (any other type than raw requires sox)
  -a <demod> : Add demodulator
  -s <demod> : Subtract demodulator
  -c         : Remove all demodulators (must be added with -a <demod>)
  -q         : Quiet
  -v <level> : Level of verbosity (e.g. '-v 3')
               For POCSAG and MORSE_CW '-v1' prints decoding statistics.
  -h         : This help
  -A         : APRS mode (TNC2 text output)
  -m         : Mute SoX warnings
  -r         : Call SoX in repeatable mode (e.g. fixed random seed for dithering)
  -n         : Don't flush stdout, increases performance.
  -e         : POCSAG: Hide empty messages.
  -u         : POCSAG: Heuristically prune unlikely decodes.
  -i         : POCSAG: Inverts the input samples. Try this if decoding fails.
  -p         : POCSAG: Show partially received messages.
  -f <mode>  : POCSAG: Disables auto-detection and forces decoding of data as <mode>
                       (<mode> can be 'numeric', 'alpha' and 'skyper')
  -b <level> : POCSAG: BCH bit error correction level. Set 0 to disable, default is 2.
                       Lower levels increase performance and lower false positives.
  -o         : CW: Set threshold for dit detection (default: 500)
  -d         : CW: Dit length in ms (default: 50)
  -g         : CW: Gap length in ms (default: 50)
  -x         : CW: Disable auto threshold detection
  -y         : CW: Disable auto timing detection
   Raw input requires one channel, 16 bit, signed integer (platform-native)
   samples at the demodulator's input sampling rate, which is
   usually 22050 Hz. Raw input is assumed and required if piped input is used.


how to decode a wav file

sudo ./multimon-ng -s SCOPE -t wav /tmp/message.wav (to read wav file) How to convert a wav file to row file using sox sudo sox foo.wav foo.raw
Now we want to take the received signal from rtl_fm and pyp it to the multimon
Create a fifo Pyp 
sudo mkfifo soundfifo.raw 
ls -al 
prw-r--r--  1 anton anton     0 2013-05-07 22:35 soundfifo.raw

You will see its not a normal file its got a prw in front of the file definition when you list the files.
Lets get multimon to start receiving audio from soundfifo.raw pyp.
sudo multimon-ng -a AFSK1200 -a SCOPE -t raw soundfifo.raw
 
And now send the audio from rtl_fm to the soundfifo.raw
Decoding live data from rtl receiver. (Tuning receiver to 144.800 Mhz packet frequency and demodulate that to 22.05kHz audio)
 sudo rtl_fm -f 144800000 -s 22050 ./soundfifo.raw (read my section on rtl if you want to install rtl utilities)


You should then see the scope screen below.
 

Multimon Scope Display
And your afsk1200 decoding will start in console and the scope display will show your audio.
Here is an example of hot to decode directly from rtl dongle sudo rtl_fm -d0 -f 144800000 -s 22050 - | multimon-ng -a AFSK1200 -t raw /dev/stdin

Hope this help...
REF: www.baycom.org/~tom/ham/linux/multimon.html, http://www.youtube.com/watch?v=GBmli8Vflig and http://www.ultratechie.com/2012/10/pigate/
https://github.com/EliasOenal/multimon-ng/blob/master/README.md

No comments:

Post a Comment