Servo not moving

Hi, my servo isn't moving.

Hardwares:

  • I'm using arduino UNO r3 with mega328p.
  • The servo is micro servo 9g SG90 (the datasheet says the power supply is ~5V).

Issue:

  • Servo is not moving and keeps on making clicking sounds like a computer mouse click.

I have tried:

  • looked into the Appdata folder, and found out that the Servo.h is in the right place.
  • reconnecting USB of arduino.
  • reseting arduino.
  • restart IDE.

Code:

# include <Servo.h>
int power=7;
int control=9;
Servo myServo;

void setup() {
// put your setup code here, to run once:
myServo.attach(control);
pinMode(power,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(power,HIGH);
myServo.write(position);
}

please help :slight_smile:

Are you trying to supply 5V to a servo requiring 650 +/- 80 mA stall current from an Arduino Uno output pin that is spec'd to supply 20mA under normal operating conditions?

Hi, @jinghaowangutorontogmailcom

Does.

digitalWrite(power,HIGH);

Mean you are using the digital output pin 7 as the power supply for the servo.

A digital output pin will not be able to supply the current needed to drive the servo.

This will explain how servo works and how to connect and power it.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Thank you Tom,

I've connected to 5V pin at the "power" section, now its working.

Note that the Arduino's 5V output can not supply enough current to make the servos work correctly and reliably. You need to use an external power supply capable of supplying at least an amp.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.