Midi input to control bank of tlc5940 multiplexed solenoids

Hello Community!

I would like to request input from the community about my approach. The overall scheme of what I am attempting to do is to operate a player piano with a bank of 85 solenoids ( plus some others for pedal control, etc.) My project is well underway. I have the solenoids working as valves in a row tee fitting connected to the vacuum hoses. To control the solenoids I have an arduino uno running 6 daisy chained tlc5940 chips ( including a lot of diodes, transistors, and some resistors.) This works well! I can make the piano play by controlling the solenoids off and on with a basic pin on/off sketch so everything is in place and tested. The piano can play rapid notes and chords by tediously keying in arrays of output pin numbers and delay times in the sketch.

Now I would like to take it to the final step of being able to feed midi file signals to control the solenoids and actually play midi music but here is where I am stuck. What would be the best approach for me to use for this final step?

Do I need to purchase a midi controller add on board?

Should my Arduino Uno be able to run both a midi input sketch and give instructions to the multiplexing sketch at the same time?

Should I do something like use a Raspberry Pi instead of or in addition to the Uno?

Thanks in advance for any thoughts or suggestions.

John Chaplain
North Port, FL

Sounds like an interesting project and a Uno should fairly easily handle translating MIDI NoteOn/NoteOff into solenoid numbers. The question is where is the MIDI coming from? How do you expect it to get into the Arduino?

You could have a program running on a PC sending MIDI to the Arduino over standard 5-pin MIDI or over USB. You could have MIDI files stored on SD card and expect the Arduino to read them. And there are probably several other ways you could get MIDI into the Arduino/Piano. They will all need different hardware and programming.

And then do you need to act on any other MIDI information? E.g. do you have any control over velocity (how hard the solenoid hits) or is it just on/off.


Thanks for the reply. Getting the midi to the arduino AND putting the note through the selected multiplexed pin at the correct time for the correct duration is really what I need to figure out how to do. I am wondering if I can input the midi from the computer or from an sd card to the arduino at the same time the arduino is busy multiplexing?

As for the note velocity, I guess its just the same as a player piano roll punched hole. The hole is either there or not, so on or off the same as the solenoids will be, but there are other vacuum controls in a player piano for things like soft pedal and sustain which I should also be able to control. That will be phase 205 of this adventure which began with creating piano rolls by using a laser beam driven by an arduino cnc shield to burn the holes. I scrapped that after months of effort and now this project has required many weeks, a 3d printer, and electronics purchases and testing.

So to summarize, do you think I can read and process midi files on an Uno within the same sketch that I'm using to perform multiplexing? I guess I should just try it and see what happens. I was posting to see if anyone thought I might be wasting my time with that approach and have a better suggestion before I waste my time! lol...

It would work but if you're going to run the MIDI on a PC then I'd probably go for a different board like a Leonardo or Micro/Pro Micro or even a Due. Not because the UNO is short of computing power but they might be easier to deal with because they have native USB making MIDI over USB easier. That saves messing with a separate USB host board or having to build/buy traditional 5-DIN MIDI circuits. These days I use Micros/Pro Micros for almost anything to do with MIDI though they may not have enough IO for your needs.

In Arduino terms both MIDI and multiplexed solenoids work fairly slowly so I can't see computing power being a real problem.

I don't have much experience with reading from SD cards so I'll leave that to someone else.