Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

Practically MIDI (Part 5)

Trouble-shooting MIDI Interfaces: Martin Russ boldly goes where no man has gone before in Part 5 of this continuing saga.


A return to the harsh realities of soldering irons and circuit design this month, after last issue's theory. This month's article is again prompted by several real-life experiences and deals with home-built computer interfaces (although some of the thoughts may equally apply to all servicers and repairers of hi-tech MIDI gear).

OK - so you bought a kit to construct a MIDI interface for your Spectrum, BBC, C64, IBM etc, built it and now it is exhibiting one of the following rather distressing symptoms:

  • It doesn't work at all!
  • It is a 'bit iffy' - it works using its own test routines and some MIDI equipment, but not at all with some others...
  • Data comes out but won't go in...
  • The data gets corrupted...

It seems that build-it-yourself MIDI interfaces for computers suffer rather badly from poor or flawed design, and often from component-based problems. Having restored quite a few interfaces to life myself, I thought that a simple guide to a few trouble-shooting techniques could be very useful.

BACK TO BASICS



Starting at the beginning, let's look at a typical MIDI Input; first, as per the official specification, and then as you may find it in practice. The MIDI Spec 1.0 shows a 220 ohm resistor, a protection diode and thoroughly specifies the opto-isolator, giving a circuit much like Figure 1.

Figure 1.


Many real designs omit the protection diode, some use different values of resistor (to try and compensate for the often poor transfer ratio of the opto-isolator) and the opto-isolator seems to be anything but one with the right sort of performance. Let's take each of these components in turn:

THE DIODE



"A complete waste of money and effort — never passes any current...! " Hardly! Although not immediately obviously important, omitting the diode from a MIDI interface can affect the maximum length of cable which you can use in the MIDI system, since one of the main functions of this particular diode is to try and help limit reflections produced by the cable. Reflections? Yes, at the sort of rate at which MIDI exploits cables, you find all sorts of transmission line theory coming into effect. Reflections are a bit like the wake behind a speedboat: they trail for ages behind and upset everyone else. In this case, they can upset your MIDI data. The diode also helps to protect the line against destructive spikes, or even malicious reverse high voltages at the MIDI In.

CURRENT LOOPS



MIDI is a 5mA current loop, and the series resistor value is chosen to suit that. Changing the resistor value downwards may increase the current through the LED in the opto-isolator, but it also changes the value in the loop as a whole. If you drive such a modified Input from an Out which has its own version of an output stage, then destructive currents can arise and burn out the LED in the opto-isolator remarkably easily. Also, sinking larger currents can degrade the speed performance and increase problems with reflections, etc. So, although changing the resistor value seems like a very easy option, it can cause lots of problems in the long term.

Many of the offending parties are self-consistent within their own products, but choose to ignore everyone else. Unfortunately, with a universal standard like MIDI, where the user cannot be relied upon to buy all his equipment from the same manufacturer, then any deviation from the official MIDI 1.0 specification is bad for everyone. The current situation with the RS232 'standard' is a case in point. Years of interpretation of the standard have produced a situation where you can almost guarantee that two RS232 devices will not talk to each other - exactly the opposite of the ideals behind MIDI.

THE OPTO-ISOLATOR



The correct choice of opto-isolator is very important, for the opto-isolator does more than just isolate the Input from the rest of the equipment to avoid hum loops! Many MIDI interface designs use cheap and cheerful opto-isolators, usually with current transfer ratios of less than 75%. Let me clarify a couple of points on transfer ratios before moving on.

The transfer ratio of a device like an opto-isolator is a measure of how the device performs with respect to its input current and equivalent output current. If you pass 5mA through the LED at the input to an opto-isolator and get 5mA sunk by the output stage, then you have a transfer ratio of 1:1, ie. 100% (Figure 2). Since the presence or absence of current is what creates the MIDI data, we should all have a vested interest in seeing that it is not degraded in any way.

Figure 2.


Now an opto-isolator with a transfer ratio of 75% throws away 25% of the input. You put 5mA in and only 3.75mA comes out! Even worse, most specifications for semiconductor devices are only typical figures or - horror of horrors - maximum figures. The result is that you can have opto-isolators which throw away about half of your input - not a good idea! I would recommend using opto-isolators with transfer ratios of at least 100%, and preferably more: many MIDI systems work marginally at best, and using opto-isolators with 'only just' type specs is really very silly. Opto-isolators with current transfer ratios of greater than 100% have built-in amplification, usually in the form of a Darlington configuration transistor pair. Excellent spec devices like the Hewlett-Packard HP6N138 can be bought in one-offs for only a pound or two, and will repay the investment many times over in reliability. Considering the cost of the equipment you will be connecting together with MIDI, the cost savings made by using a cheap opto-isolator are so insignificant as to be pointless.

A 'BIT MARGINAL'



Surely the things I have been describing are unusual and infrequent occurrences? No, not in my experience - here's a classic example of the perils of using marginal opto-isolators: I built one MIDI interface which worked perfectly when it was tested by looping the Out to the In and sending MIDI data through it using the computer (the standard test!). However, it did not work at all when I tried to input MIDI data from any of my MIDI gear. Or rather, only the MIDI In was non-functional - you could send System Exclusive dumps and MIDI clocks from the Out perfectly OK. Surprise, surprise, the answer lay in the opto-isolator - the design of the input stage relied on about 80% or better transmission from the opto-isolator. The one supplied in the kit was the right type but was not the highest spec device, and its transfer ratio was below 60% - just low enough to stop the Input working reliably. Changing the opto-isolator for one with a better spec produced instant results - the interface now worked in both the looped and normal way.

Unknown to many erstwhile designers of MIDI inputs, opto-isolators have another hidden trap - the transfer ratio can degrade with time, as the LED light output falls. When this happens, opto-isolators with low current transfer ratios can be improved by adding an additional single transistor stage to their output, but this is often tricky (especially on a PCB not designed for it!) and is often prone to later failure - 'Leave well alone if it works' is a good rule of thumb.

Soldering and handling components or PCBs can weaken joints, damage CMOS chips (and other types too!) and thus cause early mortality of the circuit board. A much better solution to a poor ratio is to replace the opto-isolator completely. For most applications and for most of us end-users with limited technical know-how, this is a quick and simple way to restore operation without any problems being generated by the process of upgrading.

OUTS & THRUS



The story is less complicated for Outs and Thrus. Here there are really only two components which can be wrong - either the two series resistors aren't right, or the driver stage isn't up to the task in hand. Some designers have been quick to notice that if you leave the series 220 ohm resistor out of the line leading from the +5V, then you can power external Thru boxes and mergers, etc - no need for batteries or power packs!

That's fine, except it flies in the face of the MIDI spec, can upset your data and your pocket, and can be the source of further problems in the future. Why is there a 220 ohm resistor there in the first place? Well, it is there for a very good reason, since it prevents the main +5V supply for the equipment being available at an Output socket (Figure 3). This stops the user blowing up his power supply by connecting incorrectly-wired MIDI leads into the Out or Thru socket, since it effectively limits the maximum current which can flow to 5 volts/220 ohm = 27mA. So you cannot add the two resistor values together and use a 420 or 470 ohm resistor!

Figure 3.


The original preliminary MIDI spec differed slightly from the present MIDI spec 1.0, one area of which was the specification of the output drivers. Originally, open collector 74LS' type gates were specified, but the V1.0 spec merely says that a gate or transistor can be used. Obviously, since this needs to be capable of sinking the 5mA in the MIDI current loop, we have our major specification - although I would still recommend using devices with current sinking capabilities well beyond this minimum figure! Modern 74HC' type gates can do a good job and, in fact, with TTL prices being as low as they are, a single transistor seems an extravagant waste of resources when a few pence more could buy five additional inverters or buffers as well. Gates have the additional advantage that they both pulldown and pull-up the line, whereas a transistor only pulls it down, so you can get improved speed and integrity in long chains by using gates rather than transistors. Nuff said!

At this point I ought to mention the advisability of putting IC sockets onto PCBs for components used as interfacing, etc. If something goes wrong with a board, it is often because the inputs or outputs have been blown by inadvertent or malicious incorrect connections. Putting any interfacing chips in sockets means that you can easily upgrade them and get the system running again or, in the case of marginal opto-isolators, you can easily upgrade the components. Sockets for 6-pin or 8-pin devices like opto-isolators only cost a few pence and it is well worth it as a long-term investment. After all, since MIDI makes rather a good job of partially future-proofing music gear, and modern hi-tech electronic consumer equipment seems to last forever, it makes some sense to prepare for tomorrow's purchasers of slightly used classic DX7s etc. Conversely, if you do not fit sockets and the device fails or needs upgrading through deterioration in performance, then de-soldering is not only difficult but doing it could well break or damage tracks on the PCB, leading to more repairs and perhaps another failure at some time in the future... Sockets really are a good idea!

As another thought on a slightly different tack within the same subject: beware PCB-mounting DIN sockets! OK - so the interface uses a PCB designed to use PCB-mounting sockets, and they save a lot of time consuming hardwiring, but they can take quite a hammering when used on stage or in a busy studio environment. Five or even only two bits of soldered copper are usually all that is holding the sockets in place, and too much enthusiasm on the part of the musician can easily result in pushing the MIDI plug into the interface, instead of just into the socket. When this happens it usually upsets some of the other components or PCB tracks as well, so it can often end up requiring major surgery.

THE UPSHOT



Why all these problems with home-built interfaces? Classical design theory aphorisms say things like 'If it works first time then there is something seriously wrong with the design...' or 'The one specification that is not mentioned on the data sheet will be the most significant in your application'. What it all boils down to is that it is very easy to get a prototype circuit to work, but only when you build a thousand of them do you discover that, because of an unforeseen problem, only one in a thousand will actually work and that you were lucky the first time.

Talking of building things, next month I reckon it is about time we had another hardware project, so stand by for an amazingly useful MIDI gadget!


Series

Read the next part in this series:
Practically MIDI (Part 6)



Previous Article in this issue

Technology & Education

Next article in this issue

Alesis MMT-8 MIDI Recorder


Sound On Sound - Copyright: SOS Publications Ltd.
The contents of this magazine are re-published here with the kind permission of SOS Publications Ltd.

 

Sound On Sound - Jan 1988

Topic:

MIDI


Series:

Practically MIDI

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 (Viewing) | Part 6 | Part 7 | Part 8


Feature by Martin Russ

Previous article in this issue:

> Technology & Education

Next article in this issue:

> Alesis MMT-8 MIDI Recorder


Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for September 2020
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £38.00

All donations and support are gratefully appreciated - thank you.

Please Contribute to mu:zines by supplying magazines, scanning or donating funds. Thanks!

Monetary donations go towards site running costs, and the occasional coffee for me if there's anything left over!
muzines_logo_02

Small Print

Terms of usePrivacy