Go Down

Topic: . revisiting MIDI in on the arduino (Read 2012 times) previous topic - next topic

anomad

. hello!

. i'm trying to build the MIDI in component as described in the 'works:MIDI-IN works+schematics'  - but, i just can't seem to get it working  :(

. i'm a complete n00b when it comes to electronics, but have spent the last two weeks trying to get this circuit correct so that the Rx port actually gets MIDI information

. on my bread board, i followed the wiring (and parts) of the MIDI shield schematic on instructables and am stuck.

. i can put an LED parallel to pins 1 and 2 on the 4N28 and see pulses when i'm sending MIDI data in, so i know i have the input coming in properly. (and the diode facing the correct way.. only took me an hour to figure that one out - as i said, n00b.  ;) )

. on the right side of the 4N28, i have:

pin 4 - ground
pin 5 -3.3k (orange/orange/red/gold) resistor to +5v
pin 5 - wired to Rx on the arudino
pin 6 - 100k (brown/black/yellow/gold) resistor to ground

. and i've wired an LED to 13

. i'm using the following code, in an attempt to just see the statusLED turn on, but nothing happens.  my hunch is that nothing is going to the serial Rx.

Code: [Select]

//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
     digitalWrite(statusLed, HIGH);
     delay(20);
     digitalWrite(statusLed, LOW);
     delay(1);

}
}


. but, nothing.  i noticed that if i move the cable from 4N28 to Rx and it touches pins 4 or 6, the statusLED will flicker a little, but it's usually junk.  so, i'm under the impression that the Rx works... just not when i have it wired like the above schematic.

. i think this is the same issue some other users had, but i never saw what the solution was.

. so can anyone help me w/what to do next?  something to try or ??? i'm' really pretty lost here and have spent 15+ hours in my spare time trying to make sense of this.

. thank you!

-james

Grumpy_Mike

Often the problem is you miss identify the connectors on the MIDI socket you need to know if the diagram is looking from the front or back of the socket.
Have a look at my MIDI stuff:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Shield.html
There are other MIDI projects  there as well.

anomad

@Grumpy_Mike: thx for the reply!  i've come across your projects before and - wow! those are really impressive!  :)

. i switched the MIDI pins 4 and 5 and didn't get anything.  i tried putting a blue LED between the 4N28 pins 1 and 2 and it didn't light up.

. i moved the wires back to the original position and the blue light started blinking to the MIDI messages again.

. unfortunately, nothing coming down Rx

. here's what it looks like on the breadboard:



. the black wire goes to the Arduino Rx port (and the statusLED is further up on the breadboard.  it lights up briefly when the code is finished uploading...)

anomad

. ok, no luck w/the other schematic, so i tried MIDI IN from http://www.tigoe.net/pcomp/code/serial-communication/midi

. here's what it looks like


. and still nothing comes down the Rx port... i feel that i have to missing something simple at this point.

. anyone see anything obviously wrong?

. thanks!
-james

anomad

. um, yeah.  i don't think your spam really helps my problem.

. where's the report to admin button ?

PaulS

There's a spam reporting forum. The idiot has already been reported.

anomad

. ok - had a friend look at my setup, and the MIDI pins 4+5 were backwards, as well as my diode and the LED - so it *looked* like it was working, but it wasn't.

. i've fixed that issue - then, instead of running to the serial port, i just sent to one of the digital inputs (2) and said print 'low' if it digitalRead == LOW,

. sure enough, if i press a key on my keyboard down, i see 'low' printed three times, and another three when i release the key

. but when i switch back to the serial port - i don't get anything. :(

. anyone have any ideas?

PaulS

I have an idea. Why don't you show us the code?

anomad

.  :-[
Code: [Select]
//variables setup

byte incomingByte;
int statusLed = 13;   // select the pin for the LED
int readLED = 2;

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


void loop () {
 if (Serial.available() > 0 ) {
   incomingByte = Serial.read();
   Serial.println(incomingByte);
   blink();
 }
 if (digitalRead(readLED) == LOW) {
     Serial.print("LOW\n");
 }
}

void blink(){
 digitalWrite(statusLed, HIGH);
 delay(100);
 digitalWrite(statusLed, LOW);
 delay(100);
}


Go Up