PIC driving servo

Thread Starter


Joined Jan 21, 2010
hi..i am currently using PIC16F887 MCU to work on servo motor FUTABA model. I am able to control the direction of servo motor using C programming but i dont know the programming code to control the speed of servo motor..
For example, the rotation of servo motor from 0deg to 180deg needs less than 1 sec.however, I need to control the rotation of the speed from 0deg to 180deg in 12sec smoothly..
can anybody help??thanks alot...


Joined Apr 20, 2004
Welcome to the forums.

Tacking your question on the end of a two year old thread is a good way to get ignored. The old thread - http://forum.allaboutcircuits.com/showthread.php?t=16566

A fixed pulse width will hold the servo at a given rotation. Increasing/decreasing the pulse width by a certain amout will cause motion. When you know the pulse widths for 0 and 180, then it is a matter of incrementing/decrementing the pulse width so the change takes place over 12 seconds.

The servo spec sheet will give control pulse widths.

Thread Starter


Joined Jan 21, 2010
hi..thanks for the reply..yaya..after posting my question, i only realize that im questioning on a two year old thread..

thanks for your information, i will try to work on that. i knew the pulse width of servo motor im using..but in C programming, im using PWM and 'for' loop to control...i jz worry it can't rotate smoothly in 12second from 0 to 180..


Joined Jan 18, 2008
Jomar makes a gear door sequencer or servo sequencer that controls speed. I don't know if it can slow to 12 seconds from position A to B, though.

Other manufacturers make similar servo controllers/sequencers. Their literature is scanty on the way in which it is done.

For DIY, this Seattle Robotics link describes one way to do that.

It is interesting that the "off" time of the servo PWM position signal is used. Again, I am not sure a servo can be slowed to 12 seconds that way.

I could not find an example of the method suggested by beenthere. It sounds reasonable, but may produce a jerky response by the servo depending on the step resolution capability of the servo and program. Maybe a combination of the Seattle Robotics method with slowly incrementing the change in pulse width would work more smoothly.



Joined Feb 11, 2008
I've done slow rotations (for slow robot scanners) like that using very fine (sub uS) changes in pulse width.

The fine pulse width stops any jerkyness from the controller, but the problem still exists on the load side. There is a certain amount of shaft and load friction and geartrain slop, and it will still tend to move in jerks, at least some of the time.

The best way to get this result is with a DC gearmotor and rotate the motor at a low constant speed. RC servos are better for faster moving scans.