1

I purchased a 20KG Digital Servo, DS3218MG with a Control Angle of 270° .

I am trying to get it to rotate with the following code:

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

int restingVal = 0;
int keyDown = 80;

void loop() {
  int minutesDelay = 1;
  Serial.print("Value");
  Serial.println(restingVal);

  delay(10000/2);  

  myservo.write(keyDown);
  delay(500);
  myservo.write(restingVal);

}

It makes a small "clicking" noise, but it never moves. I have tried:

  • powering it from the arduino using a USB cable
  • powering it using a power cord plugged into an electrical outlet
  • powering it with 4 AA batteries in a battery pack (power from the battery pack to the servo with it's ground to the Arduino's ground and the arduino plugged into an outlet)
  • using a 470uF capacitor and then tried a 680uF capacitor.

What am I doing wrong? Is there something else I could look at?

update: changed code to:

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  myservo.write(60);
  delay(2000);
  myservo.write(120);
}

int restingVal = 0;
int keyDown = 80;

void loop() {

}

I get the same problem.

The power cord I'm using to connect the arduino is 12V DC 1A.

Here is a photo of the wiring in one configuration (with the battery pack and the wall outlet): enter image description here

Orange wire goes to GND on arduino, the long green goes to ~9, yellow goes to VCC on battery pack.

6
  • 3
    It can require a peak of 1.8 A. Can the batteries do that? Try a small common servo motor.
    – Jot
    Nov 27, 2018 at 6:41
  • When I replace it with a tiny servo, it works fine. Nov 28, 2018 at 2:31
  • You should proivde schematic. It's unclear from given image
    – Pararera
    Nov 28, 2018 at 4:32
  • 1
    The batteries are perhaps too weak, the wires too thin and the breadboard can not handle those currents. Perhaps with a 5v 2a power supply, with good wires, and good connections it will work. Keep the grounds connected. @SilvioCro, I was able to follow the wires from the photo, the wiring is okay.
    – Jot
    Nov 28, 2018 at 11:16
  • @Jot Look at orange wire. Looks like it's plug into GTND rail.
    – Pararera
    Nov 28, 2018 at 12:27

2 Answers 2

3

The DS3218MG servo motor is a strong servo motor and it requires more current than normal servo motors.

With a normal servo motor the peak current can be 500 mA or even 1 A. This DS3218MG is specified somewhere at 1.8 A stall current (only 80 to 100 mA during normal operation). However this YouTube video measures a stall current of 2.3 A.

During normal operation, the average current will not even be near the stall current. The peak current on the other hand can be close to the stall current. The peak current occurs at the moment that the servo motors starts to move.

You need a 5 V 2.5 A power supply for that servo motor, together with wires and connectors that are suitable for that current.
You could cheat a little by adding a capacitor. I suggest 2200 µF or 4700 µF.

It is a common mistake to underestimate the current of a servo motor. A power supply is often more expensive than the servo motor.
If a lot of torque is required, perhaps a geared motor is easier to use.

2

My guess is that the servo is drawing too much current from the Arduino 5v pin which can provide up to ~450mA when powered from USB and ~650mA from power jack.

Try providing 5v from an other source to the servo while keeping the GND of that power source and the Arduino common.

2
  • I guess he uses power from two differend sources
    – Pararera
    Nov 28, 2018 at 4:33
  • This may be a really simple question, but what kinds of other sources are available? I added the 4xAA battery pack to provide dedicated power to the servo, hoping it would help. I thought about using a 9v battery, but the servo says "DC 4.8-6.8v" Nov 28, 2018 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.