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

Thread: Eurorack voltages to/from Teensy

  1. #1

    Eurorack voltages to/from Teensy

    Hi, I want to interface with eurorack modules using a Teensy and I have some questions that some of you may be able to shed some light on.

    Since the digital pins are 5V tolerant I guess these could be used for the gate input/output?

    To send CV between -5V and +5V I have found schematics using MCP4822 DACs together with LN324N opamps where sending the value 0 would represent -5V (note C0), 2048 would be 0V (note C5) and 4096 would be +5V (note C10).
    But how do I get data the other way, ie read -5V/+5V into the Teensy?
    Regards
    Johan

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,297
    ...either an external ADC that accepts your range or use an op amp gain and offset circuit and regular analog read....

    http://www.ti.com/lit/pdf/sloa097

  3. #3
    Junior Member RetroD's Avatar
    Join Date
    Dec 2019
    Location
    Iowa
    Posts
    7
    Here's a few options using the OP-amp/offset circuitry:

    If you want the -5V/5V to be mapped to 0V/5V (Non inverting solution) :

    Click image for larger version. 

Name:	NonInverting Solution.PNG 
Views:	20 
Size:	19.0 KB 
ID:	18374
    Click image for larger version. 

Name:	Noninverting Graph.PNG 
Views:	7 
Size:	15.9 KB 
ID:	18375

    If you don't mind it being inverted, -5V/5V mapped to 5V/0V ( which is easily fixed in software ) :

    Click image for larger version. 

Name:	Inverting Solution.PNG 
Views:	18 
Size:	9.8 KB 
ID:	18377
    Click image for larger version. 

Name:	Inverting Graph.PNG 
Views:	5 
Size:	16.0 KB 
ID:	18376

  4. #4
    Quote Originally Posted by RetroD View Post
    Here's a few options using the OP-amp/offset circuitry:

    If you want the -5V/5V to be mapped to 0V/5V (Non inverting solution) :

    Click image for larger version. 

Name:	NonInverting Solution.PNG 
Views:	20 
Size:	19.0 KB 
ID:	18374
    Click image for larger version. 

Name:	Noninverting Graph.PNG 
Views:	7 
Size:	15.9 KB 
ID:	18375

    If you don't mind it being inverted, -5V/5V mapped to 5V/0V ( which is easily fixed in software ) :

    Click image for larger version. 

Name:	Inverting Solution.PNG 
Views:	18 
Size:	9.8 KB 
ID:	18377
    Click image for larger version. 

Name:	Inverting Graph.PNG 
Views:	5 
Size:	16.0 KB 
ID:	18376
    Thanks retroD,
    so VIN would be the CV-signal and AnalogInverted would go to an analog input on the teensy?
    The analog inputs have been very unstable when I have used potentiometers, would the signal in this circuit generate a stabil reading?
    /Johan

    I forgot that the analog inputs only accepts 3.3 volts, how would I modify the 5V/0V to 3.3V/0V?
    Last edited by johanbilen; 12-08-2019 at 06:00 PM.

  5. #5
    Junior Member RetroD's Avatar
    Join Date
    Dec 2019
    Location
    Iowa
    Posts
    7
    Yes, VIN would be your CV signa. Analoginverted would go to your analog input on the teensy in the second example, and Analognoninverted would be your analog input on the teensy in the first.

    The circuit will devide the instability in half. One way to decrease the voltage sway would be to add a capacitor around 1 to 10 nF between the output of the opamp and ground.

  6. #6
    Junior Member
    Join Date
    Oct 2019
    Location
    Germany Maintal
    Posts
    18
    The Opamp with +/-12V Supply can kill the 3v3 Input of your teensy.

    So i use a railtorail opamp with 3v3/0V Supply for the analoginputs.

  7. #7
    Quote Originally Posted by RetroD View Post
    Yes, VIN would be your CV signa. Analoginverted would go to your analog input on the teensy in the second example, and Analognoninverted would be your analog input on the teensy in the first.

    The circuit will devide the instability in half. One way to decrease the voltage sway would be to add a capacitor around 1 to 10 nF between the output of the opamp and ground.
    RetroD, I simulated the second circuit you posted and it worked like a charm.

    Regarding Teensy->DAC->Opamp, I found a circuit from https://github.com/elkayem/usbMIDI2C...0Schematic.pdf which unfortunately only generates output values of 0-8.8V.

    This is my simulation, the left part (CV_IN->To_Analog_IN) is your circuit and the right (DAC->CV_OUT) is from usbMIDI2CV.
    Click image for larger version. 

Name:	opamp.jpg 
Views:	13 
Size:	131.4 KB 
ID:	18410

    How would I modify your circuit to send out -5V=3.3V, 0V=1.65V and 5V=0V?
    Do you have a similar circuit diagram as usbMIDI2CV for sending out -5V/5V from Teensy?

    Regards
    Johan

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,351

  9. #9
    Senior Member
    Join Date
    Nov 2017
    Location
    Belgium
    Posts
    215
    As Wibbing mentioned you need to use a rail to rail opamp supplied with 3.3V otherwise you might damage your teensy.
    Since eurorack modules are usually powered by -12V, 12V, all inputs should be able to handle those voltages.
    Rerun your simulation with a sweep between those voltages and see what happens.

    Here is a schematic that will convert -5V..5V to 3.3V..0V and has the recommended 100k input impedance.
    Voltages outside the +/-5V range will be clamped to 3.3V or 0V.
    The -10V reference voltage is obtained from the -12V supply with the help of a resistor and a shunt voltage reference. This to avoid any supply voltage fluctuations effecting the opamp output.
    Possible candidate for the rail to rail opamp is MCP6001, MCP6002 or MCP6004, depending on how many opamps you wil need.

    How it works:

    Gain for Vin = R2/R1 = 0.33
    -5V..5V x -0.33 = 1.65V..-1.65V

    Gain for AREF = R2/R3 = 0.165
    -10V x -0.165 = 1.65V

    Now add those two together and the result is
    -5V..5V -> 3.3V..0V

    Click image for larger version. 

Name:	cv_in2adc_inverting.png 
Views:	10 
Size:	26.3 KB 
ID:	18411
    Click image for larger version. 

Name:	cv_in2adc_inverting_plot.png 
Views:	4 
Size:	74.4 KB 
ID:	18413

  10. #10
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    329
    As far as I know, teensy analog inputs have ESD diodes to Vdd and Vss that make them +/- 12V safe if they have enough series resistance. Even more so at lower voltages (as Paul's circuit does).

    The MCP6001 has some similar issues (see the data sheet).
    Last edited by jonr; 12-10-2019 at 06:58 PM.

  11. #11
    Quote Originally Posted by neurofun View Post
    As Wibbing mentioned you need to use a rail to rail opamp supplied with 3.3V otherwise you might damage your teensy.
    Since eurorack modules are usually powered by -12V, 12V, all inputs should be able to handle those voltages.
    Rerun your simulation with a sweep between those voltages and see what happens.

    Here is a schematic that will convert -5V..5V to 3.3V..0V and has the recommended 100k input impedance.
    Voltages outside the +/-5V range will be clamped to 3.3V or 0V.
    The -10V reference voltage is obtained from the -12V supply with the help of a resistor and a shunt voltage reference. This to avoid any supply voltage fluctuations effecting the opamp output.
    Possible candidate for the rail to rail opamp is MCP6001, MCP6002 or MCP6004, depending on how many opamps you wil need.

    How it works:

    Gain for Vin = R2/R1 = 0.33
    -5V..5V x -0.33 = 1.65V..-1.65V

    Gain for AREF = R2/R3 = 0.165
    -10V x -0.165 = 1.65V

    Now add those two together and the result is
    -5V..5V -> 3.3V..0V

    Click image for larger version. 

Name:	cv_in2adc_inverting.png 
Views:	10 
Size:	26.3 KB 
ID:	18411
    Click image for larger version. 

Name:	cv_in2adc_inverting_plot.png 
Views:	4 
Size:	74.4 KB 
ID:	18413
    Thanks Neurofun, it seems that the more I research about this teensy/CV-thing the more complicated it gets...
    Before Paul mentioned it in his reply I was not aware that the analog inputs only accepts max 1.2V.

    I only have rudimentary knowledge of electronics but want to convert my modular system:

    https://www.youtube.com/watch?v=4d7keme8hrA
    https://hackaday.io/project/160884-the-chameleon-system

    to conform to Eurorack standard.

    How would your schematic be modified to output 0-1.2V so that the analog inputs of Teensy can read the signal?

  12. #12
    Senior Member
    Join Date
    Nov 2017
    Location
    Belgium
    Posts
    215
    Quote Originally Posted by johanbilen View Post
    Before Paul mentioned it in his reply I was not aware that the analog inputs only accepts max 1.2V.
    You can choose your ADC_REFERENCE to be REF_3V3(default), REF_1V2 or REF_EXT.

    How would your schematic be modified to output 0-1.2V so that the analog inputs of Teensy can read the signal?
    Gain formula for inverting opamp is
    Gain = Rfeedback/Rin = Vout/Vin

    Gain Vin = 1.2V(Vout range)/10V(Vin range) = 0.12
    R1 = 100k(input impedance)
    R2 = Gain x R1 = 0.12 x 100k = 12k

    Gain Aref = 0.6V(Vout offset)/10V(Aref) = 0.06
    R3 = R2/Gain = 12k/0.06 = 200k

  13. #13
    oops, redundant

  14. #14
    Junior Member
    Join Date
    Oct 2019
    Location
    Germany Maintal
    Posts
    18
    It is not recomendet to use the internal diodes because the current in this diodes will disturbe the multiplexer so that OTHER INPUTS will produse false results! We use 6002 opamp with 3v3 supply.

  15. #15
    These are my circuits so far, I would like some feedback please:

    5V gate input:
    Click image for larger version. 

Name:	5V Gate Input.jpg 
Views:	5 
Size:	81.7 KB 
ID:	18884

    5V gate output:
    Click image for larger version. 

Name:	5V Gate Output.jpg 
Views:	3 
Size:	52.7 KB 
ID:	18885

    0-8V Controlled Voltage Out
    Click image for larger version. 

Name:	0_8V CV Output.jpg 
Views:	16 
Size:	75.6 KB 
ID:	18886

    /Johan

Posting Permissions

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