A simple MIDI keyboard.
-----------------------
 by Jordan D. Petkov

This article describes a simple MIDI keyboard for PC, built by me
in order to give my children possibility to have a not-so-bad
musical instrument home without spending a lot of money.

The archive file MKC.ZIP contains a set of files:

README.TXT   - this file;
MKC.JPG      - electrical schematic of device;
MKCC.HEX     - program file for PIC controller; 
MIDIMON.EXE  - MIDI monitor Windows application;
BOARD.JPG    - picture of device's board; 
KEYB1.JPG    - picture of keyboard (top);
KEYB2.JPD    - picture of keyboard (left);


1.About schematic.

Minimum elements are used to achieve minimal cost:  

U1:PIC16C84 - the famous single-chip controller by Microchip is 
   the core of this device;

U2:74LS138  - decoder 3-to-8, used to scan keyboard dynamically; 

Q1-4MHz,C2,C3: quartz resonator and capacitors needed for PIC's 
   internal clock generator;

R1,R2: resistors to pull up a specific IC pins to Vcc (which is +5v);

R3: protective resistor;

Diodes: generic Si diodes to prevent false keycrossing envents while   simultaneously pressing a group of keys on keyboard;

keyboard matrix - means 8*8 keyboard switches, one under each keyboard
                  pad;

connector DB 15 (male)-to connect to soundcard MIDI/Game port.

As seen on the picture, there is no need of power supply unit - a unit
wich is most dangerous element in such constructions. This means, no high
voltage is required and the cost is significantly reduced. The only 
hazard you should take is that could damage you soundcard by improper connecting it's DB 15 pins. I did not managed to do it on my cheap 
Yamaha.

This device is intended for working with PC sound boards only. If you
wish to use it with another MIDI stuff, you should think about power
supply and buffering MIDI signals in standard way as described
in many articles I have seen in Internet.

2.About hardware.

I used an old keyboard from simple 4-octaves analog sintesizer, adding
to it switches (buttons) for every pad. As you can see on the photos, it
is not much pretty, but it works good and this is all I needed. 
You can use successfully almost any kind of keyboard. I mean there are a
lot of non-expensive keyboards (called sound banks or somehging like
this) in toy-shops, wich can be easily accomodated for this purpose.

Part of universal PCB is used with size approx. 5x5 cm. As you can see on
BOARD.JPG picture there are four connectors. First is for MIDI cable, 
second is for keyboard matrix colummn cable, third is for keyboard
matrix row cable and fourth is for PIC onboard programmer.

As a result I have a keyboard wich is connected to my PC via MIDI cable.
All I need is to swich on the computer, to start MIDIMON.EXE, 
to select MIDI keyboard as MIDI input, and MIDI mapper as MIDI output 
and PLAY.

3.About software.

I supply a hex code generated by Microchips MPASM from a program I wrote.
At this moment I'm not intending to publish it in source code. The hex
code is all you need (and a PIC programmer ofcourse) in order to put
the program on PIC chip.

This version of program doesn't support additional buttons for mode
switching. At this moment I'm working on this. When all is ready, I will
publish it.

By the way, I've tested my keyboard with CAKEWALK and it works fine,
so I can swich instruments programmatically, recording what I'm playing and play it back. I suppose all standard MIDI application, 
supporting MIDI keyboard as input device, will work with my keyboard.

4.Future developement

- Support of additional buttons for mode changing at playtime. It is 
  possible to change a number of keyboard keys with buttons using the
  same design of schematics. 
  They probably should be useful if the keyboard is connected to 
  other standard MIDI devices.

- Dividing keyboard into two parts in order to be able every
  part to be assigned to different MIDI channel, so one can play
  different instrument, at different transposition on every keyboard 
  part. This would give a way to play, for example, a organ with 
  left hand, and a guitar with right at the same time.

- Windows application which will be used instead MIDIMON.EXE in order to
  swich keyboard modes and parameters such as INPUT DEVICE, OUTPUT
  DEVICE, PATCH, TRANSPOSITION, VELOCITY , group dividing etc. This will
  allow user to swich these without additional buttons, using
  mouse clicks or computer keyboard.


Any question or suggestion will be appreciated.

Sorry for my bad English, this is not my mother's language :-)

j.d.petkov@mailcity.com
www.geocities.com/jdpetkov