Servo not working!

hello,

I got my sg90 servo today and I wanted to try it. First I connected the + pin on servo from 5v of my nano. It didn't work, then I connected it from breadboard power supply and it moved a bit, but after that no response! is it broken?

kind regards

What are you expecting by connecting a servo to power and ground and not connecting the signal wire?

Even those tiny servos draw more current than can safely be supplied by the 5V pin of a microcontroller, although I do sometimes do it for a test. So it's not something to be encouraged. Use a separate supply.

And post the code; maybe there's something wrong there too.

I agree with the suggestions above. However it's more likely you have a code or wiring error. I'm assuming you did connect the signal wire and just forgot to mention it?

Hello
Take some time and run a simple servo tutorial.
That will help.

Your SG90 Servo Motor has the following colored wires. Check that you have connected the servo accordingly with UNO.

SG90Con
SG90PWM
Figure-1:

SG90-1
Figure-2:

Test Sketch
Ever time you press K1 of Fig-2, the servo will move by 30 degrees.
Write codes and post here which will be corrected by the Forum Members if needed.

1 Like

Yes

I forgot to mention it.

here is the code:

[code]
#include <Servo.h>
/* After including the corresponding libraries,
   we can use the "class" like "Servo" created by the developer for us.
   We can use the functions and variables created in the libraries by creating 
   objects like the following "myservo" to refer to the members in ".".*/

Servo myservo;
//it created an object called myservo.
/*  you can see Servo as a complex date type(Including functions and various data types)
    and see myservo as variables.               */

void setup(){
  /*"attach" and "write" are both functions,
     and they are members contained in the complex structure of "Servo". 
     We can only use them if we create the object "myservo" for the complex structure of "Servo".
  */
  myservo.attach(9);//connect pin 9 with the control line(the middle line of Servo) 
  myservo.write(90);// move servos to center position -> 90°
} 
void loop(){
  myservo.write(90);// move servos to center position -> 90°
  delay(1000);
  myservo.write(60);// move servos to center position -> 60°
  delay(1000);
  myservo.write(90);// move servos to center position -> 90°
  delay(1000);
  myservo.write(150);// move servos to center position -> 120°
  delay(1000);
}
[/code]

You also forgot to mention which pin the servo signal wire is connected to

and I tried other servo motor and it is working

to pin number 9.

Then the other servo could be broken.

Can I fix it?

I have no idea as to your skill set and capability to repair a servo motor. I'd venture to say if you are asking, then no you cannot fix it.

Send it to a refuse bin.

Strata Refuse Bin Secure Push-On Lid 80 Litre Dustbin Black - Hardwearing and durable plastic - Suitable for both indoor and outdoor use

1 Like

Take it apart, and learn how a servo works. If you don't see a way to fix it, you still learned something.