Practically MIDI (Part 2)
Continuing our new series for DIY fans, Martin Russ shows how you can go about adding extra MIDI Ins, Outs and Thrus to a MIDI interface.
Martin Russ shows you how to add extra MIDI Ins, Outs and Thrus to a MIDI interface.
I seriously doubt if anyone is now producing any new electronics-based musical equipment of any kind that is not fitted with the ubiquitous DIN sockets. Everything has a MIDI interface, from guitar/bass amplifiers through to VariLites. There are even MIDI interfaces designed to enable those now unfashionable games machines known as 'home computers' to control, monitor and edit MIDI devices. Most of the interfaces found on keyboard instruments have only a single MIDI In or Out port and rarely a Thru, making star connections difficult. Due to the time delays encountered, the current move away from chained MIDI connections can be easily achieved by having multiple Outs on your MIDI equipment. This article describes the typical circuitry found in MIDI interfaces and shows you how to add as many Ins, Outs and Thrus as you want.
The basic format of any MIDI interface is closely defined in the MIDI Specification. Most, if not all, MIDI interfaces will adhere to the specification, though I will give a few pointers to alternative possible implementations.
Since most computers prefer to speak in bytes of 8 bits at a time, while MIDI uses a serial 'one-bit-at-a-time' system, most MIDI interfaces use a standard chip known variously as an ACIA, UART or PCI, depending upon which computer dialect you speak. This chip converts from the parallel byte-based computer-speak to the serial bit-based MIDI-speak. Some MIDI instruments use serial I/O pins built into the microprocessor chip itself - this can make identification of the appropriate pins more difficult, as the processor chips tend to be more obscure than the common ACIA, UART and PCI chip. Once in serial format, the bit transmission and reception is straightforward.
Reception of MIDI data from a MIDI In socket consists of a 5mA loop termination, comprising a resistor, LED (light emitting diode in an opto-isolator) and a protection diode. The opto-isolator prevents any hum caused by earth loops and thus stops the unwary from the dangerous practice of removing the earth wires in mains plugs. The far side of the opto-isolator usually has a pull-up resistor on the output of the photo-transistor and the resulting TTL logic signal is fed into the serial Rx pin of the ACIA, UART, PCI chip.
To add one or more MIDI Thru connections to a device you need to buffer this opto-isolator output signal using TTL buffer gates. The use of buffers is important because opto-isolators can be very fussy about their fan-out, causing corrupted data due to insufficient bandwidth. The buffer recommended in the MIDI specification is an open collector 74LS type gate: a commonly used example is a 74LS05, a hex inverter chip - so the gates tend to get used in pairs. Other commonly used chips include 74LS04s, 74LS14s and 7405s.
The 'LSI 4 is especially popular for inputs because it has a Schmitt Trigger input which helps to reject noise and thus helps keep the MIDI data error-free. This 'totem pole' output stage chip has also been used as an output on some designs - despite the MIDI Specification's recommendation to use open collector types, it turns out that active pull-up can improve the integrity of MIDI links. Even better than 'LS type gates are the recently introduced HC or HCT gates, which have the advantage of low power as well as being capable of sinking enough current.
Some MIDI interface designers have thrown all caution to the winds and have opted for a single transistor as the output stage - a 'minimalist' rather than a 'belt and braces' design strategy.
Some Thru connections are implemented by connecting a MIDI Thru socket in parallel with the input socket. This is very naughty and totally against the MIDI Spec ("One Output shall drive one Input"). This is not recommended for any serious designs, as the driving stage is not designed to source more than 5mA, and so the sharing of current which results can corrupt the data due to LEDs not turning on properly.
Whatever driver method you choose, there are a few pointers which should help you find the appropriate section of your interface (see Figure 1).
First look at the circuit diagram (please try to obtain a service manual for your equipment before attempting any modifications) or else scan the printed circuit board (PCB) and see if there are any obvious Serial Interface chips: 6850, 8251 and 6402 are common numbers to look for. If you find a serial chip, then find the Rx pin of the ACIA, UART, PCI and trace it to the opto-isolator - most opto-isolators come in 6-pin or 8-pin DIL packages. The common types are made by 'unusual' manufacturers in TTL/CMOS terms - look for Hewlett Packard, National, Toshiba or GE devices. (The 'Rolls-Royce' class of fast HP devices in particular often have gold-plated pins and sculptured logo plastic packages.
If you can't find an obvious serial interface chip, then your equipment may well have a microprocessor with one built in - a so-called 'micro-controller'. This sort of 'one chip solution' level of integration is being pursued very actively by most of the micro-controller chip manufacturers. In this case, a literature search or a telephone call to the manufacturer's agents could help in the absence of a circuit diagram. You can, of course, find the relevant pins by tracing forward from the opto-isolator. To the best of my knowledge, no-one has yet put an opto-isolator on the front end of a serial interface equipped micro-controller (!) - so the opto-isolator will always be present on a MIDI In. The protection diode on the input side of the opto-isolator could also help to identify the relevant component.
Once you have traced the connection, you can then try to implement the buffers. There may well be a few suitable spare gates lying around the circuit which could be pressed (soldered?) into service. Again, a circuit diagram is useful here and helps to avoid mistakes on multi-layer boards. The resistors you need to add could be mounted on the 5-pin DIN socket.
Note: the ground connection on the Thru(s) but not the In - this is part of the hum-prevention mechanism.
While you are looking at the In part of the MIDI circuit, it is worthwhile considering adding an extra MIDI In socket as well. I do not intend to describe how to implement a 'merge' function here but will describe a simpler solution to a lot of common problems with MIDI Ins. I propose a switched MIDI Input. This means that you can choose between (say) a master keyboard and a sequencer by flicking a switch, rather than reconfiguring your MIDI system by software or by use of an expensive MIDI switching unit.
Adding such an In is easy - just add an extra DIN socket and connect it and the existing switch to a double pole, double throw switch (DPDT). The common of the switch is connected to the opto-isolator (see Figure 2). Although simple, such a system does not need extra cables or mains power and is a lot cheaper than buying a MIDI switcher unit.
To add extra MIDI Outs, you follow much the same procedure as for fitting Thrus: the output of the ACIA, UART, PCI chip is connected to a TTL buffer and hence to the MIDI Out socket, forming a 5mA current loop. A typical circuit is shown in Figure 3.
The modified circuit uses the same type of buffer as described above. If you want to add more than one extra Thru and Out, then it is unlikely that you will find enough spare gates. To implement the buffers then you could try adding an IC 'piggy-back' fashion to an existing TTL chip, by soldering the supply pins and bending up all the other pins, or you could build a piggy-back board made from Veroboard or similar. If you want a ready-made PCB, then I recommend the one published in Elektor Electronics magazine (May 1987 issue). Adaptable to many uses, this is a professional quality board whose only disadvantage is the lack of any provision for PCB-mount DIN sockets (more hard wiring, Igor!).
Remember: this sort of customisation will invalidate your instrument's guarantee, so it could be worth waiting for the customary year before proceeding. However, with the returns rate for most modern electronic equipment being as low as it is, it could be worth taking a small risk and fitting it now - it is up to you. All fitting of such extra electronics is, of course, at your own risk.
While we are on the subject of warnings, it is probably fair to say that such customisation has contradictory effects on the resale value of equipment - it has got more features than the original, but "it's been messed about with..." The neatness of the installation can be a big factor in this: use proper round sheet metal cutters (Q-max's) to make the holes for the DIN sockets and try to label the new Thrus and Outs neatly - white Letraset is usually appropriate but is tricky to use and to produce neat and durable results - at a pinch you could use Dymo labels...
If you feel unsure of your ability to carry out this sort of hi-tech hacking, then try your local music store - the engineer there should be well versed in this sort of activity (if not, then show him this article!) and it also improves the shop's 'passing trade' record, ie. punters in the shop are more likely to buy things... If you live too far away from a suitable dealer, then you could try your local ITEC centre or the Electronics Department at the local Technical College (or whatever they are called these days). Asking around amongst fellow musicians can also be a good source of "...oh yeah, John knows this guy who puts extra RAM into E-Bows to make them sustain longer..." and could be worth following up, cautiously. (Before I get any enquiries, the E-Bow cannot have any extra RAM fitted, since it hasn't got any in the first place!)
That about wraps it up on Thrus and Outs. Remember: if you always connect a MIDI Out (or a Thru) to a MIDI In you should have no exasperating disasters or strange faults (ever had a Thru box battery failure?... You think you've done something silly with a channel allocation or something and spend hours trying to find out what you did wrong !). Next month, Part Three deals with the misuse of MIDI.
Feature by Martin Russ
Previous article in this issue:
Next article in this issue: