Go Down

Topic: Arduino Midi Questions (Read 13570 times) previous topic - next topic


Hello.. Project is right under construction at the moment.. Will have to make the Hardware mounting first, and then start coding. Hopefully i will figure it out.
This is what it looks at the moment.
I will not use a LCD anymore.. i want to display it with LEDs.. I use the LCD Windows to look inside the case where it will be illuminated by an LED (different colour every time you change the Page of the Settings).

I made a quick measuring test. Everything should fit inside this small sucker, i dont know how but it does somehow, not even a small ant could fit in anymore if all the parts are in.. haha.. Still waiting for my Li-Po Battery.


I am off to work now.. hear you all later.. sorry for the bad and messy pics, no time to clean up the acryl  :-[


Wow.  You've been moving fast.  Notice you like that rainbow ribbon cable too (I've been slowly snipping bits of a 200' length I got way back when I was a kid).


Yeah i bought that rainbox ribbon cable for my MidiBox Sid MB-6582 project. Still have some left, its perfect for every DIY Project.
Just ruined a potentiometer for my Delay Unit while fitting the knobs again.. damnit.. those are hard to get :(

Hopefully i can fix the Vacuum Speaker, because i dont wanna buy that one again too.

Slim fits are always a little "part consuming"  ;)

I got some cool ideas for the LEDs.. hope i can ask you if i got problems ? Thanks


These guys have 100' rolls of 9, 20, 25, 34, 40, 50 flat ribbon cable if you need some.


Not rainbow, but not really seen inside a box either. I buy stuff from them all the time. Just got some 2" speakers for an alarm output on a fencing project I have going.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Dec 04, 2010, 06:34 pm Last Edit: Dec 04, 2010, 07:33 pm by izze Reason: 1
Hey guys.. just did my first coding steps..

I almost finished the part where a Dimming/Flashing (looks really nice and dims-flashes perfect) LED Tells me how high the Current Midi CC Setting is 0-127.
I got my Encoder working with the Quadrature Lib.

In the next days i will start working on the Page Switching.
Heres the code.

Code: [Select]
IZZE BOX first Steps...

#include "Quadrature.h"
#undef int                    
#undef abs
#undef double
#undef float
#undef round

Quadrature quad1(8, 10); /* Thank God that my Encoder works */
int ledPin = 11; /* Dimm-Flash LED */
int enctime;

void setup() {
 quad1.position(60); /* Got to first find out which start amount is best for MidiCC */
void loop() {
 int encoder = quad1.position();
 encoder= encoder % 128; /* Restrict it to 128 Steps */
 enctime = map(encoder, 0, 127, 20, 1); /* Mapping it to a useful time amount */
 if (encoder >= 127) {
   encoder=127; /* Stops it from Skipping to Zero somehow? */
     encoder=encoder; /* That was somehow clear huh ? haha */
 for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=10) {
 analogWrite(ledPin, fadeValue);        
 delay(enctime);    }
 for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=10) {
 analogWrite(ledPin, fadeValue);      

I just wonder how can i make the Steps on the Encoder faster ? Takes forever to come from 0 to 127..
It would be cool if it would act like a potentiometer.. so lets say 1 or maximum 2 full turns should bringt it from 0 to 127.

What would the code look like if i want to switch pages with a button.
Because the button first says HIGH and i dont want it to switch on the HIGH status, because it would switch even while still holding the button down. I only want to switch after button is pressend and released.

Thanks guys


I just wanted to test the MidiVox Shield.. it doesnt work. I did everything like i should.. double checked solder points, pins, uploaded several times like in the instructions. The Power LED lights up but it doesnt receive any midi. The Midi Input is also ok.. it works on my other equipment. I will order another 6N139 OptoCoupler maybe this one is not all right ?

Also the delay unit produces "ground noises".. dont know the exact word in english. The Speaker and the amp inside my unit dont make those noises, i cant test the midivox sound output yet, so i cant tell you about how the midivox sounds.

This is starting to bug me.. damnit..  :-/


Apparently the opto-isolators are very sensitive to component values.  And, yes -- sometimes it seems different batches behave differently.

I got lucky on my 4N33's; bypassing the resistor turned out to be all I needed.

The other inevitable "gotcha" on MIDI seems to be getting the connector inverted.  Try hanging a random LED on the connector just to ensure you've got MIDI coming in the way you think you are.


I got this shield

What do you mean by bypassing the resistor ?
The resistor that connects to the optocoupler ?
Seems that on the midivox it is a 270 ohm..

Sad that this problem stops my project run from 100 to 0 :(


I didn't realize you were using a third-party MIDI-in shield.  I see no reason to assume the shield isn't working.  From the video on the Midivox site, the data LED should blink when it sees MIDI coming in.  So that's an easy test right there.


Dec 06, 2010, 02:18 am Last Edit: Dec 06, 2010, 02:29 am by izze Reason: 1
Yes i know but it doesnt light up.. and i checked everything. So it has to be a faulty part. It travelled a long way from the US to Austria. I am getting a Siemens 6N139 and a Vishay CNY17 and will test it out with those. Dont really know if i should change the resistor value.

Midi is coming in.. just tested it with an LED.. so it has to be the shield somehow.. :(


At the risk of...

Make sure the program/MIDI switch is in the right position.  Also, hook it up to your computer in that orientation.  If I am reading the diagram right it should blink when you send serial to it (such as try to program it) from your computer.


Doesnt work.. hmm i will try getting another optocoupler.. if that doesnt work too, i will build my own shield.. i just wanted to use the midivox because it already has implemented different waveforms and a 12bit DAC which is good to start with.

PS: When sending midi i hear the midi signal itself really really silently whispering through the speaker. i will have the optocouplers by the end of the week, will post again then. maybe i will write some more code, in the meantime. Hopefully my Li-Po battery arrives so i can go on building the damn thing..

best regards


If the LED isn't blinking from any serial data, I don't think the opto should be your first suspect.  

I just looked at the schematic again.  The "data" LED is wired to pin 8 -- not the standard serial monitor location.  Which means it won't light unless you are using his code.

Why don't you write a simple "Do I see activity on the opto?" sketch?  Light up the LED on pin 8 when ANY serial is present.


Dec 06, 2010, 03:30 am Last Edit: Dec 06, 2010, 03:44 am by izze Reason: 1
I wrote this.. but it doesnt light up when sending serial in.

Code: [Select]

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

void loop() {

     // send data only when you receive data:
     if (Serial.available() > 0) {
           digitalWrite(7, HIGH);
digitalWrite(7, LOW);

 digitalWrite(7, LOW);


Did you test the LED by itself?  And have you tried putting an LED in place of the opto to see if it lights up?

Go Up