MIDI Input - what to check for Optocoupler - Page 1
Forum section: electronics / beginners

author: Saimoun
author_rank: Frequent Contributor
timestamp: November 24, 2023, 09:58:09 am
content: HiI have two general questions about designing a MIDI input circuit:What specs to look out for when choosing the optocoupler?How to choose the pullup resistor value on the output?Attached is the suggestion circuit from the MIDI spec. They suggest 280 ohm for the pullup resistor, with PC900V optocoupler. That sounds like a big waste of energy IMHO?? (At 3.3V that would mean a 11mA current!) Or is this for a faster rise-time?Hoping to get some insightsThank you!

author: Andy Chee
author_rank: Super Contributor
timestamp: November 24, 2023, 10:06:55 am
content: You’re correct about rise time.MIDI operating at 31,250 baud requires reasonably clean edges. And being a current loop precludes the conventional high speed solution of a totem driver.

author: WimWalther
author_rank: Regular Contributor
timestamp: November 24, 2023, 10:48:48 am
content: Energy or power?You're only wasting 39mW..

author: Saimoun
author_rank: Frequent Contributor
timestamp: November 24, 2023, 11:49:02 am
content: Quote from: WimWalther on November 24, 2023, 10:48:48 amThanks for the reply - and yes IMO that's a lot for a simple input circuit. Modern devices consume very little, the whole project uses about 250mW of power

author: shapirus
author_rank: Super Contributor
timestamp: November 24, 2023, 12:15:44 pm
content: PC900V seems to be pretty slow.You may want to take a look at these:https://docs.broadcom.com/doc/6N137-HCNW137-2601-2611-HCPL-0600-0601-0611-0630-0631-0661-2601-2611-2630-2631-4661-High-CMR-High-Speed-TTL-Compatible-Optocouplers-DS

author: oPossum
author_rank: Super Contributor
timestamp: November 24, 2023, 01:16:32 pm
content: Quote from: Saimoun on November 24, 2023, 11:49:02 amMIDI generally has a low duty cycle so power use will be lower than 39 mW.

author: Saimoun
author_rank: Frequent Contributor
timestamp: November 24, 2023, 02:37:28 pm
content: Fair enough, good point - I guess the transistor (inside the optocoupler) cannot pass through all those 11mA of current so it will be less.But anyways - nobody has answered my 2 questions yetDoing some research myself, I found that the most important is that the rise time and fall time works with the MIDI speed (the MIDI spec says 2us max). I believe this is influenced by the CTR and rise/fall time of the optocoupler, as well as the output resistor.I also found out that if the CTR is too low, one can add an extra NPN on the output to boost/speed up the signal? Something like the attached circuit. Any thoughts?

author: CaptDon
author_rank: Super Contributor
timestamp: November 24, 2023, 02:54:16 pm
content: MIDI devices 'expect' at least 10 ma. of drive current because there are devices out there that were built in the days of the 4N25 style couplers. MIDI source open circuit voltage is usually 5vdc. With a 1.4 volt drop across the opto LED and a .7 volt drop across the opto transistor (usually less but design for worst case) you have 2.9 volts remaining (not to mention connector and cable losses) so at 10 ma. that calculates to 290 ohms not counting stray losses. Therefore 270 ohms is about right on the money!!! Remember, there is NO direct ground path between MIDI devices via the MIDI data cable to eliminate 'ground loop' hum. I play a Casio MG-510 MIDI guitar on stage and I built a custom passive 'belt-pack' type device which has a multi-shielded multi-pair 20 foot 'umbilical cable'. The pack on my belt includes a connection for my headset microphone with a mute toggle switch, it includes a Monitor Return audio path for my headset along with a padding resistor to drop the audio power and a wirewound pot to adjust the monitor headphone level. In addition there is a 3 ft. MIDI cable hanging out of the belt pack which plugs into the MG-510 AND I have two ultra high brightness red LED's riding the MIDI send and return signals through 2.2K resistors. They barely light up but indeed show me if MIDI data can flow in both directions. This has been handy if my MG-510 is driving someone else's MIDI kludge pile!! (I know my nightmare works!) Cheers Mate!

author: Andy Chee
author_rank: Super Contributor
timestamp: November 25, 2023, 06:23:36 am
content: With switch mode power supplies becoming far more common since the MIDI spec was documented, it might be worthwhile investigating whether modern gate drive optocouplers can do the job, like:https://www.onsemi.com/pdf/datasheet/fod3150-d.pdf