Author Options:

Feature rich servo controller Answered

Hi All,

I'd like to write a servo controller that allows another system to offload some of the low level motion control work to the controller. This is primarily for amateur robotics applications. I'm trying to work out whether a controller implementing the features below would be replicating effort of existing open source drivers and not really worth the bother. Has anyone come across an existing controller that can some/any of the following?
  • Position feedback
  • Alterable traversal rate(s) changeable in real time (mid motion)
  • Different seeking modes (acceleration, stall detection, hammering, error margins)
  • Different communication modes (position queuing, position interrupts, upstream arrival and stall messages, etc)
  • and so on...
I'm looking at doing this probably with an Ardunio Nano and controlling as many servos as possible, but the primary goal would be feature richness. I could also see applications for an Attiny version (1 controller to 1 or 2 servos, limited feature set). Has anybody got any thoughts on the idea?

Thanks in advance,


I'm pretty sure the Arduino can cover all of that without the need for any additional circuits.

I know - infact as part of the opening post I noted that I may infact implement this on an Arduino Nano. I'm not looking at a complex circuitry solution - just the bare minimum for a microcontroller and i2c bus.

The goal is to have a chip (or a board) that is specialised at taking commands (probably i2c) and controlling one or more servos, with some clever motion control options. What I'd like to end up with is a "drop in" chip that will handle servo control without putting much load on your robots' "brain" level controller(s).


Well the bare minimum would be connecting the servos directly to the arduino. All you would need is an outside power source. Don't try to use the 5V output from the Arduino. Connect the power and ground wires of the servos directly to the power source and place the signal wires on one of the Adrunio's I/O pins.

There are many different Arduino compatible motor controllers out there. You don't see many for servos because they don't have the power demands of most motors and are easier to work with then most stepper motors. So an added controller chip in conjunction with your micro controller/ robot "brain" isn't needed. The processing power needed to run a set of servos isn't putting any more of a load on the "brain" then having the brain pass a signal off to another controller. Adding another IC to the mix is only reducing your battery life.

Thanks yeah, I see where your coming form. I'm aware that an Arduino can be used for both control and low level co-ordination - however this is not what I'm trying to acheive - nonetheless I see that could be a desirable usecase.

My intention is to load down a few micro controller units (MCUs) for high level processing, things like sensor processing, maybe even a neural network implementation. This is my idea for reducing shared effort across control nodes.

The power overhead of extra MCUs is as nothing next to the power consumption of a servo. I'd argue if I can create a controller that can put down a set amount of force, detect a stall and feedback realtime effort exertion/resistance data I could reduce controller processing load significantly. The approach as I describe it will scale fairly effectivly too, as far as I can see.

Thinking about it, if I program it correctly the library could be used in either case (as a servo manager or arduino library). Is this something that you could see yourself using?

To do that, you aren't using the existing electronics in the servo though, are you ?

Yep - the plan is to use existing servo electronics with a slight modification - an a2d read on the position sensor.

My logic for measuring load would be something like this - increment position 1 step in the desired direction then track how long it takes to get there. "There" would be a set value held either in EEPROM or flash (self flash a data table or an additional computer managed pre flash configuration step?) or algorithmically calculated on the fly.

If you have these two bits of information (where it should be & where it is) my reasoning is that you can do clever things with the PWM control signal. For example sending the signal less often than expected, reducing effective force and speed in some servo models (I have done this bit before).


You aren't going to be "force sensing" etc etc with that.

Now, if you were talking about replacing the electronics, you'd be something novel, though I am pretty sure you can already buy retrofit units that can do what you're proposing

Hmm I'm not sure on existing products, you could be right. Openservo seems like a good option but would need some hacking to work with smaller servos that seem quite popular with amateur roboticists. The minimum 6v requirement is also a problem for some of my applications. Finally, the focus of the project differs from what I have in mind.

Your right, I'm not measuring force (I don't think I said this...). However we can synthesize resistance data from target position and actual position data. If I'm riding a bike at 2kph and it's hard work, I deduce I'm going up a steep hill and to reach my target speed of 4kph I'll have to pedal harder.


/Measure current in the servomotor

Current would be interesting, but it wouldn't be any good for situations where we want to move to within an error margin of the target, push up to or past, or do other cool stuff of that type that servo motors traditionally don't do.


It would be a limiting parameter, or an alternative operating mode. Its perfectly usable as a parameter for a slew to position, because it limits the slew speed automatically

Sounds interesting... I'll aim for positional feedback first and see how much flash is left over, though I can't envisage any problems.