Saturday, December 17, 2022

RP2040-AD9833 VCO--Triangle to Ramp Waveform Conversion

Hello again! This time I continue design and fabrication of a Eurorack audio VCO based on an RP2040 dev board and AD9833 function generator

the bench battle begins.....

I discussed the volt per octave ADC and MCU in the previous post here.  The V/octave PCB worked on the bench, but the AD9833's output leaves a bit to be desired for DIYaudio:

  • Its output is 0V to 600mV--we need more bipolar beef!
  • It can output triangle, sine, and square, but only one waveform at a time.

How can we turn this puny triangle signal into the bipolar 10V peak to peak triangle/ramp/pulse found in a traditional analog VCO?  

A common way achieve triangle to ramp conversion is to invert the "downward slope" of the triangle.  The inversion means instead of the waveform going up and down it only goes up.  

Easy right?

You can use an op amp to invert things:



...but as per my lab notes you have to turn on and off the switch at exactly (and I mean, exactly) the right time!


How can we create this critical switching signal?  

That's the tricky part! I had some (complicated) ideas using comparators to trap the top and bottom of the triangle, or maybe an ADC and MCU, but my notions seemed overly complex. 

There must be a simple way to do this, but how?  

At the advice of a friend I turned MODWIGGLER DIY FORUM for help.

MW is an amazing resource!  

After posting my problem some really talented techs jumped in with suggestions; the thread on MW is here

Guest from OpenMusicLabs conjured up a simple Falstad Simulation--fantastic!

Guest's from OpenMusicLab's design--you can see the sim he created here.


I drew up a schematic based on his idea--my schemo also provides for a pulse width modulated square wave, which I fully stole from the DIY legend Thomas Henry, as well as a buffered triangle output:

Values changed for the bench prototype (so far): C3 and C6 are are .0022uF; zener is 5V; R18 is 50K.

I turned that into a PCB to try out on the bench.....

Then I sent the gerber to this blog's patient and always helpful sponsor, PCBWAY, who quickly got it back to me:

My usual shout out to the folks at PCBWAY, please help out this geekly blog and give them a look for your next round of fab....

Cool! 

Did the PCB work right away?  

Nope.  

It wasn't a mistake in the design, nor in the converter circuit's basic concept, rather, I suck at breadboarding and was sloppy with soldering....I don't know exactly what it was, but all the wires and parts and alligator clips and things all my bench over drove me nuts.  

After blowing up a SEEED RP2040 **and** a 9833 breakout board, cleaning up bad solder joints, trying out some different cap values, and wasting a lot of time due to stupid breadboarding mistakes, yes, I got it to work.

The horror....

The horror....

The ramp wave created wasn't perfect but it was pretty close; it sounded a bit gritty, which was A-OK by me.  The distortion at zero crossing was less evident at lower frequencies where it counts most.  


Distortion at 4k; it diminished at lower frequencies


There was further discussion on ModWiggler about how to clean up this distortion. For instance, don't use a 2N7000 MOSFET for the switch, use a comparator. Update 2-27-23--putting a .01uF cap between pin 1 of the 2N7000 and ground improved this switching distortion somewhat. I will include this mod in a future "improving the tri to ramp converter" post.

The conversion conversation continues....this is an extremely helpful and enthusiastic community, and I am grateful for all the techs who helped with this design to date. 

OK I will put the AD9833/RP2040 and this waveform conversion board into a single package to make a Euro module VCO prototype in the next post. I will also make it easy to swap in different waveform conversion boards so the design can be further refined by making the VCO truly modular, from a design and layout perspective.

If I have time? Really folks, it's time to keep moving forward. Please stay tuned.

No comments:

Post a Comment

Building a Moog T904B Inspired High Pass Filter--Using an SMD hotplate--Works!

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file (main b...