Pages: [1]   Go Down
Author Topic: MIDI input troubles  (Read 1408 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

However, when I connect a midi device to the input I get no luck. I've tried MIDI outputs from two difference devices; a Oxygen 8 keyboard and a old emagic mt4. Neither out which give me anything . If I put a LED and a ~220 Ω resistor between pins 2 & 5 of the MIDI input I can faintly see it glow as events are sent, so I have to assume that everything looks good there and it's providing enough power for the LED in the optoisolator. However if I put a LED & resistor between the output of the optoisolator and ground I get no flashing at all, it just stays on, which is curious.

When trying to test the MIDI input I've got got the Arduino on it's own power supply, not USB power. 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?

Any help or guidance would be great, I've been stuck on this for far too many evenings!


1: http://www.midi.org/techspecs/electrispec.php
2: http://www.flickr.com/photos/jsmiccolis/8059406413/in/photostream
3: https://gist.github.com/1e9ef74f04f28e217878
Logged

Nice, France
Offline Offline
Full Member
***
Karma: 11
Posts: 234
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

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?

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?

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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply!

Regarding the photo, I've uploaded one of the actual circuit I'm using[1]. The only difference from the MMA spec is that I'm using two 220 Ω resistors in place of a 470 Ω, but it's something I read others have done without any issue[2]

To be more specific than "no luck", my project's eventual aim is to handle note-on/off and control change messages. In my initial tests I'm just looking to flash the LED on pin 13 on when a note-on is received. What I'm seeing now is that the LED hard wired to pin 13 comes on and stays on.

I've actually got a saleae logic analyzer[3], so tested the inputs by putting a 1k Ω resistor between pin 5 and 4 of the MIDI input and have been able to see the signal coming off of devices using the saleae. It looks good, I can decode it, etc... When I try to look at the output from the circuit however, I'm not able to detect anything not with the saleae or just a LED.

The board I'm using is an Arduino Uno, and I am using digital pin 0 (the serial in) for MIDI in. When uploading a sketch I disconnect the MIDI so it doesn't interfere, and when actually running the sketch I'm not attempting to use the serial I/O for anything except MIDI.

Thanks again for your help, and hopefully something here makes it clear what I'm doing wrong.

1: http://www.flickr.com/photos/jsmiccolis/8075476742/in/photostream
2: http://www.instructables.com/id/Send-and-Receive-MIDI-with-Arduino/step9/Receive-MIDI-Messages-with-Arduino/
3: http://www.saleae.com/logic
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been able to get to the bottom of my issue and wanted to share what I tried in case it helps others. I used the software serial library to receive the input from the midi circuit and mirror it back to my computer using the usual serial methods. Doing this I discovered that my midi device was sending a `11111110` byte down the wire near constantly. This is a "Active Sensing" message, it's a normal thing for a midi device to do, but just something I was unaware of. So what I though was a short, was actually my arduino board dutifully receiving midi and notifying me about it!
Logged

Pages: [1]   Go Up
Jump to: