Go Down

Topic: Servo motor problem with arduino (Read 2067 times) previous topic - next topic

anjali_yadav

Mar 01, 2015, 08:58 am Last 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 am Last Edit: Mar 01, 2015, 11:28 am by Robin2
You will have to post your code if you want advice about why your code is not doing what you want.

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

TomGeorge

#2
Mar 01, 2015, 01:45 pm Last 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....

anjali_yadav

 :-X 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()) {
    Serial.println("Data received..");
    int angle = Serial.parseInt();
    Serial.println(angle);
    servo.write(angle);
    delay(15);
    Serial.println("Exiting If..");

} }

anjali_yadav

i m giving  it 6 v external supply

Robin2

Your code works pefectly on my Uno

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

zoomkat

Make sure the arduino ground and servo power supply grounds are connected together.
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

anjali_yadav

which servo motor you r using and what current and voltage you are giving?

anjali_yadav

I m using mg995 servo motor  and giving 6 v ,500mA

TomGeorge

Hi,

Can you please post a picture of your project.

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....

anjali_yadav

This the circuit diagram which i m using,

Robin2

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.

anjali_yadav

how much current it supplies 4 AA NiMh batteries  bcz i need to run 4 servo motor

anjali_yadav

700 mA will be enough for 1 servo or should i give more bcz according to my calculation(my project) it have to give around 9 kg-cm toque

Go Up