Thanks very much for your reply.
I did read that about a month and have forgot it already. Sorry about that.
I am uncertain what post a schematic means. Will a photo of the circuit suffice?
#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>
int ledPin = 13;
MIDI_CREATE_DEFAULT_INSTANCE();
void setup()
{
 //Serial.begin(31250);
 pinMode(ledPin,OUTPUT);
 MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop()
{
Â
MIDI.sendNoteOn(77,127,1);
 //MIDI.send(NoteOn,48,127,1)
 digitalWrite(ledPin, HIGH);
 delay(3000);
 MIDI.sendNoteOff(77,0,1);
 //MIDI.send(NoteOff,48,0,1)
 digitalWrite(ledPin, LOW);
 delay(1000);
Â
}
No.
A schematic is a circuit diagram of the system you are trying to make. It uses standard symbols to represent the components and the connection between those components are drawn as lines which are always horizontal and / or vertical. That is no diagonals.
Only by seeing your circuit in this way can anyone tell if your code does what is necessary to make it do the function you require of it.
I trust my ignorance is not making you excessively grumpy
Not at all. My PhD supervisor used to say "Ignorance is the prerequisite of learning"
You are making an effort to learn and cooperating and that makes me very un grumpy.
Is it a capacitor?
No. However it is an unusual component and I haven't seen anything exactly like this. It look to me like an encapsulated feed through inductor. The round things at the end look like a ferrite bead with an earthed screen in the middle. It is designed to reduce any high frequency interference picked up by the leads.
However, it looks, from your diagram, that those are MIDI OUT signal lines not MIDI IN which is what you want. Could it be you have the wrong bit of your equipment? The four connectors on the other side of your board have a square black component that might be the opto isolator that I would expect to see on a MIDI IN connector.
As to your code, I can't get it to compile on my system so here is some simple code that does very much the same thing only without a libiary and with random notes.
/* Midi note fire - Mike Cook March 2012
*
* -----------------
* send MIDI serial data, automatically for a test
*
###############################################################################################
HARDWARE NOTE:
The MIDI Socket is connected to arduino TX through a PNP transistor to invert the MIDI signal.
A common anode RGB LED is pulled down through pins 9, 10, 11
################################################################################################
*/
// Arduino pin assignments
#define midiChannel (byte)0
// Start of code
void setup() {
// Setup serial
Serial.begin(31250); // Debug speed
}
//********************* MAIN LOOP ***********************************
void loop() {
int val;
val = random(20,100);
noteSend(0x90, val, 127);
delay(200);
noteSend(0x80, val, 127);
delay(800);
} // end loop function
//********************* Functions ***********************************
// plays a MIDI note
void noteSend(char cmd, char data1, char data2) {
cmd = cmd | char(midiChannel); // merge channel number
Serial.write(cmd);
Serial.write(data1);
Serial.write(data2);
}
The other thing worth trying is to swap over the two connections on the DIN plug as these are often misinterpreted in diagrams.
I couldn't believe that I would be so stupid as to confuse the input from the output, but stranger things have happened. I have also double checked for the correct pin on the midi port. Everything looked fine but the data was still shifted. Midi-OX was still registering note info as pitch shift and other CC nonsense.
However, it looks, from your diagram, that those are MIDI OUT signal lines not MIDI IN which is what you want. Could it be you have the wrong bit of your equipment? The four connectors on the other side of your board have a square black component that might be the opto isolator that I would expect to see on a MIDI IN connector.
edit: I am creating midi data in the arduino and sending it to a sound source. Are you sure i send it thru the midi input, with optocouplers? At the moment positive is negative in electronics for me.
I thought perhaps midi=ox might have been transposing/remapping the data somehow but other midi recording software read it as the same nonsense.
I tried your code again to see if there was some pattern in it. Some linear shift perhaps? but nothing still that i could recognise. I attached 5v and TX pins directly to the midi chord and bypassed the circuit board altogether, hoping that the optocouplers at the other end would protect my sound card. Finally some success as I could then see note on and note off data ( it was one midi note less that what i sent)
Then i took the tx pin from the arduino and bypassed the NPN component on the pCb. Everything then worked as expected. Status, data1 and data2 were correct. That NPN transistor in the circuit is indeed the culprit. It musn't be the recommended 2N222 component.
Do you think it would be worth my while to replace these strange transistors with the recommended 2N222 component?
Do you think it would be worth my while to replace these strange transistors with the recommended 2N222 component?
I am not sure what you are talking about here.
edit: I am creating midi data in the arduino and sending it to a sound source. Are you sure i send it thru the midi input, with optocouplers?
MIDI inputs must have optocouplers, it is in the MIDI specification. It isolates the two systems. MIDI outputs are directly driven with a transistor or as a fudge directly from the Arduino's TX pin.
I thought perhaps midi=ox might have been transposing/remapping the data somehow but other midi recording software read it as the same nonsense.
This points to you sending something incorrectly.
Again we can't discuss things without a schematic of what you are talking about. So we need to see a schematic of how you connect things from the Arduino to the MIDI.
Then i took the tx pin from the arduino and bypassed the NPN component on the pCb. Everything then worked as expected.
It sounds like you have a logic level inversion at the Arduino end and you are compensating for it by removing the logic inversion from the receiving end. Leading you to the false conclusion:-
That NPN transistor in the circuit is indeed the culprit.
The midi is sent to this output port from the a very complex place. There is no way that i would attempt to do a schematic of that yet. I pulled the midi out port out of an old firewire soundcard in the hope that i could get it working and save a few dollars.
I think i will be quite happy to let the arduino fudge it for a while.
PS> i had a quick look at your magic wand. Very inspiring .