This project shows you which note is being playing, within a single octave (white notes only!), by lighting up a different LED for each note.
- I develop more sophisticated LED visualisations in Wemos MIDI LED Matrix.
- The Arduino MIDI Channel Monitor shows you which channels are being used.
Warning! I strongly recommend using an old or second hand keyboard for your MIDI experiments. I am not responsible for any damage to expensive instruments!
These are the key Arduino tutorials for the main concepts used in this project:
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Uno
- 8x LEDs (I used white LEDs)
- 8x resistors (I used 100Ω to match my LEDs)
- MIDI receive interface (see Arduino MIDI Interfaces)
- Breadboard and jumper wires
The Circuit

When using LEDs it is important to use the right size resistor to limit the current going through the LED. There are lots of resistor calculators on the Internet, such as this one from digikey, which also includes a chart of typical voltage settings for different coloured LEDs.
The diagram above shows red LEDs. I had a number of white LEDs in my parts box, so I used those.
For this circuit, our supply voltage is 5V, I’ve used a typical LED current of 20mA (you can get a more accurate value from the data sheet for your LEDs), and I’ve used the typical voltage (“forward voltage”) from the digikey cheat-sheet (3.0 to 3.4V for white LEDs). Putting these values in the calculator gives a resistor value of between 80 and 100 ohms. So I went with the highest value of 100. You will need to use the correct value for the type of LED you have.
The easiest wiring setup used 8 LEDs. It would be useful to expand it to 13 to support a full chromatic octave. Each LED is linked to one digital output pin on the Arduino.
The Code
This uses the “callback” idea from the Arduino MIDI Tone Module to listen out for MIDI note messages, but instead of playing a tone it lights the appropriate LED. The LED will stay on until it receives the appropriate note off message.
At the start of the code, there is a list of LED pins corresponding to notes. As the MIDI handling is looking for consecutive notes, but I only have 8 LEDs I want it to ignore any “black notes”, so if I don’t have an LED for a note, I use the value -1 which the code later on can watch out for.
Closing Thoughts
If we wanted it would be relatively easy to combine the tone() and LED monitoring functions in the same project. I’ve not tried this with a full MIDI keyboard yet, so there might be nuances that the code doesn’t recognise (like the “all notes off” MIDI function).
The LED handling is also fairly simple, with each LED linked to a different output pin. There are a number of tricks that allow more LEDs using the same or smaller number of pins and even programmable LEDs that would allow a whole string of multi-colour LEDs to be controlled from one microcontroller.
Kevin