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

Thread: Getting +/-5v audio signals into the Teensy 3.x analog inputs

  1. #1

    Getting +/-5v audio signals into the Teensy 3.x analog inputs

    Hi all

    I'd like to get modular synth audio signals into a Teensy for processing (pitch detection) but I'm green when it comes to electronics. Currently thinking I need to offset the +/-5v to 0-10v, then voltage divide that down to 0-3.3v. Is this correct, and is there a way of doing this without a -5v reference?

    I'm looking at this schematic from the Ornament and Crime module for its CV inputs, however that seems to be using a -5v reference from the eurorack power source, and I am trying to avoid that at this stage - I am powering the Teensy from USB and if its not too complicated I want to keep it that way whilst prototyping the code.

    Does anyone have an example of such an offset circuit, or how to calculate one? I have some of the MCP6004 op-amps as used in the O&C module.

    Thanks in advance !

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    Yep, that opamp circiut is the good way to do it, especially if the offset is a highly stable & accurate reference voltage.

    This would be the not-as-good way...

    https://www.dorkbotpdx.org/blog/paul...alog_input_pin

    More detailed discussion is here:

    https://forum.pjrc.com/threads/28423...late-cv-signal

  3. #3
    Thanks Paul, that not-as-good way you linked to looks like a good starting point. Note in this instance I want to get audio input in rather than CV, if that makes a difference.

    I was just looking at this schematic for an offset circuit:
    Name:  yIERi.png
Views: 490
Size:  1.2 KB
    (from endolith's answer at http://electronics.stackexchange.com...sing-atmega328)

    ...and starting to learn how to use Circuits Cloud to try things out.



    Quote Originally Posted by PaulStoffregen View Post
    Yep, that opamp circiut is the good way to do it, especially if the offset is a highly stable & accurate reference voltage.

    This would be the not-as-good way...

    https://www.dorkbotpdx.org/blog/paul...alog_input_pin

    More detailed discussion is here:

    https://forum.pjrc.com/threads/28423...late-cv-signal
    Last edited by adamski; 01-07-2017 at 10:24 PM.

  4. #4
    I've attempted to combine your not-so-good offset and scaling schematic with a 16hz high-pass filter:
    Click image for larger version. 

Name:	Screen Shot 2017-01-08 at 00.26.17.jpg 
Views:	64 
Size:	103.1 KB 
ID:	9334
    Last edited by adamski; 01-07-2017 at 11:27 PM.

  5. #5
    Senior Member
    Join Date
    Feb 2013
    Posts
    563
    Quote Originally Posted by adamski View Post
    Hi all

    I'd like to get modular synth audio signals into a Teensy for processing (pitch detection) but I'm green when it comes to electronics. Currently thinking I need to offset the +/-5v to 0-10v, then voltage divide that down to 0-3.3v. Is this correct, and is there a way of doing this without a -5v reference?

    I'm looking at this schematic from the Ornament and Crime module for its CV inputs, however that seems to be using a -5v reference from the eurorack power source, and I am trying to avoid that at this stage - I am powering the Teensy from USB and if its not too complicated I want to keep it that way whilst prototyping the code.

    Does anyone have an example of such an offset circuit, or how to calculate one? I have some of the MCP6004 op-amps as used in the O&C module.
    if you want to omit the +/- 12 V bus, you'd have to bias the op-amp* differently, like so:

    Click image for larger version. 

Name:	fig4.png 
Views:	225 
Size:	69.4 KB 
ID:	9341

    that's the circuit used at the O&C outputs, rather than inputs. in that case, V_out = - (R2/R1)*V_in + (1+R2/R1)*V_bias. R1 is typically/conventionally 100k ("high" impedance), so for a 10V input range, you'd pick R2=33k. the trick then is to come up with V_bias, which needs to be ~ 1.24V (= (1 + 33k/100k)*1.24V = 1.65V). in this case, a simple voltage divider should do: e.g., using the 3.3V supply, 49k9 and 30k would get you fairly close (= 30/(30+49.9)*3.3).


    *you'll need a rail-to-rail one, so MCP6004 is fine; you'd power it off 3.3v so the teensy is protected from over-voltage.

  6. #6
    Quote Originally Posted by mxxx View Post
    if you want to omit the +/- 12 V bus, you'd have to bias the op-amp* differently, like so:

    Click image for larger version. 

Name:	fig4.png 
Views:	225 
Size:	69.4 KB 
ID:	9341

    that's the circuit used at the O&C outputs, rather than inputs. in that case, V_out = - (R2/R1)*V_in + (1+R2/R1)*V_bias. R1 is typically/conventionally 100k ("high" impedance), so for a 10V input range, you'd pick R2=33k. the trick then is to come up with V_bias, which needs to be ~ 1.24V (= (1 + 33k/100k)*1.24V = 1.65V). in this case, a simple voltage divider should do: e.g., using the 3.3V supply, 49k9 and 30k would get you fairly close (= 30/(30+49.9)*3.3).


    *you'll need a rail-to-rail one, so MCP6004 is fine; you'd power it off 3.3v so the teensy is protected from over-voltage.
    Thank you, that is super helpful. Much appreciated.

    I will be powering it off the 12v bus eventually, when I get round to installing the AD7367 I'm planning to try out for the CV inputs which needs 11-15v power.. (Need to get my SMT soldering skills up to scratch first!!)

  7. #7
    Senior Member
    Join Date
    Feb 2013
    Posts
    563
    Quote Originally Posted by adamski View Post
    Thank you, that is super helpful. Much appreciated.

    I will be powering it off the 12v bus eventually, when I get round to installing the AD7367 I'm planning to try out for the CV inputs which needs 11-15v power.. (Need to get my SMT soldering skills up to scratch first!!)
    note the schematic doesn't show the low pass / capacitor in the feedback path (it's value will depend on the sampling frequency; in case of OC: 560p ~ 8.6kHz cut-off / 16.7kHz Fs); also that's the kind of (DC-coupled) circuit you'd use for CV inputs rather than audio; i guess it'll do for testing purposes, but unless you actually intend to DC couple the inputs (choosing AD7367 suggests so?), eventually it might be preferable to AC-couple the inputs. the DLD schematic posted in the other thread has an example for AC-coupled inputs (see INA-1, INB-1).

  8. #8
    Quote Originally Posted by mxxx View Post
    note the schematic doesn't show the low pass / capacitor in the feedback path (it's value will depend on the sampling frequency; in case of OC: 560p ~ 8.6kHz cut-off / 16.7kHz Fs); also that's the kind of (DC-coupled) circuit you'd use for CV inputs rather than audio; i guess it'll do for testing purposes, but unless you actually intend to DC couple the inputs (choosing AD7367 suggests so?), eventually it might be preferable to AC-couple the inputs. the DLD schematic posted in the other thread has an example for AC-coupled inputs (see INA-1, INB-1).
    I am planning to have 4 DC-coupled CV inputs (possibly via the AD7367), and 1 audio input. I'll have a look at the DLD schematic for the AC-coupling, cheers.

Posting Permissions

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