Oscilloscope graphics just for fun

Motivation

My friend Thomas has a YouTube channel where he tears down and repair electronic equipment for fun and educational purposes.

Lately he has been investigating a bunch of oscilloscopes from different eras and wanted some kind of neat X/Y vector graphics that could be displayed on the oscilloscope screens.

Way back when I made some simple Arduino code to run a pair of X-Y laser galvos.

The code would simply convert a list of X/Y coordinates into two PWM signals that were then low pass filtered and fed to the galvo drivers. Later I added animation to the code so that the logo would tumble in 3D space.

The 2D logo data was designed as a vector file in something like CorelDraw or Inkscape and then exported as a HP-GL plotter file. These files are simple to convert to a list of coordinates. I used a Processing sketch to convert to a comma separated list that could simply be copy-pasted into an Arduino sketch.

Thomas has adapted this project to work with his oscilloscopes where it would just show a still image. Here is a link to Thomas project. It is interesting to see the crazy frame rate he has gotten using a rusty old 16MHz Arduino Mega.

I have included the original Arduino UNO code (AS-IS NO SUPPORT!!) for inspiration.  The outputs are PWM signals on pin 3 and 11 and a simple RC low pass filter (2,2k,10n) will convert these to analog for an oscilloscope, laser scanner or similar.

More better with modern stuff

After revisiting this project I thought it could be fun to re create it using a more contemporary stuff.

The ESP32  micro controllers has two built in D/A converters and the possibility to feed these at ridiculous speeds via. DMA so this seemed like a good choice.

The previous project would just take a list of points, make a 3D projection of these and play them back two by two via. the analog interface (PWM). The analog values  would then simply jump from point to point. The smoothing effect of the low pass filters used to convert PWM to analog would provide a bit of smooth transition between the points.

In the plotter files mentioned earlier all figures are broken down to a series of line segments and each line is defined by a start and stop point. This makes it really easy to convert vector drawings into lists of numbers. If you wanted to draw a straight line between two points you need to provide all the intermediary points in this list yourself.

An easy solution would be to make the program that reads the plotter files also fill in these points and then just let the Arduino play them back. This has the drawback that all the points need to be transformed in 3D space if you want to be able to animate the graphics plus they take up a lot of space in memory.

A more attractive method is to only store and transform the original start and stop points and then have the Arduino fill out the intermediate points in real time. This may be too much to handle for an Arduino UNO but no problem for a ESP32. I used Bresenham’s line drawing algorithm to do this.

The result is a smooth but delightfully retro effect which is best viewed on a old cathode ray oscilloscope.

I tried to add some grey scaling by drawing some figures less often than others. It is not so apparent in the video but the grid behind the DZL logo is darker due to the fact that it is only drawn every 4 frames.

So what can we do with this?

I am sure that there are a bunch of old X/Y type CRT’s out there that could be turned into cool retro displays of some kind.  I have been staring at this for a couple of days now and I really pleased with the fuzzy Nixie like vibe I get.

If you want to try it

In place of the Processing sketch I made this converter to convert the HPGL vector files to a suitable .csv format. It just runs in your browser.

The data from the converter can be used with this ESP32 Arduino sketch (AS-IS NO SUPPORT!!).

Due to the quick’n dirty nature of the project there is a limit to the number of points the code can handle. I have not really made an effort to use memory efficiently so this may be improved. Try smaller files first.

The graphics is output directly as analog values from pin 25 and 25 on any ESP32 module. At this time I have _NOT_ tried this on ESP32-S3.

Hope you have fun 🙂

 

 

 

Leave a Reply