Pi Zero + MIDI in via GPIO

ayskura posted Jun 13, 21:37:

Hi all,

I am continuing to build my raspberry pi Zero based Samplerbox and so far I am having lot of fun. I managed to make the buttons and waiting for a display to add. Meantime I got all the elements to build the MIDI in circuit and I am having problems to make it work with PI Zero... I followed all instructions I found and added lines such as these

////In summary, my /boot/cmdline.txt:

root=/dev/mmcblk0p2 ro rootwait console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 elevator=noop bcm2708.uart_clock=3000000

and my /boot/config.txt:


and known that my kernel is 4.4 and the baud rate seem to be correct.

but when I play in my midi keyboard I can hear only one note every 5 seconds or so and there is no note release (the note keeps playing until the end of the sample and it's monophonic (just one note at the time).
I also noticed if I change the MIDI channel I transmit it kind of reset the midi cycle and I can play another note but always one at the time and no release.

If I play with a USB midi keyboard it works as expected polyphonic, and release works

Any idea what can I do to make this work? I would love to have MIDI in directly without USB as it would save me from having a 3 ports USB etc...

thank you

ayskura posted Jun 14, 02:59:

a doubt I have is the MIDI connected from facing or from the connectors? I mean there are 2 cables going to the MIDI port, one coming from a resistor of 220Ω and another coming from a DIODE... where should I plug them? I understand it's 1-4-2-5-3 the pins but are those from the connection or from the Soldering end? than you

I think it should be Pin 4(DIN) to the Resistor > pin 2 of the 6N138
and Pin 5 (DIN) to pin 3 of the 6N138
but is the 4 and 5 facing the connection or the soldering side?

Also I am using HP 6N138 / 922 ru?

is it possible it's the wrong optoisolator?

thank you

Ayskura posted Jun 14, 04:28:

Ok an update: I build another one and this time with a Raspberry pi 3 and same thing! The MIDI keyboard only plays one mono note and it keeps playing unlimited... Any idea what could I be doing wrong?

ayskura posted Jun 19, 04:35:

Another update:

I connected to another MIDI keyboard as I was noticing the one I was using keeps on sending constantly MIDI signal even when you not play (it's a CS1X Yamaha) so I plugged another MIDI keyboard and with a fresh install of Samplerbox_20161114 didn't work but adding


to my config.txt I manage to make it work but only monophonic, only 1 note at the time I can play. If I plug a USB keyboard at the same time on the USB keyboard I can play polyphonic but on the MIDI only monophonic and the more if I press more than one key the previous key remains pressed until I press it again (kind of missing MIDI NOTE OFF if I try to play more than 1 note) .... any idea what's happening how can I sort this out?


  (not published)
  I want to post as guest