Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Teensy 3.1 analog out to inverting opamp pin

  1. #1
    Junior Member
    Join Date
    Nov 2018
    Posts
    6

    Teensy 3.1 analog out to inverting opamp pin

    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?

  2. #2
    Junior Member
    Join Date
    Mar 2014
    Posts
    17
    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.

  3. #3
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Quote Originally Posted by pepijndevos View Post
    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.

    Click image for larger version. 

Name:	MIDI_to_CV.jpg 
Views:	7 
Size:	85.4 KB 
ID:	15223

    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?

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,068
    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.

  5. #5
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Quote Originally Posted by Theremingenieur View Post
    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.

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,068
    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).

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,691
    Quote Originally Posted by dslamnig View Post
    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.

  8. #8
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Quote Originally Posted by PaulStoffregen View Post
    Keeping the opamp would be safest.
    Yep, that's what I'll do. The whole thing uses 10 opamps now, one more or less doesn't make much of a difference. Thanks for sound advice.

  9. #9
    Junior Member
    Join Date
    Nov 2018
    Posts
    6
    Quote Originally Posted by Theremingenieur View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •