When I first began designing devices that support MIDI, I searched for schematic examples on Google. After reviewing a few examples, I realized that I needed to delve deeper into the matter to create a well-functioning MIDI implementation for all N-audio devices. In this topic, I’d like to share my experience with you.
What is MIDI?
MIDI stands for Musical Instrument Digital Interface, which is a serial communication protocol operating at 31,250 bits per second. It uses 8 bits per byte, along with a start bit and a stop bit, and operates at 5 volts DC. The standard MIDI connector is a 5-pin DIN connector, with female connectors on the device and male connectors on both ends of the MIDI cable.
Designing the MIDI In Schematics:
Galvanic isolation of all MIDI inputs is crucial, as it helps to isolate the digital ground loops. This is done through an optocoupler, which is a component that contains a separate LED and phototransistor (or an opto component) in a single package with galvanic isolation within the range of 1000-5000 volts between both elements. It’s important to choose an optocoupler that is fast and can adequately transfer the MIDI data without skipping bits. My choice is the 6N138 optocoupler, which is relatively cheap and available in DIP and SMD packages, although it’s relatively large in size.


The yellow trace shows the input MIDI signal before the optocoupler. The green trace shows the output signal after the optocoupler.
Designing The MIDI Out Schematics:

When it comes to the MIDI out schematic, simplicity is key. To achieve this, I opted for a single transistor buffer, which is not only fast but also affordable. Moreover, this transistor also isolates the microprocessor, ensuring added protection. I selected the 2N5551 (MMBT5551 SMD) transistor specifically for its high Vce (collector-emitter voltage) of 160V. For EMI protection, I incorporate two 100p capacitors into the circuit. Implementing this circuit with two 220 Ohm resistors effectively limits the current across the 6N138 LED from the MIDI in schematics to approximately 5mA. R3 plays a role in limiting the base current, while grounding the middle pin enhances shielding across the MIDI cable. It’s important to note that when using this circuit, you must invert the signal from the microprocessor.
Summary:
I hope sharing my experience with MIDI implementation helps you in your own designs and understanding of this technology. These schematics should provide a good working solution, saving you time and effort in your search for an effective MIDI implementation.