Troubleshoot Midi In. Arduino not receiving w/ RX

Hi everyone, Im a new member and this my first post, but I have spent many hours pouring though old posts as a guest. I cant seem to find a real solution to my current problem and I'm hoping someone can help me out. I have been trying the venerable MIDI-IN: code + schematics (Sorry, Link in next post) without much luck. The optoisolator circuit is working fine. I get about 5v at opto pin 5 with a few tenth's of a volt variation corresponding to keystrokes. Also, when the RX is disconnected , a LED connected between +5v and pin5 flickers when keys are pressed. I have removed the resistor from pin 6 to ground. The Led will not light with it in and many reported that it was not necessary. I have tried nearly all of the proven sketches, (especially the simplest ones with one led to signal midi data recieved) in the midi in thread and tried different baud rates, but so far no data seems to make it to the arduino. There were a few post by others who seemed liked they were having the same problem, but no real solution was posted. Some said that it just worked after rebuilding the whole thing, but unfortunately that didnt work for me.

Ive checked for cold soldered joints on the arduino(diecimila), thats not it. I tried different keyboards, I was using a microkorg but then tried my sci prophet 600, no luck.

Anyone have this problem or have any ideas whats going on? Im pretty good with hardware, but software is my achillies heel and Im not sure what to try. Thanks in advance. Charlie

Here is the link to the thread with f the Midi in schematic and sketches, : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1187962258/0

and tried different baud rates,

there is only one baud rate to use with MIDI and that is 31250 baud, so anything other than:- Serial.begin(31250); Will not work. Have you looked at:- http://www.thebox.myzen.co.uk/Hardware/Glockenspiel.html

I get about 5v at opto pin 5 with a few tenth's of a volt variation corresponding to keystrokes.

That sounds like you haven't really got any test equipment that could help you. You need an oscilloscope to see the signals and that can pin point if you are getting signals in. Write some software that just lights an LED if you see anything arrive on the serial port like:- if(Serial.available() != 0) digitalWrite(13, HIGH); and see if bytes are coming in, that should pinpoint if your problems are hardware or software.

Thanks for the help.... this is what im trying to run now:

//variables setup
byte incomingByte;

int statusLed = 13;   // select the pin for the LED


//setup: declaring iputs and outputs and begin serial
void setup() {
  pinMode(statusLed,OUTPUT);   // declare the LED's pin as output
  Serial.begin(31250);        //start serial with midi baudrate 31250 or 38400 for debugging
  digitalWrite(statusLed,LOW);
}


void loop () {
 if (Serial.available() > 0) {

    incomingByte = Serial.read();
    // wait for as status-byte, channel 1, note on or off
    if (incomingByte==144){ // 144 is note on ch1
      digitalWrite(statusLed, HIGH);
      delay(20);
      digitalWrite(statusLed, LOW);
      delay(1);
    }

 }
}

Still no luck. No indicator light and the RX light doesnt blink at all. I have also tried changing the program so the led turns off with serial data, and other than the status led beinging always on, there is no change. can anyone suggest another way to test if my arduino can recieve data?

OK, It works! but I have no idea why. I unhooked the lead from the Rx socket and touched it to pin 2 of the atmega chip and then back in the RX socket.....now it works. I know that I did this a dozen times yesterday. Oh, I also briefly stuck a 1k resistor between tx and rx. Did I somehow manage to jumpstart it or something?

Well...I spoke too soon. I unhooked the input and put it right back in and now no longer works. I dont think that it is a continuity issue. I get a strong beep when when the probes are directly on pin 5 of the optoisolator and pin 2 of the atmega and have rebuilt the circuit and changed jumpers dozens of times.

I redid my experiment by touching the wire directly to atmega pin 2 with no results , however I have found the LED blinks with pressed keys when I connect the wire to Pin 1 of the atmega? i guess this just resetting the arduino with every keystroke. Again i am like 98% sure that all of the hardware and connections are good and the software has been verified by others (and it briefly worked for me.) It seems the x factor here is the arduino itself and its reluctance to take in data. sigh.... Why is this so being so difficult? Could there be a problem with my arduino?

good grief

Did I somehow manage to jumpstart it or something?

No.

i am like 98% sure that all of the hardware and connections are good

well with a description of what you are seeing I am 98% sure it is hardware connections.

Well you were right. It was hardware, still not sure why though. For me, Kuk's scematic with a 4n28 opto just doesnt work. Even though i could test the opto by could getting a led to flicker, the arduino just would not recognize the incoming data. none of the 10 I have worked. Last night I tried another opto, a cny17-4, it has a similar pin-out. It worked right away!... Im just thrilled that this works so I not gonna loose too much sleep wondering why, but... ...obviously, many others have had success with the 4n28, why doesnt it work for me?

thanks for your help, Grumpy Mike.