Teensy 3.1 analog out to inverting opamp pin

Status
Not open for further replies.

dslamnig

Member
I need to add gain and a DC offset to Teensy 3.1 analog output. I want to use an inverting opamp to accomplish this, non-inverting opamp setup makes gain and offset interdependent and I want to keep things clean. So the question is - can I connect the analog out pin to inverting opamp input safely? All schematics that I've seen connect the out pin to a non-inverting opamp. In such a configuration the opamp input pin draws minimum or no current, and is electrically isolated from anything else. However in an inverting configuration the opamp input pin is connected to the gain resistor network, and basically anything that's connected afterwards (e.g. an inverting voltage adder).

Right now I'm buffering the analog out pin with a (non-inverting) voltage follower, before the gain/offset opamp. And I use yet another opamp to invert the signal back to normal. So that's 3 opamps for a pretty simple function. Is there a way to reduce that number?
 
IIRC the DAC has a limit of like 1mA. In an inverting opamp config, the two inputs form a virtual ground. So say you put your reference at 2.5V with a total range of 5V. This means that your input resistor is essentially connected to 2.5V.
So with a resistance of more than 2k5 the current will always be less than 1mA. So if you use something like 5k-10k that's definitely okay.
 
IIRC the DAC has a limit of like 1mA. In an inverting opamp config, the two inputs form a virtual ground. So say you put your reference at 2.5V with a total range of 5V. This means that your input resistor is essentially connected to 2.5V.
So with a resistance of more than 2k5 the current will always be less than 1mA. So if you use something like 5k-10k that's definitely okay.

Thanks very much for the reply. Here's the circut. What I'm making is a MIDI to CV/gate converter, to drive my old ARP Avatar. This is the CV part, where the Teensy analog out pin voltag range is expanded to 0 to +8V (8 octaves). The bias part removes the 5 to 10 mV offset on the Teensy pin (the voltage never goes down to zero). Also, there's an added voltage from the pitch bend part, -5 to +5V.

MIDI_to_CV.jpg

The circuit is built and tested, works fine. But there is an added non-inverting voltage follower between the input and Teensy. Would you say it would be safe to remove the follower?
 
Both stages in your drawing are inverting. The first (inverting adder) will output = offset - gain * input. So, you will need a second inverter to re-revert everything and to really get higher CV for higher input voltage.
 
Both stages in your drawing are inverting. The first (inverting adder) will output = offset - gain * input. So, you will need a second inverter to re-revert everything and to really get higher CV for higher input voltage.

Maybe I wasn't completely clear. The drawing shows the proposed circuit, the one I'd like to be evaluated for safety regarding the Teensy pin. In the actual circuit that I've built there is a 3rd opamp, a non-inverting voltage follower which buffers the Teensy pin. The question is whether I can safely remove this 3rd opamp and use the circuit as proposed.

Also, both circuits output positive CV.
 
In that case, it might be ok to drop the third, additional voltage follower.
But I must admit that I’m a little surprised to read that you are only considering positive CVs at the output. The most widespread yet unofficial CV standard for pitch, established by Moog Music inc, sets 0V output for middle C (Midi note 60), so that you have theoretically to cover voltages from -5V (Midi note 0, 5 octaves below middle C) to +5.583V (Midi note 127, 5 octaves plus a fifth above middle C).
 
The question is whether I can safely remove this 3rd opamp and use the circuit as proposed.

Keeping the opamp would be safest.

Without it, at the very least I'd add a couple clamping diodes to GND and 3.3V. If the opamp does something strange at startup or poweroff, even a 1N4148 should be plenty to shunt the < 1mA current which could flow through those resistors towards the Teensy pin. Especially during startup before code configures the DAC, remember the pin is a high impedance.
 
I’m a little surprised to read that you are only considering positive CVs at the output. The most widespread yet unofficial CV standard for pitch, established by Moog Music inc, sets 0V output for middle C (Midi note 60), so that you have theoretically to cover voltages from -5V (Midi note 0, 5 octaves below middle C) to +5.583V (Midi note 127, 5 octaves plus a fifth above middle C).

Thanks for addressing this issue, I also had doubts about my CV scheme. Currently I play my Avatar with an Akai MAX49 keyboard that has CV and gate outputs. It outputs positive CV only, with 0V being C1, MIDI 24. So I copied that behavior, and it works ok if Avatar's VCOs are tuned very low. Wikipedia https://en.wikipedia.org/wiki/CV/gate places 1V at A1... However setting 0V at middle C sounds good, and I think my Avatar will like it ;)

I've limited my CV range to 8V because the DAC has 12-bit resolution, and linearity is not perfect. So I'll bias CV at -4V to +4V around middle C and see how it sounds.
 
A follow-up with a better circuit. I'm still learning my opamps, and I learned the hard way that it's not a good idea to do voltage adding and offset adjust on a single opamp. An adder needs virtual ground at opamp input, if there's an offset the inputs start interacting. The first circuit worked OK because the offset was small, just zero adjustment. When I raised the offset to get -4V/+4V output range, the Teensy output and pitch-bend modulation went completely out of tune. Anyway, here's a better circuit. I've simply moved the offset adjustment to the last inverting opamp, and it works fine:

MIDI_to_CV_2.jpg

I've measured the error over the 8-octave range, it's about 3mV max. With one semitone having 83mV the error is about 3.6 cents (or +/- 1.3 cents), sounds acceptable to the ear.
 
I expected this would be less than an average VCO error margin, but it still makes sense to introduce as little error to the chain as possible - especially if it concerns pitch. Murphy's law clearly states that the errors always add up, not subtract.
 
Status
Not open for further replies.
Back
Top