Servo/solenoid control through OF


I’ve had to dust off my folder of OF stuff so I can work on some old projects I was never satisfied with, and I’ve decided to get into controlling external devices. I had written some programs that output to midi through virtual ports so that I could have it input directly to programs running in the background [this was in OF4, so i’ll probably transpose everything to 5 or 6], but i’d much rather see if i can get them to output to an actual instrument.

My first thought was a microcontroller with servo/solenoid controls to hit keys/buttons on the musical devices. I see that there has been some experimentation with arduino interfacing with OF, but from what I can tell, the arduino only supports 16 total input/outputs. I would like to get upwards of 80, just so that I can work with the whole range of midi.

So I’ve looked around for a microcontroller that could handle that many devices, but I haven’t found anything really. Another concern is the voltage/current powering 80+ solenoids or servos at any given time would demand… Any suggestions?


Extending the ports on an arduino is relatively simple with shift registers. Here is some info about it:

This is very scalable and you could technically have shift register controlling more shift register. This is fundamentally how you could switch the thousands of LED of an LED screen.

Another but similar way is to daisy chain multiple arduinos together via the serial pins. I often prefer doing this as dealing multiples of the same chip keeps things simple. I can give you details on that if you want.

hi nabontra

Maybe check this out…-llers.html

Servo Channels - Up to 84
Logic Outputs - Up to 84
Logic Inputs - Up to 84
10-bit Analogue Inputs - Up to 36
Servo Refresh Rate - 20mS under all conditions
Position Control - Directly programmed in uS
Speed Control - From maximum down to 20 seconds for full rotation
Servo Power - Separate terminals for voltage of your choice in groups of 8 servo’s
Logic Power - Direct from the USB Bus
Control interface - USB

Chris – that’s a really neat device. It’s nice to see something well-designed that does exactly what it needs to do.

Nick, if you’re bent on an Arduino-based solution, you could also try DIY using the TLC5940 which will let you control 16 PWM channels (if you want more than binary resolution).

Kyle made an excellent point that by sending messages rather than posting in here, the topic really does a terrible job at sharing info about this!

So here is what happened “behind the scenes” so to speak.

[to stefan]

That site gave me a lot of insight into the possibilities of the arduino. I think linking the arduinos would be much easier, but I have to keep my experiments to a pretty tight budget right now. So in the shift register method, am I right in assuming that the byte going into the specific shift register pin would just trigger a relay with an outside power source for the solenoids?


The trick is to build your own arduinos. In fact you can simply buy bare atmega168 DIP (about $4) chips and use the Arduino software to program them. The only thing you need is a programmer () which you can get here:
This programmer is directly supported by the arduino software.

I have some more info here of how to set things up:

[to chris]

That’s pretty amazing. I guess the problem I’m having trouble with is servo VS solenoid control. As the solenoid is only triggered by the supplied voltage, I would assume the control board would just trip a small relay for each solenoid.

If such is the case, it almost seems like overkill to use these really nice servo microcontrollers which are outfitted for the degree of turn and everything.…-ircuit.png

I mean, essentially the board is just outputting bytes to the servo pins to communicate, that could be hooked up to relays and the data adjusted to trip the relays I think…

[to kyle]

I’m definitely not bent on an arduino solution, but it definitely seemed like the most feasible option as a microcontroller to interface with OF right now. I’m still perusing different types, but if you have any suggestions, i’d love to hear about them.


I really think the one Chris mentioned would work well, actually. It’s a bit more expensive than an Arduino, but you’ll end up spending a lot more on solenoids anyway (or even on outfitting an Arduino to do the same thing). It uses an FTDI chip like the Arduino, so you can just send it serial data to control it, and OF already has a serial library built in.