Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 04:08 19 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Arduino UNO + Olimex MIDI

Author Message
deseipel
Newbie

Joined: 15/01/2013
Location: United States
Posts: 4
Posted: 06:01am 17 Jan 2013
Copy link to clipboard 
Print this post

Hi guys, I'm new.

last week I bought an ARduino UNO and and Olimex MIDI shield. What I want to do is simply map incoming MIDI data to other MIDI output data. So, if the device receives a C5, it sends program change. STuff like that.

The Olimex MIDI shield (link here

I'm not an electrician by any means and I'm a newbie to Arduino. However, I felt like this should be relatively easy. All the pins on the OLimex & UNO match up.

short version: I can't get this to send or receive MIDI. MIDI OUT has 5v on pins 4 & 5 (and so does THRU). MY sketch simply sends a MIDI note every second and lights up some LEDs.

I also suspected that the mA could be too low, but I'm not sure how to conclusively tell that or not. From what I've read, it should be around 2,5mA under a load.

I've received a lot of help on the Arduino Forums, but thats about it and it remains unresolved. I do not have a scope.
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 02:36pm 17 Jan 2013
Copy link to clipboard 
Print this post

Dan, You are not getting much action here. Have you tried the Olimex forums ? You might find more help there. Someone from Olimex might assist.
 
deseipel
Newbie

Joined: 15/01/2013
Location: United States
Posts: 4
Posted: 07:43am 18 Jan 2013
Copy link to clipboard 
Print this post

I posted something there about a week ago. No response. Today I emailed Olimex support. I've also posted in the Arduino forums.

The consensus is that, hardware-wise, it's sound. I'm at a point where I'd need to measure mA on pins 4 & 5? But I've done that and I get no reading. But I'm not sure sending MIDI would put it under enough load, so I"m going to get an LED and put it in 4 & 5 and see if it blinks ever.

Aside from that, I wish I had an oscilloscope.

 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 11:58am 18 Jan 2013
Copy link to clipboard 
Print this post

You have not provided enough detail for anyone to even think about helping you. Make it easy for people. Include links to the Arduino Uno, maybe a schematic showing how things are connected and since it may be a software problem you should include some or all of your code. Just remember, most of us failed Mind Reading 101 if we even attempted it.
 
deseipel
Newbie

Joined: 15/01/2013
Location: United States
Posts: 4
Posted: 12:16pm 18 Jan 2013
Copy link to clipboard 
Print this post

ok,

Here's the UNO schematic
UNO R3

Olimex MIDI Shield schematic
MIDI Shield


code example used

/*
MIDI note player

This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
If this circuit is connected to a MIDI synth, it will repeat
the chromatic scale from F#-0 (0x1E) to F#-5 (0x5A).

The circuit:
* digital 1 connected to Female MIDI socket pin 5 through 220-ohm resistor
* Female MIDI socket pin 2 + shield connected to ground
* Female MIDI socket pin 4 connected to +5V through 220-ohm resistor
Attach a MIDI cable to the Female Socket, then to a MIDI synth, and play music.

created 13 Jun 2006
modified 30 Aug 2011
by Tom Igoe
Modified by Rob Ward
23 March 2012
Tested on a Roland MT-32 (a classic!)

This example code is in the public domain
and developed from the code at:
http://www.arduino.cc/en/Tutorial/MIDI

************************************************************ **************


Ardunio UNO MIDI OUT

.--------. 2
| | 220R .-------. 220R
| | ___ 5 / O \ 4 ___
| O1 |----|___|----|--O | O--|---|___|----- +5V
| | 3 | O | O | 1
| | \ | /
`--------' `---|---'
|
-----I---0V
NB Looking from the back of the female socket
************************************************************ **************
For Ardunio Mega 2560 Serial2. has been substituted for Serial. and midi from
pin 16 ie TX2, then no cross talk between serial and midi IO.
*/

const int my_channel=1; // on Channel 1 :-)
//const int my_instrument=1; // Acoustic Piano
//const int my_instrument=71; // Bassoon
int my_velocity=80; //max=127, min=0 volume
void setup() {
// Set MIDI baud rate:
Serial.begin(31250); //standard midi serial baud rate
delay (200);
//Establish channel and Instrument
}

void loop() {
// play notes from F#-0 (0x1E) to F#-5 (0x5A):
for (int my_instrument=0;my_instrument<=127;my_instrument++){
midi_com(my_channel,my_instrument);
delay(200);
for (int pitch = 0x1E; pitch < 0x5A; pitch ++) {
midi_note_on(my_channel, pitch, my_velocity);
delay(100);// sets duration of the note
//Turn off the note begun above
midi_note_off(my_channel, pitch, 0);
delay(100);// sets separation between notes
}
}
}

// Starts a MIDI note. Doesn't check to see that
// 0<=channel<=15, or that data values are <= 127
void midi_note_on(int channel, int pitch, int velocity) {
Serial.write(0x90+channel);
Serial.write(pitch);
Serial.write(velocity);
}
// Stops a MIDI note. Doesn't check to see that
// 0<=channel<=15, or that data values are <= 127
void midi_note_off(int channel, int pitch, int velocity) {
Serial.write(0x80+channel);
Serial.write(pitch);
Serial.write(velocity);
}
// Sends a midi command. Does not check if
// 0<=channel<=15 or 0<=instrument<=127 ie 1-128
void midi_com(int channel, int instrument) {
Serial.write(0xC0+channel);
Serial.write(instrument);
}


Official MIDI specs
MIDI Specs

I thought it'd be pretty straight-forward.

remove RX jumper,
stack midi shield onto UNO,
connect USB,
upload code to do MIDI stuff,
disconnect USB
replace RX jumper,
power the board via 9v
connect MIDI-to-USB to PC to test reception of MIDI notes (in the code).


but no dice. An LED in the MIDI DIN blinks (pins 4 & 2), which seems to indicate output of serial data, but again nothing shows up in MIDI OX (software used to monitor MIDI devices on my pc). The MIDI/USB cable I'm using is a Roland UM1.

The Olimex board gets power, i've measured 5v on the MIDI DIN and I get 5v on D0 & D1 of the UNO.

Hopefully, that's enough info.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1099
Posted: 01:34pm 18 Jan 2013
Copy link to clipboard 
Print this post

Hi deseipel,

That's a good informative sub post - as Bob said, it's hard to assist people who don't provide much info.

From my perspective, the hardware looks OK. The UNO would need to sink around 8mA when it outputs a low. Check that it can do that.

If you disconnect the MIDI connector and simulate it with two 220 ohm resistors and an LED, then slow the baud rate right down to REAL SLOW, you should be able to check out your programs logic and see the switching on the LED. This should verify all hardware OK if it blinks appropriately.

Check that the polarity of the data you are sending is correct. ie. if the MIDI needs a hex C5 to do something, double check your code is putting out a hex C5 not a hex 3A
- this might be obvious but I don't know anything about MIDI.

On the PC end, can you loop back and send MIDI data to yourself to confirm the PC is reading the data correctly.

Cheers, Doug.



... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
deseipel
Newbie

Joined: 15/01/2013
Location: United States
Posts: 4
Posted: 07:06pm 18 Jan 2013
Copy link to clipboard 
Print this post

I just inserted the LED into the DIN on pins 4 & 5. Then I've run this (and variations) of a simple sketch. BTW, pins 4 & 5 run at 10mA. The WEIRD thing about this sketch is, the LED always skips the 2nd DASH. ????



int pin = 1; //Serial out pin

void setup()
{
pinMode(pin, OUTPUT);

}

void loop()
{
dot(); dot(); dot();
delay(1000);
dash(); dash(); dash();
delay(1000);
dot(); dot(); dot();
delay(3000);
}

void dot()
{
digitalWrite(pin, HIGH);
delay(250);
digitalWrite(pin, LOW);

delay(250);
}

void dash()
{
digitalWrite(pin, HIGH);

delay(1000);
digitalWrite(pin, LOW);

delay(250);
}
Edited by deseipel 2013-01-20
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024