Download free music MP3s on genuine quality, the world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, The world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, stats, charts, biographies and concerts. stats, charts, biographies and concerts.
Saturday, February 22, 2025
Waveshare RP2040 Matrix MIDI Monitor
Following on from my ESP32C3 OLED Mini MIDI Montor and Waveshare Zero, Pimoroni Tiny, and Neopixels this project uses a Waveshare RP2040 mini Matrix display. This is largely the same pinout as the other Waveshare boards, but includes a 5x5 programmab…
If used with USB MIDI, then all that is required is to plug the RP2040 Matrix into a computer and it will be able to come up as a USB MIDI device called "CircuitPython Audio".
If serial MIDI is required, then a Ready-Made MIDI Module supporting 3V3 operation is needed and can be connected to TX/RX on GPIO 0 and GPIO 1 as well as 3V3 and GND.
The Code
I'm using Circuitpython for this one. It uses the same version of Circuitpython as the Waveshare RP2040 Zero - details here. It requires the following libraries to be installed:
/lib/adafruit_midi/*
/lib/neopixel
/lib/adafruit_pixelbuf
The string of Neopixels is hooked up to GPIO16, so can be initialised as follows:
The main loop just cycles around checking for MIDI events and updating the LEDs.
while True: msg = midi.receive() if (msg is not None): if (isinstance(msg, NoteOn)): if (msg.note >= MIN_NOTE and msg.note <= MAX_NOTE): pixels[midi2pix(msg.note)] = GREEN;
if (isinstance(msg, NoteOff)): if (msg.note >= MIN_NOTE and msg.note <= MAX_NOTE): pixels[midi2pix(msg.note)] = OFF;
pixels.show()
The Neopixel strip is scanned and MIDI is checked every time through the loop, but the display only changes if a NoteOn or NoteOff is received.
In terms of mapping notes to the LEDs, I'm keeping it simple and just using the LEDS in the string order they are already arranged.
Ideally, I'd go bottom-left to top-right, but that would mean some fancier mapping of position to note that I'm not bothered about doing at this stage.
Find it on GitHub here.
Closing Thoughts
At some point I'll be able to resist a neat, small display, but today is not that day. And it is doubly hard when it is a small LED matrix.
This is a fun little board and I'm chewing over a few other ideas now I've got the basics out of the way.
No comments:
Post a Comment