Electronic – Oscilloscope/Function Generator with GnuRadio (using very cheap hardware)

function generatoroscilloscopeRFsoftware defined radio

I was just getting started with RF signal processing, and I was very interested in being able to make an oscilloscope and function generator work in real time with python. Essentially, I would like some means of:
*Creating arbitrary waveforms defined by a numpy array (or sending out individual pulses in real time)
*Reading arbitrary waveforms into a numpy array (or receiving instantaneous voltage readings in real time)

I am quite new to this field, and I want to make sure I understand exactly what gnu radio is capable of and how I might go about setting this up.

It seems that gnu-radio is meant to interface with USRP–which is definitely out of my price range at the moment. I want to have a much better idea of what I am doing before I spend more than $20 on this.

I know $20 is not a lot, but I know that I can build an oscilloscope from a $2 usb audio driver, and I can use Mathematica (which I already have) to play arbitrary waveforms through the audio jack in my computer. Radio Shack has all the electronics I need to work with that signal. I am not looking for good sampling rates or anything fancy–yet. I just want a better grasp of the field.

So is gnu radio the best way to go about making a simple oscilloscope + function generator setup?
If so, what is the cheapest hardware I would need to get something that will send/receive arbitrary waveforms?


Added – RM

NumPy:

NumPy is the fundamental package needed for scientific computing with Python. It contains among other things:

  • a powerful N-dimensional array object
    sophisticated (broadcasting) functions
    tools for integrating C/C++ and Fortran code
    useful linear algebra, Fourier transform, and random number capabilities.

  • Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data.
    Arbitrary data-types can be defined.
    This allows NumPy to seamlessly and speedily integrate with a wide variety of databases.

NumPy array:

GNU Radio

Best Answer

No. GNU Radio is not the best way to go about making a simple oscilloscope + function generator setup BUT it may suit what you are trying to do, which is actually something slightly different.

If you are specifically aiming at producing real-time real-world arbitrary waveform generation and basic oscilloscope functionality where speed is not critical and you have a PC available, then there are numerous free or low cost software solutions available that directly target these capabilities, either separately or in combination. Gargoyle and friends will tell you about many of these by using search strings such as

           arbitary waveforms soundcard 

The above produced either directly or via linked links (examples only) the references listed at the end of this post under "OSCILLOSCOPES & FUNCTION GENERATORS:"

BUT

GNU Radio is targeted more towards RF solutions than towards what you appear to be wanting to do. It essentially attaches processing software to an ADC/DAC front end of your choice with a minimum of intervening hardware an with a software radio as the mos likely target - BUT not the only one.

As it is RF focused in original mindset the most supported hardware look suspiciously like multi MHz RF front ends and costs accordingly, BUT it does have sound card drivers and also has emulation capability allowing complete software playing with no hardware at all.

So, yes, it will do what you want.

It is Python based. Whether it uses NumPy arrays or other means of data presentation is entirely your choice.


GNU Radio oscilloscope module usrp_oscope.py

Usefully, GNU Radio has an oscilloscope module available - usrp_oscope.py - here - 350 lines of Python code.

Oscilloscope module

Basic Q & A here

User discussion here and here


An excellent introduction to what GNU Radio does (and doesn't) do is here
[http://www.gnu.org/software/gnuradio/doc/exploring-gnuradio.html]

A good overview of hardware supported here
[http://gnuradio.org/redmine/projects/gnuradio/wiki/Hardware] with mention of soundcard interfaces. They note:

  • Most computers nowadays are shipped with a built-in sound interface or sound card. 16 Bit resolution at 44.1 kHz (kSPS) and two channels is a long available level that you can expect. Virtually every operating system supports this hardware out of the box, and it's sufficient for a lot of DIY and hobby applications. You can expect stereo (2 channels) input and output.

    If the quality of a built in sound interfaces are not very expensively built and introduce noise or show bad frequency characteristics or degraded resolution, that is dynamic range. Fortunately, high quality sound interfaces are offered, like professional digital recording equipment, with more than a dozen channels, up to 24bit resolution and 192kHz sampling rate. These interfaces can be connected internally via PCI bus or externally via USB.

GNU Radio's own Wiki - excellent get you ging page here

"Exploring GNU Radio" by Eric Blossom - the 'father' of the GNU Radio concept here

Python writing tutorials for GNU Radio here . They say:

  • Welcome, GNU Radio beginners. If you are reading this tutorial, you probably already have some very basic knowledge about how GNU Radio works, what it is and what it can do - and now you want to enter this exciting world of Open Source digital signal processing (DSP) yourself.

    This is a tutorial on how to write applications for GNU Radio in Python. It is no introduction to programming, software radio or signal processing, nor does it cover how to extend GNU Radio by creating new blocks or adding code to the source tree. If you have some background in the mentioned topics and are starting to work with GNU Radio, this probably is the correct tutorial for you. If you don't know what a Software Radio is or what a FIR filter does, you should probably go a few steps back and get a more solid background on signal processing theory. But don't let this discourage you - the best way to learn something is by trying it out.

    Although this tutorial is designed to make your introduction to GNU Radio as easy as possible, it is not a definitive guide. In fact, I might sometimes simply not tell the real truth to make explanations easier. I might even contradict myself in later chapters. Usage of brain power is still necessary to develop GNU Radio applications.

Wikipedia / GNU Radio here



  • "OSCILLOSCOPES & FUNCTION GENERATORS:"

Free "Soundarb" soundcard based function generator. here 1 - SoundArb is a free program from David Sherman Engineering Co. that allows you to control a PC sound card like you would a conventional function generator. You can select standard waveforms, load arbitrary waveforms from a text wave table file, control the frequency and amplitude of the waveform, and select from a versatile set of triggering modes. With a stereo sound card, one channel can be used as a "sync" output.
Free software download here


XOSCOPE - GNU Sourceforge Oscilloscope here

  • xoscope is a digital oscilloscope using input from a sound card orEsounD and/or a ProbeScope/osziFOX and will soon support Bitscopehardware. Includes 8 signal displays, variable time scale, math,memory, measurements, and file save/load.


Opencircuits.com/Oscilloscope - vast range of oscilloscopes including open source hardwrae, sound card based, more. Superb. Here


Free miniscope pc oscilloscpe front end here


This offering via EDN may be free Program turns PC sound card into a function generator with softwarehere

Wikipedia provides this introduction which in turn links to

Virtins Sound Card Signal Generator 3.2. Typical lowish but note free commercial offering. Free trial . $20 ish ull version here . Many siilar availabnle. Many free.

Basic tutorial

This handbook for a commercial product but with some good related material here

DIY Verilog FPGA implementation

Instructable AWG using an AVR microcontroller. Not quite what you want but shown minimalist hardware that can be used with no PC here