Hack of the Whenever I Get Around to It

December 8, 2007

Software Scope Emulator with Slow Phosphor

Filed under: Uncategorized — Chris Merck @ 6:29 am

To help with programming the scope graphics sound generating program from the last post I wrote the scope.c program to simulate an oscilloscope for testing outside the lab. I revisited the scope.c program and added a slow phosphor and a cool scrolling effect. The result is entrancing, particularly when you pipe different kinds of files into the scope.

Here are examples of various types of files piped into the new scope simulator:


the video is not as good as the pictures below, but you get to see the motion

rastered bitmap images (converted from pngs automatically!)

random data (/dev/urandom)

the contents of my harddisk (/dev/sda1)

an mp3

and from the audio used in the last post:

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.


September 26, 2007

PICRoboSim released

Filed under: Uncategorized — Chris Merck @ 12:36 pm

The simulator is finally ready for release! Features added are a sensor configuration screen, improved light calculations, Vista compatibility, improved Linux compatibility (a few of the libraries still don’t load right). Furthermore, there now is a handbook with documentation tutorials, and troubleshooting tips.

(the new look of the simulator)

(config screen)

See the PICRoboSim main page for details.

September 21, 2007

Freehand Integration and Differentiation

Filed under: Uncategorized — Chris Merck @ 2:27 am

Two years back I wrote a simple VB program to take a derivative and an integral of a function drawn by hand. It taught me a few things about basic Calculus, and even more about how not to draw sine functions. You can grab a copy of Freederiv and try it for yourself – with a tablet it becomes a great visualization tool. I will provide the source if I can ever find it, but it should be elementary to (re)write. Feel free to do so.

The obligatory screenshot(s):

(apparently my sines are more like linked semi-circles)

If you want to use it on Linux just run it through Wine. You will need two fairly standard Windows files for it to work. Simply copy “mscomctl.ocx” and “msvbvm60.dll” from the C:\WINDOWS\SYSTEM32\ directory of a Windows machine into your ~/.wine/drive_c/windows/system32/ directory.

(Freederiv running under Wine)

September 17, 2007

Astroflug – astroids squared

Filed under: Uncategorized — Chris Merck @ 11:47 pm


What happens when you take the classic Astroids game, remove the asteroids, add 50 enemy ships, and independantly simulate the trajectory of each particle of ammunition? You get Astroflug – a rather addictive though simple arcade game. There are four levels of difficulty: beginner, intermediate, advanced, and epic. Windows and Linux binaries and sources can be gotten here. It is written using SDL, so you will need SDL.dll in C:\WINDOWS\SYSTEM32\ or just in the same directory as astroflug.exe on Windows or install the libSDL12 and libSDL12-dev packages on your favorite Linux flavor.
Perhaps the coolest feature of Astroflug is that for each particle or enemy ship in the game a force is calculated and applied with respect to every other particle. That is, everything interacts with each other in a physical way. The result is very smooth-feeling immersive gameplay.

(a typical snapshot of an Astroflug session)

When you start to get pwned you can use a bomb blast that fires all your ammo at once in every direction. It is fun to watch how the shock-wave reacts to and wraps around the enemy ships.

(using the bomb blast)
(getting overrun)

(once your ammo “cools down” it gravitates back towards your ship!)
(interesting behavior is seen when enemy ships are told to attack each other!)

Have fun with this one. I will post any updates here (hopefully including a parallelized version).

August 25, 2007

Graphics in Brainfuck using bfsdl

Filed under: Uncategorized — Chris Merck @ 6:09 pm

Who says you cannot do graphics with brainfuck?

My interpreter, bfsdl, executes standard brainfuck code with a twist: the memory space doubles as video memory. It can be used either to visualize the execution of a program or to draw graphics to the screen.

Here is a box drawing program half way through erasing a box:

interpreter C source code
box drawing brainfuck program

Thanks Matthias Schmidt for the base interpreter!

August 16, 2007

YaCy crawl of this site

Filed under: Uncategorized — Chris Merck @ 2:39 am

At the suggestion of some IRCers I tried the open source, p2p web search and crawling tool YaCy. I have to say I am impressed with the features and the speed of the web crawl.

Here is the visual result of a web crawl of hotwigati.blogspot.com:

And an action shot of the crawl:

The exciting new feature in YaCy is the ability to distribute the web crawling among many peers resulting in fast and extensive crawls.

Of course there are privacy and security concerns. The software is Java-based, reducing the risk of exploitation, but there still remains the ‘risk’ of having your IP in the logs of sites crawled by anonymous peers through your machine.

June 19, 2007

Unfreezing Remote-connecting X Apps

Filed under: Uncategorized — Chris Merck @ 12:22 pm

Apparently when some X applications are launched remotely via qrsh and connect back to the host’s X server their gui freezes up. This happened with da_ic on Red Hat. However, xterm never seemed to freeze for some reason. The fix is to use xterm to launch the desired application:

Instead of:



xterm -e da_ic

in your script.

March 29, 2007

Pencil and Paper Potentiometer

Filed under: Uncategorized — Chris Merck @ 2:38 pm

An argument in Design II led to the following experiment:

Can a graphite ring on paper can work well as a potentiometer for measuring angle?


  • #2 pencil
  • piece of notebook paper
  • 9V battery (hardest thing to find)
  • Voltmeter
  • Some way of measuring angle (printed-out protractor)
  • Two circular objects to draw circles (CD-ROM and medium drink cup)


  1. Draw two concentric circles on a piece of paper.
  2. Color in the resulting ring darkly with the pencil, leaving a small gap in one place.
  3. Label angles on the ring with the protractor.

    (finished graphite ring and ticks every 10 degrees)

  4. Place 9V battery over gap in graphite.
  5. Hold black probe of voltmeter to negative terminal of battery.
  6. Sweep the red probe around the graphite ring and observe how the voltage varies with angle from battery.

(performing the experiment)

(schematic of circuit formed on paper)

When data were taken and graphed, if was found that they were highly linear. This agrees with the theoretical model depicted in the schematic above.

Note that the jump near 270 occurred because the region around the 270 deg mark on the ring was not shaded in dark enough. The discrepancy was fixed by applying more graphite to the 270 region. For future reference, the total resistance around the ring (R_total) was 140kOhms.

Conclusion: a rather accurate potentiometer can be made with pencil and paper.

February 18, 2007

Virtual Cathedral in Half Life 2

Filed under: Uncategorized — Chris Merck @ 5:54 am

For an Art History project I was required to build a detailed model of a cathedral. Instead of making a lame clay model I opened up Hammer (for the first time) and started putting together a Half-Life 2 map of Durham Cathedral, complete with the Ravenholm priest standing at the alter. Here is a link to the map file so you can try it out. The idea is that a video game provides an interactive environment that immerses the viewer in this gigantic Romanesque masterpiece. Subtle touches like AI birds you can chase around and the movable, breakable pew benches really add to the reality of it all. I had intended on presenting the project by letting my peers (who were to view and review the project) sit in a room with a wireless keyboard and mouse at a table centered in front of a large projector screen with good sound. Unfortunately the project was canceled and I never bothered to put the finishing touches on the church. So for better or for worse, here are some screenshots:

(in-game (or rather, in-church) screenshots)

(floor plan of the actual cathedral)

(screenshots of editing the map in Hammer)

(idea sketches)

The effect I was really after was captured by Valve in their tech-demo “Lost Coast”, see more screenshots here.
(screenshot from “Lost Coast”)

« Previous PageNext Page »

Blog at WordPress.com.