Digital VCO

dvco

This is a voltage controlled DDS, implemented with a Cypress PSoC (Programmable System-on-Chip). It uses standard 1V/Octave control voltages over a 0-10V range and generates 8 different waveforms with a +/-5V swing as output. Output frequencies from 20Hz-20kHz are possible, and falling-edge sensitive hard-sync is also provided.

The waveforms are:

Select ValueWaveform
0Sine
1Triangle
2Square
3Sawtooth
4Pulse
5Random Pulse
6Random Level
7Double Pulse

Samples

Here are a few examples of what it sounds like:

These were all recorded through a mixer and a USB A/D on a Mac with Felt-tip Sound Studio. Note that these are plain .WAV files and thus rather large. I tried using lame to encode them as .MP3, but the results weren't very much like the original.

Design Files

PSoC Designer project files

Schematic

Matlab scripts for lookup tables

Theory of Operation

The circuit can be divided into 4 distinct sections:

Design Notes

Aliasing

Working on this design has really highlighted the problems of aliasing for me. I've been doing DSP work for more than a decade, so you'd think that this wouldn't have been such a surprise, but the fact is that nothing brings home a system effect like actually hearing it. The sine waveform, with its naturally limited bandwidth doesn't suffer too badly from this (although there are some audible 'birdies' in the full-range sweep), and the triangle wave is tolerable, although somewhat worse than the sine. The waves with the sharp transitions though (square, pulse, sawtooth, and double pulse) are very sensitive to the natural jitter of the edges caused by quantization in time of the sample rate. When these are swept, you can hear this constant high-level fuzz that gradually resolves into individual aliases sweeping up and down the spectrum.

The main thing to remember is that when you're generating signals with sharp transitions at low sampling rates, the aliases are going to hit you hard. There are a number of techniques for reducing or controlling this effect, but they unfortunately require either lots of computation or lots of memory, neither of which are available on this particular PSoC. Using a higher-end chip with more flash memory it might be possible to do multiple wave-tables with band-limited waveforms. In this technique, the frequency computation routine would also generate a pointer to the wavetable which is dependent not only on the waveform selection, but also on the current frequency. I'll probably play around with this for a future version of the firmware.

For more details on this, see Dr. Aaron Lanterman's series of lectures on Synthesis. He has an excellent discussion of digital oscillators here: Alias-free synthesis of classic analog waveforms; digital state variable filters (Warning: this is a ~200MB RealMedia file).

PSoC Architecture

Learning to use the PSoC has been an interesting experience. Although these parts provide a wealth of possibilities, they are also fairly limited. This application in particular pushes the envelope of their capabilities, primarily because of the CPU loading caused by the DAC update ISR. The PSoC's MCU, while flexible and easy to understand is also rather slow when compared to some of the other offerings. With a maximum clock rate of 24MHz and an average time of 6 cycles per instruction, it sometimes struggles to meet hard realtime deadlines in a fast system. On the other hand, it was quite a deja-vu feeling to program this beast in assembly language. The architecture reminded me of nothing so much as the 6502 processor that I first learned on years ago.

The hardware capabilities are truly stunning though, especially the analog modules. Using just three unique blocks they've cooked up a broad range of functions that, while primarily targeted at low-speed signal conditioning and data acquisition, can be pushed into audio-speed DSP. The digital blocks are useful as well, although I would have loved to see one additional function: an accumulator for quick computation of NCOs would have been a really nice additional feature.

Additional Possibilities

Cypress provides a wide range of user modules, including various amplifiers, data conversion functions, filters, serial I/O functions and timers. Moving away from the speed requirements of the audio-frequency oscillator presented here suggests a number of Synth-DIY applications that are well within the capabilities of this architecture. Among these are:

I'll probably be exploring some of these in the future.

Power Supplies

This system is designed for my rack which has +/-12V and +5V available. +/-15V supplies can be used with only one change - the 2k resistor at the top of the Pitch control (labeled 'Tune' in the schematic) should be increased to 5k so that the summed CV normally stays in a 10V range.

If no +5V is available, a standard LM7805 type regulator may be used on the +12V line to provide power for the PSoC. Since the PSoC and it's associated circuitry draw very little current (I measured 19mA), an LM78L05 might be used to reduce size.

Tools and Resources

Cypress provides PSoC Designer free of charge. It's a decent integrated development environment (IDE) which allows you to pick and place the hardware functions you want, configure them and link them into the firmware. After you've specified the hardware, you can write the firmware and debug it. The free version provides only assembly language support with no real debugging, but it can be augmented with a C compiler and In-Circuit Emulation (ICE). For this project, I found that assembly language was more than adequate, and I didn't need the ICE. Instead of spending $700+, I just routed debugging signals out to GPIO pins to monitor internal conditions.

There are over two hundred PSoC application notes available at Cypress' website. These cover both hardware and firmware topics and a wide variety of target applications.

Programming the PSoc requires special hardware. I used the CY3210-Miniprog1 which is available for a reasonable price from Digi-Key. It's a pretty good deal, and includes several of the high-pincount PSoC devices which are useful for developing complex applications.

Acknowledgements

Thanks to the members of the Synth-DIY mailing list for providing me with lots of great ideas and encouragement for this project.

Return to Synth page.

Last Updated
:2006-05-10
Comments to:
Eric Brombaugh

Valid HTML 4.01 Transitional