Let's Make Robots!

Servo Controller: A thought experiment

First up, this is at best a work in progress, at worst only ramblings.

I have seen members asking about driving more than a handful of servos and getting the response that they can either use an arduino and its assorted libraries to drive 12+ servos, correction, up to 20 servos or get a dedicated controller board that seems to cost in the area of 50USD. I spent an hour or so knocking up an idea. I want to lay out my thoughts and see where it could or should go.


I have read a good deal about a free language available for a large number of the lower end PIC microcontrollers. One of the library modules offers servo control for 8 servos per available timer and it is coded for a maximum of 24 servos and/or 3 timers. An 18f4550 has 40 total pins, i2c, usb, and an internal oscillator and costs < 6USD in single unit quantities. Once again this was only a step up from doodles on a napkin.

The Plan


 I was thinking i2c control over up to 24 servos and from my calculations having a spare 4 pins that could return data to the i2c master might be something useful. The address would be set via an analog pin.

I2C Data

Having up to 3 sets of 8 servos requires 5 bits. 2 bits to select which of the 3 sets of 8. 3 bits to select which of the 8 servos to control. And, 3 or 4 bits to set a delay so one could have a servo move more slowly. The final 7 or 8 bits would set the direction/speed.

Bank   Servo   Delay   Degree/Speed
 bb       bbb      bbb(b)   (b)bbbbbbb    *The (b)'s are a one or the other, not both or neither.

If there are only 7 bits for the Speed/Degree, you would miss a degree choice here and there. Because 127 < 180, each bit increase is about 1.4 degrees of increment.

One of the reasons I wanted to post this is to test the waters and get input. If I or someone else was to actually produce one of these chips, is there anyone that could/would test it. If so, what kind of documentation, beyond knowing what pins are for what and the above I2C command, would be required?

I really don't want to put a great deal of time and effort into this if there is good reason why the controller boards are so expensive.

I welcome any critiquing/criticism.


The library and language I was contemplating:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I wanted to get this written up so people could put eyes on it and tell me if I should pursue it.

It sounds very interesting. Alas I would use a Propeller chip to control up to 32 with the Servo32.spin object on the OBEX web site. It also has a ramp rate object that is awsome!

After seeing you and mixmar discussing it in the shoutbox. I am now thinking how to implement with a 16F690. As I don't currently have any 18F parts just heaps of 12F's and 16F's.

Any particular reason for choosing I2C over plain old vanilla serial uart? Just I tried to bit bang master I2C with this pic and failed miserably. Ended up doing serial uart instead. It might be easier to implement in this case as the servo pic would be slave and slave is fully supported in hardware on 16f690 unlike master.

However it might be easier for more people to use the chip if it was just serial?