decoding RTTY in Max

Using a local clock

(update 12/18/2013) Here is a video that shows acoustic coupling between to computers running RTTY in Max at 12.5 bits/second

Next version will have better syncing within the patch (i.e.., sample accurate timing, instead of [metro], [delay], and [snapshot]

original post

Have added stop and start bits to ascii rtty signal and reversed mark and space to the normal setting.

The current local test patches are:

tkzic/max teaching examples/

  • rtty-sim7.maxpat
  • rtty-recv7.maxpat

Accurate communication only works at very low speeds – around 11 bits/sec.  The timing on the receive side is very critical. The way it works now, is that it uses the first start bit, after a period of inactivity, to reset the clock. The ‘delay’ setting for the clock seems to be the key factor in whether the bits get read as characters.

I think that any speed increases at this point will require sample accurate timing on both send and receive sides. But as a proof of concept we have a decent start.  Its also possible that the filtering/bit detecting could be improved – but again, this is a matter now of precise timing adjustments at the sample level – and using more frequent and accurate clock adjustments on the receive side to maintain sync.

RTTY encoding and decoding in Max

notes

Today I was able to get an AFSK (audio frequency shift keying) system running in Max – sort of – It encodes text into ASCII bits and decodes the signal back into text – with a clock set at around 30ms (32 bits/second) – but there is no clock synchronization yet. Or stop bits, etc., The patch just uses the transmitter clock to sync the receiver (cheating)

Listen to an example of the word ‘hello’ at 32 bits/sec

local file is in max teaching examples/rtty-sim5.maxpat

Next step will be to get receiver sync happening – then make it conform to RTTY standard – probably a few days effort for this, but at least this is a proof of concept.

The synchronization may need to happen at the sample level (gen~) because it requires finding the beginning and end of bits – in order to set the clock pulses accurately.

 

ep-4xx13 DSP – week 13

Signal processing with radio

  • unintended interactions
  • using the wrong tools
  • measuring the invisible
  • antennas
  • propagation is frequency dependent
  • Extreme frequencies, negative frequencies?

links

Demodulation of signals in Max

These patches are works in progress. Please contact me if you have questions about how they work.

  • Modem.maxpat – modulation/demodulation
  • gen-fm-detector2.maxpat – a phase locked loop in gen~. Use with modem.maxpat – but turn FM modulation level down to about 250.
  • pid-mrmapes2.maxpat – Using a PID controller to control oscillators
[wpdm_file id=15]

Frequencies and modes

  • Arduino transmitter: AM 1330 kHz.
  • Wireless micorophone: Wide FM 676 mHz.
  • Cordless phone: Narrow FM 926 mHz.
  • Cell phone: Digitally encrypted trunking FM 836 mHz.
  • Macbook trackpad: Noise 5 mHz.
  • Macbook AC adapter: Noise 600-1400 kHz.
  • Wifi: Digitally encoded PCM 2.4 gHz.
  • FM broadcast band: Wide FM 89.7 mHz
  • TV audio 600 mhz/660 mhz FMW

 

Notes on rtl-sdr source code – first impressions

I did a quick read of source code (rtl-fm.c) today.

Basically it opens an input stream of IQ samples from the rtl-sdr device, demodulates filters, and outputs audio.

Other than usual madness with threads and locking – the code is fairly straightforward. Not well commented – but clear enough that we could extract the input streaming and frequency (device) control to make a Max external. One question would be whether or not to do the downsampling in the external, or in Max?

Rough estimate would be this project would involve about 1-2 weeks of analysis and hacking. Possibly less – but there is a learning curve – and a heuristic stuff which is required to work with the hardware.

Fortunately it actually works in MacOS and Windows – and there are plenty of other examples to compare it to. But this is not a casual evening project.

 

Compliling rtl-sdr from source on Mac OS

notes

Just compiled rtl-sdr using  instructions below, from: http://sdr.osmocom.org/trac/wiki/rtl-sdr

!! but did not run: sudo make install – or sudo ldconfig !!

so the programs are just running locally in: tkzic/rtl-sdr/build/src

I didn’t want to overwrite the macports versions which are running in the exec path.

after compiling I was able to successfully test by running this from rtl-sdr/build/src:

./rtl_fm -f 94900000 -W -s 200000 -r 48000 - | play -r48000 -t s16 -L -c 1 -

which caused annoying pre-christmas music from WHOM to ruin this peaceful morning.

—————————————————————

Building the software

rtlsdr library & capture tool

You have to install development packages for libusb1.0 and can either use cmake or autotools to build the software.

Please note: prior pulling a new version from git and compiling it, please do a “make uninstall” first to properly remove the previous version.

Building with cmake:

cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

In order to be able to use the dongle as a non-root user, you may install the appropriate udev rules file by calling cmake with -DINSTALL_UDEV_RULES=ON argument in the above build steps.

cmake ../ -DINSTALL_UDEV_RULES=ON

installing gnu-radio, rtl-sdr, and gnuradio-companion in Mac OS

Update 5/2014

May want to try these instructions from gnuradio.org: http://gnuradio.org/redmine/projects/gnuradio/wiki/MacInstall

Original post

I used these instructions today (12/3/2013) (mac os 10.8)

http://penturalabs.wordpress.com/2013/09/14/gnuradio-osx-installation-guide/

gnuradio-companion

# gnuradio-companion

also take a look at this post: – at the very bottom – is the simple list of instructions for installing gnu-radio and rtl-sdr

https://sites.google.com/site/alalbiolupv/tips-howtos/rtl-sdr-osx

Here is an example of rtl-sdr command, which now works from macports install:

/opt/local/bin/rtl_fm -f 94900000 -W -s 200000 -r 48000 - | play -r48000 -t s16 -L -c 1 -

 

 

Piping IQ data from rtl_sdr to wav file

 

  1. A program called pipeiq.c
  2. A streaming method called borip

It could solve the issue of getting IQ samples into Max – until I can write a Max external which reads the device directly.

http://www.reddit.com/r/RTLSDR/comments/1fl62j/hdsdr_for_linux_woborip/

I have saved the pipeiq.c local file to: tkzic/radio-sdr-experiments

Here are links to information about borIP – a program that streams radio IQ data over UDP to a simulated USB port – at least i think thats what it does.

http://wiki.spench.net/wiki/BorIP_Server

There are also instructions here for installing GR (gnu radio) on mac os

http://wiki.spench.net/wiki/BorIP