Hi, I'm new and I'd like some advice or help. I have an Arduino UNO r3 and an Olimex Midi shield. The function of the box is to receive midi signals via the MIDI IN and then process or handle the notes and trigger events such as program changes, NRPN messages. And then those messages are sent out MIDI out.

I do not want to use MIDI over usb, I'm not using a computer for performance.

One of the challenges is that the UNO apparently only has 2 serial channels (TX,RX) and the midi shield, when installed, uses those. I have to physically remove the shield when I want to upload to the arduino UNO r3.

The other challenge is that if I wanted to use software serial, I don't think it would work, would it? Assuming I have my UNO loaded, I reinstall the shield, plug in midi chables, power it on via 9v battery; softwareserial sends via the 2 digital channels, but those are being 'occupied' by the sheild AND my usb cable isn't connected, so the monitor wouldn't show anything (and COM3 wouldn't be available anyway).

So can I use software serial AND have the shield on AND have the USB cable connected? I would say NO.

Here's the code I'm using (below). I'm using MIDIOX to send midi messages via a USB to MIDI cable. The code should do 2 things as a test, 1) turn on the LED when a noteOn is sent and send a noteOn message every second.

my hardware is a Uno R3 (programmed via USB). I was able to figure out that the Olimex MIDI shield has a jumper that you can remove to program it, and then replace to run it. This way I don't have to remove the shield every time.

There's a lot commented out, because I couldn't even get simple things to work, let alone the rest.

//if note1 or note2 is sent, send program change control to go up or down //if (note == 60){ //need to get the actual note number that I'll assign // MIDI.sendProgramChange(1,10); digitalWrite(ledPinGrn, HIGH); // sets the LED on delay(1000); // waits for a second; digitalWrite(ledPinGrn, LOW); //set the LED off //} //if (note == 62){ //need to get the actual note number that I'll assign // MIDI.sendProgramChange(2,10); // digitalWrite(ledPinRed, HIGH); // sets the LED on //delay(1000); // waits for a second; // digitalWrite(ledPinRed, LOW); //set the LED off// }}//if note3 is sent, send nrpn to set volume to zero

//int program =0; //program or patch hardcoded to begin at zero MIDI.begin(MIDI_CHANNEL_OMNI); MIDI.setHandleNoteOn(HandleNoteOn);// MIDI.sendProgramChange((program),10); //channel is hard coded to 10 for now}

void loop () {

MIDI.read(); //is there incoming MIDI?

// LED Tests //digitalWrite(ledPinGrn, HIGH); // sets the LED on //delay(1000); // waits for a second //digitalWrite(ledPinGrn, LOW); // sets the LED off //delay(1000); // waits for a second MIDI.sendNoteOn(60,127,10);

You can comment out blocks of code using the /* */ style of comments more easily. You cal also use the IDE to do comment blocks with one menu.

The way your loop is structured there is no delay between the note off and the note on at the start of the loop. You need to add a delay at the bottom of the loop so that you can hear a break in the note.

Do your LEDs come on at all?Does OMNI work? Try a different channel number?Have you checked that MIDIOX actually sends out the midi characters?

You also need to get rid of the delays in your code. Delays will stop the rest of the program from working properly. For example, while you delay in loop you are not processing midis messages arriving.

/* LED Tests digitalWrite(ledPinGrn, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPinGrn, LOW); // sets the LED off delay(1000); // waits for a second */

Also, if I didn't mention it, there's a jumper on the Olimex board that allows you to upload without having to remove the whole shield.

At this point I'm just trying to test 2 things: if the shield can send and receive MIDI. So when the device is ON, (powered by a 9v battery, not the usb, just to be clear), the loop here should send (TX) a noteOn and Off. (Granted, I need to add a delay for testing purposes, as you mentioned).

I'm not getting anything in MIDIOX. The MIDI OUT of the Olimex shield is connected to my laptop via a USB/MIDI converter (Roland UM1). So, as I understand it (which could be wrong), the code should send the initial noteOn, jump to the HandleNoteOn, light up the LED, then send noteOff. ? I'll try adding a delay after noteOff to see if it helps.

Does OMNI work? How would I tell? Its supposed to listen on all channels, so are you saying I should try to listen to a single channel? I can try that as well.

MIDIOX has a MIDI In/Out monitor and that's how I'm monitoring the MIDI in/out. I'm sending MIDI by using the keyboard functionality of MIDIOX. It shows the midi messages going outbound, but my board doesn't respond. I've used MIDIOX in the past to send MIDI this way and haven't had any issues.

On my USB to serial converter, the are a couple of LEDs that tell you if messages are being sent on the out and in lines. Does yours have the same? If so, do you see those LEDs flash at all when you send messages?

I would also suggest that you try to get one direction working at a time. Fix up your sending loop so that you toggle a led on and off with the note on/off that you send. Then verify that you get that message in MIDIOX by monitoring the input window. If you don't work on that first as you are more in control of timing and message.

Then also check the config for MIDIOX. You need to make sure that it is actually using the USB interface for output. The LEDs on the cable would be a good indicator, but you can also check the config to make sure your device paths are set up correctly.

I think OMNI does not work with the midi library. Check the comments on the header file.

An obvious one, but make sure the jumper on the olimex board is replaced after you upload, or you will get nowhere.

an observation: right after I upload via USB, I see the UNO TX led light up every second. I assume this is the MIDI message that I told it to send. I open up the serial monitor and see garbage coming through each second:

1øÿÿøÿÿ1øÿÿøÿÿ1xÿÿøÿÿ1xÿÿøÿÿ

the baud rate on COM3 is set to 38400bps.

I tried just having the UNO send MIDI data and I see nothing coming through in MIDIOX.

If you see the messages appearing on the serial monitor then they are making it to the PC and I would look at how you have configured MIDIOX. Have you goat a synthesiser or music keyboard the you can connect to the arduino to see if it plays a note? You can also use the same to see if MIDIOX plays the note on the kid.

I've used Midiox and the usb/midi converter cable tons of times, I mean all I usually have to do is make sure the Roland UM1 is selected as input & output. I can flash the UNO to just send MIDI (to only test TX) and still get nothing in MIDIOX. LED flashes on the Olimex shield, but as near as I can tell nothing is coming across the wire.

To clarify, when I said that I saw data in serial monitor, that was when I still had the usb cable from PC->UNO plugged in. It was not the USB/MIDI cable. The serial monitor won't work for my tests because the serial is being used by the midi shield. Any serial communications sent or rxd by the UNO must go through the MIDI shield. Know what I mean?

That's why this is such a challenge. I can't monitor the serial communication. All I have is MIDIOX. I tried using a USB monitor, but it didn't pick up anything. I dunno. It would be great if Olimex would respond.

You should be able to find a ttl or terminal program that you can use instead of MIDIOX to verify that you can get data to the PC from the arduino. It may be the Roland thingy is stopping your messages. You should see the same or similar rubbish as the serial monitor. If you google 'terminal program free' you should get a few that will fit the bill.

Once you have established you get messages on a regular 1 second, then you move onto the next part of the chain.

It may seem obvious, but a logical approach that builds on what you know is working is the only way to go when you are looking at these or any other sorts of problems. Work outwards from what you know works. In your case:

Arduino seems to send messagesYou assume that they are reaching the PC but don't know, so you need to verify.Once this is verified then turn to MIDIOX

Similarly in the reverse direction, although here your midi callback would imply you are not getting messages, you need to prove to yourself that these are actually leaving the PC.

But I still have no way to see if data comes through my USB to MIDI cable. When it's plugged into the UNO and then into my pc's USB port, it shows up as a MIDI device, not a COM port (to monitor via a terminal app). edit: I also tried BomeSX MIDI monitoring app, and still I get nothing from the MIDI shield.

The post in link I provided above discussed the USB/MIDI cable that I have, in conjunction with the sparksfun midi shield and the UNO and PRO. but in that scenario, it was the PRO that had 'diminished' mA, as to cause the MIDI signal to be too weak for the USB/MIDI cable to pick it up. But the UNO + Roland UM1 USB/MIDI cable + Sparksfun MIDI shield was not an issue. The measured mA on that was 2,5mA under a load. I have a multimeter, but I'm not really sure how I'd measure mA during a MIDI TX. ?

What I have been able to determine is:

While the UNO is running, the MIDI OUT and MIDI THRU have 5v on both pins 5 & 4 ?