Micro Servo

I am having trouble with my servo Motor. When ever I set the position of the motor between the value 0 - 9 the servo motor does a 360 then moves on to the next input. Any numbers Between 10 -180 work fine the motor stops at that position then moves on.

This is my code and when ever it hits zero it starts turning 360 degrees and won’t stop

#include<Servo.h>

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

int i = 0;

void loop() {
{

myservo.write(180);
delay(2000);
myservo.write(10);
delay(2000);
myservo.write(180);
delay(2000);
myservo.write(0);
delay(2000);

}
}

If anyone knows whats up please help me as I am confused

Been quite a few of these "problem" servos going nuts when driven to the extreme ends.

Might be nice to do a tear down of the servo to see what has happened to the "tab" that is present in normal servos to prevent going past the limits of the feedback pot.

The Servo library full range writes values to the servo which are way outside the specified pulse range for most hobby servos. Many servos handle these extreme values o.k. Some don’t.

Are you are using an SG90 servo? There have been several reports of these particular popular servos responding strangely to extreme low values. There’s nothing you can do about it except restrict the range of movement by avoiding low values or replace the servo with one that can handle the values.

Steve

360? Then your servo is broken or it is not a conventional hobby servo.

Model number and webpage link, please.

Thanks Everyone for your help. The servo is just a stander hobby servo I think. it says "Micro Servo 99 SG90" so if that helps.

I am not to concerned about it as I am not going to be making big turns with it, I thought it was just strange.

Yes, as I said, it's SG90s that most of the reports have been about. I guess a bad batch were manufactured and have made it out into the wild.

Steve

Did you see the posts in https://forum.arduino.cc/index.php?topic=518186.0 out of control servos, servo parameters?

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks… Tom… :slight_smile: