## Monday, 13 April 2020

### Isometric surface plotting on a Vectrex CRT under analog voltage control

A while back I converted an old Vectrex vector CRT games console so that the display could be controlled directly by voltage signals from a modular synth (after being inspired by a demo I saw from Andrew Duff)

Since then I have occasionally thoughts about making synth modules that might work well with the setup and one idea was something to enable isometric "3D" surface plotting from the synth. Back in my school days I messed around with making little isometric 3D demo programs on the BBC Micro computers at school and remembered it being pretty easy to do.. Basically if you have "logical" x and y position and a z position which is some function of x and y, then you can plot on the screen as basically

Xscreen = (x - y)
Yscreen = (x + y + z)

with appropriate scaling and offsetting to place (0,0) at the bottom centre of the screen. The line x=y then runs vertically up the middle of the screen.

My idea was that I'd use a ramp waveform from an oscillator (VCO) on my modular synth to scan the "logical" x axis at high frequency. Every time the scan completed I'd increment a position along the y axis until we'd traced a series of (say) 16 horizontal lines.

To generate the screen X and Y (which can be fed to the Vectrex as analog voltages) we can use voltage summing to evaluate the equations above (subtraction would mean inverting a voltage before adding it)

Once we've done that we can add a z component from another oscillator etc, which is then added to the Y voltage, and with appropriate scaling and offsetting we should get a "3D" plot of the z component on an isometric grid.. in theory!

Ideally we'd have a z that is a function of x and y so that the plot remains "fixed" on the grid. To start with I intended trying to get the same effect by messing by trial and error fine-tuning and messing with oscillator hard syncing.

So the first challenge was to generate the logical y coordinate from the VCO ramp voltage (x). What we want is a "stepped" voltage ramp with 16 equally spaced steps, where we move to the next step (y) only when the VCO ramp resets back to zero at the end of its cycle. Each full y-ramp should take exactly 16 x-ramps to complete.

I did this with a counter chip (CD4040) which fed into an R-2R resistor ladder (forming a digital to analog converter). Using one gate of a CD40106 hex inverter schmitt-trigger i could convert the VCO ramp into a pulse wave with a falling edge at the end of the cycle. This pulse clocked the counter and the lower 4 output bits of the counter fed the DAC (the upper 8 bits can just be left unconnected and ignored).

I had an integrated R-2R resistor network (4610X-R2R-103LF) component handy and used the 4 most significant bits (I tied lower bits to ground) but it would have been pretty easy to make an R-2R network from discrete resistors.

The R-2R DAC output is buffered by an LM358. I also buffered the VCO input using the other opamp gate. Note that the LM358 is not rail to rail so I ran it at 12V and ran the IC's through a 9V voltage reg so there was plenty of headroom.

This is what it looked like on breadboard...

It seemed to get the desired result!

I also thought it would be useful to have a "start of plot" signal output from the circuit for hard syncing a VCO at the start of the grid plot. For this I just hooked up bit 3 of the counter output to another gate on the 40106 (so I'd get a buffered rising edge when the bit 3 of the counter rolls round to zero). I also buffered the counter clock via the 40106 as I thought that might also be useful for hard synching an oscillator.

Then I got to work playing..

• I used the ramp out of a Befaco Even VCO module to drive the logical x axis.
• A Befaco dual A*B+C module did the x-y and x+y voltage adding
• A second Befaco dual A*B+C module did the z-scaling/adding to x+y voltage and also x-y offsetting
• The X and Y voltages went via an mcop 4x4 matrix mixer where they could also be attenuated, sent to the Vectrex X and Y connections and to audio (although none of this sounded so good!) plus a component of these voltages could be sent to the Vectrex brightness channel so brightness patterns could also be "plotted" on the grid
• I tried various sources for the z-voltage, from simple sine waves with and without hard-sync, FM'd sines, triggering two ramps on the Maths etc. Some results in the video below..

There is definitely some potential there but to really make the most of it needs "static" plots (patterns that jump around can easily be made without all this grid plotting). There is definitely mileage in hard sync and triggering waveforms (e.g. using Maths module) but I some kind of "function of x and y" would be really interesting to try... something for more experimentation