MIDI input troubles

miccolis:
I'm having trouble getting midi input working. I've built the MIDI input circuit using a Sharp PC900V, so basically keeping as close to the official spec[1] as possible. I've been able to verify that the optoisolator is working fine; I've built a test circuit with a LED connected to the output of the optoisolator, when I power up the circuit the LED comes on and if I apply a couple volts across the emitter it shuts off[2]. So the circuit itself seems ok.

Looking at your photo I don't see the diode from the MMA circuit.

miccolis:
However, when I connect a midi device to the input I get no luck.

Could you be more specific about the lack of luck? What is your sketch trying to do - what are the expected results and what are the observed results?

miccolis:
I've tried MIDI outputs from two difference devices; a Oxygen 8 keyboard and a old emagic mt4. Neither out which give me anything .

How are you determining what they give you?

miccolis:
And when uploading to the Arduino I've found I need to disconnect it from any MIDI device, or the upload will fail.

Now for the strange part. The LED hard-wired into pin 13 has done some strange things when everything is connected and powered up. I'm using very simple test programs[3], but what happens is the LED does the initialization blink, then goes on, and stays on, until i disconnect the input from the serial rx (pin 0). Could this be a short somewhere?

Unless you are using a board like a Mega, you have only one UART. Your serial connection is thus doing two or three things:

  • Providing a USB to serial connection to the computer, for uploading compiled sketches to the Arduino
  • Providing a serial to USB serial connnection, for debug messages and so on; often at 9600 baud
  • Providing a serial to DIN connection to the MIDI-in (and out, if you have one), at 31250 baud

It can only do one of them at once.

You should therefore pick a digital output pin to enable MIDI-in, which is low by default and which your sketch sets high to enable MIDI. This will prevent sketch upload and MIDI in from getting in each other's way.

Also, you should not attempt to send debug or status messages over the serial to USB connection, once you have enabled MIDI-in.