ofArduino servo number on Arduino Mega

Hi all,

I am setting up a project with 18 Servos on an Arduino Mega. While the Arduino servo library is capable of driving 48 servos, ofArduino seems to be limited to 6. Does anyone know if this is a coded limitation (so that there might be a way to adapt the code for the Mega Board) or if it is a more complex problem?

Of course I could just send some values from OF to Arduino, while doing the actual servo controlling in an adapted Firmata Code, but I’d prefer to do all coding in OF while running only standard Firmata on the Arduino.

Maybe someone has a good idea. How would you solve his?

Thanks for any hint!
oe (Christian)

Guessing it’s because the Arduino only has 6 PWM pins. You’ll need to use a software PWM or some multiplexer chip.

EDIT: ignore

I think that was a legacy holdover from when Firmata was only capable of handling a few servos. you can change that in ofArduino code and change the max servos number higher and it should be fine

I did a project controlling 72 servos on an arduino mega.
We used pololu servo controllers. They exist in different sizes, this one could do the job: https://www.pololu.com/product/1354. We also tried some cheap chinese controllers, I think they were called usb usc32, but they didn’t work well.
You could use https://github.com/thomasgeissl/ardPololuServoController on the arduino side. I will probably update it to support the other protocol and other features.

We did the communication using OSC messages, https://github.com/CNMAT/OSC. Which was fine in our case.

Let me know if I can help you somehow.

Edit: https://vimeo.com/135904342 in case you’re interested in the installation

1 Like

Can you please share some more details here? I want to see your hardware schematic?
Also what are the specifications of whole of your hardware setup?
Can you please share your firmware also?

electronic assembly

I have also been working on updating the core library for the 0.10 release, I think it would be great if you guys could test the servo functionality. Sorry this is a bit late on here but on the chance someone stumbles here and wanted to use more than 6 servos

Hi DomAmato,

thanks a lot for working on it. I just now took down my installation and am ready to test. I have to admit I have some problems setting it up though. I have compiling errors when just replacing the 4 files in “communication” as well as when downloading he whole branch. Have to admit I am not a compiler nerd, though. So if you could give me some background on how to approach best, I would be happy. I am running on OS X, have 082 and 084 already running.

Greetings!
oe

You will need OF 0.9.* to run the code in my branch. I would suggest downloading the release and just replacing the ofArduino files, I don’t think there are many changes I made to the ofSerial files and even then it shouldn’t be required. You should just be able to run the ofArduino example included but you will probably have to rename some things as I changed the naming conventions to be more in line with Firmata’s naming conventions.