On 3/13/2022 3:00 PM, ☼ wil lindsay ☼ wrote:
Using an Arduino as a gate with some 6N138 optocouplers would allow you to translate the signal from Midi to something like the https://github.com/FastLED Arduino-WS2810 libraries should be fairly simple, give or take figuring out the power supplies for your midi bridge and the LEDs. Yeah, I already got the Arduino/AVR to LED thing done. I also can easily do MIDI on the AVR, no problem.
The only real issue in using MIDI would be the lack of match in the specs. Midi is built around 0-127 (#0-#7F) where these LED libraries are typically 0-255 for each color. I'm sure you could sort something on the arduino like The Note (0-127) is an addressable LED and the Velocity 0-127 (doubled) is the color, where notes would be expected in a series of three. (R,G, & B). If there is no standard per se, I'd like to keep it in a fashion where someone with a keyboard could easily control the lights manually, so the above looks good from note and velocity. I think it might be better to use patch control msg to set to R, G, or B (or W), as then a manual player could then still play and control the LEDs directly.
Midi also uses the irritating speed of 31,250baud which normally has to be a cludge on an arduino. Actually, 31250 is easy on the 16MHz Arduino/AVR (31250*16 = 500K, which is divisor 32 on the UART. With the common crystals used on the AVR, 9600 and such are the odd birds. It might make more sense to just use serial at a higher speed and define your own information packets. I could, for sure, but it seems like a project that does MIDI would have more appeal. The SPI speed of these LED strips is lightyears faster, and your arduino code and/or the library will typically collect your color commands in a buffer and send them a bit delayed. There's a little bit of lag, but even if you're synching to music, the human brain has an amazing tendency to make light flashing timing "feel" right, even when it's off.
Yep, the MIDI speed is dwarfed by the SPI rate.