Introduction: MIDIfying an Electronic Organ
This instructable guides you in taking that old unloved electronic organ that you have in your garage or basement, and converting into a modern musical instrument. We won't dwell too much on the details of the particular organ that you have, other than to say that fundamentally the typical musical keyboard is a set of keys which connect when pressed to a common bus. In the old world, considerable circuitry existed alongside the keys which caused an output to be passed onto the bus, which in turn was amplified and passed on to an audio system. Today the keyboard is a set of sensors; we read the state of the individual keys, and send the changes to a software synthesizer, which is driven by MIDI commands.
The instructable covers much of the process involved, from collecting the digital state of the keys, managing it with an Arduino microprocessor, building a MIDI data stream, and passing it on to a computer (including Raspberry Pi) which is running the synthesizer.
Step 1: The Keyboard Abstracted
The following represents an abstracted electronic organ, where each row is a set of keys or stops or other control switches. The 0 column entries represent individual keys, and the - a bus to which the key is connected when it is pressed. The 61 key Great Manual could be the first row, the Swell Manual the second row, the Pedals the third, and the Stops etc the fourth. The rows actually contain 64 elements because of its digital significance as power of 2 beyond 61. Within the keyboard rows, the keys follow normal musical convention with C at left.
Bus 0 — 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.................... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Bus 1 — 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.................... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Bus 2 — 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.................... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Bus 3 — 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.................... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Each bus is independent, and electrically isolated from its peers. The first 8 elements are highlighted in Bold, with 8 such blocks in the above arrangement. The next Step details a Printed Circuit Board which operates on the bold elements, and the other 7 blocks of them.
The keys have been represented as 0's above. We can take this a little further, and say that a key is a digital 1 when pressed, and 0 otherwise. And keys can be conventional musical white flats or black sharps, or organ pedals, or organ stops, or a bank of rotary switches that might give us a saxophone tone. We simply regard the instrument as a set of switches on a set of buses, and essentially a digital stream of 0 and 1's.
Step 2: Wiring From the Keyboards
To help with wiring the keyboards, a Printed Circuit board has been constructed using Eagle CAD. Its size is about 96mm X 43mm, and 8 are required, stretching across the rear of the organ keyboard assemblies.
Let us look at this Printed Circuit Board (PCB) in detail. The left image is the front of the PCB onto which components are mounted, and the right is its rear where we solder the components.
Firstly, the 2X3 components at the top are intended to connect to the keys above, with the top two connections bus 0 and 1, the next pair 2 and 3, and the bottom pair also buses 2 and 3. It was found that a PCB 2X3 header was rigid enough to accommodate single strand hookup wire from the keys simply pushed into the header, similar to Arduino shield wiring. The hookup wire that I used was recovered from the original organ; it is 0.75 mm diameter.
So each 2X3 Header accommodates a column of the bold highlighted keys, or in broad terms one note. The board thus requires 8 of these headers. The image contains one of these female headers at top left. The middle section of the board is populated with 32 diodes (1N4148 or similar), each corresponding to one of the red inputs. The diode polarity is as marked on the board, with cathode (black band) at the top end of the board. A single diode is illustrated at position 4. Finally, a single 2X5 male header populates the lowest section of the board. Its upper 2 pins are not connected. Pin 1 is located in the bottom right corner, and connects to the leftmost 4 diodes, Pin 2 to diodes 5-8, and finally 29-32 connect to pin 8. The header may be cut from a longer DIL section, as illustrated on the board. The wiring between the various components is carried within the PCB itself, with the only soldering required the diodes and headers.
8 of these complete boards are mounted immediately below the manuals using the mounting holes provided, stretching conveniently across the organ. The function of this board is thus to take one block of 8 keys across 4 buses, and present it to a male header to which 10-way ribbon cable will be connected for transfer to the next stage. The board design may be downloaded from the zip file provided.
Step 3: Consolidating Keyboard Outputs Into Shift Registers
Two further PCBs are required, as displayed above. They are known as DIN R5, and are popular in the MIDI world, although they simply provide a shift register function. Firstly in the upper horizontal section, you can see 4 2X5 male headers, which connect via ribbon cable to the 2X5 counterpart on the 8 boards above. We need two DIN boards to accommodate our 8 such cables.
Further down the board are IC chips which form a 32-bit shift register, and finally of interest to us are 2 further 2X5 headers, one of which (J2) gangs to further DIN boards (our second one), and the other J1 to our Arduino or Arduino-like microprocessor.
To summarise, we have -
- Up to 4 buses of 64-keys feeding into
- 8 boards of 32-inputs, 8-outputs per bus
- these 64-outputs feeding into 2 32-bit shift registers
- the Arduino microprocessor will cycle across the buses
Step 4: Putting the Hardware Together
The connections between Arduino, the two DIN boards and the ribbon cables from the organ key complex are illustrated in the picture above. Note that the second DIN’s J2 is just left empty.
The connectors employ IDC technology (insulation-displacement contact), and the wires do not need to be stripped or separated. They are applied to the cable with a compression tool available at hobbyists. At left the end of the crimped cable may be neatened with a razor blade; at centre the underneath of the connector provides a 2X5 female socket; and at right a top view of the connector.
The DIN boards and the custom PCB boards were attached to organ woodwork using round- headed brass wood-screws and spacers. A part-view of the custom PCB boards mounted in the organ is pictured above. The upper hookup wire cables connect stops or controls into the boards, and the mass at left emanate from the pedals. Finally, the removal of the tone generators and other assorted functions of the original organ has enabled the cabinet void to be reused for wine storage.
Step 5: The Arduino Complex
The Arduino complex seen to the left of the two DIN boards above will now be discussed. It consists of three distinct layers, interconnected as Arduino shields. The PCBs comprising the layers are fortuitously coloured Blue, Green and Red.
The Blue layer (at top) is a shield produced by Freetronics, which provides a 16X2 liquid crystal character display. (2 rows of 16 characters). It is not strictly essential, but is extremely useful in checking out the operation of keyboards, pedals and stops. It is driven by the LiquidCrystal library, and other hardware variants could be easily substituted.
The Red layer (at bottom) is a Teensy 3.2 mounted on a Sparkfun Teensyduino board. The Teensy offers direct MIDI support, and otherwise behaves as an Arduino UNO. So using the Teensy saves components downstream. The power supply (5V 2A) connection is at bottom left, and the USB connector supporting serial or MIDI output at centre left. The headers at top and bottom edges provide standard Arduino shield functionality.
The Green layer (sandwiched between Blue and Red) is a custom PCB board. Its purpose is broadly to support bits and pieces such as link to the DIN boards, and to cut down external wiring. Some of its functionality is redundant. It includes some circuitry for supporting MIDI via a standard Arduino UNO. It also provides a 2X5 male header for ribbon cable connection to the J1 header on the first DIN board. Other functionality includes Volume Control support; the original Organ employed a 10K potentiometer (pot) driven by a Foot Shoe.
The four horizontal headers provide standard Arduino shield connectivity to the Teensy board below and the Liquid Crystal display. The imprint resembling a bus station in the bottom left corner is a leftover, and the long vertical header at left provides connectivity to the four buses, volume control, and ground.
The custom board was developed using Eagle CAD, and zip files of the Gerber complex sent to PCB fabricators are available in the PCB2 zip file.
Step 6: The Arduino Software
The software was originally developed for an Arduino UNO, and was later amended with very few changes to use the Teensy. Pin usage is unchanged.
The Liquid Crystal display uses half a dozen pins, and it was decided to use the Analog pins in digital mode in order to get a block of adjacent pins for the buses. The Volume Control uses another Analog pin in Analog mode.
Much of the software is concerned with reading the individual keyboard, pedal and stop keys by enabling each bus in turn, and marching the bit values out of the shift registers provided by the DIN boards.
The downstream environment will typically include a processor running Windows, or UNIX, or Linux, and a Software Synthesizer such as FluidSynth, which might in turn be managed by jOrgan. FluidSynth is ultimately driven by one or more Soundfont(s), which specify what sound is generated when a particular MIDI command is received. There is some analogy with Word Processing fonts. For the keyboard and pedals, a change from the previous scan will result in a MIDI Note On or Note Off sequence being generated. The left-most key is MIDI 36, and increment across the keyboard. The bus index will easily provide scope for the MIDI channel number. For the stop keys, MIDI program control sequences are generated, or it might be sensible to generate Note On/Off and leave it to jOrgan or similar MIDI downstream software to interpret, adjust and expand. Whatever course is taken, the ultimate decision is imposed by the definition of the downstream Soundfont(s). The software has been used in various guises to generate MIDI via USB to Windows operating the Wurlitzer application and FluidSynth, and to a Raspberry Pi running FluidSynth and a General MIDI Soundfont. This description is admittedly sketchy, but anyone familiar with the Arduino environment or C will have no difficulty amending it for their own purposes; there is reasonable internal documentation, and reasonable modularity.
The Arduino software is contained in organino.zip.