Interfacing with a modular synth

Status
Not open for further replies.

jcarruthers

Well-known member
As the Teensy 3.1 has "proper analog output" it seems ideal to use as a basis for a modular synth "module"

This is what I am hoping to interface with.

Signals in the A-100

In the System A-100 there are three types of signal:

Audio Signals
Control voltages
Trigger voltages

Audio Signals are produced by the sound source Modules (such as VCO or NOISE), and lie in the range from -5 V to +5 V (10 VSS). The System A-100 can also let you use external Audio Signals (e.g. Microphone, Electric Guitar, Keyboard).

To interface satisfactorily, the level of external Audio Signals must be brought up to the A-100’s operating level.
Module A-119 (External Input), is ideal for this job, having among other things an internal pre-amp, and two inputs of different sensitivity.
Control voltages, as produced by modulation sources like the LFO and ADSR, are from -2.5 V to +2.5 V (5 VSS) for the LFO, and from 0 V to +8 V for the ADSR.

Trigger or Gate Signals, which start a process or function, are typically from 0 V to 5 V, with the trigger occurring as the leading edge of the waveform shoots up from 0 V to 5 V.

These definitions of the various signals, and the distinctions between them - sound sources and modulation sources - are right in principle, but a modular system like the A-100 often makes a mockery of them. In a modular set-up, all of the modules produce voltages, and can be used as control voltages or triggers, thus blurring the distinction between the various types.

For example, the output from an LFO can be used as an audio signal, as a control voltage for a VCF or VCA, or as a trigger signals for a sequence.
It’s just about true to say that anything can be modulated by anything else, so that a modular system gives the musician extraordinary flexibility and individuality.

The first thing I'd like to pay around with are the trigger/gate signals - so that looks ok to interface directly in to the Teensy. I can put them on a rising interupt.

The differential voltages look a little more difficult and don't really know where to start.

So, my questions: how best to get the voltages in to the Teensy and make sure I don't fry it?



James
 
see here for a teensy 3.1 based module (using attenuverters for the CV inputs)

http://neutron-sound.com/images/neutronOAsch.jpg

that's not necessarily the only way to do it, but the principle (generally speaking) is always the same.

for the ADC, you want to make sure that a) your CVs are scaled (and, ideally, limited) to the input range (ie 0-3v3 in this case, unless using an external reference) -- typically the limiting (or overvoltage protection) is done with diode clamps (as in above schematic); and b), get the impedances right. the ADC wants to see a fairly low impedance source, the CV source a fairly "high" one (the convention is 100k); hence the op amp.

for the GPIO, i wouldn't (you shouldn't) directly connect to the pin. in the above schematic you can see there's again the diode clamps and a current limiting resistor ("gate"). a more common thing you see is people use a transistor "switch". as per (for instance) here: http://mutable-instruments.net/static/schematics/Braids-v03.pdf (second page, J1/"gate")

as for the outputs / DAC, similar considerations apply; it'll also depend on what's the intended use.

i'd suggest you head over to muffwiggler DIY -- it's a generic thing, not something specific to teensy. there's plenty of threads re building modules around microcontrollers, and on buffering in- and outputs specifically.
 
If I just want to copy the trigger part — it looks like all I need is a 20k resistor and a couple of protection diodes — do I need the OPA2277 too?
 
Yes, those orgone accumulator and braids examples are doing things in what is generally seen as the correct way, with Schottky diode (for over voltage) and resistor (for current limiting) protection on inputs and buffering (to avoid excessive current draw and to protect the output being used as an input) on outputs.

In general, assume that any pin could meet +/- !2V (for eurorack, +/- 15V for the 5U systems) and design accordingly.

One issue is that for pitch CV, you typically want a wide range of input voltage with high linearity, because pitch shifts are very noticeable and a quantizer is not a universal remedy. However, forcing that voltage range down to 5V or 3V3 is problematic; either you get a narrow range of pitches (5 octaves, or 3 and a bit octaves, at 1v/oct), or pitch accuracy suffers as you get significant change from non linearities and noise (dividing down a 0..10 or -2..8V range; even worse if you want to accept v/oct for LFOs).

I have recently been looking at the AD7367 analog to digital converter for this. Its an interesting chip that uses three different power rails. The main chip runs on 5V. The analog front end runs on +/- 11.5 to 16.5V (so works with +/- 12V and +/- 15V systems) and directly digitizes voltages in the -10V to +10V (20 octaves), at 14bits and with good linearity. Lastly, it has a third voltage input which tells it what voltage to run the digital interfacing at (5V or 3V3 for example) and communicates over SPI. I just got one. Unfortunately it is TSSOP24 which is a little awkward for experimentation; I also got a TSSOP to 0.1" breakout for it.

AD736x-connections.png
 
If I just want to copy the trigger part — it looks like all I need is a 20k resistor and a couple of protection diodes — do I need the OPA2277 too?

That op-amp is used to make a 3V buffered reference which is used for reading pots via the ADCs and also as a destination for overvoltage on inputs. Given that Teensy 3.1 is 5V tolerant you could use the 3V3 rail for that, if you only wanted trigger inputs.
 
Last edited:
The opamp circuit is probably the "best" way to convert +5 to -5 CV to an ADC input.

But it seems you're looking for the "cheapest" way. I believe it involve 3 resistors, and probably 1 capacitor, connected like this:

cv2adc.png

-5V will become 0 volts at the ADC. +5V will become 1.2V, and zero volts input will appear as 0.6V.

There are several caveats.

  • The DC offset depends on the 3.3V power supply. If the 3.3V rail varies, so does your signal at the ADC.
  • The scaling assuming the CV signal is driven from a low impedance source. Any output impedance from whatever device is sending the CV signal will add to R1, causing the scale to change somewhat.
  • The ADC input will be driven by resistors, which allows the capacitive switching inside the ADC to inject some noise. The 10 nF capacitor will help, but the noise in the ADC measurement will be greater than if the ADC pin had been driven by an opamp or low impedance signal.

The scales the CV +5V to -5V down to 0 to 1.2V, for use with analogReference(INTERNAL). The default is 3.3V, so be sure to configure to the internal reference.

With all those issues in mind, the only problem left is choosing the 3 resistors. I did a little Kirchoff Current Law math and put the equations into a perl script to find the best combinations of 1% resistors. Here's the results.

Code:
R1 = 5900, R2 = 1020, R3 = 3920
R1 = 6190, R2 = 1070, R3 = 4120
R1 = 6340, R2 = 1100, R3 = 4220
R1 = 6650, R2 = 1150, R3 = 4420
R1 = 6810, R2 = 1180, R3 = 4530
R1 = 6980, R2 = 1210, R3 = 4640
R1 = 7150, R2 = 1240, R3 = 4750
R1 = 7320, R2 = 1270, R3 = 4870
R1 = 7500, R2 = 1300, R3 = 4990
R1 = 7680, R2 = 1330, R3 = 5110
R1 = 8250, R2 = 1430, R3 = 5490
R1 = 8660, R2 = 1500, R3 = 5760
R1 = 9530, R2 = 1650, R3 = 6340
R1 = 9760, R2 = 1690, R3 = 6490
R1 = 10500, R2 = 1820, R3 = 6980
R1 = 11300, R2 = 1960, R3 = 7500
R1 = 12400, R2 = 2150, R3 = 8250
R1 = 13700, R2 = 2370, R3 = 9090
R1 = 14000, R2 = 2430, R3 = 9310
R1 = 14700, R2 = 2550, R3 = 9760
R1 = 15400, R2 = 2670, R3 = 10200
R1 = 15800, R2 = 2740, R3 = 10500
R1 = 16200, R2 = 2800, R3 = 10700
R1 = 18700, R2 = 3240, R3 = 12400
R1 = 19600, R2 = 3400, R3 = 13000
R1 = 22100, R2 = 3830, R3 = 14700
R1 = 22600, R2 = 3920, R3 = 15000
R1 = 23200, R2 = 4020, R3 = 15400
R1 = 24900, R2 = 4320, R3 = 16500
R1 = 25500, R2 = 4420, R3 = 16900
R1 = 27400, R2 = 4750, R3 = 18200
R1 = 30900, R2 = 5360, R3 = 20500
R1 = 32400, R2 = 5620, R3 = 21500
R1 = 33200, R2 = 5760, R3 = 22100
R1 = 34000, R2 = 5900, R3 = 22600
R1 = 35700, R2 = 6190, R3 = 23700
R1 = 37400, R2 = 6490, R3 = 24900
R1 = 40200, R2 = 6980, R3 = 26700
R1 = 41200, R2 = 7150, R3 = 27400
R1 = 42200, R2 = 7320, R3 = 28000
R1 = 43200, R2 = 7500, R3 = 28700
R1 = 48700, R2 = 8450, R3 = 32400
R1 = 49900, R2 = 8660, R3 = 33200
R1 = 54900, R2 = 9530, R3 = 36500
R1 = 59000, R2 = 10200, R3 = 39200
R1 = 61900, R2 = 10700, R3 = 41200
R1 = 63400, R2 = 11000, R3 = 42200
R1 = 66500, R2 = 11500, R3 = 44200
R1 = 68100, R2 = 11800, R3 = 45300
R1 = 69800, R2 = 12100, R3 = 46400
R1 = 71500, R2 = 12400, R3 = 47500
R1 = 73200, R2 = 12700, R3 = 48700
R1 = 75000, R2 = 13000, R3 = 49900
R1 = 76800, R2 = 13300, R3 = 51100
R1 = 82500, R2 = 14300, R3 = 54900
R1 = 86600, R2 = 15000, R3 = 57600
R1 = 95300, R2 = 16500, R3 = 63400
R1 = 97600, R2 = 16900, R3 = 64900

Combinations towards the end of this list will be closer to the 100K input impedance a CV input would normally have, but the impedance driving the ADC will also be higher (a fundamental trade-off with a cheap resistor-only circuit).

Of course, this is all "in theory". If you try this circuit "in practice", please post with your results. I know quite a few people want to interface CV to ADC pins, so it'd be nice to know if this really works, and if so, how well in practice with a real synth system.
 
This schematic has some good looking circuits for CV and gate outputs.

http://mutable-instruments.net/static/schematics/Yarns-v03.pdf

They use SMD ICs though—

http://www.nxp.com/documents/data_sheet/74AHC_AHCT1G125.pdf
http://www.ti.com/product/opa4171

Presume there are probably some kind of DIP alternatives.

yep, that's good practice for CV outputs -- if you're after pitch CV. note that the output resistor is inside the feedback loop. see here for an explanation as to why: http://www.muffwiggler.com/forum/viewtopic.php?t=64576

the other part is just a line driver, there're DIP alternatives for that. but you don't have to use one, you could use an op amp or transistor.
ditto for the op amp. the most commonest part used is TL08x/TL07x.

for the DAC, it'll be difficult to find something non-SMD that's as neat.

edit: @nantonos -- that looks like a nice part, that AD7367.
 
Last edited:
Paul — thanks for that. I reckon the opamp is the way to go. Cheap way is good as I have the bits lying around. Thanks for explaining the resistor way.

The Mutable Instruments Tides seems to have some nice examples for outputting both unipolar and bipolar CV. These are 0 to 8v and -5 to 5v and use basic TL072 so will be easy to replicate:

Screen Shot 2014-09-24 at 22.53.50.jpg

The Braids has a nice example of CV input for both octave and FM — but annoyingly uses a surface mount AD8354:

Screen Shot 2014-09-24 at 22.58.13.jpg

The Tides uses an MCP6002 which is available as DIP — so that looks good to go too:

Screen Shot 2014-09-24 at 23.07.55.jpg

They're all designed for 3.3v as well so that's a bonus.

In the spirit of "modular" it would be great to have breakout boards for these things…

Also, one thing that I don't see in any of these Mutable Instrument schematics is the protection diodes.




James
 
Last edited:
the mcp3204 has internal protection diodes, these will go some way, i guess. in my experience, with the teensy you do at least want a small series resistor after the op amp (see the neutron schematic), otherwise it'll get funky.

you'll be fine with TL072/4, i'd say. also, better to avoid referencing the pots to the rails ("VCC"), as the braids does.
 
Can I skip the MCP3204 and go direct in to the Teensy?

sorry, should have been clearer: i meant when using the teensy 3.x ADC, in my experience you'd need the series resistor. and sure you can skip it. i tend to do it, so does the neutron board. an external ADC if done properly will yield better performance though. also see nantonos' point re range above.

and it kind of depends on what you want to do. if you all you need is, say, 4 bit of resolution, then there's no point in using an external ADC. if you want want really tight V/oct tracking, then things might look different.
 
Last edited:
Thanks —*I have to admit to being more of a "mechanic" than an "engineer" when it comes to circuits etc — I can solder and put together a PCB — happy to wire up things and then code etc

At the moment my intended application really just needs the trigger/gate stuff — stage 2 might need some CV output.
 
in that case i think you'll be absolutely fine with the onboard ADC (assuming CVs will be used to set clock divisions and such)

here's a teensy based trigger module i've made:

14895548967_a5a993f94c_c.jpg

it has 4 CV inputs pretty similar to the TIDES, going directly to the teensy ADC via a 100R series resistor and a small cap (ie, just one inverting op amp (TL074), with negative offset). you;ll need a negative voltage reference but it's a neat trick to save on parts. the values then just need to be inverted in the code. the 6 outputs are simply non-inverting amplifiers with a 1k series resistor after the output. the trigger inputs are done with NPN transistors, much like the braids, but another schottky diode from base to ground. that's it. (i'd post the schematic, but i don't have one).

edit: oh, and it does have protection diodes before the ADC pins.
 
Last edited:
The Mutable Instruments Tides seems to have some nice examples for outputting both unipolar and bipolar CV. These are 0 to 8v and -5 to 5v and use basic TL072 so will be easy to replicate:

View attachment 2723

The left hand part of that circuit is a second-order lowpass fiilter to get rid of high frequency stuff that you don't want in your synth (and certainly don't want going into the audio interface if you are recording). Then a fixed voltage from a voltage reference is summed with the filter output to create a bipolar (symmetrical about 0v) signal which is still direct coupled (no capacitor) so it can go down to low frequencies or DC as a control voltage.

The Braids has a nice example of CV input for both octave and FM — but annoyingly uses a surface mount AD8354:

Yes, pretty much any DAC that you would want is surface mount nowadays. Except for the easy to use but not very good MCP4922 which is a dual 12-bit SPI DAC of rather modest abilities (INL 2bits typ +/- 12bits max).

View attachment 2725

The Tides uses an MCP6002 which is available as DIP — so that looks good to go too:

MCP6002 is a general purpose, unipolar, rail to rail (ish) op-amp which works fine at 3V3 or 5V. Its another way to assure voltage limiting, the signal lies between the rails (and much closer to the rails than an ordinary op-amp like the TL072) and the rails are at low voltage so no risk of suddenly getting 12 volts output. Other modules use TL072/074 running off +/- 12V which is fine on the output but as an input buffer, there is a chance the MCU sees rail voltage 9even temporarily during power-up) which can kill it.

In the spirit of "modular" it would be great to have breakout boards for these things…

Also, one thing that I don't see in any of these Mutable Instrument schematics is the protection diodes.
Correct. Apply -12V and bye-bye.

And yes, breakout boards would be nice.

I have some sketches of a "generic Eurorack Teensy 3.1/Audio Adapter" module but its well down in the backlog while I focus on completing more pressing projects. Basically the two audio ins (buffered and brought from +/-5V to 0..1.2V), two audio outs (3rd order 20kHz low pass filter, offset removal and buffering up to +/- 5V), onboard DAC out (3rd order 18kHz filter, offset removal and buffering up to +/- 5V), some digital ins and outs for triggers and gates, some CV ins (jumpered for unipolar 0..5V or bipolar -5..5V) with protection diodes and voltage reduction for the built-in ADC inputs, (same as is done on the orgone accumulator), and twin pitch CV inputs using that nifty AD7367 which has two simultaneous inputs, or four non-simultaneous with multiplexing). Plus usual Euro power input and so on.

Portions of that (like a pair of filtered analog outs) would be nice as breakouts.

mxxx has done some really nice teensy-based Eurorack modules, some with displays and typically using those SMD SPI DACs. None using the audio adapter (or the chip on it) though.

I worry slightly that the DC-blocking capacitors on the audio adapter, while fine for the consumer audio applications which are the target market for the chip, severely limit use for low frequency oscillators especially on input (1uF cap and 29k input impedance for the line-in). For the output, 100k or 1M input impedance gives some LFO possibilities.
 
Last edited:
Thanks to all! This is great.

I guess my next step is to draw something out and post it on here - if you guys could sense check it that would be great.

James
 
Or just try the 3 resistors on a solderless breadboard.

Or try some of the other ideas, quickly and easily, using breadboard construction. Yeah, it's flimsy, but very quick to try stuff and save yourself a lot of time with non-working ideas when you go for something like making a PCB.
 
Thanks Paul — I don't intend to be making PCBs quite so soon.

Breadboard, resistors and some ICs will be the order of the day. I think I even have some TL07x somewhere.
 
(I just want to draw it out so I don't go killing any of my Teensys)

I don't actually have any modular synths - a guy a work has been talking me in to them - and I've been showing him some of the stuff I'm doing with the FastLED library — we both came up with a really nice idea for a synth module.
 
I have some sketches of a "generic Eurorack Teensy 3.1/Audio Adapter" module but its well down in the backlog while I focus on completing more pressing projects. Basically the two audio ins (buffered and brought from +/-5V to 0..1.2V), two audio outs (3rd order 20kHz low pass filter, offset removal and buffering up to +/- 5V), onboard DAC out (3rd order 18kHz filter, offset removal and buffering up to +/- 5V), some digital ins and outs for triggers and gates, some CV ins (jumpered for unipolar 0..5V or bipolar -5..5V) with protection diodes and voltage reduction for the built-in ADC inputs, (same as is done on the orgone accumulator), and twin pitch CV inputs using that nifty AD7367 which has two simultaneous inputs, or four non-simultaneous with multiplexing). Plus usual Euro power input and so on.

sounds good. i'm somewhat intrigued by that AD7367.

anyways, true, i think there'd definitely be some interest for the audio-adapter-as-a-module (plus some generic i/o). the reason I wasn't using the audio adapter board was mainly that i wanted to use up some of the audio codecs i had accumulated, i hadn't even noticed those 1uF caps.

i'd tend towards a self-contained board anyhow -- it's tricky though, anything SMD will put a lot of people off. whereas pre-populated boards seems like quite a project.
 
Status
Not open for further replies.
Back
Top