Print This Post Print This Post

MIDI Chord Button Keyboard Using PIC Microcontroller – 3

The following table documents the connecting leads and molex pin-header numbers tying the various interfaces together.

Header Pin no. Signal/Function Direction Header Pin no. Signal/Function
Chord Controller-SV1 1 RD7 ——> Matrix Decoder-SV4 1 Chord Sel. C
Chord Controller-SV1 2 RD6 ——> Matrix Decoder-SV4 2 Chord Sel. B
Chord Controller-SV1 3 RD5 ——> Matrix Decoder-SV4 3 Chord Sel. A
Chord Controller-SV1 4 RD4 ——> Matrix Decoder-SV4 4 Note Sel. E
Chord Controller-SV2 1 RD3 ——> Matrix Decoder-SV1 1 Note Sel. D
Chord Controller-SV2 2 RD2 ——> Matrix Decoder-SV1 2 Note Sel. C
Chord Controller-SV2 3 RD1 ——> Matrix Decoder-SV1 3 Note Sel. B
Chord Controller-SV2 4 RD0 ——> Matrix Decoder-SV1 4 Note Sel. A
Chord Controller-SV4 1 +5v ——> Matrix Decoder-SV7 1 +5v
Chord Controller-SV4 2 N/C Matrix Decoder-SV7 3 W (KEYDOWN)
Chord Controller-SV4 3 RB1 <—— Matrix Decoder-SV7 2 Y (/KEYDOWN)
Chord Controller-SV4 4 GND ——> Matrix Decoder-SV7 4 GND
Chord Controller-SV3 1 RC2 <—— Keypad-X1 6 In S3, 7, 11, 15
Chord Controller-SV3 2 RC1 <—— Keypad-X1 7 In S2, 6, 10, 14
Chord Controller-SV3 3 RC0 <—— Keypad-X1 8 In S1, 5, 9, 13
Chord Controller-SV3 4 RE2 <—— Keypad-X1 5 In S4, 8, 12, 16
Chord Controller-SV8 3 RB4 ——> Keypad-X1 1 Out S13-S16
Chord Controller-SV8 4 RB5 ——> Keypad-X1 2 Out S9-S12
Chord Controller-SV8 5 RB6 ——> Keypad-X1 3 Out S5-S8
Chord Controller-SV8 6 RB7 ——> Keypad-X1 4 Out S1-S4
Chord Controller-X3 1 /MCLR <—— Keypad-X2 1 RESET
Chord Controller-SV6 1 RC3 ——> Keypad-X2 2 LED1
Chord Controller-SV6 2 RC4 ——> Keypad-X2 3 LED2
Chord Controller-SV6 3 RC5 ——> Keypad-X2 4 LED3
Chord Controller-SV6 4 GND ——> Keypad-X2 5 GND
Chord Controller-SV6 5 +5v ——> Keypad-X2 6 +5v
Chord Controller-SV9 1 TX/RC6 (via 220R) ——> DIN SOCKET 5 MIDI-OUT
Chord Controller-SV9 2 GND ——> DIN SOCKET SCR Screen
Chord Controller-SV9 3 +5v (via 220R) ——> DIN SOCKET 4 MIDI-OUT
Chord Controller-SV10 1 +5v ——> Volume Pot LH Tag Top
Chord Controller-SV10 2 AN5 <—— Volume Pot Middle Tag Slider
Chord Controller-SV10 3 GND ——> Volume Pot RH Tag GND
Chord Controller-SV11 1 +5v ——> Pitch-wheel Pot LH Tag Top
Chord Controller-SV11 2 AN6 <—— Pitch-wheel Pot Middle Tag Slider
Chord Controller-SV11 3 GND ——> Pitch-wheel Pot RH Tag GND
Chord Controller-SV7 1 GND ——> FTDI-USB RS232-TTL 1 GND
Chord Controller-SV7 4 RX/RC7 <—— FTDI-USB RS232-TTL 4 (PC) TX
Chord Controller-SV7 5 TX/RC6 ——> FTDI-USB RS232-TTL 5 (PC) RX

Other connectors are documented on the schematic.
Note that I used a 10K Lin pot for the pitch wheel and 10K log for the volume pot. Although these values are a little on the high side for efficient analog conversion, in practise they work fine.

I had originally intended to build the key matrix on a printed circuit board, and this would still be the preferred solution. Two thing deterred me. First, placement of the 6X6mm TACT switches on the PCB using the default outlines supplied in Eagle would have meant a longer keyboard than I wanted, and secondly, My Eagle license only allows Eurocard size boards – meaning there would be 3 boards to join together for the matrix. These two factors represented enough reason to look for another solution. I finally plumped for a single longish piece of matrix board. This allowed the key matrix to have the desired spacing – I fore-shortened the distance between each tag on the switches to 0.2 inches by straightening these close to the body of the switch, which then allowed a switch-to-switch pitch of 0.6 inches.
In solving one problem however, I created another. Mounting the finished board proved fiddly and difficult, and a solution using nylon nuts and bolts had to be adopted – you have been warned!
I terminated the matrix with 2 IDC headers – one 10-way and the other 20-way. Because my finished matrix was hand-wired, I haven’t given connection details for this, and you should refer to the matrix decoder schematic for connection details.
I’ve included a suggested matrix schematic in with the main Eagle project files, should you wish to augment this. A snapshot of this is given below:

Suggestion for key matrix

Suggestion for key matrix

Chord Shift Switch
I made provision for plugging in a foot-switch, but as the floor in front of me is rather busy when I’m playing, also provided a handy switch bar on the unit. It is crude but effective, and I’ll briefly describe it here.
A piece of 4mm (0.196 inch) diameter bright drawn mild steel was bent at 90deg each end so to form a bar 305mm (12 inch) long, with two short arms projecting roughly 40mm (~1.5inch) and 50mm. (2 inch) A thread was cut on each arm (I used M4), so that when the bar is placed through two locating holes on the front of the keyboard cabinet, and a washer and nut are threaded onto each arm, the shift bar is approximately 20mm from the keyboard cabinet front. (0.75inch)
Two small metal plates (I used Meccano) are fixed over the two holes on the cabinet front, and 2 collets (4mm) are fixed on each of the shift bar’s arms, which are then pushed into place in the cabinet.

Chord Shift bar front view

Chord Shift bar front view

Chord Shift Bar Front view detail

Chord Shift Bar Front view detail

On the inside of the cabinet, a washer then 2 locknuts are threaded onto each arm, and tightened in place so that the bar is held firmly but can move vertically 2-3mm (0.1 inch)
On my unit, I ensured the longest arm was on the LH side of the cabinet, and I mounted a small micro-switch on a metal bracket (Meccano) to the side of the cabinet, another small bracket on the end of the threaded arm, so that when the bar is depressed, it activates the switch. A small spring returns the bar to it’s original position when the bar is released.
Chord Button Keyboard Shift Bar - LH side switch-mounting detail

Chord Button Keyboard Shift Bar - LH side switch-mounting detail

Note that the micro-switch is mounted using two 2.5mm screws held captive under a 4mm washer dressed to curve over each screw. Although the complete arrangement looks ad-hoc, it is easy to adjust, and once everything is in postion and tightened up, gives reliable and consistent operation of the Chord Shift.
Another view of the Chord Shift switch arrangement

Another view of the Chord Shift switch arrangement



I put together 3 panels, comprising LH and RH side of key matrix cover, plus the keypad cover. These were done in FrontDesigner and are avalable here:
Key Matrix LH side:
Key Matrix RH side:
Keypad: Panel.FPL

Full size (300 dpi) jpeg images of the above are here: Panel_FS.JPG

Schematics and PCBs

The Eagle schematic and board layouts are here:

Source and Binaries.

The project source-code, written in C18 for Microchip MPLAB is here:
Note that I’ve commented out the lines of code which set up my DB50XG synths, although the compiled binary contains these activated. To use the code on other than a DB50XG, you should re-compile the code.

Copy the code below to your web site.
  • Share/Bookmark
PDF Printer    Send article as PDF   

You must be logged in to post a comment.