Build a MIDI Input for Your Casio SK-1

By Paul Messick and John Battle

This article first appeared in the August 1987 issue of Keyboard Magazine.

Making weird noises into a Casio SK-1 and then playing them back is some of the most fun you can have standing up. Amazing as it seems, this cute little keyboard is a real, honest-to-goodness polyphonic sampler that sells for under $100. (For a full list of the SK-1's somewhat startling array of features, see Keyboard Report, Oct. '86.) Sooner or later, though, just about everybody who gets to fooling around with one has the same reaction: "Gee, wouldn't it be great if they had put a MIDI port on it?"

There's a reason why they didn't, of course. It would have doubled the cost. But if you'd like to add a MIDI input to your SK-1, for driving your sampled sounds from a drum machine or whatever, read on. Assuming that you're reasonably handy with a soldering iron, you can build the modification yourself. (Just don't ask whether the mod will equip the unit to transmit samples using the MIDI sample dump standard. Go play with your Fairlight.) The mod is no longer available as a kit, more information on building the mod from scratch is available from http://www.maxmidi.com/diy/sk1. A pre-programmed eprom is available at http://www.maxmidi.com/diy/order.html. [Note: In contrast to the info in this article, current versions of the kit use an Intel 8031 and an EPROM. But otherwise it works the same.] If your idea of electronic wizardry is figuring out which end of the battery has the little plus sign on it, you can find a friend to build the mod. This is not a project for absolute beginners, though it doesn't present any major technical hurdles.

Scanning Keyboards: Hardware Theory

The easiest way to get the SK-1 to understand MIDI messages is to fool it into thinking they're coming from its own keyboard. So in order to understand how the modification works, we need to review a little theory on scanning keyboards. The simplest way to "read" a keyboard electronically is illustrated in Figure 1. In this system, one input to a microprocessor is assigned to each key. Normally the input line is pulled to a high (positive voltage) state by internal resistors. When a key is depressed, the line is lowered to a binary zero (zero voltage) state by the key contacts. Thus, a zero on a given input port indicates a key-down condition, while a one indicates a key-up.

[Figure 1]
Fig. 1. A direct input from a keyboard to a microprocessor would require one data line for each key.

While this system works all right for small groups of keys, it gets cumbersome for large keyboards. A 32-key keyboard read in this manner would require 32 input lines and a microprocessor capable of keeping track of them all, an expensive proposition at best. A much more economical approach is shown in Figure 2. Using this scheme, which is often referred to as "matrixing," the keyboard is subdivided into x groups of y keys each. In our 32-key example, we would expect to end up with eight groups of four keys each.

[Figure 2]
Fig. 2. When the keyboard is scanned in matrix fashion, the microprocessor sends a voltage down each select line in turn and checks at the data lines to see which of the keys in each group are depressed. This allows many more keys to be scanned with fewer lines running in and out of the processor.

Referring to the figure, in the normal (no keys down) state, both the select lines (S0 through S7) and the data lines (D0 through D3) are all low. What's more, pressing a key has no effect on this. The read cycle begins with the microprocessor raising one of the select lines (say S0) to the one state (+5 volts). When this occurs, if any of the first four switches (SW0 through SW3) are depressed, the result will be to raise the corresponding data line to the one state. For example, if SW1 and SW2 are closed because their keys are being played, then data lines D1 and D2 will go to the one state when select line S0 is raised to +5 volts. In this situation, the four-bit data word 0110 is generated. By systematically raising each of the eight select lines to 5V and reading the corresponding data lines, the microprocessor can efficiently read all 32 keys. The diodes shown in the figure are needed, by the way, to prevent the keys from shorting together, causing strange and wonderful sound effects.

This may seem like a lot of trouble to go to in order to read the keyboard, but remember that microprocessors are blazingly fast, and they don't mind repetitive chores. On the positive side, we can now read a 32-key keyboard with only 12 input lines. Since each input represents a significant amount of hardware, the savings are considerable. (They become even more significant when we start talking about reading a 61-key keyboard with only 18 lines instead of 61!)

The SK-1 Keyboard

Figure 3 is a partial schematic of the SK-1, along with the modification board we're planning to add. The microprocessor in the SK-1 reads the keyboard using a matrix-type algorithm. The approximate timing for the read cycle is given in Figure 4. Note that this information was obtained by analyzing the lines with a logic analyzer and is not official information from Casio.

[Figure 3]
Fig. 3. Schematic for the SK-1 MIDI modification. The 8751 at left "sees" the voltages being sent down the select lines by the SK-1, and introduces the signals on the appropriate data lines to convince the SK-1 that its keys are being depressed.

The process of synchronizing the MIDI interface to the SK-1 microprocessor is simplified considerably by the fact that, for some reason unknown to the authors, the first three select lines go high (forming a hexadecimal 7) for 300 microseconds just before the beginning of a new read cycle. This forms a convenient landmark for beginning the write cycle of our 8751 add-on.

[Figure 4]
Fig. 4. The SK-1's select lines are scanned every 2.5 milliseconds or so, with pulses 200 microseconds in length.
After the hex 7, the eight select lines go high, one after another, for approximately 200 microseconds each. Data is then read at the approximate midpoint of each of these pulses. The MIDI port simply inserts a high signal on the appropriate data line(s) shortly after the beginning of the corresponding select line pulse. For example, if a Middle C is desired, the 8751 waits until the second select line (S1) goes high and then writes 1000 to the data lines. The 10K resistors in series (R1 through R4) allow the keyboard to override the MIDI port if desired. This process continues through all eight select lines.

PC Board Construction

Begin the modification procedure by constructing the circuit shown in Figure 3. Care should be exercised in assembling the PC board to ensure that static electricity not discharge through the microprocessor or other integrated circuits. Soldering should be done using a small, low-wattage soldering iron and resin core solder. This is not a project for beginners, so please exercise extreme care in constructing the PC board and installing it in the SK-1.

Using Figure 5 as a guide, begin by inserting the resistors and capacitors and soldering them in place. Be sure to check the polarity of capacitors C3 and C4. Install diode D1, placing the band toward the center of the board. Insert voltage regulator U3 and bend the leads to line up its mounting hole with the hole on the PC board. Attach it to the board with either a 4-40 screw and nut or a pop rivet. It is important to attach it to the board, since it must be able to dissipate heat; it uses the board as a heat sink.

[Figure 5]
Fig. 5. Assembly drawing for the SK-1 modification's PC board. Colored boxes represent solder pads.

Insert MIDI connector J1 and the sockets for U2 and U1, taking care to place the notches in the correct direction. Care should be exercised when installing the microprocessor and opto-isolator into their sockets to avoid bending pins or installing the chips backward. It may be necessary to bend the pins inward slightly by pressing each row of pins carefully against a flat surface. Connect a four-inch piece of red wire to the pad labeled VCC and a similar black wire to the pad labeled GND.

Separate and strip each wire at one end of the 12-wire ribbon cable and connect it to the 12 pads at the left end of the board, taking care to connect the wire with the tracer to pin 1.

Customization

[Figure 6]The SK-1 adapter board has several options that must be hard-wired before installation. Turn the board over and notice the nine numbered pairs of semicircular pads on the left side of the board (see Figure 6.) A blob of solder may be placed on any of these pairs to select the options listed in Figure 7. The solder blob should attach itself to both semicircles, electrically connecting them together, if that particular option is desired.

The first option determines the assignment algorithm for the adapter. Normally, the interface assigns notes on a first-in/first-out basis. If C, E, G, and B are held down on your controller, these notes will sound on the SK-1. If a fifth note is played, say a D, while the first four are still being held, then the C will be reassigned to the D. If the "A" option is choosen, however, the assignment algorithm ignores any notes past four. This is similar to how the SK-1 handles its own keyboard.

The SK-1 will ordinarily assign its MIDI channel to the channel of the first data it receives after power-up. If you want to assign a particular MIDI channel to it, select option "F" and then select the numbered jumpers indicated in Figure 7.

Fig. 7. Any of the options below can be selected by soldering the appropriate connection(s) on the circuit board shown in Figure 6.
A F 1 2 4 8 X Option Description
0 x x x x x x Enable Voice Reassignment
1 x x x x x x Disable Voice Reassignment
x 0 x x x x x Auto Channel Assignment
x 1 0 0 0 0 x MIDI Channel 1
x 1 1 0 0 0 x MIDI Channel 2
x 1 0 1 0 0 x MIDI Channel 3
x 1 1 1 0 0 x MIDI Channel 4
x 1 0 0 1 0 x MIDI Channel 5
x 1 1 0 1 0 x MIDI Channel 6
x 1 0 1 1 0 x MIDI Channel 7
x 1 1 1 1 0 x MIDI Channel 8
x 1 0 0 0 1 x MIDI Channel 9
x 1 1 0 0 1 x MIDI Channel 10
x 1 0 1 0 1 x MIDI Channel 11
x 1 1 1 0 1 x MIDI Channel 12
x 1 0 0 1 1 x MIDI Channel 13
x 1 1 0 1 1 x MIDI Channel 14
x 1 0 1 1 1 x MIDI Channel 15
x 1 1 1 1 1 x MIDI Channel 16
x x x x x x 0 Wrap Out of Range Notes
x x x x x x 1 Ignore Out of Range Notes

Option "X" selects whether incoming MIDI notes that are outside the Casio's 31-note range will be ignored or played. If the "X" jumper is not connected, the MIDI interface will "wrap" out-of-range notes into the nearest octave. Connecting the jumper will cause the Casio to ignore notes below F2 and above C5. The other jumpers, "Y" and "Z" are currently unused.

Installation

Carefully loosen the 11 Phillips-head screws and remove the bottom cover of the SK-1. Clip the red and black wires leading to the battery compartment as close to the PC board as possible. The modified instrument will no longer operate on batteries, so you won't be needing these wires again. Set the lid aside and turn the SK-1 on its face, as shown in Figure 8.

[FIgure 8]
Fig. 8. After removing the recessed screws, open the SK-1 and set the front panel on its face.

Using the template in Figure 9 as a guide, locate and drill a 5/8" hole in the rear panel of the synthesizer. In order to minimize the risk of breaking the case, the hole should be drilled slowly with using a Forrestner-type bit. Another approach is to first drill a small hole, say 1/8", and gradually use larger and larger bits until the desired size is reached. Either way, the drill template should be used in order to ensure proper alignment with the PC board.

[Figure 9]
Fig. 9. Template (shown actual size) for drilling the new hole in the rear panel to accommodate the MIDI jack. (Note: this template fits the current SK-1 kits only.)

Use a small screwdriver to pry off the volume control slider. Remove the seven Phillips-head screws securing the main PC board to the case and carefully remove this board, setting it aside as shown in Figure 10.

[Figure 10]
Fig. 10. Remove the main circuit board and set it aside. The new circuit board and the end of the ribbon cable are visible at right.

[Figure 11]Once the hole is drilled, the PC board should be mounted in the small cavity behind the speaker, as shown in Figure 11. The installed board will extend slightly underneath the main synthesizer circuit board with the ribbon cable extending around the end of the main board. Once the unit has been tested, a small amount of Super Glue may be used to secure the circuit board in place. Don't apply this glue until you're sure everything is working.


Fig. 11. The new circuit board is now in place. The ribbon cable
extends over the end of the main board.

The ribbon cable from the modification board should be formed into the shape shown in Figure 12. Notice that the cable will be connected to the leftmost set of pins on the main synthesizer board, just above the "TUNE" adjustment. The wire with the tracer (pin 1) should be on top (right). The ends of the ribbon cable wires should be stripped and soldered to the appropriate pins as shown. Check to be sure that none of the pins are shorted together. The red and black power wires from the mod board should then be connected to the 7.5V and ground terminals of the SK-1 power connector. The red wire should go to the terminal nearest the rear of the SK-1 case, and the ground to the innermost terminal. If in doubt, use a voltmeter to check the polarity.

[Figure 12]
Fig. 12. The other end of the ribbon cable is stripped and soldered to the main board as shown here.

Testing

Connect a Casio power supply to the SK-1 and apply power. Turn the unit on, then off and back on again. (For some reason, the Casio becomes confused when using an external power supply.) It should function just the way it always does. Now connect a MIDI cable to the input jack. Unless you have selected the "F" option, the SK-1 should respond to any MIDI channel. If it doesn't, then recheck your wiring carefully. Make sure that all the ICs are installed in the proper direction and that the polarity of C3, C4, and D1 is correct (see Figure 5). If you have an oscilloscope, check the crystal pins for the presence of the 12 MHz clock signal. Finally, check pin 10 of the microprocessor for the input MIDI signal.

Final Assembly

Insert a MIDI plug into the input connector in order to align the PC board. Use a small amount of Super Glue to secure the MIDI connector to the inside of the case. (Be careful not to glue your cable to the SK-1). Put the main PC board back in place and secure it with its seven screws, and finally replace the rear cover. That's all there is to it. We hope this project will help you have many more hours of fun with your SK-1.

Parts List

Resistors
R1-R4 10K ohm
R5 220 ohm
R6 270 ohm
R7 8.2K ohm
Capacitors
C1, C2 27pF, ceramic disk
C3, C4 10uF, 15V tantalum
Diodes
D1, D2 general purpose, 1N4148 or equivalent
Other Parts
X1 crystal, 12 MHz
U1 microprocessor, Intel 8751BH
U2 optoisolator, Sharp PC-900
U3 voltage regulator, 5 volts, LM7805
J1 DIN connector, five-pin female PCB