Go Down

### Topic: Servo motor problem with arduino (Read 1 time)previous topic - next topic

##### Mar 01, 2015, 08:58 amLast Edit: Mar 01, 2015, 09:00 am by anjali_yadav
i m having problem with servo motor with arduino.I m using mg995 servo motor. when i m increasing the given angle of servo by 10-10degree( example - 0 , 10,20...180) thn it's working nice but when i gave angle like45 degree when it is at 0 degree, thn it start giving problem.
it feel like motor gets confuse where it should move to get that 45 degree

in short : 1) it was at initial 0 degree 2) i gave input serial 120 degree

3) thn it move bit clock wise diction

thn it stooped

4) after sometime , it

move anti click wise 120 degree

#### Robin2

#1
##### Mar 01, 2015, 11:27 amLast Edit: Mar 01, 2015, 11:28 am by Robin2

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

#### TomGeorge

#2
##### Mar 01, 2015, 01:45 pmLast Edit: Mar 01, 2015, 01:46 pm by TomGeorge
Hi,
How are you powering your servo, do not use the 5V pin on the controller, it cannot supply yhe load demanded by the servo?
The servo needs it own power supply.

Can you please post a copy of your sketch, using code tags?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Tom......
Everything runs on smoke, let the smoke out, it stops running....

#3
##### Mar 01, 2015, 02:45 pm
my code is this :
#include <Servo.h>
Servo servo;
int servoPin = 9;

void setup() {
Serial.begin(9600);
servo.attach(servoPin);
servo.write(0);
Serial.println("Prog Intiallized Successfully...");
}
void loop() {
if(Serial.available()) {
int angle = Serial.parseInt();
Serial.println(angle);
servo.write(angle);
delay(15);
Serial.println("Exiting If..");

} }

#4
##### Mar 01, 2015, 02:46 pm
i m giving  it 6 v external supply

#### Robin2

#5
##### Mar 01, 2015, 03:43 pm
Your code works pefectly on my Uno

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

#### zoomkat

#6
##### Mar 01, 2015, 06:17 pm
Make sure the arduino ground and servo power supply grounds are connected together.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

#7
##### Mar 02, 2015, 07:18 am
which servo motor you r using and what current and voltage you are giving?

#8
##### Mar 02, 2015, 07:21 am
I m using mg995 servo motor  and giving 6 v ,500mA

#### TomGeorge

#9
##### Mar 02, 2015, 08:36 am
Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?

Tom...
Everything runs on smoke, let the smoke out, it stops running....

#10
##### Mar 02, 2015, 08:46 am
This the circuit diagram which i m using,

#### Robin2

#11
##### Mar 02, 2015, 10:32 am
500mA may not be enough current for your servo. Try a pack of 4 AA NiMh batteries and see if that solves the problem.

I just tried the code with a very small servo to ensure there is nothing wrong with your code.

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