LOLShield MIDI Waterfall Display

This builds on the Arduino MIDI Note Monitor with a slightly different take to the Wemos MIDI LED Matrix making use of a “LOL Shield”.  LOL in this case stands for “lots of LEDs” – in this case a grid of 14 x 9 – and is a fun way to get your Arduino lighting up as many LEDs as will fit within the footprint of a standard Arduino shield!

For more with the LOLShield, see the following projects:

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
  • LOL Shield (these are readily available on ebay)
  • MIDI in module (see Arduino MIDI Interfaces)
  • Jumper wires

The Circuit

The LOL Shield was originally designed by Jimmy P Rogers and then published as an open source design.

The original kits aren’t sold anymore and arguably there are many other more user friendly “LED” kits for Arduino these days.  To have several displays chained together, you will need an Arduino Uno per shield, so there are significantly more efficient ways to have lots of LEDs from a single Arduino (but more on that in another post).  But I still like my LOL Shield and it makes for a very nicely self-contained light unit, so I recently grabbed a couple more and made them up for this project.

The kit and finished item looks like this.

I wanted to use several of these together, so had to decide on a way to power them and get a MIDI signal to each of them. I went for simplicity and took the output of my MIDI module and literally just fed it to the RX pin of each board in sequence.  As long as there is only one transmitting device, it can feed several receivers in this way quite happily.

I also took advantage of a feature of the variants of Arduino Uno I’m using – they all have additional breakouts for the serial ports, so I have a set of extra TX, RX, 5V, GND holes on the board near the analog pins as shown below.  This is particularly useful when using a shield as it means I don’t have to try to get at the RX pin from the shield itself.

Arduino Uno - Extra Pins

I used these to power all three boards and link the RX pins to my MIDI module. I powered the whole lot from a micro-USB port.  Its fine to power an Arduino via its 5V pins as long as you are using a clean, regulated 5V power supply.  Anything over 5V (well, around 5.5V I believe) and you’ll damage the Arduino as hooking up a power supply directly to the 5V line bypasses all the built-in protection circuitry.

ThreeArduinoMIDIRX_bb

The Code

The LOLShield uses a technique call “Charlieplexing” that takes advantage of the different states of the IO pins of a microcontroller so that each pin can drive more than one LED.  The downside is that it has some interesting failure modes if an LED fails.

But thankfully we don’t need to worry about the details as there is a library for the LOL Shield that takes care of it all, but it isn’t available as a standard Arduino library.  This means it has to be downloaded directly as a ZIP file from the github repository and imported using “Sketch” – “Include Library” – “Add .ZIP Library”.  You can find it here:

To use the library you need to include “Charliplexing.h” (not to be confused with other LED Arduino libraries that support “Charlieplex.h”).  Then access to the LED matrix is by way of an LedSign programming object.

I wanted a nice “waterfall” effect with any played notes fading off as they scroll up the display.  To do that, I needed some code that could take each row of the matrix and replace it with the LED pattern from the row below.  Consequently I decided it would be best to manage my own “view” of the LED matrix and then at suitable moments copy my view to the actual LED matrix to display it.

Now I didn’t want to scroll the display every time I went through the loop() as it would be too fast, so I use a counter to skip most of the loops().  In my case, I set my counter to 10,000.  This means that the display gets scrolled one row once in every 10,000 loops.

In order to know which notes are on at any one time, I maintain another list for the note states.  When a MIDI noteOn event is received the note is listed as being “on” and when a MIDI noteOff event is received it is listed as “off”.  The bottom line of the display, when it is being scrolled, is set from the list of which notes are on and off.

I am using three displays so I can cover a wider range of notes.  But the displays don’t actually need to know anything about each other. Instead, I just set them to respond to a different set of MIDI notes.  For my three boards, I used the following MIDI note ranges:

  • Board 1 – MIDI 46 to 59 (A2# to B3)
  • Board 2 – MIDI 60 to 73 (C4 to C5#)
  • Board 3 – MIDI 74 to 93 (D5 to A6)

Which is used is defined by the value of MIDI_NOTE_START near the start of the code.

The shield supports 8 levels of brightness from 7 (fully on) down to 0 (completely off) if you use it in “GRAYSCALE” mode when initialised.  I use the vertical row to determine which brightness to use, but I was lazy again – the library seems quite happy to take any value above 7 and just call it “full” – so I just pass in the row number.

It is also worth noting that the rows in the library are counted from 0 at the top down to 8 at the bottom.  The columns count from 0 on the left across to 13 on the right.

Find it on GitHub here.

Closing Thoughts

As I said earlier there are many ways to get a large number of LEDs driven from an Arduino, so I might come back to this idea again with some other forms of LED matrix (I particularly like the Adafruit Charlieplex’d IS31FL3731 modules that support 16×9.  I have a couple of these so might give those a try at some point too.

I also have a number of different LED “backpacks” based on a whole range of different driver approaches. I’d also like to do something with programmable LEDs, so watch this space.

Kevin

Leave a comment