Adding MIDI to Old Home Organs

About: I don't use instructables any more, so please consider all my projects here as archival.

In a previous instructable "How to Get a Free Synthesizer" I talked about how to obtain a "synthesizer" (a home organ) for next to nothing. So, maybe now you have your free home organ and maybe it looks cool but doesn't work properly or maybe it works properly but you're bored with the soundalike presets typical of old, top-octave synthesis organs.

Maybe you'd like to turn your organ into a MIDI controller! It's going to take some wiring, but if I can do it so can you. Then you'll have your vintage keys AND whatever modern (or vintage) sounds you like.

This project is specifically tailored to organs (or synths) which use a common-connection or what I call "bussed" keyboard. This is most organs built before about 1983. Organs built after 1983 began to use computer control over sound generation and started to use what is called a "matrixed" keyboard. More on this on the next page.

This project was produced for the 2012 Maker Faire in Raleigh, NC.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Bussed Vs Matrixed Keyboards

We have two types of keyboard wiring schemes used in all electronic keyboarded instruments:
- matrixed
- bussed

Matrix keyboards are how almost all modern keyboards are wired. It is most easily understood as a crosshatch of vertical and horizontal wires where the key is at every intersection. This method has the advantage of using the least number of connections but it must be scanned by some sort of microprocessor. 61 keys can easily be scanned with only 16 pins on the CPU. The microprocessor scans one row or column at a time but does it quickly enough it is fully transparent to the musician. the CPU then instructs whatever makes the sounds to play the notes pressed. No problem for today but 40 years ago it would have been cost-prohibitive.

Bussed keyboards have all the keys fed with a signal (usually a raw squarewave note fed directly from a divider chip) which then connects to a common connection. There might be more than one common connection. This may take the form of multiple key contacts or it may be some arrangement which pulls springs into contact with metal rods running the length of the keyboard.

The bussed keyboard type was the first to be used because of the way sounds were generated in the organ. The earliest organs used individual oscillators for each note. Each note was wired to a key, and when you pressed the key you were connecting the signal to the amplifier. Individual oscillators eventually gave way to integrated circuits which divided a master signal down into top notes and then all the lower octaves. Again, the final note outputs were wired to each key.

The reason for multiple bus rods/rails under the keyboard? You could have the dividers output a high frequency squarewave which could then be fed off to other divide-by-x circuits to create more simultaneous octaves. The voice tabs would turn on or off the inputs to the other dividers. Usually these were the "flute" or "tibia" sounds. They were labled by "footage", eg. 16", 8", 5 1/3", 4", 2" etc...

Step 2: The Challenge of Using Bussed Keyboards

How are we going to connect all those key contacts to our CPU to convert them into MIDI commands? If we have 2x 61-key keyboards, that's 122 key contacts. No way does any CPU have even close to that. Shift registers to the rescue!

A shift register is an integrated circuit which converts serial to parallel data and vice-versa. This project uses the 74hc165, which is a Parallel Input, Serial Output (PISO) shift register. The shift registers "latch" in all the inputs at once, and then the CPU reads the data out of the string of shift registers serially, meaning one bit at a time.

We need 8 shift registers to handle 61 keys as the shift registers used have 8 parallel inputs.  We can't escape the fact that some serious wiring work is going to be needed to connect all the keys to the shift register inputs. The plus side is we only need three CPU pins to control and read the shift registers.

If we want to read more than one keyboard we can multiplex the keyboards with some extra CPU pins. What the CPU will do is change the state of the common buss connections on each keyboard so they are either grounded or floating and read one at a time. We use a 16 mHz CPU (actually a microcontroller) which can easily multiplex two keyboards and still have time to spare to read knobs, buttons and update a display.

Step 3: Wiring - Organ Side

The first step is to get the back and/or top off your organ and see what you're up against as far as wiring is concerned. The easiest way to handle this project is to decide that you will NOT be keeping the original functionality of your organ. It's possible to retain the original sounds but the difficulty in doing so depends if your organ sends the actual audio to the keys or just a control signal. If a control signal is used then it's not hard but if audio is present the conversion will be much more difficult. In any event, just something to think about but this instructable will only cover not keeping the original functionality.

Wiring is expensive, tedious and time-consuming. We can avoid as much as possible by trying to retain as much of the original wiring harness as possible. Since the sounds were most likely produced by octave dividers, you will likely find your wiring harness is not ordered by note but by "key", meaning all the "c"s are together, all the "d"s are together etc.. No one says you can not just scan that in directly and then figure it out in software, but if you want to use my code you have to sort the wires back into ordered notes. I found it made troubleshooting much easier to have my notes in order as they went into the shift registers.

Your choice for sorting out the wires is either use the existing board(s) or cut out the wiring harness at the sound board and solder it to a protoboard. I chose to use a protoboard (actually the guy who had the keyboard before me did). You will need to use the protoboard method if you want to PROPERLY scan more than one keyboard. You will need a diode for each key to prevent "ghost notes" and it is unlikely to be feasible to add that to the old sound generator board.

Step 4: Wiring - Scanner Side

I highly recommend using either rainbow ribbon cable OR use teflon-coated wire. I think there must be teflon-coated rainbow ribbon cable but I have never seen it. Anyhow, rainbow wire helps keep your connections in order and teflon-coated wire insulation will not melt or shrink as you solder it.

I used Molex connectors because I had them on-hand and because you can push the Molex terminals out of the connector if you find you have made a mistake. I discovered too late on my breadboard version that my Molex connectors were not really end-stackable. I got around it by bending my header pins. On my hardwired version I did it properly by giving one 0.1" hole space between each connector.

Step 5: Project Files

Everything you need to for the project is here on GitHub:

There you will find a more detailed explanation of the project, as well as the Arduino 1.0 project source, modified libraries needed by the code and an Eagle schematic.

Step 6: Other Hardware

In addition to the organ of your choice and the 74HC165 shift registers, this project also used:
- Atmel ATMEGA328p on a Modern Device SBBB
- Wicked Device RBBB shield board
- 5v regulated switchmode power supply
- Modern Device Fluxamasynth single-chip MIDI synth
- HP Entertainment Center VFD
- 4x 50k pots (10k would be better)
- 2x pushbuttons

Check my github repository on the previous page to get updated libraries for the Fluxamasynth and HpDecVfd which work with Arduino 1.x and which provide some extra functionality (more control over sound parameters for the Fluxamasynth)

Step 7: How It Works

How does the microcontroller convert the information from the shift registers into MIDI notes?
As described earlier (in shift-in-midi-description.rtf, available on GitHub) , the microcontroller causes the shift registers to latch the data on each input and then shifts all 64 bits of data out of the registers. Here is the process for converting the shift register data into notes:

Note: this process runs continually in a loop, thousands of times per second

1. The shift registers are latched, reading the 61inputs all at once.

Note: logic gates always need a reference for high or low. Usually it is best to provide a reference to "high". This was necessary for early integrated circuits called "emitter coupled logic" or "TTL". It was much less wasteful of power to pull inputs high on these chips than to try to pull them low. When we say "pull" we mean to connect a pin to a current source or sink via a resistor. Typically 10K Ohm is used. So, in our case, every input requires a connection to the supply voltage (5 V) via a 10K resistors. This is a lot of resistors, but luckily, resistors are very inexpensive. So, when we latch in the inputs, if no key is pressed a "high" logic state will be read. We connect the shared bus to ground (actually a pin on the microcontroller set to be a low output, which acts as a current sink). If a key is pressed, it "pulls" the shift register input pin to a "low" logic state. This means a key being "on" is actually read as "off", which is backwards, but we can fix this easily a little later.

2. Shift register data is stored in an 8 byte array of current key state and previous key state.

Once the shift registers are latched, we start sending clock pulses. Each clock pulse causes the state of the shift register to shift one bit towards the output pin. Each chips output is connected to the input of the next chip. This allows the data to move sequentially through all the chips. But how do we deal with the "on is off" and "off is on"? The 74hc165 provides two serial outputs - a normal output and an inverted output. We connect the microcontroller to the inverted output of the last shift register. This changes the input states back to what we want - key down is "on" or "1" and key up is "off" or "0".

We are using an 8-bit microcontroller. It works best and most efficiently with 8 bits (one byte) at a time. So, we read the shift register data one byte at a time.  The eight bits in a byte store the key state of eight keys. We need 8 bytes to store the key states of all 61 keys.

We have to pay careful attention to how the data comes out of the shift registers. We wired our chips so the first registers first pin (input A) is connected to the rightmost key - we call that key "1". The last key is key "61". So, we are going to get the key states out of the registers in right to left order. So the first byte read is actually going to be the last five keys (and the three unused inputs). We wanted our bytes to be stored in left to right order, so we also had to make sure we put the first bit received in each byte into the leftmost bit of the key state byte.

You can do it any order you want, but you have to be consistent!

3. Key states are converted into push states; push states are stored in a 61-byte array holding either note on, note off or no change.

So, we have 8 bytes worth of key states for all 61 keys. But this is not exactly what we need to send MIDI commands. MIDI causes notes to sound with a "note on" command and the note stays on until "note off" is sent. So we have to convert the key state into a press state. We want to know when a key has be pressed so we can turn the note on and we want to know when a key has been released so we can turn the note off. We do not want to send "note on" thousands of times per second. That would flood the MIDI bus with data and it would not work.

To generate push states from key states we have to store the current key state and the previous key state. We compare the two each scan loop and see if the state changed. If it went low-to-high, then a push down is registered and a "note on" is sent. If it went high-to-low, then a key up is registered and a "note off" is sent. If nothing changed, no new MIDI data is sent.

We compute MIDI note information by storing a lowest note value and then adding the array index to it to get the actual note. This is the simplest way to approach it. If you want to get fancy you will need some sort of look-up table.

4. The process repeats. We make sure we wait a minimum amount of time between keyboard scans. If we scan too fast we will pick up what is called "key bounce" - electrical noise generated when the key contacts open and close. If we read it we will get spurious key state information. All we have to do is wait a little longer then the typical "bounce" period. If the bounce period (10 microseconds in this project) has not yet elapsed, we simply exit the scanning loop and try again.

How do we actually convert key states into push states?
In this project, we read the shift registers using software. This is called "bit banging". It is not the fastest method. There is a hardware facility in the ATMEGA chip called the SPI (Serial/Parallel Interface) which could do it much faster. However, it is harder to understand and it turns out for reading human inputs bit-banging is plenty fast. We make sure it is fast by using the microcontroller as efficiently as possible. We make all our key state comparisons using bitwise operators. The bitwise operators we use are "<<" shift left, ">>" shift right. "^" exclusive-OR (XOR) and "&" AND. XOR is used to see when key state within a state byte has changed when compared to the previous state. AND is used to select bits from a byte using a bitmask. The shift operators are used to move a bitmask bit left or right inside a byte to select a specific bit to compare. All these operations can be carried out in one or two clock cycles, making them very fast.

If you want to learn more about how the code works, take a look at the source. We provide plenty of comments on how each part works. Again, the most difficult part is simply making sure you read and compare data in the correct order.

Step 8: More Photos

Here's what the whole thing looked like at the 2012 Raleigh, NC Maker Faire, where it was presented.

Step 9: How It Sounds?

Well, it sounds like whatever you have it hooked up to MIDI-wise. I used a Fluxamasynth, which is great for the price but is mostly single-sampled instruments so, uh, let's just say you wouldn't want to cut a record with it. But for what it costs and the convenience, it's great.

Note that this method of keyscanning, and they type of keyboard used, precludes getting a key velocity. Maybe you could do a retrofit which uses optical or hall-effect sensors and be able to get velocity. That's a whole other project though. Your best bet for sounds is therefore stuff which doesn't use velocity, like church organs, harpsichords etc... In fact, many times a beautiful but unfixable church organ will be converted to MIDI in this manner and then used with sampled instruments. Check out "jOrgan" - it's free.

I wanted to give a basic demo video but tragedy struck while I was working on fixing a dead key (due to a break somewhere in the wire for it). The keyboard fell off the table and got thoroughly smashed. Do you want to hear the sound of stuck keys? I didn't think so.

I have some other old keyboards around which I hope to hook up to my scanner so stay tuned, I may yet put up a demo!

Hurricane Lasers Contest

Participated in the
Hurricane Lasers Contest

Be the First to Share


    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest

    17 Discussions


    Question 10 months ago

    Hi, compliment for your great job!
    Also, I am trying to do like you on an old pedalboard for organ.
    I wanted to ask you a suggestion:
    I am endowed with an encoder MIDI taken by midi boutique
    I ask you if the keying voltage must be positive negative or passive.
    Thanks for your help

    Juan CarlosG47

    2 years ago

    hello great job.i have Yamaha cs01 it is a matrix synth.i would like send signal midi from iMac to Yamaha s possible with your example?

    thank you


    2 years ago

    I hope this is not something I totally overlooked in your post, like maybe the whole point of your post even, I'm not a super techy person. But is there a simple, minimally-invasive retrofit where the only thing you're adding internally is something the keys can press down on and can be wired to a compact external apparatus that does the rest of work needed to interact with a sequencer? Where the added midi feature even has its own power source and does not i teract with the original keyboards' circuitry. Where the original circuitry doesn't even know it has a midi function being added?

    1 reply

    4 years ago on Introduction

    Hi Excuse me Help me about this circuit This circuit is a Midi keyboard I try to connect my sound card MIDI port I do not know how?

    It was actually a synthesizer old and defective.

    I'm going to use the MIDI keyboard
    How to connect the circuit output to a MIDI cable?
    6-pin output
    5-pin MIDI cable


    5 years ago on Step 2

    As an alternative approach, these days, there actually *are* devices that have that enough inputs to handle an entire manual. For about $10 per manual, you can buy an Arduino clone board based on the ATMega 2560. Configure all of the digital pins and analog pins as inputs, skipping pins 0 and 1 (USB), 13 (internal LED), and 18 and 19 (for MIDI). Now you have a device that can take up do 65 independent digital inputs—enough to handle an individually bus-wired manual with several analog input pins left over for reading expression pedals. Don't forget to buy an extra one to handle the stop rails.

    Adding MIDI output is pretty trivial. Just implement the MIDI electrical spec:

    or buy a premade MIDI shield. Assign each manual to send on a different MIDI channel, and you're done.

    If you're really feeling inventive, you could use another set of Mega boards wired with MIDI inputs and pin outputs so that you can programmatically drive the old organ. (Depending on the control voltages and current involved, you may need to use additional switching circuitry, of course.)


    5 years ago on Step 2

    Thank you so much for publishing this information. As an electronics (am/fm/tv) engineer for 40 years, I get asked these questions and attempt to get everyone answered, but I'm an ole geezer, grouchy, and LAZY and I appreciate anything that is accomplished when sharing information. You are a good reference. One of my good friends (and another computer engineer) help me totally gut an old organ console, add 3 more keyboards, re-wired everything from scratch, and what d' ya know, we made it! KUDOS and thanx- MUCH-O!

    Swift-Waters OPUS 1.JPG
    1 reply

    Reply 5 years ago on Step 2

    That's an impressive setup! I'm glad the information was useful to you. The old stuff (60's and earlier) tends to have good contacts which make for years of trouble-free operation, so it's worth the rewiring.


    Hi! Great instructable! I' ve been looking for way to build a MIDI keyboard for months! Nevertheless, I'm having problem figuring out how to wire all those switches. If I got it right, the matrixing is already done for me in the schematic you are providing (along with the sketches and the libraries). What confuses me is that I don't know where the switches should be connected to the diagram. I do realise that they should be connected across the X pins and the numbered pins 2-11, but still I'm not 100% sure.
    I' d also like to know whether pins 7 of the shift registers should be interconnected or they should be simply left unconnected.
    Does each capacitor C8-C14 have to be connected close to the VCC and GND pins of the ICs?
    I believe it's OK to use an Arduino UNO R3 instead, connect everything to the corresponding pins just like in the schematic and load the ATMega with the code provided, isn't it?
    And one last question: According to the example schematic of a matrixed keyboard above, some diodes should be connected in series with the switches (obviously to eliminate any ghosting or masking). Again, I'm not quite sure how to connect those in the "shift-in-midi" schematic.
    I would truly appreciate a revised circuit diagram, which will include some switches, but this is way too exacting, so don't bother. I'll be more than satisfied, if you just give some guidance and, I believe, I will figure this out.
    I hope I didn't tire you with all these questions!
    Thank you in advance,

    6 replies

    Reply 6 years ago on Introduction

    Let me try to answer your questions.
    - The schematic (and code) is for a non-matrixed keyboard.
    - Looking at the bottom portion of the schematic, the little "probe" shaped things are where you connect each key contact. In my example I pull up each input, so each key should connect to ground when closed.
    - pin 7 is the inverted output on the 74hc165 and is only used on the last register before the CPU to turn the signals from active-low to active-high.
    - The decoupling capacitors should be as close as possible to the V+ input on each chip.
    - Diodes are only needed on the inputs if you intend to multiplex keyboards, like I did. In that case, each switch contact would connect to a diode (forward biased) and then to the shift register input. If you only need a single keyboard then diodes are unnecessary.

    If you have the choice, use a matrixed keyboard. It's much more wiring to use an un-matrixed keyboard. However, many older organs used the latter, hence this project was developed.


    Reply 6 years ago on Introduction

    Thank you for your quick response! I definitely have a much clearer idea of what to do now! Unfortunately I don't have access to a matrixed keyboard, so I'll take my time and wire everything up. I intend to use ribbon cables, as well. I'll let you know for my progress on this project.


    Reply 6 years ago on Introduction

    If you have an old organ keyboard, you may be able to reuse the wiring harness. Just be aware that the wires were often grouped by notes into octaves rather than notes in order, due to the way top-octave synthesis worked.


    Reply 6 years ago on Introduction

    Here's a draft of my schematic. Did I get it right? I think that I should power the Arduino externally in order to get the required Amps. How do I get the serial data output? I mean: Do I need to hook up a MIDI connector and then use something like a MIDI to USB converter and the appropriate software to convert the data to sound? Or does the microcontroller do all the job and tranfer the data directly to the PC?
    Sorry for being so novice... I hope I didn't confuse you with these questions...


    Reply 6 years ago on Introduction

    The project was designed to work with the Fluxamasynth MIDI synth shield. If you want MIDI outputs, it's probably easiest to just buy a MIDI shield for your Arduino. You may need to change the pin assignments in the code depending on what your MIDI shield expects.


    Reply 6 years ago on Introduction

    The Fluxamasynth MIDI synth shield is out of my budget, so I am considering using a "handmade" MIDI shield. After some Google search, I found out that the commercially available MIDI shields make use of the Opto Isolator 6N138 or 6N139 (they are actually the same). I found this forum topic with a very simple circuit (, so I intend to use this one to create my MIDI shield. I' ll try to figure out the necessary changes in the code, but I might need your help later on this.
    Did you have a look on the diagram in the previous post of mine? What's your opinion?
    I really appreciate your assistance so far!


    Reply 7 years ago on Introduction

    Look for "Highly Liquid" online - they sell MIDI adapters suited to matrixed keyboards. There's also a 64-button shield out there (name escapes me) which uses a dedicated scanning chip.