Tuesday, March 26, 2013

KX3 IQ & Python SDR

It's a work in progress, but here's a shot of my Python / wxPython / Numpy "panadapter" display for the Electraft KX3.  The KX3 provides a very nice IQ output (wideband, quadrature audio), covering +/- 24 kHz around the VFO tuning frequency.

I have long been interested in building an SDR software backend using Python et al.   Two principles: (1) You don't understand it if you haven't coded it, and (2) Python is the quickest and often best way to put together complicated software.  It's most at home on Linux systems, but it is not hard to port most applications to Windows.  (Not quite so easy to port: hardware-oriented stuff like audio and Ethernet.)

Like most "friendly" apps, you find that 95% of the work goes into the display and user interface.  The numerical part is almost trivial, using Numpy:

    data = np.array(iqdata[::2] + iqdata[1::2]*1j)
    z = np.roll( fft.fft(data), SIZEC/2)  # place center freq in center
    pwrwork = pwrwork + np.square( np.absolute(z) )

The total code size is about 590 lines at this point.

This application (kx3iq.py) is really a remote control app.  I "beam" the IQ data from the KX3 via my Beagleboard XM and a UDP Ethernet stream to the Python app across the room, with Hamlib rigctld provide rig control.  Using 16 bit 48 kHz sampling, that's a data rate of ~200 kB/s without any compression -- doable over most ISP's these days, if you want a long distance remote.
Post a Comment

ShareThis