Maker Pro
Maker Pro

Correctly setting PWM signal for continuous rotation servo

Passiday

Oct 13, 2013
2
Joined
Oct 13, 2013
Messages
2
Hello,

I have this continuous rotation servo: http://www.robot-r-us.com/vmchk/motor-robot-servo/springrc-sm-s4315r-continuous-rotation-servo.html

And I have http://electricimp.com/ device for controlling it.

I'm somewhat puzzled what am I doing wrong, so here I am looking for advice from someone who's more experienced than me.

The spec says that 1.5ms pulse is the rest point, while lower values will make the motor rotate counter clockwise and higher values make the motor rotate clockwise.

The Electric Imp API lets me set up the output pin, specifying the PWM period (in seconds) and duty cycle (0 to 1). I chose arbitrary period value 0.02, and thus I can get the rest point (1.5ms) with duty cycle 0.075. And the lower values really make the motor turn counter-clockwise, and the higher values make it go clockwise. So far so good. The performance of the motor is remarkably unreliable (rotation period time can differ by 10%), and also the pulse width relation to the speed doesn't follow any reasonable mathematical formula. But if I can calibrate to that, no problem.

But then I decided to change the period to other arbitrary value, 0.05. And to my surprise, the motor response to pulse width was no more the same, even if the duty time was properly recalculated to take the wider period in effect. I don't have oscilloscope to see if the PWM signal is really what I think it is, but I'm pretty sure the signal is correct, because the 1.5ms pulse correctly stops the motor.

Since the motor specs do not talk about the PWM period, I thought there is some industry standard that is so "common knowledge" that it is not specified in specs. That would explain different motor behaviour with 1.1ms signal at 0.02s period and 0.05s period.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The standard period for hobby servos is 20 mSec or 50 Hz, but it is not typically critical. If you go too long between pulses it will become erratic.

Did you read the specs:

General specifications
Speed @ 6V: 0.14 sec/60°1
Stall torque @ 6V: 15.4 kg.cm
Speed @ 4.8V: 0.16 sec/60°2
Stall torque @ 4.8V: 14.8 kg.cm
Lead length: 11 in
Gear Metal

Notes:
1
About 70 RPM.
2
About 60 RPM.


So the rotation speed is not controlled by the PWM period or duty cycle.

Bob
 

Passiday

Oct 13, 2013
2
Joined
Oct 13, 2013
Messages
2
Well, in fact it varies, 1.6ms pulse at 20ms period and 1.6ms pulse at 50ms period are interpreted differently.

As for the speed control, the spec really doesn't cover that. But it's just because it's a poor spec. As the webshop claims, "Pulse widths above the rest point result in counterclockwise rotation, with speed increasing as the pulse width increases; pulse widths below the rest point result in clockwise rotation, with speed increasing as the pulse width decreases.", and I can confirm it is so, because I have fed it those values and got slow/fast CW/CCW rotation.

I'm just somewhat disappointed about the lack of documentation what period I should use and what is the pulse-speed relation formula. Now I have to perform set of calibration tests (wrote a testing suite that counts the time of full rotation), and hope that it is uniform over other similar units and consistent also over time.
 
Top