Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 34

Thread: Midi In and Out - 3.3v ~ Let me know if I did it right

  1. #1
    Member dimitre's Avatar
    Join Date
    Aug 2016
    Location
    São Paulo
    Posts
    75

    Midi In and Out - 3.3v ~ Let me know if I did it right

    Midi in is actually working! Please let me know if I mounted it right, the diode position, etc.
    Thank you

    Click image for larger version. 

Name:	IMG_9538.jpg 
Views:	395 
Size:	114.4 KB 
ID:	10151
    Click image for larger version. 

Name:	midi_if.gif 
Views:	1620 
Size:	8.1 KB 
ID:	10152
    Click image for larger version. 

Name:	Screen Shot 2017-03-29 at 12.13.02 PM.png 
Views:	1753 
Size:	156.9 KB 
ID:	10153

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,400
    I don't see a resistor from pin 4 but the signal diode looks to be reverse biased as it should.
    Last edited by oddson; 03-30-2017 at 01:07 PM.

  3. #3
    Hi guys, I'm making a midi interface too and I have a doubt but for the output..
    For the midi spec, with 3.3v, there should be a 10ohm 0.25w resistor from UART to pin 5 and 33 ohm 0.5w from v+ to pin 4 but from page: https://www.pjrc.com/teensy/td_libs_MIDI.html 47 ohm resistors (both) are suggested.

    So, which one is better with teensy 3.2 ?
    Thanks,
    Daniele.

  4. #4
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,400
    Either will work.. 10 Ohm and 33 Ohm are the official MIDI spec but I think Paul posted 47 Ohm for both before that spec was available.

  5. #5
    Quote Originally Posted by oddson View Post
    Either will work.. 10 Ohm and 33 Ohm are the official MIDI spec but I think Paul posted 47 Ohm for both before that spec was available.
    Thanks and if may ask, what do you think about this: http://karg-music.blogspot.it/2016/01/midification.html. On midi out there is only 220 ohm resistor to 3.3v and the 6n137 is fed by 3.3v but the spec say 4.5-5.5v.
    Both wrong ?

    Daniele.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,977
    I would not recommend following the advice from that blog. There is very little difference between using two 47 ohm resistors versus 10 and 33 ohms. But using 220 and running the transmit pin directly to the cable without any resistor is not good. 5.6K for the pullup is also not good advice. These may work some times, but they are far outside the recommended range.

  7. #7
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,400
    But even though it's 'wrong' it likely still works with most configurations... the receiving circuitry is pretty resilient to current variation on most receivers.


    I'm not sure what spec you're referring to for the diode but it's just there for a bit of polarity protection so I think that's OK.

    I'm not an EE... but I think both Paul's and the MIDI spec are fine... I'd go with MIDI because it is the standard.

    (Ah ...someone that does know got here first... )
    Last edited by oddson; 04-04-2017 at 08:45 PM.

  8. #8
    Quote Originally Posted by PaulStoffregen View Post
    I would not recommend following the advice from that blog. There is very little difference between using two 47 ohm resistors versus 10 and 33 ohms. But using 220 and running the transmit pin directly to the cable without any resistor is not good. 5.6K for the pullup is also not good advice. These may work some times, but they are far outside the recommended range.
    I suspected it... asked just to be sure.

    Quote Originally Posted by oddson View Post
    I'm not sure what spec you're referring to for the diode but it's just there for a bit of polarity protection so I think that's OK.
    The optocoupler 6n137..
    I guess the answer

    Thanks guys !
    Daniele.

  9. #9
    Member dimitre's Avatar
    Join Date
    Aug 2016
    Location
    São Paulo
    Posts
    75
    I've tested both Midi spec for 3.3v (10 and 33 ohm) and Paul's recommendation and both work well in my devices.
    I've struggled a lot until discovering my volca beats receive Midi In well only if batteries are charged above 40%.
    Hope it helps somebody else.

    PS: this picutre has one resistor missing, as @oddson noted and I'll post an updated picture of the protoboard for reference

  10. #10
    Quote Originally Posted by dimitre View Post
    I've tested both Midi spec for 3.3v (10 and 33 ohm) and Paul's recommendation and both work well in my devices.
    I've struggled a lot until discovering my volca beats receive Midi In well only if batteries are charged above 40%.
    Hope it helps somebody else.

    PS: this picutre has one resistor missing, as @oddson noted and I'll post an updated picture of the protoboard for reference
    Output done! Used 2 62 ohm resistor 'cause I don't have 0.5w resistor right now..
    Tomorrow I'll test the input.
    I still don't understand if the 6n137 works with 3.3v. In some datasheet is 4.5-5.5 but in others like this: 6N137.pdf is 3.3v capable..
    mine is anonymous.. who knows.. we'll see..

    Daniele.

  11. #11
    Member dimitre's Avatar
    Join Date
    Aug 2016
    Location
    São Paulo
    Posts
    75
    I'm using Sharp PC-900V and working flawless.
    From what I've seen from the Midi documentation both are acceptable
    "opto-isolator (a light emitting diode and a photo sensor which share a single, sealed package). Sharp PC-900V and HP 6N138 opto-isolators have been found acceptable."

  12. #12
    Well my 6n137 is this: 6N137.pdf and is 5v.

    So what to do ?

    Sorry for these silly questions but I came back to this hobby after 20 years so I need to relearning almost everything

    Thanks,
    Daniele.

  13. #13
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,977
    Quote Originally Posted by DanieleFromItaly View Post
    Well my 6n137 is this: 6N137.pdf and is 5v.

    So what to do ?
    I'd start by connecting Vcc (pin 8) to +5V. Then I'd connect a resistor between Vo (pin 6) and +3.3V. Of course GND needs to be connected too.

    Don't forget the datasheet says "A 0.1μF bypass capacitor must be connected between pins 8 and 5".

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,977
    If you're using Teensy 3.2 (as you mentioned in message #3), you could also just connect the pullup resistor to +5V. The digital pins on Teensy 3.2 and 3.5 are 5V tolerant, so it's ok to give them a 5V signal.

    But do not try that with Teensy LC or 3.6. Those are not 5V tolerant. Applying more than 3.3V to the pin could damage them.

  15. #15
    Quote Originally Posted by PaulStoffregen View Post
    If you're using Teensy 3.2 (as you mentioned in message #3), you could also just connect the pullup resistor to +5V. The digital pins on Teensy 3.2 and 3.5 are 5V tolerant, so it's ok to give them a 5V signal.

    But do not try that with Teensy LC or 3.6. Those are not 5V tolerant. Applying more than 3.3V to the pin could damage them.
    Thanks Paul, works fine with 3.3v.

    Click image for larger version. 

Name:	20170409_122726.jpg 
Views:	162 
Size:	91.5 KB 
ID:	10259

    A bit ugly but it's only for a quick test.

    Daniele.

  16. #16
    Two more questions before start soldering..
    Can I get 3.3v from the 5v with voltage divider (47k+91k)? One wire less..
    Can I attach a led to show midi activity ? I think that should be ok to attach the led to the output pin with a 330ohm resistor.. Same on the midi output ?

    Thanks,
    Daniele.

  17. #17
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,400
    I think the ones with transistor type output will work as long the LED is working; these should pull the output to a value that will read as LOW by Rx.

    The ones with logic gates might require threshold voltages that won't be there if the supply is less than 4.5 v. but something like the 6N138 should work at 3.3 volts.

    If you have to power at 5 v. I can't see why a voltage divider ~ 1.52:1 ratio wouldn't work.
    Last edited by oddson; 04-10-2017 at 05:40 PM.

  18. #18
    Junior Member
    Join Date
    Apr 2017
    Posts
    11
    So I am thinking about using this midi IO board from the MIDIbox.org universe with a T3.2:
    http://www.ucapps.de/mbhp/mbhp_midi_io.pdf
    I plan to change the Out R's to 47 Ohms and tie them to 3.3V as per the standard but will power the Rx with 5V. This board is designed for an STM32 uC which is 3.3V( 5V tol.) also, but I'm wondering how it might be able to power the Outs with 5V. Is it a matter of the pin handling, just toggling between Float and Sink on the Tx pin? Is the Teensey using push-pull on the UART Tx pin?
    Yogi

  19. #19
    Quote Originally Posted by yogi View Post
    So I am thinking about using this midi IO board from the MIDIbox.org universe with a T3.2:
    http://www.ucapps.de/mbhp/mbhp_midi_io.pdf
    I plan to change the Out R's to 47 Ohms and tie them to 3.3V as per the standard but will power the Rx with 5V. This board is designed for an STM32 uC which is 3.3V( 5V tol.) also, but I'm wondering how it might be able to power the Outs with 5V. Is it a matter of the pin handling, just toggling between Float and Sink on the Tx pin? Is the Teensey using push-pull on the UART Tx pin?
    Yogi
    Why 5v ? 3.3v is ok for midi output.

    Daniele.
    Attached Files Attached Files

  20. #20
    Junior Member
    Join Date
    Apr 2017
    Posts
    11
    Quote Originally Posted by DanieleFromItaly View Post
    Why 5v ? 3.3v is ok for midi output.

    Daniele.
    Hi Daniele, well the board I linked is designed for 5V operation. I'm using a T3.2, which is 5V tolerant, so the opto circuit can be left alone and the T3.2 will be OK with the 5V TTL midi In. But on the TTL midi out I'm adding 3.3V into the board for the current loop and rewiring the two pullup Rs. It's a minor change and there are two un-used conductors on the ribbon cable.

    It's just the uC that this board was designed for, the STM32, is also a 3.3V device so I am wondering why it can get way with the Out current loop running at 5V and the Teensey 3.2 should use a 3.3V current loop. They are both 5V tolerant, but I think the STM is setup as open collector UART Tx pins. So I'm interest if the T3.2 can do this also for UART pin.
    Yogi

  21. #21
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,400
    I think it will work either way for 5 volt tolerant systems but there does not seem to be anything on that board that needs a 5 volt supply. I think that's Daniele's point.

  22. #22
    Junior Member
    Join Date
    Apr 2017
    Posts
    11
    Quote Originally Posted by oddson View Post
    I think it will work either way for 5 volt tolerant systems but there does not seem to be anything on that board that needs a 5 volt supply. I think that's Daniele's point.
    Was thinking the 6n138s are 5V devices, could be wrong. If they can operate at 3.3V then wouldn't I have to change all the R values?
    Yogi

  23. #23
    Quote Originally Posted by yogi View Post
    Was thinking the 6n138s are 5V devices, could be wrong. If they can operate at 3.3V then wouldn't I have to change all the R values?
    Yogi
    Right, 5v. So you need 5v for the input part. Not sure about the output.. Do you already have that board ?
    Daniele.

  24. #24
    Junior Member
    Join Date
    Apr 2017
    Posts
    11
    Quote Originally Posted by DanieleFromItaly View Post
    Right, 5v. So you need 5v for the input part. Not sure about the output.. Do you already have that board ?
    Daniele.
    Just finished building it up this afternoon, and yes the two Midi IN channels are @ 5V and the two Midi OUTs are setup for 3.3V (just a minor hack as outlined above). With only 3 UARTs on the T3, there are two un-used conductors on the cable so getting 3.3V to the board was easy enough. It should be good on the T3.2, just trying to figure out how the Tx pins are setup, push-pull or open drain.

    I've got a few of these boards already built for MIDIbox projects and like everything interchangeable as much as possible.
    Yogi

  25. #25
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,400
    Quote Originally Posted by data sheet
    OUTPUT
    Supply and output voltage
    6N138
    VCC, VO-0.5 to 7V
    This is from the data sheet... but logic gate based stuff may need 5v...

    Does the data pin have to be 5v tolerant to use a 5v coupler? Short of voltage dividing.

    If so the tansistor-based couplers at least should be 3.3v supply friendly for a non-tolerant uC.
    Last edited by oddson; 04-13-2017 at 12:55 AM.

Posting Permissions

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