Welcome to Robot Dialogs. This is a place where I will record my progress, mistakes, errors, failures, lessons learned and hopefully occasional success in my designs and implementations of robots and other technical endeavors. I will try to make it as educational, informative and entertaining as I can...

Saturday, September 10, 2022

Eurorack VCO Module - AS3340

I don't consider this design done; but, I've gotta start writing it down because I'm carrying too much diagnostic info in my head regarding this thing.

One of the early kit's I built was this AI011 VCO. Despite the website saying it uses a Curtis chip (CEM3340) mine came with a clone AS3340A. At the time I didn't know anything about either chip, I just wanted a VCO to build and play with. Overall it is a fine VCO, it sticks to the datasheet's circuit for trimming. I also built four Befaco Even VCOs to use with the polyphonic envelop generator. I was initially on the fence about building my own, but I eventually decided it would be a nice accomplishment to do an entire signal chain from keyboard to output all of my own designs and an oscillator was gonna be necessary.

So I bought some AS3340's from Electric Druid and set about making my own design.

The AS3340 has a triangle, falling sawtooth and pulse output. It has frequency, pulse width, sync inputs. It seems common to add a sine wave generator output with external circuitry, but I felt that would overcomplicate this first design (it also seems like an interesting thing to have as a separate module). 

The data sheet for this is severely abridged as are most of the Alfa chips data sheets. They lean heavily on the original Curtis (CEM) chip data sheets. It's basically impossible to design something with only the Alfa data sheets. This is by far my main criticism of these chips. They work fine, but the documentation sucks. You'll need to find the CEM3340 datasheet for this, but not the 2 page one, you need the full version which offers 6 pages of glorious information. Here's where I found it.

I started this design on the breadboard, as usual.

It's on the left side of that breadboard the center and right side are some LFO designs. I recently bought more breadboards to deal with this congestion, but this is from before they showed up. I knew much of the testing I'd need to do wouldn't matter if I did it on the breadboard. I wanted to make a mostly surface mount design and that meant I just had to get a PCB made and play with that instead. 

I did make a few simulations of the output stage(s): https://tinyurl.com/2ew2cxa8

The biggest difference between my circuit and the datasheet is that I've opted for the 'easier' trimming described in 'Tuning the AS3340' by Rob Hordijk. Also available here. That circuit should result in a single pass tuning, unlike the other VCOs mentioned above that require multiple passes. In that respect it works, if the circuit is correct and other variables controlled, but that proves difficult as we'll see.

So I went forward with the idea and got some v1 PCBs. When I received them I assembled one and started test and immediately found several issues. But before I get into that, here's what it looks like:


Testing and Issues

Anyways lets dig into the issues the v1 board has.

Lets start with the easy stuff.

  • When making the front panel drawings I noticed the fine tune pot and PWM pot are not equally spaced from the center line. Also the jacks centers are not equidistant from the sides making front panel layout awkward. I made the whole PCB off center relative to the front panel to mitigate this.
  • I removed R6. R6 was meant to be a pulldown for the buffer input that I've used in other designs but here it interfered with the R7/R8 voltage divider causing lower than expected output.
  • JP1 isn't necessary. I think I added it to help isolate the frequency inputs for testing, but I haven't really used it and I've shorted it on all the PCBs so far.
  • I've changed R10 to 47k (from 50k). I thought I'd need two resistors to get 51k, turns out that's a more standard value than 50k. So now R10 is a 47k and R9 is shorted. I don't know if 51k or 47k is better. I see designs with both. There are other 47k's on the PCB so in an effort to reduce component variety I think 47k is ok.
  • R21 & R23 are 5.1k. Again I didn't look up common sizes on that so 5.1k is just a nearest value I had on hand. I still haven't tested the HF tracking so who knows if they are okay.
  • RZ1 is 18k not 13k. I don't remember exactly why, but I think it was because 13k wouldn't let me fully trim out the voltage difference between TP1 and TP2 as required by the trimming process.
Now the more complicated stuff:

The biggest hurdle I've had with this design is getting a clean square wave from the pulse output. There were multiple intermittent issues I had to solve.

First I discovered after much probing that the -5V supply provided by the LM7609 regulator wasn't smooth with the caps I had on it. For some reason the v1 circuit has an output of cap of 100nF. The data sheet for the 7906 recommends 1uF, so I was off by a factor of 10. As it turns out though, 1uF isn't enough. I experimented with values I have to find that what this really needs is a 10uF on the output. I managed to rework the v1 boards to accommodate that by using some creative soldering on the optional -12 input circuit I had there incase the -5V wasn't useful. Here's the reworks specifically for that cap:
  • JP3 10uF polarized cap from -5 to -12 rail. 
  • JP2 short - by design for the -5V supply.
  • R5 short - hack that ties one side of JP3 to -12V to allows JP3 to be used for the 10uF cap.
In v2 I'll accommodate the 10uF cap and remove the additional -12V stuff and JP2. 

Here's what it looked like before the above fix:

That's almost a full 2V ripple on the -5V (channel 2) and a pretty strong correlation to the bad falling edge on the pulse output. Here's what it looked like after fixing the -5V caps.

That modification fixed that PCB's nasty pulse ring so I thought I had it solved. So I built 3 more: 

And then I found some of them also rang badly even with this modification. 
Weirdly the ringing wasn't present on the output of the chip when probed but instead on the output of the buffer. I don't know if this was the probe impedance or something else. But I went searching the web for answers. I found a few forum posts describing similar issues here's one on Mod Wiggler and another on the LMNC forum. Much of the advice says a high value 'hysteresis' resistor between the PWM and pulse output is needed. I tried several values but was ultimately disappointed, none of them solved the issue. I did notice that the pulse output between the AS3340 and the output buffer was very sensitive to probing as well as just being touched. Ultimately that observation inspired me to just try a cap on the pulse output to ground. That worked. I tried several values but it's a compromise between cleaning up the falling edge of the pulse output and not introducing so much capacitance that the edge takes forever to fall. I landed on 100pF which takes about 10-50us to fall. I put that in parallel across R10 but I only had that value as a through hole cap, so it's not a good permanent circuit.

After that fix it looks like this:

With the falling edge fixed I felt I could finally get to the real issue I'd observed which was that it seemed like my circuit wasn't in tune after installing it in the main rack. I'd plug the thing in and play a note and it would be way off. Including notes I'd tuned it to in calibration. I'll keep this brief: The circuit was fine, the other modules I made had issues. The MIDI to CV design has an issue where it's sensitive to output impedance and the tuner I made doesn't work well above about 500Hz. So that sucked to find out. 

When I had removed those there was another issue, my 12V rail was at 11.25V. As it turns out I didn't verify that or didn't think it would matter but this circuit is super sensitive to input voltage and CV voltages. That was a face palm moment. I dug up the data sheet for the Mean Well RT65B and I can see that the 11.25V is in spec (barely) but they also have a diagram and a note that 10% load on the 5V rail is needed. Forums also confirm that the supply needs a load on the 5V rail. The trim pot for the 5V rail effects the other rails. I've ordered some load resistors to put on the supplies but for the time being just trimmed them higher so that I get a proper 12V rail. 

With all of that fixed the oscillators worked a bit better. They're still a little bit off in the 1V tracking but I think that's still a minor voltage difference between the bench and the rack supplies. I need to get both more consistent to really sort this out. That said v2 will place the trim pots on the other side of the PCB so I can calibrate them in situ.

2022-08-28 - Testing Notes:

Did a bunch of testing with a frequency counter. 

Completely recalibrated all four DUTs with frequency counter and mV scale for temp adjust step 1.

The tracking from 0v to 5V looked pretty good using a bench supply for CV and multimeter with mV accuracy. Frequency counter struggled a bit at some frequencies, so I compared it against an oscilloscope at lower frequencies.

  Procedure was:

  1.    Powered on for 1hr or more to warm up.
  2.    Readjusted temp1 w/ mV range on multimeter, drifts a bit, got it under a mV.
  3.    Short J4 and get 1046.5 with ref pitch trim pot.
  4.    Set Fine Tune knob to center.
  5.    Set Freq knob to 0, full CCW.
  6.    Input CV 5.000V±0.001
  7.    Use Re-find C6 trim pot to get 1046.5, this was trickier than with F4 shorted.
  8.    Input CV 0.000V±0.001
  9.    Use scale adjust trim pot to get 32.70±0.01 Hz 
  10.    Check tracking.
Some tracking test results:

CV DUT1 DUT2 DUT3 DUT4 Ideal (Hz)
0V 32.7 32.7 32.7 32.7 32.7
1V 65.45 64.9 66.0 66.0 65.41
2V 130.9 130.2 130.7 130.6 130.81
3V 261.9 260.8 261.8 261.4 261.63
4V 523.3 521.6 523.4 522.5 523.25
5V 1047 1045 1049 1046 1046.5

I think I'm okay with that tracking. It's usable if the power supply is okay.

2022-09-04 - Testing Notes

Today I decided to test the warmup time on the circuit. I measured the AI011 and my circuit. Here's the results:


In each plot there are two lines, I used two different frequency counters. In both circuits the time to stability is about 4 minutes. This is too small of a sample set to make a broad assumption, but I'm happy that the two are fairly comparable. The setup for that was:
  1. Room temperature devices (off overnight).
  2. 5V CV input and I briefly (20 seconds or so) turned them on to get them close to 1000Hz with the knobs 
  3. Turned them off a few minutes.
  4. Turned on and recorded data for 10+ minutes.
I also took a measurement of the effect of the PWM input knob on the pulse frequency. For this I used the already warmed up DUT2 from the above test and varied the PWM (in 5% increments) across the whole range, measuring the duty and frequency.

That's way more variance than I expected, roughly 1% over the whole PWM range. I'm not sure how to check that against the spec. I can't really find a value in the data sheet to compare to. I'm not sure what (if anything) to do about that, I'm just recording the result. Here's the actual data. Perhaps this is what the hysteresis resistor is for?

There's a circuit for VCO vs PWM stability on the Alfa website I found when designing v1 but I can't get it to work in simulation and decided to leave it out.

Testing still to do:
  • Double check output voltages and adjust gain resistors.
  • Buy and try higher precision resistors R30, R2
    • Most design and the data sheet show higher precision resistors that I used, they're hard to find though.
  • I haven't messed with high freq. track adjustment at all yet.
  • Fine tune knob has a little too much influence on tune, several semi tones... reduce?
    • Increase R3 or reduce range of RFINE_TUNE1
  • Try 5.6k on R21,R23 to reduce component count.
  • I've got three different caps for CF1/CF2 on different PCBs.
    • I need to choose one type but I'm not sure how to decide yet.

12V Current: 18mA
-12V Current: 13mA
5V Current: None

Schematic: vco_as3340_v1.pdf

Thoughts for v2
  • This list isn't complete, I need to use the v1 more and get through the rest of the testing.
  • Add precision resistor footprints. I can't buy them but might as well prepare for if I find them.
  • Fix -5V regulator output capacitance.
  • Add 100pF cap in parallel with R10.
  • Remove JP1
  • Remove R6
  • Remove R9
  • Remove alternate supply (-12V paths for VEE) 
  • Add a resistor for the 'hysteresis' mentioned in forums.
  • Fix resistor values from experimentation.

Eurorack VCF Module - Low Pass Filter - AS3320

This is my first filter design for Eurorack. I seem to always use my multi-mode filters (built from kits) in lowpass mode so that's what I've designed for myself. I didn't want to jump into a multimode filter yet, it just complicates things I don't have a good grasp on yet. The module uses 8HP.

For this filter I'm using the AS3320 filter chip which I picked up along with various other chips in that series from Electric Druid. When I went to figure out the circuit I ran into the biggest road block which is that the data sheet is nearly useless. It shows a sample circuit for low pass, high pass and other use cases but they are a tangled mess of wires, very poor layout for helping anyone understand the chip. In an age where the data sheet doesn't need to fit in a single page, there's no excuse for providing such bad documentation. Rant over. These chips are clones of CEM3320 and the full data sheet for that is somewhat better. Here's where I found it.

In the CEM3320 data sheet I found the math and fine details needed for figuring out values for the passive components, we must assume that the math works the same for the AS3320. Along the way I went back over to Electric Druid and discovered a fantastic writeup and a reorganized schematic that really helped clear up what this chip does for various filter designs in the wild.



That write up was hugely helpful. The diodes in my typical power supply on modules drops the nominal 12V to about 11.5V. The data sheet's values are for 15V. Armed with the CEM3320 data sheet I did all the math to figure out component values for my supply voltage. After that I did a breadboard version to verify the design.

A couple values I was a bit shaky on because my design isn't like anyone else's so there are a couple trim pots in the resonance circuit to allow some adjustment. There are a lot of text notes in the schematic (link below) about how I arrived at the various component values.

The CV input circuit and Frequency/Resonance control pot circuits are a circuit I've used in several designs with the Frequency pot flipped to make a more intuitive control. I expect 10V CVs in my system and the chip expects a much smaller voltage max so there's a voltage divider in the path before the op-amps and another after them to manage that. Here's a simulation of it. On the resonance the input is expecting a current range. The RCC1 and RCC trim pot produce this current from the resonance CV. RCC1 is mainly there to prevent overcurrent on one end of the trim.

Like the VCA design, I used one op-amp on the input to invert the signal getting filtered and another inverting op-amp on the output resulting in a net non-inverted output.

When I got the PCBs I assembled several. 


Overall they work fine. I've swapped the 300pF capacitors (C9,C12,C13,C14) with 330pF. I'm not sure if that was because I couldn't find 300pF or if I already had 330pF. 330pF works fine.

The resonance calibration pots don't seem to have a conclusive calibration procedure. I tried to make each filter's resonance behavior consistent with the others, but it's just a personal preference where they landed. In general the filter sounds good and that's what matters most to me.

12V Current: 11mA
-12V Current: 16mA
5V Current: None

Eurorack 4:1 Mixer Module

This is a Eurorack Mixer module with four inputs in 6HP. It's quite simple and only uses an op-amp and a handful of passive components. There are four inputs and one output. The inputs pass through independent potentiometers for attenuation and the all the inputs are summed and output. Here's what it looked like on the breadboard:

There's also a simulation. This type of mixing allows a strong input to effect other inputs (crosstalk) so it's not optimal for an input that needs to be routed to some other place pre mix. Other than that limitation it seems to work just fine. The potentiometers used to attenuate the signal can be audio (logarithmic) or linear depending on how it's getting used. 

I'm glad the design works because after panelizing these I got 30 in the first order which is more than enough for me. I haven't found any issues yet with the v1 circuit, but I haven't used them much either. Time will tell.

If I make another mixer it will probably have a buffer for each input to avoid the above mentioned crosstalk and an output stage amplifier/gain adjustment. 



12V Current: 5mA
-12V Current: 3mA
5V Current: None

Schematic: mixer_v1.pdf

Friday, September 9, 2022

Eurorack VCA Module - AS3360

Every synth needs a VCA. Since I've been making a few modules around Alfa chips that are largely clones of Curtis chips I picked up some AS3360's to use for this module. The AS3360 has two VCAs in it. It's fairly simple to use compared to the VCF and VCO in the same series of chips. 

Much of the design is straight from the data sheet with some bits borrowed from the Look Mum No Computer VCA but I've changed some elements to deal with CVs in my system going 0-10V and for various component differences.

As usual I put this thing together on the breadboard first. In this case it's pretty much a complete mockup of what I have in the PCB. 

The PCB design goes quite smoothly when I can work out the details on the breadboard. The best part of looking at the LMNC design before going into the PCB design was realizing that that design inverts the input and inverts the output for a net non-inverted output. That's a nice simplification I wish I had thought of myself, it's probably common on lots of modules but the first time I've seen it and understood it.

Here's a simulation of the input CV circuit. And another simulation of the output which is a bit different from other modules I've made since the chip provides a current output.


Most designs I make now that can be panelized are panelized before I order them it's a simple step to do and I get more boards for the same price for doing it. In this case I made a design decision early that allows me to use the panelized PCB for a quad version of the VCA.
For this to work there's a bit of extra space between the two PCBs on the panel and some extra through-hole solder points where jumpers can pass power to the second PCB. That means the two boards can share the power supply components. I also have a variant of the front panel for the quad VCA.

The quad version is desirable in my skiff for dealing with the output of the polyphonic envelope:
Issues on v1:
  • The voltage divider for the CV's shows 400k and 50k resistors (R24/R19 and R29/R20). After some testing, 390k and 33k worked better. The v1 values didn't account for the gain on the non-inverting buffer correctly.
  • On the silkscreen U1 and U3 are both op-amps but the chip name TL074/LM358 are swapped.
That's not much to complain about. I'm happy with the design. I haven't put too many hours on it yet so there may be issues down the road.

12V Current: 33mA
-12V Current: 13mA
5V Current: None

Schematic: vca_as3360_v1.pdf

Thursday, September 8, 2022

Eurorack MIDI to 16x16 CV Gate Module

This is a big one. I have been pursuing an idea to make all the modules in a full Eurorack signal chain and to be able to do polyphonic voices in it. The first thing in the that chain is a midi module that can take midi from the computer or keyboard and turn it into signals for other modules. 

Early on I needed a module like that so I bought a Befaco Midi Thing kit from Thonk and started using it, but I wanted to have the ability to drive even more outputs.

So this module has 16 CV outputs and 16 Gates. It consumes 18HP. It has MIDI input and output. the brains of the operation is an Arduino Pro Mini which I've written firmware for to handle polyphonic input (more on that later). There's a single button on the front which for now lets me set a MIDI channel. This thing doesn't have nearly as much configurability as the Midi Thing but I don't have to open a manual to change the main thing I need to configure.

Design Process

This design is much more in my comfort zone than most of the analog modules. The 'hard' part of this one is the digital design and code, but that's my day job so it's a place I can flex.

Like most of my designs this one starts on the breadboard.

Obviously there aren't 16 outputs on that breadboard. There's an Arduino and a breakout board for a MCP4922 DAC and some LEDs. I used this breadboard to sort out the driver code for the DAC.

When I went from breadboard to PCB it got complicated. One issue is component shortages, I couldn't find the MCP4922 or any DAC good enough for this at the time in a surface mount package, so I went with the DIP through hole package instead. Driving 8 of those (they're dual output DACs) and 16 gates presents challenges for the Arduino Pro Mini because it doesn't have enough pins. So the PCB also has two 74HC595 Serial to Parallel shift registers for that stuff.

Every available pin on the Arduino is used in the v1 PCB for this design, but two of them (A6 and A7) are not actually usable the way I intended. They can't be outputs so the LEDs I wanted to drive with them can't work.

In the end there were 28 ICs, 34 jacks and more than 200 resistors on this PCB. Even splitting it into two PCBs and using surface mount components for most things it was a challenge to layout and route. Here's a screenshot from in the middle of the design (many components changed along the way).

With each module I get a bit better at the layouts. Now I start with the front panel components to get them in the best locations and then the through hole and finally the surface mount. That general order makes it a lot less likely to need to redo a whole bunch of layout and routing. I probably rerouted portions of this PCB at least 3 times to get it to work though.

There are simulations in the schematic for the output stages, but they're pretty simple, the CVs and gates are amplified to my desired CV range of 0-10V (almost). There's a flaw in the CV output circuit though, more on that later.


The code for this is functional for 16 voice polyphonic output. I won't go into too much detail on it here, the code is likely to change over time. I'll cover the existing features though.
  • The MIDI channel can be configured. Press and hold the button for 5 seconds and the current channel selection will blink on an LED. Press the button to change to another channel. Press and hold the button to exit and save the selected channel. The channel config is persistent through power cycles.
  • The incoming MIDI traffic is passed to the output ('Thru' Midi).
  • Incoming note on/off messages are the only messages processed. Each simultaneous note goes to the next available output until all outputs are used up.
  • There are some test programs available in the repo for checking new builds.
  • Pressing the button in normal operation stops all notes. This is handy for some midi interfaces that don't send note off commands reliably.
Future features...
This thing is a beast and could be reconfigured for a number of tasks. In no particular order these are some ideas I've had for it that I'd need to write code for.
  • A 16 output sequencer mode, I'd have to figure out how to program new sequences.
  • A 16 step sequencer mode.
  • A multi-channel mode listening to 4 midi channels and output in 4 independent polyphonic setups.
  • Handle pitch bend commands
  • A drum rack mode (like polyphonic midi, but notes fixed to specific output pairs). Maybe use CV for velocity or simple envelope in this mode, or just more gates.


This is still ongoing. 

I've solved several bugs in the code (mostly weird edge cases handling fast polyphonic MIDI stuff).

Early in the testing I was pretty confused about the LEDs not working as expected, it wasn't where I thought I'd have issues... as it turns out the A6 & A7 pins can't be used as outputs. Those might be repurposed in the future for something else.

In the beginning of my tests I was observing some jitter (note length error) in the gate outputs that I thought might be down to slow code; but, after some triage, it turns out that the jitter is almost entirely on the MIDI connection. I was testing with Abelton via a Scarlett 18i20 and the MIDI jitter is proportional to the buffer sizes used in the interface. I watched the MIDI traffic and the Gate output with a scope and measured the jitter. Setup was 16th notes at 120bpm from Abelton.

Testing different buffers as the manual suggests using smallest possible buffer.
  • buffer at 1024, 22ms jitter
  • buffer at 512, ~12ms jitter
  • buffer at 256, 6-8ms jitter
  • buffer at 128, ~5ms jitter
Calibration of the output CVs is still a bit of a pain. As part of v2 I may design a test jig to do this more quickly and more accurately. So far I measured 4 of the CVs at increasing voltage outputs and plotted that:

Very linear until the top end which is great. After that I computed the average at each measurement point and looked at the deviation from the average for each CV output.

This is a lot more illuminating. The CVs are varying ±20mV from the average over the whole range. That's a bit more than I would like. Part of it is probably due to amplification of the DAC outputs and variance in the amplifier circuit components. I think with a rig to measure the CVs and compute a calibration curve for each I could tighten this up considerably but that's going to be a lot more effort. For now I used this data to configure a scale value to get pretty close to the desired 1V/Octave output on the CV.

At this point I started testing a few of these in my skiff. In the middle of testing my VCO design I discovered that this v1 design is very sensitive to the impedance of whatever's plugged into the CV. This is a design flaw. I compared my CV output to the Befaco design and quickly saw the issue. On each CV output, just before the jack, I have a 1k resistor to limit the current the op-amp has to source. That 1k should be in the feedback loop of the amplifier. As it is the voltage across that 1k is different with any difference in impedance on the output. So the calibration above only works out if the calibration rig has the same impedance as whatever the unit is plugged into which is unlikely. I need to make a v2 to fix that because of where the resistors ended up in the layout, a rework on 16 outputs would be too difficult. I can kind of compensate for this with calibration tweaking but I'd rather not, the v1 modules are still fine for other uses.

Changes for v2:
  • Some LEDs are misaligned, not on the 14mm grid.
  • A6 and A7 on the Arduino can't be used as digital outputs, so LED1 and LED2 don't work. 
    • A6 and A7 could be used on V2 for a sample and hold function and or a clock input function or for calibration.
  • LED1 and LED2 probably need to be removed, unless some of the pins tied to control signals for the DAC or 74HC595s can be used instead.
12V Current: 87mA
-12V Current: 12mA
5V Current: None

BOM & Test Data: Google Docs