Electronic – arduino – Problem with Arduino UNO and RC servo

arduinoservo

This is my first attempt to work with a servo and I'm using this tutorial. I have a "TowardPro MG996R DIGI HI TORQUE" servo directly connected to my Arduino Uno as follows:

Servo connected to Arduino

I also created the following code to upload onto the Arduino:

#include<Servo.h>

Servo myservo;
int servoPin=9;

void setup(){
  myservo.attach(servoPin);
}

void loop(){
  for (int i=0; i>= 20; i+=20){ // increment by 20 degrees
    myservo.write(i); 
    delay(1000);
  }
}

After hooking up the servo wires to the Arduino (unpowered), I then hooked up the USB power source to my Mac computer (no code uploaded yet). However when I did this, I noticed a very strange reaction:

  1. The servo motor instantly started rotating in small increments about once every second or so, like a pulsing.

  2. The message "A new network interface has been detected" keeps popping up and closing at the same frequency as the servo's motor.

  3. The periodically appearing message prevented me from uploading my code onto the Arduino.

Of course, I thought something was wrong and promptly tried to disconnect the power source and reconnect it several times with no improvement. So, I tried the following steps:

  1. Disconnect the USB power to the Arduino.
  2. Disconnect the servo wires from the Arduino.
  3. Reconnect the power usb to the Arduino.
  4. Upload the code.
  5. Disconnect USB power source.
  6. Reconnect servo wires to the Arduino.
  7. Reconnect the USB power source.

Now, I'm having the following problem:

  1. The servo motor does not rotate.
  2. A hissing noise is coming from the servo.
  3. The message "A new network interface has been connected" does not appear.
  4. My computer does not recognize anything at all connected to the usb port where the Arduino is connected to.

At this point, I have no idea what the problem is or how to fix it. Any help to understand where I went wrong and how to remedy it would be greatly appreciated.

Best Answer

Your servo may behave erratically, and you may find that this only happens when the Arduino is plugged into certain USB ports. This is because the servo draws quite a lot of power, especially as the motor is starting up, and this sudden high demand can be enough to drop the voltage on the Arduino board, so that it resets itself.

If this happens, then you can usually cure it by adding a high value capacitor (470μF or greater) between GND and 5V on the breadboard

http://learn.adafruit.com/adafruit-arduino-lesson-14-servo-motors/if-the-servo-misbehaves

As others have commented, if your servo requires more current than the Arduino (or your USB port) can supply, you should provide a separate power connection for the servo.

Your USB port may be limited to 100mA or to 500mA, the Arduino may be able to provide slightly more current at 5V if it is connected to a power source through the barrel-jack connector. It depends on the specifications of the 5V regulator on your particular Arduino (or clone).

If you power the Arduino from a regulated 5V supply, you can draw higher currents from the VIN socket.

I note that some retailers of your servo suggest it be used with a motor controller board.

Related Topic