My Ultimate Versatile Midi Connection Board
I work with Midi, a lot. I often have to plug equipment for testing instruments, circuits and interfaces. I often need to connect more than one device to a computer or micro-controller. So I decided to build the ultimate versatile MIDI connection board that I could modify, tweak, and install permanently if needed.
I got the initial idea by reading this post, by Steve Hobley. He even gives the pdf files that you can use to make your own pcb boards. Just read it!
Steve uses the 4N25M optocoupler (or opto-isolator). I just happen to have a box full of 6N138. They have different electrical specs but are basically used in a similar way. So I had to modify the design slightly.
If I was going to modify the design, I thought I might as well incorporate all the features I might need. I want my board to:
- Provide MIDI IN and MIDI OUT connectors (of course)
- Provide seven pin MIDI connections
- Use a socket for experimenting with other optocouplers
- Provide access to each pin of the connectors for maximum flexibility
I can assemble this board in about 5 minutes. I purposely didn’t crowd the design, to be able to assemble it fast and to be able to modify it easily once assembled. There is also enough room all around to drill screw holes for permanent assembly into a circuit box. The board measures about 5 x 5 cm (roughly a bit under 2 x 2 inches). It’s also dirt cheap because I had all the parts on hand! I didn’t print the top layer showing parts. After all, there are only 7 parts that I could get wrong!
I use 7 pin connectors because some of my experimental designs use all of them. They will, of course, accept 5 pin DIN connectors. If you want to use this design with a different pin count, you will have to look at the datasheet for pin spacing. I know that the 5 pin connectors that Steve is using (and that are used by a lot of manufacturers) have a very different pin spacing. You might want to use Steve’s boards for that. I use CP-2370-ND from digikey. The male connector that matches this one is the CP-1070-ND. Note: if you build a 7 pin cable using the 1070, keep in mind that it will not fit a 5 pin female connector. Cutting pins with a pair of pliers is a waste!
Being able to change optocouplers is an extra, but it came in handy during one experiment when I smoked (literally!) the 6N138 that was installed.
Being able to access each pin, from the connector or from the computer/micro-controller, is necessary when I experiment new circuits.
About the circuit:
The circuit is simple and pretty standard MIDI. It is made to work well with micro-controllers. The MIDI connectors can receive and send a MIDI signal from/to any equipment, even my old Yamaha PSS-480 from the early eighties. Wired this way, it will also power in-line MIDI boxes like midisolutions‘ various transformers.
R7, R8 and R11 are 220 Ohms and part of the MIDI.ORG standard specifications. MIDI OUT specs specify HEX inverters on the MIDI OUT/THROUGH side to act as double-inverters/buffers. Since I’m designing for micro-controllers, and I don’t provide MIDI THROUGH (except with software), I don’t need them. So as per MIDI specs, pin 4 provides 5 Volts (through a 220 Ohm resistor), pin 2 is connected to circuit ground and cable sleeve/shield (ONLY ON THE MIDI OUT SIDE), and pin 5 provides the actual MIDI signal (through another 220 Ohm resistor).
MIDI IN is also standard. The signal arrives on pin 5 from the sending MIDI equipment. Pin 4 receives 5 Volts from the same equipment and passes it through another 220 Ohm resistor. The 1N4148 diode is used for circuit protection, in case something is plugged backward or “lost” electricity (RFI or other interference) brings the circuit on pin 5 to below zero Volt (which could blow the LED in the optocoupler). Good ol’ Ohm’s law with the 3 resistors in series and the 1.2 Volt voltage drop in the LED gives a design current loop of 5 mA. This is enough to power the LED in the optocoupler. Check your specs if you try another opto.
About the 6N138
There are many optocouplers that are used in MIDI IN circuits. They all have slightly different electrical requirements. The 6N138 needs a 1K Ohm resistor from pin 7 to ground (R5) to shape up the MIDI signal. Some circuits don’t connect pin 7 but it does help (see below).The pull-up resistor between +5 Volts and pin 6 (signal to micro-contoller) (R6) is 470 Ohm but 220 Ohm should work too. Keep it low. If you power the circuit for a micro-controller that works on 3.3 volts, R5 should be 4.7K and R6 can be 270 Ohm.
If you prefer to use a 6N136 or 6N137, use 10K Ohm for pull-up (R6). Pin 7 should not be connected for those two (they use pin 7 for something else). The MIDI.ORG specs show a 280 Ohm pull-up for a Sharp PC-900. Of course, if you’re using a 4N25M like Steve from above, use his values!
If you don’t trust/believe me, there is a good reference on mutable-instruments site (and Olivier really knows!). That post points to another, where Todd tested actual values on a scope for the R5 resistor in this post. [gameboy genius] posted a good explanation of MIDI circuitry with a mod of a monotribe here. He also pointed to a post from Nathan Wooster about that R5 resitor.
Here’s a picture of the copper side of my board, with the Eagle files to prepare your own stuff.
By the way, I have enough material here to build 50 of those boards (with the seven pin connectors). So if there is demand, I will have the board professionally printed (with a silk screen showing parts on top). I could sell the assembled board for 10-15$ a piece.