Arduino sketch for conversion of an old piano keyboard to a USB MIDI device.
This is sketch does not use MIDI port as a part of the circuit. Instead, the MIDI input conversion is done using software:
The Hairless MIDI Serial Bridge
Made for a 54 key scan matrix (8x7). For figuring out your scan matrix you can use the tutorial here. 74HC595 shift register is required. Connect everything using this diagram:
Have in mind whether you have pull up or down circuit configuration. You might need to connect your resistors to positive voltage in case pull down doesn't work for you.
You will also need to change the bits in the code accordingly. Everything you might need to replace/change is commented out in the code. Don't forget to define your digital pins correctly. After uploading the sketch run Hairless MIDI, change the baud rate to 57600 in the settings and connect to your serial port. After that run loopMIDI, add a new port and set it as MIDI In/Out port in Hairless MIDI.