Go Down

Topic: Simple Servo is freaking out (Read 1 time) previous topic - next topic

DrDuh

Hey,
I'm new to arduinos and have come across a weird problem with a simple micro servo. I'm using the arduino uno. With servo wires Vcc plugged into +5v on arduino, ground on arduino and signal to digital 9. I'm running the following code. When I run the program the arduino immediately moves clockwise and never stops, it keeps pushing and spastically jittering against its limit angle.
The step motor handles angles <= 160degrees

Thanks!

Does anyone know what the problem could be?

Code: [Select]
#include <Servo.h>
Servo myservo;
void setup()
{
  myservo.attach(9);
}
void loop() {
myservo.write(20);
delay(1000);
myservo.write(100);
delay(1000);
}

JimboZA

Spastic Servo Syndrome often happens when the servo is powered from the Arduino which cannot provide enough current.  Give it its own power with ground common-ed to Arduino. That might solve the problem....
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Robin2


the arduino immediately moves clockwise and never stops,


I doubt that you mean this literally. If you are more precise with your use of language it will be easier to help you.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

DrDuh

*Never stops trying to move right

Thanks for your replies

Robin2


*Never stops trying to move right


I was actually trying to draw your attention to the words "the arduino immediately moves"

I strongly suspect the arduino does NOT move.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

zoomkat


*Never stops trying to move right


The usual suspects are inadequate power supply, inadequate ground between the servo and arduino, and a corrupt/bad servo control signal.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy