DIY MIDI Controller Keyboard
using a recycled organ keyboard

Project blog by M.J. Bauer

slant view complete

There must be lots of faulty or obsolete keyboard instruments out there which could be given a new life as a MIDI controller for synthesizers. This blog reports on how I went about it...

A while back, I found an old electronic organ made by ELKA that someone had thrown in the trash. The instrument had been left out in the weather and many parts were damaged beyond repair. Luckily, the two keyboards (each with 44 keys) were in good condition physically. The contacts were badly tarnished, but they can be cleaned using a solvent or mild abrasive. Since there was no hope to restore the organ, I decided to build a MIDI controller around one of the keyboards. 

Elka organ guts

Photo: Upper section of old Elka organ which contained most, but not all of the electronics

The MIDI controller will use a Sparkfun 'Pro Micro' MCU module (ATmega32U4, 8-bit AVR, 5V/16MHz).
Pro Micro clones are available at ridiculously low prices. The 8-bit AVR MCU has more than adequate grunt for this application. Firmware will be developed in Arduino IDE because it is popular with hobbyists who may be intimidated by professional IDEs such as MicroChip/Atmel Studio for AVR and SAM Devices. 

The USB port can be used for firmware update (DFU) and to provide a simple command-line user-interface (CLI) intended mainly for debug usage. DC power supply options will be 9V..12V via a 5.5mm barrel jack, or 5V via the USB port, or 5V via "Power-over-MIDI" (from the MIDI OUT socket). This will allow the keyboard to be powered by a Sigma-6 Poly synth through the MIDI cable.

This MIDI controller design is intended for keyboards without velocity-sense capability. Many older keyboard instruments, e.g. electronic organs, have a key contact mechanism unsuitable for velocity measurement. Hence, provision will be made to generate a "fake" velocity signal using a front-panel control knob or a plug-in foot-pedal. The simulated velocity signal will be transmitted in MIDI Note-On messages, of course.

The keyboard contacts will connect to the MCU via a couple of input port expansion boards, each accepting up to 24 key contacts wired to parallel inputs of shift-registers, type 74HC165. Each input pin has a pull-up resistor, so the input bit normally reads High. The key contacts are wired so that a key press pulls the respective input Low. The boards interface to the MCU via a 3-wire SPI bus. A number of boards can be cascaded to accommodate a keyboard of any size. These port expansion boards are readily available at very low cost from suppliers on AliExpress. They usually come bundled with SIL plugs and hookup wires.

SPI port expander

Technical data obtained from the supplier is inaccurate. So is the signal labeling on the PCB overlay.
View/download corrected schematic and connector pinout diagrams here.

The 74HC165 has 8 bits parallel input plus 1 bit serial input (SA). Thus, when a number of 'HC165 devices are cascaded, one extra bit is available, normally used for "carry in". This works well for musical keyboards. For example, a 4-octave keyboard has 49 keys. So the key-contact interface must have 49 bits. With two 24-bit boards, you get 48 bits parallel in + 1 bit serial in = 49 bits total. How convenient is that? Similarly, a 6-octave keyboard (73 keys) can be accommodated using just three interface boards.

Some keyboards found in cheap portable instruments have their contacts wired into a 2D matrix.
I have already designed an alternative key-contact interface board to suit this type of keyboard.

The circuit is shown below. This arrangement supports up to 64 keys wired in an 8 x 8 matrix. A small-signal diode (1N4148) must be wired in series with each key contact (anode to sense line). The interface board connects to the MCU board via the same 6-pin header as the 24-bit input port expanders. The firmware will have a build option to support this alternative.

key contact matrix interface

Player Controls

The enclosure will have two small control panels on the front surface, below the keys, one on each side. The front-left panel will have a knob (rotary pot) which may be used to control either modulation or velocity level. Beside the knob is a switch to select the function of the knob (i.e. modulation or velocity). If the knob is set to modulation, the "Pedal #1" function will be velocity, and vice-versa.

The front-right panel has a 
3-position switch to select the octave shift. The entire keyboard range can be shifted up or down one octave. Also on the RHS panel is a switch to set the CV/Gate operational mode ("High-note Priority" or "Legato") and a power switch. 

FRONT PANELS

The rear panel provides external connections: DC power input (3 options), USB port on the Pro-Micro MCU, rotary switch to select the MIDI channel (one of 5), DIN-5 socket for MIDI OUT, DIN-6 socket for a "Pedal Board", and 3 x TS 3.5mm jacks for CV and Gate outputs. The "Pedal" socket has 2 analog inputs intended for Modulation (or Velocity) and Pitch-Bend, plus one digital input for a Hold/Sustain foot-switch. An extra digital input pin detects whether or not a pedal is connected.

rear panel

Since the Pro Micro MCU has pins for analog (PWM) output, it seemed obligatory to add a couple of CV outputs and a gate output, so that the keyboard can be used with a modular analog synthesizer, without needing a MIDI-to-CV adapter module. The pitch CV output (CV1) will be quantized into semitones. For CV1 and CV2 to cover the full 5V range, the MCU board must be powered via 'DC IN' (9~12V).

The extra circuitry and program code needed to provide CV outputs is minimal.

Here is the complete schematic of the proposed MCU board...

schematic

Note that 5V operation is possible via "power-over-MIDI" or via the USB port. If you don't need power-over-MIDI, remove the jumper JP1. The power switch is bypassed when using 5V power.  DC IN voltage range is 8.5V to 13V to suit a 9V or 12V power supply. Raw Vin (to the MCU on-board 5V regulator) is fixed at about 7V using an LM1117 regulator IC. A heat-sink on the LM1117 is advisable where DC IN > 9V.

... to be continued ...


___


Construction

Here's a short video clip showing how the enclosure was built...

youTube link p1 

A sequel will show fitting of the electronic parts and wiring the whole thing together.

___


MIDI Controller Operation

A key press results in a new note being initiated, i.e. a Note-On message is transmitted with the note number corrersponding to the key pressed (adjusted according to the Octave Shift switch).

A key release results in a note being terminated, i.e. a Note-Off message is transmitted with the note number corresponding to the key released (adjusted according to the Octave Shift switch).

The keyboard operates in the same manner regardless of the position of the Legato on/off switch. However, when the switch is moved to 'LEGATO' a MIDI 'Legato ON' message (CC68 + 127) is transmitted. When the switch is moved back to the normal position, a  'Legato OFF' message (CC68 + 0) is transmitted. It is assumed that the attached synthesizer complies with the MIDI Specification for legato mode.

CV/Gate Operation -- Note Priority

With the Legato switch off (open), the keyboard functions in a mode termed "High-Note Priority", whereby the CV1 and Gate outputs respond only to the highest note keyed. The intent is for the CV and Gate outputs to follow the melody line being played, as far as practicable, on the assumption that the melody notes are higher than those in the accompanyment. High-note priority works as follows...

A key press results in the Gate output being activated if the new key is the only key pressed, or if the key is a higher note than any other key(s) already pressed. The CV1 voltage is set according to the keyed note.*

A key release results in the Gate output being negated if the key/note corresponds to the key which caused the Gate signal to be activated last. The CV1 output (pitch) is not affected.

The firmware will have a build option to implement an alternative keying mode, i.e. "Last-Note Priority", whereby the CV and Gate outputs respond to the most recent note keyed.

*Note:  The 'Octave Shift' switch has no effect in CV/Gate operation.

CV/Gate Operation -- Legato 

With the Legato switch in the ON position, the keyboard operates as follows...

A key press results in the Gate output being activated only if there are no other keys held pressed.

In any case, regardless of any other keys being held pressed, a new key press results in the CV1 output (pitch) being set according to the newly keyed note.

A key release results in the CV1 output (pitch) being set according to the key which caused the Gate output to be last activated.

A key release results in the Gate output being negated if the released key was the only one pressed.

...

... to be continued ...

...

Firmware

Download firmware package here - (TBD)

The firmware download package includes source code to compile and upload the program using Arduino IDE software on your PC. Download and install this app.

... to be continued ...  (firmware is still in development) ...

___

Thanks for taking an interest in this project. Feel free to send comments and queries. 
...

See MJB's Index Page

for other DIY projects that might be of interest to you! 
___

link to email address

Last update: 04-JAN-2026