1

I have connected my servomotor (MG996R) to my L293D motor shield, which is connected to an Arduino Uno R3 Board.

I use 4x AA 1.2V NiMH batteries to power the shield, and a regular 9V battery to power the Arduino separately. I've removed the jumper wire on the shield.

I've tried uploading all the example codes I could find, multiple times, yet none of them work. The servomotor simply doesn't move at all.

Is there anyway I could see if my servomotor is broken ? Maybe the wiring is wrong, but I don't think so. Orange is for signal, Red is for + and Brown is for GND.

Could someone help troubleshoot the problem ? Thanks !

PS : here is the example code I use

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

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

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}
2
  • 1
    You said that you are using L293D shield. What is pin 9 then? And why are you trying to use <Servo.h>? Your code is intended to work with servos attached directly to Arduino. It will not work with servos attached to some external shield. Your shield is supposed to have its own library/protocol for controlling stuff attached to it. Commented May 23, 2019 at 14:19
  • Pins 9 and 10 are the ones used to control the Servo pins on the L293D. I've just tried to plug in another servomotor and it works just fine when I use pin 10, which matches the "SERVO1" pin on the L293D.
    – Riemann
    Commented May 23, 2019 at 14:26

1 Answer 1

1

You have two problems Both of them is related to your power supply :

  • 1st, max. Voltage requirement for your servomotor is 6 volts, not 9 volts

  • 2nd، your batteries are weaker than servo's need. Your servomotor need 2.5 Amps. In the max. Torque.

So, over-voltage and not enough current is your fault (According to 996R servomotor datasheet). Change your power supply by suitable one

Your Answer

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

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