This is only a preview of the February 2001 issue of Silicon Chip. You can view 29 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Li'l Pulser Train Controller":
Items relevant to "MIDI-Mate: A MIDI Interface For PCs":
Items relevant to "Bass Blazer Sub Woofer Display":
Items relevant to "The LP Doctor: Cleaning Up Clicks & Pops; Pt.2":
Purchase a printed copy of this issue for $10.00. |
MIDI-Mate
An easy-to-build MIDI interface for PCs
OU’VE PROBABLY HEARD of
Want to use your PC to control
Y
the MIDI system because it’s
been around for quite a few years now.
That acronym stands for “Musical InMIDI synthesisers, keyboards
strument Digital Interface” and it was
originally designed to allow electronic
& instruments? With the right
musical instruments, keyboards and
other “controllers” to communicate
with each other. Then when computsoftware, most PCs make good
ers and dedicated music sequencers
came along, it was logical to use MIDI
sequencers for electronic music
to hook them up as well.
Essentially, MIDI is a fairly low-tech
based on serial data commumaking. You’ll also probably need system,
nications at 31,250 bits per second,
current loop circuit. It’s a
this little MIDI interface, because inbit alike5mAa faster
version of the system
used to connect teleprinter machines,
most sound cards don’t provide a about 40 years ago. You can find out
more about MIDI and how it works in
the accompanying panel – “MIDI In
full MIDI port.
A Nutshell”.
By JIM ROWE
26 Silicon Chip
PCs & sound cards
Modern PCs make good sequencers
Fig.1: the circuit uses
two low-cost ICs – a
6N138 optoisolator
and a 74HC04
hex inverter. The
optoisolator provides
the correct isolation
for the MIDI IN
socket, while the
inverter stages buffer
the signal outputs
from the sound card.
Please note: It has
been found that the
MIDI-in port does not
work with all PC sound
cards. The simplest
solution is to increase
the value of the resistor in series with LED1
to 680Ω (from 330Ω)
and then fit a 470Ω resistor on the underside
of the PCB in parallel
with the series combination of LED1 and the
680Ω resistor, ie, from
the +5V rail directly to
pin 13 of IC1.
for electronic music. That’s because
they have plenty of memory and
“crunch power” for editing and manipulating music files, plus lots of
hard disk space to store them. All
you need for a PC to control a bunch
of instruments is a MIDI port – and
once you have this, you can also use
it to hook up music keyboards, drum
machines and other “controllers” to
feed music into the PC as well.
Ironically, most PC sound cards
already provide what’s usually called
a MIDI port (also known as an MPU401 port) but it’s really only “half” of
such a port. It includes an addressable
UART designed to send and receive
data at the correct 31.25kb/s, for example.
However, the UART’s serial input
and output operate at logic voltage
levels and the connections are simply
made available at two pins on the
card’s game port. There’s no attempt
to provide the correct current-loop
interface or the standard MIDI connectors needed to communicate with
normal synthesisers, instruments or
keyboards.
So that’s what this little “MIDI-Mate” project provides: the extra
circuitry needed to provide a PC
sound card with a full MIDI port. It
gives your PC and its sound card a
properly isolated MIDI input, two
standard MIDI outputs and also a MIDI
THRU output which provides a buffered replica of the MIDI IN signal (for
driving other instruments). There’s
also a couple of LED indicators on the
front panel, to let you easily monitor
the activity on the MIDI IN/THRU
and MIDI OUT sides of the interface.
The complete circuit uses only
two low-cost chips, plus a handful of
resistors and other parts. Everything
fits on a small PC board, including the
MIDI connectors, and it’s all housed
in a compact low-profile plastic instrument case.
The interface circuitry needs only
a few tens of milliamps at 5V DC and
this is sourced “free” from the PC
itself – via the ribbon cable which
connects the MIDI-Mate to the sound
card’s 15-pin game port socket.
Incidentally, a duplicate 15-pin
socket is provided on the end of the
ribbon cable, which extends back out
from the MIDI-Mate case. This allows
you to still use the game port to connect a joystick or similar for playing
games, even when the MIDI-Mate is
connected.
Circuit details
Fig.1 shows the circuit details for
the MIDI-Mate. As you can see, there
are only two chips involved: a 6N138
high-speed optocoupler (OPTO1) and
a 74HC04 hex inverter (IC1).
As stated above, both chips are
run from a +5V supply rail which is
obtained from the PC sound card –
via pins 1, 8 and 9 of the game port
connector (via the ribbon cable and
CON1). The 10µF capacitor is used to
provide a local peak current reservoir.
Optocoupler OPTO1 is used to provide the correct isolation for the MIDI
IN socket (CON2), which is wired in
the standard way with pins 4 and 5
connected to the optocoupler’s LED
via a 220Ω series resistor. Diode D1
protects the LED against accidental
polarity reversal (from a wrongly
wired cable, for example).
By the way don’t be tempted to
try substituting another optocoupler
for OPTO1. Most other optocouplers
don’t have the switching speed of the
6N138 and won’t reliably transfer
MIDI signals.
FEBRUARY 2001 27
Parts List
1 PC board, code 01201011,
117 x 112mm
1 low-profile plastic instrument
case, 141 x 111 x 35mm
4 5-pin DIN sockets, 90° PC
board mounting
1 16-way DIL pin strip
1 DB15 male IDC connector
1 DB15 female IDC connector
1 16-way DIL socket, IDC type
1 2m length of 15-way IDC
ribbon cable
4 small self-tapping screws,
6mm long
Semiconductors
1 6N138 fast optocoupler (OPTO1)
1 74HC04 hex inverter (IC1)
2 3mm red LED
1 1N4148 or 1N914 diode
Capacitors
1 10µF 10VW tag tantalum
Resistors (0.25W, 1%)
7 220Ω
2 330Ω
Fig.2: install the parts on the PC board as shown here. Make sure that all
polarised parts are correctly orientated and note that the two 330Ω resistors go
in the centre of the board (ie, they connect to the cathodes of the two LEDs).
The PC board is very simple and should only take a few minutes to assemble.
It is secured to the base of the case using self-tapping screws which go into
integral plastic standoffs.
28 Silicon Chip
OPTO1’s output transistor is connected as a simple switch, with its
emitter grounded and its collector
connected to the +5V rail via LED1
and a 330Ω series resistor. When
MIDI information arrives via CON2,
the transistor in OPTO1 switches
on and off and its collector current
causes LED1 to blink in sympathy. At
the same time, the collector voltage at
pin 6 swings up and down between
0V and +5V and it’s this logic voltage
signal that’s fed to the UART in the
PC’s sound card via pin 15 of CON1.
This same signal is also used to
produce the circuit’s MIDI THRU
signal, by passing it through inverters
IC1f and IC1a in series. Pin 2 of IC1a
therefore provides a buffered version
of the incoming MIDI signal. The two
associated 220Ω resistors are used to
regulate the 5mA current in any MIDI
load circuit connected to CON3.
The two MIDI OUT signals are produced in a similar way to the MIDI
THRU signal. However, in this case
they use the voltage signal from the
sound card’s MIDI output instead of
the signal from OPTO1. This signal
comes from pin 12 of the sound card’s
game port connector, via CON1. It’s
passed first through inverter IC1e and
The 15-way connecting
cable passes through a
slot that’s filed in the top
of the rear panel. Also
show here is the 15-way
female IDC connector at
one end of the cable. This
allows devices such as
joysticks to be connected
to the game port, without
disconnecting the MIDIMate.
Fig.3: here’s how to assemble the
connecting cable. Note that the red
conductor goes to pin 1 of each
connector and that pin 16 of the 16way header socket is unused.
then through inverters IC1c and IC1d.
These then drive the MIDI OUT sockets (CON4 and CON5), again via their
own pairs of 220Ω series resistors.
The remaining inverter (IC1b) is
used to drive the MIDI OUT indicator
LED2, using the logic signal from the
output of IC2e.
Construction
All the components used in the MI-
The 16-way IDC header socket plugs into a matching 16-way DIL pin strip on
the PC board. Power for the unit is supplied via the PC’s game port, so no
external supply is needed.
FEBRUARY 2001 29
Fig.4: this is the full-size etching pattern for the PC board.
DI-Mate are mounted on a PC board
coded 01201011 and measuring 117
x 112mm. A 16-way section of DIL
connector strip on the PC board is
used as input connector CON1. This
mates with a 16-way DIL socket on
the 15-way ribbon cable, which links
the MIDI-Mate to the PC sound card’s
game port.
The 16-way DIL socket is mounted
about 100mm from one end of the
cable, while the DB15 female IDC
connector is mounted at the adjacent
end. The DB15 male IDC connector
is fitted at the sound card end of the
cable (ie, at the far end).
Note that all three connectors are
IDC types for easy fitting. The 16-way
DIL socket is simply fitted with the
cable located over the connector teeth
for pins 1-15. This is easy to do if you
use the coloured side (red stripe) of
the ribbon cable to indicate the “pin
1” conductor.
Be sure also to connect the conductor with the red stripe to pin 1 on all
the connectors – see Fig.3.
There’s virtually no physical
wiring inside the MIDI-Mate box,
Fig.5: be sure to set up the options
in either Multimedia Player or your
sequencer program so that they’re
talking and listening to the sound
card’s MPU-401 MIDI port.
because even the four DIN sockets
and the indicator LEDs are mounted
directly on the board.
Fig.2 shows the layout on the PC
board. The parts can be fitted in any
order – the only things to watch are
that you fit the polarity sensitive
parts the correct way around. These
include OPTO1 and IC1, the 1N4148
diode, the two LEDs and the 10µF
capacitor. Both LEDs are fitted with
their cathode lead closest to CON3.
It’s easy to identify the cathode
lead – it’s always adjacent to a flat
section on the plastic collar of the
LED body. It’s also shorter than the
anode lead (see Fig.1).
Initially, the LEDs can be fitted in
the upright position, with their leads
straight. Later on, the leads can be
bent forward at a right angle about
11mm above the board, so that they
protrude through matching holes in
the front panel.
Note that the board must be fitted
with two short wire links. One is just
above the 10µF capacitor and IC1,
while the other is just behind CON4.
Final assembly
The assembled PC board is secured
inside the case using four 6mm-long
self-tapping screws. These mate with
four of the moulded mounting pillars.
The case rear panel has a 20 x 4mm
rectangular notch cut into the top
centre. This allows the ribbon cable
from the PC to loop in and connect to
the MIDI-Mate and then loop back out
again. The front panel has six round
holes – two 3mm holes for the LEDs
and four 16mm holes for the DIN
sockets. These holes can be marked
out by using a photocopy of the front
panel artwork as a template.
The best way to make the holes for
the DIN sockets is to first drill small
pilot holes. These holes can then be
carefully enlarged to the correct size
using a tapered reamer.
Trying it out
No adjustments are required for
the MIDI-Mate; if you’ve assembled
it correctly, it should be ready for use
Fig.6: you can use this fullsize artwork as a drilling
template for the front panel.
Drill small pilot holes for
the MIDI sockets first, then
carefully enlarge them using
a tapered reamer.
30 Silicon Chip
MIDI In A Nutshell: What It Is & How It Works
MIDI
is an acronym standing for
“Musical Instrument Digital
Interface”. It’s a standardised system for communicating between
electronic musical instruments, keyboards, controllers and sequencers
(including PC-based sequencers).
The MIDI standard was agreed on
by a group of musical instrument
makers in 1983 and has been used
and extended since then.
MIDI uses serial data communication at 31.25kb/s (kilobits
per second). This involves using
asynchronous 5mA current loop
signalling, with the current provided by the “transmitting” end. Each
byte of a MIDI message takes only
320µs to be transmitted (counting
start and stop bits). Since most MIDI
messages are 2-byte control codes,
this means that over 1500 such
codes can be sent each second via
a single MIDI cable.
Each MIDI cable carries only one
signal, so for bi-directional communication, two cables must be used.
The cables themselves use shielded
two-conductor wire.
All MIDI cables are fitted with
standard 180° 5-pin DIN plugs at
both ends. However, only pins 4 and
5 are used for the actual current loop
signalling (wired 4-4 and 5-5). Pins
1 and 3 are left unconnected, while
the shield braid is connected to pin
2 at each plug.
Inside MIDI equipment, pin 2 is
connected to earth only on MIDI
immediately. You need only connect
it to the sound card of your PC via the
ribbon cable and game port connector, and fire up the computer.
To try it out you will need to have
some sort of synthesiser or other MIDI
instrument to hook up to one of the
MIDI OUT sockets and also a way
of playing MIDI files. This could be
just the Windows 95/98 “Multimedia
Player” accessory program, playing
almost any handy “.MID” music file.
Of course if you have a more elaborate
sequencer program like Windjammer,
Cakewalk or MidiSoft Recording
Session, these would be even better.
The main thing you need to watch
OUT sockets. This allows correct
earthing of the cable shield braids,
without creating earth loop problems.
Unlike most other current-loop
signalling, current only flows in a
MIDI link when data is actually being
transmitted. This allows MIDI cables
to be plugged and unplugged without any problems, as long as data
is not actually being transmitted at
the time.
To prevent equipment damage
due to wiring errors or component
faults, all MIDI inputs are provided
with 3kV of galvanic and electrostatic
isolation via an optocoupler.
For correct MIDI communication
between equipment, a MIDI OUT or
MIDI THRU socket at one end must
be connected to a MIDI IN socket
at the other.
In most MIDI systems there is a
single main controller or sequencer
(often the computer), from which
most of the MIDI messages originate. When these messages must
be sent to more than one instrument,
they can be distributed in either “star”
or “daisy-chain” fashion, as desired.
There’s no need to worry much
about the actual code messag
es
sent over the MIDI links, because
nowadays this is all handled by
sequencer or other software running on the PC, and by firmware
running in the other instruments
and keyboards. It’s probably enough
to know that most MIDI messages
are short commands to allocate a
is that you set up the options in either
Multimedia Player or your sequencer
program so that they’re talking and
listening to the sound card’s MPU401 MIDI port, instead of its inbuilt
FM or wavetable synthesiser. Otherwise, the fact that you’ve connected
up MIDI-Mate will be ignored and
your external synthesiser will remain
silent.
Assuming that you have a synth
esiser or other MIDI instrument connected to the MIDI-Mate, getting it to
“play” should now simply be a matter
of loading a MIDI file and clicking on
the “Play” button. And while the file
is playing, MIDI-Mate’s MIDI OUT
particular instrument to a particular
channel, to tell it to start or stop
playing a particular note, to change
the instrument’s attack/decay or
other performance parameters, and
so on. As mentioned earlier, these
commands are generally in the form
of 2-byte codes.
Using a PC-based music editing and sequencer program (and
perhaps a MIDI music keyboard to
feed in the actual notes), you can
assemble a complete sequence of
MIDI commands to play a piece of
music – on say the “instruments”
in a synthesiser. The synthe
siser
can then be made to “perform” that
piece of music simply by sending
the sequence to it, via the MIDI link.
When you’re happy with the result, you can save the se
quence
on disk as a MIDI music file. These
have a standardised format and are
identified with the “.MID” extension.
Disks with collections of pre-composed MIDI music files are also
available and you can download
them from the Internet as well.
Finally, it’s important to realise
that although a MIDI music file may
look superficially similar to a .WAV
file of a digital sound recording, it’s
really quite different. It’s more like an
electronic equivalent of sheet music
– simply a sequence of instructions
describing how to play the music.
In this case, the instructions are for
electronic instruments rather than
for human players.
LED should blink away merrily as
the MIDI commands stream out to
the synthesiser.
Similarly if you have a MIDIequipped music keyboard or other
controller, you’ll now be able to hook
its MIDI OUT to the MIDI IN socket
on MIDI-Mate and record your own
music on the computer’s hard disk
– after clicking on the sequencer
program’s “Record” button, of course.
And that’s really all there is to it.
With MIDI-Mate and a sound card,
your computer will have all the hardware it needs to become a powerful
MIDI sequencer. The rest is up to you
SC
and your musical creativity!
FEBRUARY 2001 31
|