Midi PWM Solenoid Control

I have been reading all over the internet (and various forums including this one) and finding bits and pieces but not specifically what I seek. Basically, I would like to make a musical percussion array consisting of solenoids hitting various objects. It's not too difficult to just go with discrete outputs and simply do ON/OFF but I would like velocity (dynamic) control. From what I can see I need to use pulse width modulation to achieve this. My intent is to control 32 separate solenoids via midi.

I can't seem to find what is the best way to achieve 32 PWM outputs along with parsing the midi code and converting into control voltages. I have seen that there are a great many ways of accomplishing this. I'd prefer to send midi directly into an arduino but I could also go virtually through usb or something though that seems more difficult. I've seen midi shields and PWM output shields but I can't seem to find anything about the compatibility between the shields. I am not concerned with powering the solenoids, I already understand how to do that.

So basically, what's the best way to get 32 PWM outputs and also getting the midi input to the arduino that would be controlling the solenoids? I hate asking because I am a firm believer in searching diligently but sometimes you have to know when to ask for help.

Thanks in advance for any assistance given, it is greatly appreciated.

Hey D3ADP1X3L,

I wasn’t sending MIDI signals to the arduino directly but rather processing the triggers in pure data and sending over serial. My solenoid drivers connected to the TLC5940 chip, which comes with Practical Maker’s PWM shield. Feel free to use any the code Meta-Piano_Extended/solenoiduino_64 at master · epicjefferson/Meta-Piano_Extended · GitHub


I play Cajon (wooden box drum) and the idea of automating 1 or 2 is quite interesting.

I wonder what the advantage of PWM is.

Impulse = force x time.

If it takes, let's say 15 millisecond to get a certain velocity/volume at 50% PWM, it should be possible to achieve the same, by turning the output on completely and control velocity using the time you keep it on.

Fantastic! Thank you very much. I am going to play around with this code. As for the schematics, I am new to Eagle. Is there a way to get it to display a component list with values?