Haven't seen it mentioned here, but I combined this sketch with teh serial to midi converter and it worked just taking the midi in through USB. Thanks for the sketch! I finally got my ableton clips triggering and flasing a LED at me when launched. Nice!
Hey, thanks for all your information, I have an arduino receiving midi from a controller or from the computer..!
Now i have another problem!! (when will i finish!?jejeje) i bought a 9V AC/DC for go everywhere with my arduino and my midi controller. But without the USB power it doesn't works!! What happens?!
I have the circuit done and working, but here is the problem:
With this code, happens two diferent thinks with power via USB or 9V black power jack.
without usb power, never is available, the serie...
int statusLed=13; //one
int statusLed2=12; //ten
int statusLed3=11; //hundred
byte incomingByte;
void setup() {
pinMode(statusLed,OUTPUT); // declare the LED's pin as output
pinMode(statusLed2,OUTPUT); // declare the LED's pin as output
pinMode(statusLed3,OUTPUT); // declare the LED's pin as output
Serial.begin(31250); //9600 for USB i 31250 for MIDI i 38400 for debugging
}
void loop () {
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
blink(HIGH,statusLed);
delay(temps);
blink(LOW,statusLed);
delay(20);
}
}
void blink(byte valor, int nled){
digitalWrite(nled, valor);
}
It is the resistance between RX and 5V.
It should be measured as about 1k to connect either MIDI or USB.
So I can't for now have a standalone solution where it is possible to connect the FTDI from time to time because the resistance is then too low or too high without the FTDI.
I can put a switch to enable a parallel resistor to the 3,3k one : enabled would be MIDI, disabled would be FTDI.
Or perhaps a transistor?
Or a FTDI in my enclosure... I made eveything to not have the need of it, but... And it would allow me also to have MIDI over Serial/USB connectivity.
So, for now I don't really know. I could try a transistor, but would it allow 9600 or 11250bps? I'm not sure with a 2N2222? (Their frequency is 250MHz or 300MHz)
Sorry, this seems not the best schematic since it comes from a book and the guy didn't scan everything...
For what I can answer:
The M151250 is the 6-pin optocoupler, it seems very similar to ours.
The 3k9 resistor depends on the circuit. As I mentioned previously, with a standard Arduino it is 3k3 and a standalone Atmega chip without FTDI it is 1k.
Don't worry about the 100k! It works without and often better! (see other pages of the topic)
I have finally gotten the midi in schematic to work with a casio keyboard using the following code.
char incomingByte;
byte note;
byte velocity;
int statusLed = 13; // select the pin for the LED
int action=2; //0 =note off ; 1=note on ; 2= nada
//setup: declaring iputs and outputs and begin serial
void setup() {
//start serial with midi baudrate 31250 or 38400 for debugging
Serial.begin(31250);
digitalWrite(statusLed,HIGH);
}
//loop: wait for serial data, and interpret the message
void loop () {
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
Serial.print(incomingByte,HEX);
}
}
However, by checking the signals through USB in S2MIDI, it doesn't seem that the computer is receiving actual MIDI commands. Hexadecimal values appear when I press and release keys, but they don't represent actual midi values. Any ideas? (Here is S2MIDI's output for playing c through c (one octave))
But what are you doing like this? Are you using the Arduino as interface? :-?
I guess you wanted to monitor what the Arduino gets using the USB connection, but your baudrate in S2MIDI is not set correctly.
Anyway if you're using pure MIDI>Arduino I think something like a low-cost lcd (ebay, a few $ including shipping) is the best solution for monitoring the input. That's what I do!
Pretty much the story is that I bought a midi interface because I wanted to connect my keyboard to the computer to be able to play with sound and record the notes etc. Unfortunately, that interface was cheap and didnt work, so I set out to build one on the arduino. So I guess I am essentially using S2MIDI to 'forward' the signals to a midi input for a program such as midiox or fruity loops. RIght now however, I dont receive any sound.