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

Thread: placement of zener diode for voltage protection for harware MIDI circuit?

  1. #1

    placement of zener diode for voltage protection for harware MIDI circuit?

    Hi Everyone,

    I want to move my MIDI circuit off the breadboard and following the schematic below found on the PJRC MIDI Library page.

    I am trying to determine where to place the protection diode in the MIDI out circuit.

    Where it says:
    The extra diode between the 2 MIDI connectors is a 5.6V zener. Other than this extra diode, the circuit board followed the schematic shown above. The zener diode is not necessary for normal opertation, but does provide extra protection if external voltage is applied to the MIDI OUT port.
    Would the 5.6V zener diode be placed in parallel to the 47Ω resistor at pin 4 on MIDI out?

    I am working with a Teensy LC so I am using this schematic from the PJRC MIDI Lib page:

    Click image for larger version. 

Name:	td_libs_MIDI_sch_t3.png 
Views:	33 
Size:	4.9 KB 
ID:	23032

    Any guidance is greatly appreciated =)

  2. #2
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    AFAICT the zener looks like it's intended to protect the Teensy TX pin from any incoming excess voltage via the Midi out port. A 5.6v zener may be appropriate for a +5v board but I think that a 3.6v item is suggested for a +3.3v board.

    Some kind of buffer is a better engineering solution.

  3. #3
    Quote Originally Posted by MatrixRat View Post
    AFAICT the zener looks like it's intended to protect the Teensy TX pin from any incoming excess voltage via the Midi out port. A 5.6v zener may be appropriate for a +5v board but I think that a 3.6v item is suggested for a +3.3v board.

    Some kind of buffer is a better engineering solution.
    Thanks for the reply @MatrixRat - ahh yep - that differentiation of 5.6v vs 3.6V is not made on the MIDI lib page depending on the board. Thank you for pointing that out.

    As for the placement of the zener, that was my original question... would the zener diode then be placed in parallel to the 47Ω resistor at pin 5 or ?

    Not sure I follow about the buffer? Won't the zener provide voltage protection just fine? New territory for me here so additional detail would be super helpful. thanks!

  4. #4
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    From the pic it looks like the Cathode end of the zener is connected to the LC's TX pin and considering that it works as a shunt, the Anode would be connected to Ground.

    After thinking on it I must correct myself re the zener voltage in that a 3.3v item would be suggested, however am not convinced it would provide any real protection so have never used one here.

    A while back I'd wired up this on a breadboard and for the sake of clarity have left out the Din plugs. Multimeter indicated ~ 5Ma of current flow.

    Click image for larger version. 

Name:	IMG_20210101_0001.jpg 
Views:	17 
Size:	15.8 KB 
ID:	23045

    Generally accepted as a "standard" from back in the days when +3.3v MCU's didn't exist however some Midi gear does things a little different in the receive circuitry and will pull more current like 7.5 Ma so may not work with a +3.3v derived Midi output.

    The Teensy's LC TX pins are rated at 5Ma and Ok, the duty-cycle is fairly low and usually works.
    Adding some kind of output buffer between the TX pin and the outside world can act as some protection if you want.

    One section of a 74HCT125 or 74HCT245 will act as a level translator providing +5v as well.
    Can also be done with a transistor or two and am happy to post another pic if you're interested.

  5. #5
    Quote Originally Posted by MatrixRat View Post
    From the pic it looks like the Cathode end of the zener is connected to the LC's TX pin and considering that it works as a shunt, the Anode would be connected to Ground.

    After thinking on it I must correct myself re the zener voltage in that a 3.3v item would be suggested, however am not convinced it would provide any real protection so have never used one here.

    A while back I'd wired up this on a breadboard and for the sake of clarity have left out the Din plugs. Multimeter indicated ~ 5Ma of current flow.

    Click image for larger version. 

Name:	IMG_20210101_0001.jpg 
Views:	17 
Size:	15.8 KB 
ID:	23045

    Generally accepted as a "standard" from back in the days when +3.3v MCU's didn't exist however some Midi gear does things a little different in the receive circuitry and will pull more current like 7.5 Ma so may not work with a +3.3v derived Midi output.

    The Teensy's LC TX pins are rated at 5Ma and Ok, the duty-cycle is fairly low and usually works.
    Adding some kind of output buffer between the TX pin and the outside world can act as some protection if you want.

    One section of a 74HCT125 or 74HCT245 will act as a level translator providing +5v as well.
    Can also be done with a transistor or two and am happy to post another pic if you're interested.
    Ahhhh, yep - thanks for the eye on that pic on the MIDI lib page in regards to the zener placement - I was trying to figure that out just from the photo too...

    As for the 3.6 zener, I hear you on the current range - 5.6V zener seems a safer bet but given what your saying about the potential for 7.5 mA, maybe it won't protect...

    I am definitely interested in the buffer options. Would love to see a pic of those two (the IC or transistor options). Thanks so much for walking me through these concepts!

  6. #6
    Since you only need to sink current a simple NPN transistor driver is sufficient and robust enough so that the Zener isn't required.

  7. #7
    Quote Originally Posted by UhClem View Post
    Since you only need to sink current a simple NPN transistor driver is sufficient and robust enough so that the Zener isn't required.
    Thanks for the advice on the tranistor. this is new territory for me here. can you elaborate a little more on using a NPN, i.e which NPN and its placement in the schematic? thank you...

  8. #8
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    Sorry about the delay, distracted by other work.

    A single NPN pulling something LOW will work as an inverting buffer and the receiving device won't like it.

    A PNP transistor pulling HIGH works, tested on a T3.5.

    Click image for larger version. 

Name:	3v3HighSideMidiOut.jpg 
Views:	25 
Size:	125.2 KB 
ID:	23053

  9. #9
    Quote Originally Posted by MatrixRat View Post
    Sorry about the delay, distracted by other work.

    A single NPN pulling something LOW will work as an inverting buffer and the receiving device won't like it.

    A PNP transistor pulling HIGH works, tested on a T3.5.

    Click image for larger version. 

Name:	3v3HighSideMidiOut.jpg 
Views:	25 
Size:	125.2 KB 
ID:	23053
    No worries @matrixrat , I appreciate the help and explanation! i believe I have a BC557 on hand...

    To clarify: those are 1 kΩ resistors in series there at the base of the transistor?

    thank you for sharing this example. super helpful and much appreciated.

  10. #10
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    No problem and yes, those are 1k resistors.

  11. #11
    Quote Originally Posted by MatrixRat View Post
    No problem and yes, those are 1k resistors.
    Wonderful thank you.

    One more point of clarification: in your diagram it shows the rear view of the MIDI OUT DIN so the pin out should be as follows?

    Click image for larger version. 

Name:	3v3HighSideMidiOut.jpg 
Views:	39 
Size:	131.3 KB 
ID:	23060

  12. #12
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    Yup. That's how I wired it so that's how I drew it

  13. #13
    Quote Originally Posted by MatrixRat View Post
    Yup. That's how I wired it so that's how I drew it
    Many thanks again @matrixrat super super helpful. I am just getting started with MIDI hardware and software implementation so these details are really important to me and hopefully for others to follow. cheers

  14. #14
    hey @matrixrat - I have a follow up on this buffer circuit if you dont mind?

    the sketch of the buffer circuit you shared here, I overlayed pin 4 of the MIDI OUT going to the Tx line on it and you confirmed this was correct?

    I am using the schematic for the teensy LC and 3.x from the MIDI lib page, and pin 5 not pin 4 goes to the Tx line. Also, is that a ground symbol off of pin 5 after the resistor in your sketch?

    Click image for larger version. 

Name:	td_libs_MIDI_sch_t3.png 
Views:	18 
Size:	4.9 KB 
ID:	23128

    sorry - i'm just not getting the buffer circuit yet based of the sketch you provided unfortunately.

  15. #15
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    Sorry it's given you a headache so I tidied it up for a photo.

    Click image for larger version. 

Name:	BC557_3v3_MidiOut.jpg 
Views:	19 
Size:	61.1 KB 
ID:	23131

    Yellow wire > TX pin
    Red wire > +3.3v
    Black wire > 0v

  16. #16
    Hey @MatrixRat, apologies for the delayed reply. Thank you again for your patience with my learning process and sharing the additional detail on the buffer circuit. No worries - the headache was self generated and not from your expertise =)

    Here's my schematic at this point incorporating the buffer circuit you provided:

    Click image for larger version. 

Name:	Teensy_LC_BC557_3v3_MidiOut.jpg 
Views:	26 
Size:	71.5 KB 
ID:	23161

  17. #17
    Senior Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    216
    No problem, I've been on the road. Sounds like you got it working. Well done!

  18. #18
    Quote Originally Posted by MatrixRat View Post
    No problem, I've been on the road. Sounds like you got it working. Well done!
    Couldn't have done it without your great help and patience. Thank you! I just tested on the breadboard and it is working great =)

    Now, moving on to a push button encoder for the next challenge

Posting Permissions

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