MIDI Organ Circuit Description and Overview
This page describes in detail how my MIDI controller works. It's a fairly simple architecture and the way it's connected makes it very extendible.
Note: If you have any questions, feel free to email me using the address given on the contact page. Chances are that if you have a question, other people may be asking the same thing and it will alert me to update this documentation.
Dataflow

Figure 1: Dataflow diagram of entire system
The above dataflow diagram shows the components of the system and their flow:
- A menu system is used to collect data from the operator and also present to the operator the current configuration details. MIDI channels and transposition for manuals, pedalboards and stops can all be configured via this interface.
- An easily expandable system for identifying each device in the system and reporting the states of each "switch" in that particular device and
- Finally, a system for sending the MIDI out messages (this is all done inside the PIC processor thanks to the USART)
Component Description - Menu System
The menu system consists of an LCD display and 4 pushbuttons ("down", "up", "next" and "previous"). All configuration of the system is done via these four buttons. On "boot" of the device, the LCD displays first the version number of the current firmware, then it proceeds to display a short description of each device (by device, I mean a manual, peadalboard or set of stops) that it has detected is attached to the system (these messages are purely for testing purposes while building the system). After these "post messages" have been displayed, the LCD will display the first menu item and the device will start scanning for key presses.
Component Description - Device Chain
The device chain is best thought of as a set of parallel-to-serial shift registers which have their inputs connected to every single key/stop/pedal in the organ. However, because it was a requirement (for me) to make the device capable of being installed in any organ with any combination of pedals, stops or manuals without it being necessary to make a different version of firmware, there is a single 8-bit shift register inserted at the start of each device in the chain to provide "header" information about the bits that follow.
An example device chain:
[Controller]<--[8 bit header]<--[key states for pedalboard]<--[8 bit header]<--[key states for manual 1]<--[8 bit header]<--[key states for manual 2]
The header consists of two bits which identify the type of device (manual, pedalboard, stopboard or termination of device chain), 4 bits that describe the number of keys that device consists of, 1 bit to state if the device is a toggled and 1 bit to state if the device wants feedback (i.e. wants to know if its down or up). See the following table for more information:
| Bits 6 - 7 |
Device identifier
The state of these bits defines the type of device attached to the system
Possible combinations: (bit 6 to bit 7)
00 = Terminator. This is not a device but instead identifies that there are no more devices in the set. Take note that this combination does not actually require a separate shift register, it can simply be done by tieing the serial input of the last shift register in the chain to HIGH (it's HIGH because the data line is active LOW)
01 = Stop board.
10 = Pedal board.
11 = Manual board.
|
| Bits 2 - 5 |
Device key count
This numeric value of these four bits is basically the number of 8-bit shift registers which follow holding the key states minus 1.
Examples: (bit 2 to bit 5)
0000 = 1 shift register following (max 8 keys)
0001 = 2 shift registers following (max 16 keys)
1111 = 16 shift registers (max 128 keys)
|
| Bit 1 |
Request feedback bit
If this bit is HIGH, the device also contains a set of serial-to-parallel shift registers which want to be sent the state of each key in this device. If it is LOW, no feedback information is used. Similarly to the toggle bit, this feature is only really useful on stop boards with momentary switches where you want a LED to be illuminated when the stop is active.
|
| Bit 0 |
Toggle
If this bit is HIGH, the note on and off messages are sent every-time a key completes a full up/down cycle. That is, the key will become "push on/push off". If it's LOW, the keys function normally. This feature is only useful on a stopboard with momentary switches.
|
Note that this assumes that the parallel-serial shift registers all send the MSB (i.e. bit 7) first.
Schematic Diagram for the Controller.
Important: The LCDCON and LCDDATA connectors in this schematic are used to connect a KS0066 LCD module to the device. LCDCON pins 1-6 connect to the LCD modules pins 1-6 and LCDDATA pins 1-8 connect to the LCD modules pins 7-14. Pins 15-16 of the LCD module are for the backlight of the LCD and are optional to connect. KS0066 LCD modules are readily available from Dick Smith Electronics in Australia for about AU$20.
For those wanting a table for the pinouts of the keybus (what I have named the connections which interface to the shift-registers), I have listed them in the table below:
| Keybus Pin Number |
Description of Pin |
| 1 |
Ground |
| 2 |
+5 Volts Supply |
| 3 |
KBCLK - Connect to ALL shift registers CLK pin |
| 4 |
KBPL - Connect to ALL shift registers PL* pin |
| 5 |
KBDIN - Connect to the first headers D7 (data out) pin |
| 6 |
KBDOUT - Connect to the first serial-parallel SER (data in) pin |
* indicates an active LOW signal
I have chosen these pinouts as it makes expansion incredibly easy (if pedal/manual/stop boards are designed similar to the examples below). Each device can have an input and an output keybus socket, pins 1-4 can all be joined directly (I think there is going to be some limit to the amount of registers the clock and pl signals can interface to, I have tested it with 14 74HC165's and it still works fine) and pins 5 and 6 are kind of obvious (if a device has no feedback information, pin 6 can be connected directly to pin 6 as well).
Examples of Common Keybus Devices

A 32 key pedal-board with no toggle and no state feedback

A 16 key stop-board with toggle and state feedback
More coming soon!
|