Go Down

Topic: Midi IN and arduino : need a logical explanation of what happens here ! (Read 2224 times) previous topic - next topic

chaosbc

Hi there
I am playing around with this instructable projects : http://www.instructables.com/id/Send-and-Receive-MIDI-with-Arduino/?ALLSTEPS

I only do the MIDI Receiving part.
so normally, the led 13 should blink when I press the middle C of my midi controller.

Everything works as expected 90% of the time...(I mean sometime the note is not detected, maybe it is because of arduino slowness ????) basically this is my first issue.

The next one is really weird ! :
If the arduino is electrically powered through the usb cable :it is ok
If the arduino is electrically powered through the DC jack : the led 13 is blinking like crazy
I have no idea what's going on...

Grumpy_Mike

Any problem is not due to Arduino slowness. Instructables projects are normally crap don't use them.

You have an issue with your external power supply. Is it DC? What voltage is it? What is the current capacity?

chaosbc

The PSU is 9volts 1A. I tested two models : same result.
I did make search over the internet yesterday and I strongly suspect that serial is not enabled if the Uno is not powered through usb...
When powered via dc jack it seems that the arduino looks for a serial communication and since there is the midi plugged, the chip is expecting something from there...
If I unplug the pin Rx at start the blinking does not happen.
If I replug it afterward, no note will be detected.

Grumpy_Mike

Quote
I strongly suspect that serial is not enabled if the Uno is not powered through usb...
That is not correct, it is.

Quote
When powered via dc jack it seems that the arduino looks for a serial communication
Yes it is the boot loader looking to see if new code is needed to be uploaded.

Quote
and since there is the midi plugged, the chip is expecting something from there...
No. If nothing sensible is received then the Arduino goes on to execute the code you last uploaded to it.

We need to know what you have actually done not what you are following.
That menas a photograph showing your wiring (not more than 1000 pixels wide) and the code you are running use code tags ( the </> icon )

chaosbc

I cannot believe it : my two PSU are actually out of order.
They deliever few mv according to my multimeter.
I grabbed one working 12v PSU and it is working normally on DC jack (jaw fallen on the floor)
well sometime some notes are still ignored...maybe the optocoupler is not working normally ?
maybe I will try to plug directly midi to the 'duino, bypassing the optocoupler

Grumpy_Mike

Quote
maybe I will try to plug directly midi to the 'duino, bypassing the optocoupler
That will do you no good as the signal will then be upside down.

chaosbc

ah.
well this guy  (http://forum.arduino.cc/index.php?topic=22447.0)
uses a 4n28 instead of a 1N4148...
maybe to be tested...

Grumpy_Mike

Quote
uses a 4n28 instead of a 1N4148...
???
A 4n28 is an opto isolator and a 1N4148 is a diode, you can not substitute one for another.

chaosbc


Grumpy_Mike

The 4n28 is not as good as the 6N138 so you will be going backwards.

These missing notes are you sure that your MIDI source is not using running status and the software is not designed for that?

chaosbc

No, I don't think so...
I only use a very simple master keyboard (ekeys49) so no fancy option...

Grumpy_Mike

In which case you will have to do a little invistagation to track it down. This is a bit tricky because the serial I/O is being used by the MIDI, normally you would use this to look at the numbers you recieve. So you need to look at another way of looking at these things.

One way would be to attach an LCD display, the other would be to use the software serial libiary and a level converter to connect to a terminal application in your PC. You would then just write a sketch that displayed the numbers you were recieving. If these were correct then your problem would be the MIDI libiary you are using, if they are not correct then it would be a hardware prolem either one of baud rate or signal integrity.

chaosbc

Yes, indeed, it makes sense. Thank you for those advises  Grumpy_Mike.
Also I tried to plug the arduino via midi to the midi out of my computer and run a loop with a Middle C.
EVERYTIME the note is detected by the Uno.
Well...if I play with fast tempi like >160 bpm it is difficult to see if notes are ignored of if it is about persistence of vision.
I am ok with this. my project is supposed to run a robot dc motor when receiving midi signals from PC and orders will never need to be that fast.
So finally it is working perfect for my project but I am curious to find out what's wrong if I use only the midi keyboard. So I believe I will search with my ol' oled  spi screen (cause actually I don't use any midi library)

Go Up