# How to control continuous rotation servo motor (360°)?

Connected servo motor (180°) to Arduino Uno R3.

Currently I am using a servo motor which have rotation angle specified as 180°, but I have a requirement to rotate to certain angles greater that 180°.

So do I need to go for a continuous rotation servo motor (360°), so that I can stop the motor at different angles greater than 180°, was my assumption true, will continuous rotation servo motor satisfy this requirement?

I mean I need to rotate 5 times CCW as 180° then rotate 5 times CW as 0°. I use 360 Continuous Rotation PWM standard RC Robot servo FS5113R . Current code, which I am using 180° servo motor.

Servo myservo;myservo.write(180); int pos = 0; void setup() { myservo.attach(9); }

void loop() { { myservo.write(180); delay(1000); myservo.write(0); } }

will continuous rotation servo motor satisfy this requirement?

No.

When you use a continuous rotation (not really a) servo the value used with servo.write() sets the speed and direction of the servo rotation, not its angle.

You can get real servos capable of 360 degrees (and more) rotation. Search for sail winch servos

the value used with servo.write() sets the speed and direction of the servo rotation, How?

abuwesam: I use 360 Continuous Rotation PWM standard RC Robot servo FS5113R...

I found an example code for it here:

http://robojax.com/learn/arduino/?vid=robojax-servo-360

abuwesam: the value used with servo.write() sets the speed and direction of the servo rotation, How?

A continuous rotation "servo" has no feedback mechanism within it so it has no way of knowing its angular position. When you write a value, say 20 to a proper servo it rotates to position 20 and stops. When you use the same command with a continuous rotation "servo" it rotates towards position 20 but has no means of knowing then the position has been reached so it continues to rotate.

In theory you can control the position of such a servo by moving it for a fixed time then stopping it by writing 90 to it but it will not work reliably because its speed depends on the voltage being supplied to it and the load on its output. Many have tried and all have failed.

You could add a rotary encode to the output and manage its position yourself. Please feel free to try it.

What is your advice to use for smart curtain. I mean using Bluetooth to open and close curtain. I have the code and app android but I’m looking same as servo motor but rotate more than 180 degrees.

By all means use a "servo" to move the curtains as long as it is powerful enough, but add limit switches to determine when the "servo" must stop because it is at the limits of travel.

What code do you have ?

void loop() { //Read from bluetooth and write to usb serial if(bluetooth.available()> 0 ) // receive number from bluetooth { int servopos = bluetooth.read(); // save the received number to servopos Serial.println(servopos); // serial print servopos current number received from bluetooth myservo.write(servopos); // roate the servo the angle received from the android app }

}

abuwesam: void loop() { //Read from bluetooth and write to usb serial if(bluetooth.available()> 0 ) // receive number from bluetooth { int servopos = bluetooth.read(); // save the received number to servopos Serial.println(servopos); // serial print servopos current number received from bluetooth myservo.write(servopos); // roate the servo the angle received from the android app }

}

sherzaad: I found an example code for it here:

http://robojax.com/learn/arduino/?vid=robojax-servo-360

This code is very similar to the link I posted in post #3! ;)

using limit switches as proposed by @UKHelibob is probably the simplest solution.

put simply, use 'digitalRead()' to continously check the state of the limit switch and when the limit switch is reached/trigerred use 'myservo.detach()' to stop the servo.

hope that helps....