# Controlling an old servo with arduino [duplicate]

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:

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()
{
myservo.attach(SERVO_PIN);

}

void loop()
{

myservo.write(0);
delay(5000);
myservo.write(30);
delay(5000);
myservo.write(50);
delay(5000);
myservo.write(90);

}


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

• have you connected the ground of arduino with ground of battery? Sep 3 '16 at 11:05
• It would probably help if you connect the servo power with the same polarity as the battery power. Sep 4 '16 at 11:54
• that was an error with the scheme, it was obviously connected correctly, otherwise it woudn't have moved. 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.