# Variation of speed for Servo Motor

Hello, for a school project, I recently bought an adafruit shield motor and two Servo Motors (Continuous Rotation : SM-S4303R). I would like to make these two motors change speed with time.

exemple : make motor1 go at speed s1(t)= 10*t make motor2 go at speed s2(t)= 5*t

Could anyone tell me if this kind of program is possible or show me an exemple ?

To make servo motors change speed you'd want to add increments and some delay between destination travel.

Say the servo is at 0 degrees and you want it to go to 90. you can send it a go to 90 and as fast as the mechanicals can carry it the servo will travel.

On the other hand if the servo was at 0 degrees and you wanted it to travel to 180 degrees, you can torque it in 1/2 degree increments (using microseconds) and between each torque pause for 18000 milliseconds, then the servo will move very slowly.

What Idahowalker describes is good for normal servos.

But you don't have normal servos but continuous rotation servos (which are basically geared motors with their own driver) so you may have problems. You can certainly try changing the speed simply by changing the pulse width of the servo control signal in a similar way. But in most cases the speed of that type of continuous servo cannot be controlled with any real accuracy.

Initially I'd try the Sweep example code from the IDE and see how that works for you.

Steve

You mention an adafruit shield motor What is that? Is it a motor or a motor driver shield?

As slipstick mentions, do try controlling the speed of the continuous rotation servos with different servo.write commands. But the electronics in the servo, designed to make positional (non-continuous rotation) servos behave best for positional awareness. When they are repurposed for continuous rotation, They give the ability to move the servo in both directions and stop. But not very accurate speed control.

If the servo.write() works for your needs, then great! If not, you could consider bypassing the servo electronics and going directly to the motors in the servos using an appropriate motor driver. Maybe even something like and adafruit motor shield... But Pololu has many DC motor drivers also.