Continuous Servo Nightmare!

Hi there everyone! Dave here… I’m a complete newby to Arduino (UNO) and am trying to control a continuous rotation servo motor ( FEETECH FS5103R) which seems pretty happy just doing it’s own random thing.

I’ve tried a lot of tutorials, watched lots of videos and tinkered with the sweep library example with no real idea what I’m doing.

Please be kind, I’m not stupid, just very new to this tech and I will get it… as long as I know why I’m doing it wrong. I would like to make it go 0 - 360 then stop and wait for the next time I trigger it (that’s a whole new can of worms for me).

If someone can go through step by step so I can check that I have all the planets aligned… that’d be tops.

Thanks in advance,

Dave.

Welcome to the forum Dave.

Have you been through the Core-Electronics tutorial below? If you have and it’s still not working post up you code and some photos of the setup and somebody on the forum should be able to help.

1 Like

G’day Shaun,

Yeah, that was the first step. No matter what I do, the servo just does weird stuff. I know the little adjustment/calibration screw is in the the motor to set it to a zero point or something, but I’m not sure how to set that up first. I have a feeling that that is the root of my problem. I’ll go through the tutorial again and again and see how I go tonight. I’ll be back with screen shots and photos if I have a massive fail.

Thanks again,
Dave.

I can safely say that this servo is NOT goin from 0 - 180 and back again. It goes more than 360 deg CW, then over 720 degrees CCW.

What am I missing? I’m using the Sweep example library code. I am mucking about with the pos <=180: pos +=1 code etc and getting different results.

I honestly though that this would be so simple. Perhaps it is and I’m thick, but I can usually find the logic in most problems… until now.

Is there magic numbers I should be entering instead of the example code? I’m going to lose sleep over this…

This is my set up. 5V power supply, positive going to the servo, negative going to the earth on Uno, earth then going to servo (via breadboard) and control cable in Digital Output 9. Pretty sure that’s what the doctor ordered.

IMG_2704

The hardware wiring looks OK.

Is this the code your using?

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

@Shaun21504
It probably is, or something similar.

@Scoutegg needs to read the documentation on write and understand the difference with a continuous rotation servo and standard servo.

https://www.arduino.cc/en/Reference/ServoWrite

2 Likes

Thanks @Robin57159.

That makes a lot of sense. I haven’t used continuous servos for a long time and forgot that little fact myself. :slight_smile:

@Scoutegg Here’s a snippet of code to test it with from http://www.bajdi.com/continuous-rotation-servos-and-arduino/

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
  
  myservo.write(45);                  // rotate counterclockwise full speed
  delay(2000);                           
  myservo.write(90);                  // stop
  delay(100);
  myservo.write(135);                 // rotate clockwise full speed
  delay(2000);
  myservo.write(90);                  // stop
  delay(100);
  myservo.write(80);                  // rotate very slowly counterclockwise
  delay(2000);
  myservo.write(90);                  // stop
  delay(100);
  myservo.write(100);                 // rotate very slowly clockwise
  delay(2000);
} 
2 Likes

Hey guys, thanks for this. I will have a play a bit later and let you know how I go. I really appreciate your help guys.

I’ll be back.

1 Like

A quick tip days later - also worth having a common ground between power supplies.

1 Like

Ha ha, thanks. I think I’ve done that. I’m pretty sure I’m making an error somewhere. I’ll let you know if i can’t figure it out soon.

Thanks heaps.