MIDI keyboard controlled LED strip My objective is to light a led on a strip corresponding to a keyboard note.
I have Arduino Uno with MIDI in module hooked up to a serial port. Piano is hooked with a standart midi cable, Led Strip is powered using Arduino's 5v (Figured i don't need more because Max 10 leds will be active at a time).

My setup works but not accurately. All is fine when only 1 note at a time is played, but the denser the music becomes (faster or more notes are played simultaniously) more inaccuracies show - more leds don't turn off or on, or the notes I didn't play light up. 

At first i used software serial and there were even more mistakes, when i switched to hardware it became better.
Could it be that Arduino UNO is just not powerfull enough and cannot keep up with incoming midi input or is there another problem?

Here is the code:

#include &lt;MIDI.h&gt;
#include &lt;Adafruit_NeoPixel.h&gt;

MIDI_CREATE_DEFAULT_INSTANCE();

#define STRIP_PIN 11
#define STRIP_NUM_PIXELS 88

Adafruit_NeoPixel strip = Adafruit_NeoPixel(STRIP_NUM_PIXELS, STRIP_PIN, NEO_GRB + NEO_KHZ800);

void handleNoteOn(byte channel, byte pitch, byte velocity)
{
  strip.setPixelColor(pitch - 21, strip.Color(50, 50, 50));
  strip.show();
}

void handleNoteOff(byte channel, byte pitch, byte velocity)
{
  strip.setPixelColor(pitch - 21, strip.Color(0, 0, 0));
  strip.show();
}

// -----------------------------------------------------------------------------

void setup()
{ 
    MIDI.setHandleNoteOn(handleNoteOn);
    MIDI.setHandleNoteOff(handleNoteOff);
    MIDI.begin(MIDI_CHANNEL_OMNI);
    strip.begin();
}

void loop()
{
    MIDI.read();  
}
The biggest problem is that updating the LEDs is an intensive task.


Hand-crafted assembly is written to get the timing right
Interrupts are disabled while the update is running
88 LEDs take a (relatively) long time to update.


At about 1.2µS per LED plus 50µS for the reset pulse, you're looking at about 155µS that the Arduino can't be doing anything else at all. That includes receiving anything through serial.  And since you update for every note you receive, if there is a second note coming in with 155µS of that one, it will be missed.

You may get better results with the FastLED library instead of the Adafruit Neopixel library, but ideally you want to work with a board that is fast enough to not need to do such tight bit-banging for the protocol, so that interrupts can still be enabled for receiving data.