Midi keyboard with 8051 compatible uC

(c) copyright 1996 by: Nico Coesel

Nico Coesel's MIDI Projects

This project  describes a built-it  yourself midi  keyboard. It's expandible in
two ways, more keys and velocity sense.

The hardware
At the top of the diagram (midikey.gif) you'll find a standard uC circuit using
a 8031. All  8031 pin compatible  uCs  can be  used (8x31,  80x32, 8x51,  8x52,
8xC31, etc).  I've used a 16KB Eprom a smaller one may be used too, the program
(midikey.asm) fits in a 2KB Eprom as well. The midi  output is connected to the
output of the  UART of the  8031. An 8051  assembler  can be  obtained from the
'net' at several places.
To scan the keys  I've implemented  a multiplexing scheme. By DC0..DC3 and P3.5
(= port 3, signal 5) it's  possible to address  22  keys. With P3.0  the status
of the lower keys can be read, with P3.2 the high keys can be read. This  means
a total of 46 keys. For my own keyboard I used only 44 keys.
The uC  continuously cycles DC0..DC3 and P3.5 from 0 to 21. When a lower key is
pressed  current can flow from P3.0  through the  diode into the '154 (or '138)
when the uC  addresses that particular  key. Reading  pin P3.0 will result in a
'0'. When no key is pressed P3.0 will read '1'.
The diodes are there to avoid two outputs of the '154  (or '138) being short by
pressing two keys at the same time.
At  the  bottom  there is a thumb wheel switch.  This is some kind of a  rotary
switch with 16 position which outputs binary code.

One  could add a  velocity  feature  by  connecting  the  diodes to the  common
contacts  of a keyboard  with dual pole contacts. Two  remaining pins (P3.6 and
P3.7= /WR and /RD) could  be used to read the extra switches. From time between
opening and closing of the contacts the velocity can be obtained.
It's also possible to use two '154s so  a maximum of 64  keys can be used. Also
using the two remaining pins on the uC would allow 128 keys.

For questions and suggestions email:

The EPROM Hex Code

Or the EPROM Assembly Code

The Schematic

Nico Coesel's MIDI Projects