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