Hack of the Whenever I Get Around to It

November 29, 2007

Graphics on Oscilloscopes using Audio CDs

Filed under: Uncategorized — Chris Merck @ 1:10 am

In a course this semester I had the opportunity to use a full-analog oscilloscope (circa 1960). The glow of the phosphor, the smoothness, and the simplicity of the device enchanted me – its elegance unsurpassed by the newer feature-loaded digital monstrosities. Particularly of interest to me were the figures which may be created by putting the scope in XY-mode (where channels 1 and 2 control the x- and y-deflection of the cathode ray respectively). If sine waves are used the resulting patterns are called Lissajous figures, but more interesting figures are possible if specially crafted inputs are used. I made it my goal to display a flower pattern (the polar graph of sine wave harmonics) on the scope by some easy method.

I decided to write a program to generate stereo sound that the oscilloscope would translate into 2D graphics (when the left audio channel is run into the x channel and the right into the y). After three hours in the EE lab I came up with the following:

  • flowergen.c, to enable the generation of sound to produce vector graphics with functions defined by the user. Currently it makes dancing flower shapes and a pong imitation.
  • img.c, to convert greyscale png images into sound which will then be displayed on the scope, using a rastering technique.

  • scope.c, to simulate an oscilloscope for testing when no scope is at hand.

These programs may be downloaded here. They require a Linux machine to run. I suppose they could also run on other systems with some modification.

Here is what the result looks like (the pong imitiation is missing from the end of the video as I ran out of memory on my SD card… you will have to try it for yourself to see that!):

For detailed instructions on how to do this yourself check out my instructable on the subject (not written as of yet).

For those who want instant gratification all you have to do is download (and extract) the finished wav files and burn them to a CD. Then sacrifice a pair of headphones to make a cable to connect the headphones jack of a portable CD player to the scope.



1 Comment »

  1. Very cool project. I been toying with the idea of building a scope clock using a PIC controller and a couple of 8 bit DACs. I must say that I never thought about just using my soundcard, there are two good 16bit DACs already biased and just sitting there ready to feed directly in. On my blog you mentioned ioctl(), I knew about this method, but it would require to code in C or more special Peal libs, thats why I chose to go with wave (no to mentions platform independent). Also very cool blog, as a programmer and network engineer I find your work very interesting. Shoot me some e-mail sometime.


    Comment by Evan — February 4, 2008 @ 5:50 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: