as part of this old thread, I started trying using an old RC servo with arduino.

The one I used (Sanwa SRM 102) has a torque of about 3kg\cm and operates with 5V. I used an external power supply for the servo and made the wiring with the little material I found out on the web. The wires are RED-BLACK-BLACK and it seem to be +-\Signal.

This is the scheme:

enter image description here The problem appears when I try to upload my sketch. The servo tries to push as much as possible forward, forcing and I need to power off it.

Using the "Servo" library, the problem appears whatever I write in the myservo.write(x) statement, and tries to reach always the same position.

I made a little video to show you what I mean:


Maybe being and old servo it uses some different communication protocol?

What can I try?

This is my semplified sketch:

#include <Servo.h>
#define SERVO_PIN 9

Servo myservo;

void setup()


void loop()



EDIT: As suggested, it was just a problem of common gnd.

  • \$\begingroup\$ have you connected the ground of arduino with ground of battery? \$\endgroup\$
    – abhiarora
    Sep 3 '16 at 11:05
  • \$\begingroup\$ It would probably help if you connect the servo power with the same polarity as the battery power. \$\endgroup\$
    – Dave Tweed
    Sep 4 '16 at 11:54
  • \$\begingroup\$ that was an error with the scheme, it was obviously connected correctly, otherwise it woudn't have moved. \$\endgroup\$
    – lateralus
    Sep 5 '16 at 7:25

The program looks fine to me. However, i am not able to see any connection connecting Ground of battery with ground of arduino.

It is very important as there are two different circuits (one is your arduino and other is your servo connected with battery) in your project communicating with a single wire which delivers signal in pulse width modulation form(servo signal). The circuits should agree on same voltage reference which can be achieved by connecting ground of two circuits together.


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