I design my first Pi MIDI interface way back in 2012 while I was waiting for my first Pi board to arrive.
It’s went through several revisions since then and now looks like this:
The circuit is now completely 5V as per the original MIDI specification but the MIDI IN is 3.3V compatible with the Pi via a voltage divider circuit.
OK that’s the hardware what about the software?
Getting a MIDI 31250 Baud Rate on a Pi is not easy as it should be as 31250 is not a standard Pi baud-rate. But you can trick your Pi into it if you overclock (or rather underclock) the UART clock.
Start a terminal session and type:
sudo nano /boot/config.txt
Add these lines to the end of the file
# Change UART clock to 2441406 for MIDI 31250 baud rate init_uart_clock=2441406 init_uart_baud=38400
save and exit.
Once saved reboot your Pi.
Next we need to stop the serial UART being used by Raspbian for the shell console. Check my previous post “MiniPIiio RS232 set-up” on how to do this.
Finally we need to add the following to “cmdline.txt”
bcm2708.uart_clock=3000000
After doing all of this we should be ready to connect a MIDI keyboard or synth to our Pi.
Again I hope to have it stocked in out our store on Tindie soon: