MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

CV and trigger - best practice design for microprocessors
MUFF WIGGLER Forum Index -> Music Tech DIY  
Author CV and trigger - best practice design for microprocessors
jcarruthers
Hi all,


I've been browsing through the forum as I am looking to create a few boards to interface a Teensy (or Arduino) with a modular synth. The choice of Teensy is because it seems like the best value considering the number of inputs/outputs along with the size/speed/memory.

I figure there are six basic circuits:

FM or "bipolar" — input and output — -5 to +5 volts
Octave or "unipolar" — input and output — 0 to ? volts
Gate/trigger input and output — 0 to 5 volts

I've seen so many different examples of how to do them all — I want to discuss "best practice" — for instance gate/trigger using either diodes or transistors. For the CV outputs I expect to use a decent DAC such as the 4922 (with a reference voltage?)

Ideally it should protect the microprocessor from frying — and they should tolerate a decent range of voltage. In terms of output it should conform to the right "standard" (I know there's not really a proper set)


James
pre55ure
Digital inputs:

Analog inputs:



For digital outputs use an op-amp as a comparator (lm324 works well). You can use voltage dividers to set the comparison threshold and the output level.

For analog outputs, the MCP's work well but need to be buffered for use with synths. There are lots of places around the net to find schematics for a basic DC follower/buffer.

Analog inputs and outputs that swing between -5 and +5 are a bit more difficult and in both cases require the input or output to actually be between 0 and 5v at the micro end but then shifted (and possibly amplified) to work.

A good way to learn about this sort of stuff is to download eagle and then take a look at schematics that other people have posted. Mutable instruments have all their board designs posted, and the Midibox project also has a lot of schematics posted for boards that are designed to translate between modular signals and microprocessor signals.
Jaspo
I have taken on a project that involves connecting a Eurorack trigger out to an Arduino which is controlling lights. I have the lights working, but I am a little confused on the trigger>arduino side. I expect a transistor would act as an isolated switch, with the trigger in at the base. I was hoping to use the 5v on the arduino, but I am not sure how to set it up.

The main thing would be to protect the eurorack, although I doubt I could do much damage. I am a noob at DIY, but I have a basic understanding of components and have the tools and components.

The first image seems similar to what I want to achieve.

pre55ure wrote:
Digital inputs:


Is the diode there to protect against negative voltages? Why is the top most 10k resistor needed?

Any help or alternative methods would be greatly appreciated.

Thanks,
daverj
Jaspo wrote:
Is the diode there to protect against negative voltages?


Yes. The transistor will be damaged if the base goes too far below the emitter. The diode limits how far negative the base voltage can go.

Jaspo wrote:
Why is the top most 10k resistor needed?


The transistor can just short the output pin to ground in that design. It can't provide any positive voltage. The resistor provides the positive voltage and the transistor then shorts that to ground as needed.
executiveBlaster
The 10k is a pullup resistor, but the arduino has internal pullups so it is not strictly necessary. RESETIN would be tied to a digital pin configured as an input. When the incoming trigger is high, that digital pin will read low. code would be something like this:


#define INPUTPIN 8 //could be any free digital pin

pinMode(INPUTPIN, INPUT); //set INPUTPIN to input
digitalWrite(INPUTPIN, HIGH); //enable the internal pullup.

if(digitalRead(INPUTPIN) == 0) {
//do your thing
}
executiveBlaster
oh and the original question. as pre55ure mentioned, mutable's site is a great resource for this. check out page 2 of the braids schematic:

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

The second op amp in his analog inputs is powered from 3.3V and ground, so nothing above or below that can come out and damage the ADCs. It's a better approach than using diodes to limit.

Using a unipolar offset, like on the pitch input, makes a lot of sense here. A bipolar signal will add and subtract from the position of the pot, but will clip on either side of it. Adding an attenuator after J2 would make this a good general purpose ADC input.
Jaspo
I got it now. I realize this is all basic beginners electronics and I should know it. Thanks for taking the time to explain it. The programming has been the easy part, but I am out of my element with the electronics.
bloodsample
Sorry for resurrecting this old thread, but I find myself in the same boat as the OP and I have some additional questions I was hoping someone could answer.

I'm working on my first eurorack module based around an ATMega328p microcontroller (Arduino Uno).

I too am a software guy so I'm having some trouble figuring out what the best practice is for wiring up a digital output from the microcontroller pin to a gate output 3.5mm jack.

I've been refreshing my electronics knowledge and reading up as much as I can, but most of the information I've consumed is either specific to a single component (e.g. how an op-amp works, how a transistor works, etc) or too broad and prescriptive (e.g. "do this and that") without explaining the "why".

The microcontroller digital output pin is 5V high and 0V low. My understanding is that this should be enough to trigger a gate (according to the Doepfer spec).

So here's my (dumb) question: Why can't I simply connect the microcontroller's pin directly to the tip of a 3.5mm jack?

It seems that if I provide 5V at the output that would be up to spec for a gate signal in eurorack. I've also read that the output impedance of a digital pin on the ATMega328p set to high (5V) is 80-100ohms, which seems like a pretty low output impedance (which I've read is a good thing).

I have a bit of an intuition for input/output impedance and the need for a buffer, but I'm not really confident in how this applies to real circuits in practice. Do I need a buffer for digital out to 3.5mm jack? Is a buffer needed because of the voltage divider created by my module's output impedance and the other module's input impedance which could cause the 5V gate to be lower (if the other module has a lower input impedance than my module's output impedance)? Should there then always be a buffer at all I/O jacks on a module?

pre55ure wrote:

For digital outputs use an op-amp as a comparator (lm324 works well). You can use voltage dividers to set the comparison threshold and the output level.


Could you help me understand why a comparator is needed here? Is it to ensure the output is "rail-to-rail" (0-5V) in case the microcontroller pin happens to be lower than 5v? Or does it serve a differen purpose?

Here are some different examples of gate output schematics I've found (all of which are slightly different). I'd love to get a better sense for "why" these components were chosen and why a simple wire wouldn't do. Also, why are there so many different kinds of circuits for this? Is there not a "best" way to handle this?

From the Mutable Instruments Grids schematic:


From the Mutable Instruments Yarns schematic:


From Ken Stone's Gate Sequencer schematic:


From Synthrotek's 16-Step Sequencer schematic:


Apologies for the noobish questions and thank you in advance for any help!
pichenettes
Quote:
and why a simple wire wouldn't do


If you mistakenly patch the output of another module into your "simple wire" digital output, you'll expose an MCU pin to a voltage that might be outside of its supply range, and you'll very probably destroy things (either the GPIO output circuit for this single pin, or a whole range of adjacent pins, or the entire MCU - I've experienced all of these).

So at the very least you need the 1k protection resistor - you can intuitively imagine that it gives some "slack" for the GPIO pin to stay in the 0V-5V range, even when a voltage out of this range is enforced on the other end, due to mis-patching.

Another (much more dubious) motivation for the presence of this protection resistor is that it allows passive mixing of several outputs.

Then the choice of the actual output circuitry depends on:
1/ how high you want the output to swing, and what's your MCU output voltage.
2/ if you consider that your output is just for digital purposes, or if it should deliver a good quality signal for more "analog" purposes.

Regarding 1/, if your MCU is powered by 3.3V, you really don't want your output gate to be at such a low level. You need to shift the output level to +5V or +8V or +12V. There are good reasons to use any of these 3 voltages: +5V because many digital modules set this precent (including Doepfer's MIDI/CV interfaces). +8V because 0V-8V is a common range for unipolar modulation signals - and some VCAs are calibrated to give full amplitude with a CV of +8V. +12V because that's the highest positive voltage attainable.

Whatever your target voltage is, if your MCU is powered by a lower voltage, you'll need to amplify/level-shift its output. There are several ways of achieving this - logic buffers or level shifting ICs, a single transistor inverter, or an op-amp in non-inverting configuration with the appropriate gain. The choice of any particular technique depends on available PCB space, the availability of spare op-amp gates you can dedicate to this task, the number of outputs... For example I won't use a transistor if that'll be the only occurrence of a transistor on the board...

Regarding 2/, it's something often overlooked... If you look with your scope at the straight output from an MCU pin, you might see that it can sit a dozen mV above GND / below Vcc, and that it can be tainted by a lot of noise. This is not an issue if your digital output is fed to a digital input, but if you want to use it for example to "gate" a signal with a VCA, you'll get bleed and/or inject noise into your audio signal. Same issue if it goes to audio rates and users of the module might want to use it as a squarish sound source. So if you consider that your digital output should output signals clean enough to be patched directly into the CV input of another module, you need to be careful:
- A logic buffer/driver/level shifter with good bypassing will output a cleaner signal than an MCU pin.
- A single transistor inverter (or a rail to rail op-amp in saturation) will allow noise from VCC to "leak" on the output when it is in the HIGH state.
praffensperger
Thanks for the sage advice, Oliver. Maybe this is a noob question but do eurorack power supplies typically have enough noise on the rails to make a single transistor inverter unsuitable for buffering a digital output that might be used for a vca or similar audio rate signal?
pichenettes
praffensperger wrote:
Thanks for the sage advice, Oliver. Maybe this is a noob question but do eurorack power supplies typically have enough noise on the rails to make a single transistor inverter unsuitable for buffering a digital output that might be used for a vca or similar audio rate signal?


Depends on the power supply type, the power distribution method (everything is possible from horrible flying bus board to bus bars or well routed boards with a "star" topology), and the presence or not of module whose current consumption is not constant (blinking LEDs).
Troubleshooter
I have kept it very simple in my MIDI -> CV+Velocity+Gate+Clock

digital output : DO -> 1K resistor -> minijack

analog output : 7xDO -> 2R2 network -> trimmable Zero summing Opamp -> Trimmable Gain opamp -> minijack

Supply on +/-15VDC using 7805 for mcu, 7812/7912 for ompamps

Isn't perfect, I know but it's simple cheap and works like a charm...

No experience in inputs.
latigid on
Perhaps a follow-up question to Olivier:

Your handling of CV ins and outs has changed quite a bit over time; is there a particular reason?

E.g. in the earlier MI modules you did a lot of the processing in the analogue domain using op amp filters/mixers, some clamping diodes, some rail-to-rail op amps etc. Meanwhile in the newer designs you've switched to multiplexers and interpretation of offsets/attenuators in software. Is it a necessary answer to "attenuvert everything" philosophy?
praffensperger
I can't speak for Oliver but I can imagine muxing pot inputs (like in rings) with a single adc because people generally don't turn pots all that fast. So you can sample them at a lower rate than you can a CV input. And if you attenuvert (is that a word?!) in software then you can also add a scaling table for a custom transfer curve or something like that. I haven't looked at the rings code to see if it actually does that.
bloodsample
pichenettes wrote:

[...]you'll expose an MCU pin to a voltage that might be outside of its supply range, and you'll very probably destroy things[...]

So at the very least you need the 1k protection resistor[...]


Thanks a lot for your answer Olivier! (and for sharing your schematics).

I'm still not sure I understand how the resistor helps with mismatched voltages (or maybe I misunderstood you).
For example let's say we have 5V at the microcontroller output, then a 1k resistor, then someone connects that jack accidentally to some other output that's at 8V.

So:
uC| (5V+) -----[1K]-----(JACK)====(JACK)----(8V+)

I'm actually not quite sure what would happen here. Wouldn't that just cause current to flow from the other module into my module? Is that idea of the 1K resistor to limit this current to prevent damaging the uC pins? Would a diode help to prevent current from flowing the other way? Sorry for the noobishness.


Troubleshooter wrote:

digital output : DO -> 1K resistor -> minijack


Similar question here. What's the theory behind the 1K resistor?


Thank you all for your help!
MUFF WIGGLER Forum Index -> Music Tech DIY  
Page 1 of 1
Powered by phpBB © phpBB Group