Servos not reacting to PWM (independently powered)

Hey there,

I have set up my Arduino to run a test program through a servo (sweep, from the examples). The servo is separately powered by a wall-wart supplying 6V. The code just makes the servo sweep through its range of motion.

This was working flawlessly a week ago, now it’s not.
The servos are getting 6V. The PWM is being rendered to the pin. If I connect the PWM output to an LED I can see it changing brightness in accordance with the anglular PWM that is being sent to the motor.
But if I take the lead from the LED and plug it in to the servo, nothing happens.

Now, I may have been an idiot earlier and accidentally mixed up the servo pins. I was worried that I’d blown my Arduino chip, but since its still writing PWM to the pin I’m guessing this is not the case? It should just not work at all if Id managed to do that, right?

Anyway, I’m on PC Windows 7, With Arduino uno.

Here’s the code;

// Sweep
// by BARRAGAN <> 
// This example code is in the public domain.

#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
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>=1; 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 

Thanks for any help!

Now, I may have been an idiot earlier and accidentally mixed up the servo pins.

That presents the possibility that you may have damaged the servo. More likely your wiring is now not correct, is lose, or not making proper connection.

Do you have a multimeter to measure the voltage of the wall-wart ? If it is rated DC 6V, the output might be 10V.

It is possible to have an Arduino pin that is only partly working. It is not likely, but it is possible. If you connect a led to it, you use a led and a resistor ?

Did you connect the GND of the Arduino to the '-' of the servo/wall-wart ?

Perhaps you should use a regulated power supply, and a new servo motor.

I had the problem where I did not connect the independent power supply's '-' terminal to the Arduino's GND pin. After that it the servos worked perfectly.

Note that a servo needs a PPM signal which is what the examples in the Arduino IDE generates.

Your issue is likely a grounding problem as stated above, make sure that the negative side of the walwart is connected to the arduino's ground pin.

Yep, totally right guys, grounding didn't go back through the Arduino. Please forgive my noobishness.

What I don't get is why it makes a difference. Given that a path to ground should have minimal resistance, both grounds meet up in the end either way and so I thought the two circuits are equivalent?

Currently the arduino grounds through the computer's USB, which (I presume) goes right through to the same mains power board that also supplies the wallwart that powers the servos. If the computer's earth offers no resistance it can be removed from consideration, right? The circuit is then the (-) from the arduino returning to the powerboard and meeting the wallwart (-) there. The only difference is the length of the piece of wire before they meet - so my (obviously wrong) logic tells me that they are equivalent.

Or does the secret lie in the fact that the Computer has a (-) and a ground, and they are not the same thing? (then why does the arduino board have a ground rather than a (-)?

Thanks for the suggestions before. I am now back up and running, even though I am yet to understand quite why :-)



A wall-wart uses a transformer. The old 50Hz/60Hz transformer or a switching power supply with a high frequency small transformer. So the (-) and (+) output are not connected to earth ground.

The USB connector of the computer 'could' be connected to earth ground, but not always. At least not with a laptop.

Suppose you connect both sides to earth ground, that will still go wrong. Current peaks and noise will make the Arduino go nuts.

Using ground earth as an electrical wire is something for shortwave radios.

For proper operation the small amount of current flowing from the arduino to the servo via the servo control line needs to return back to the arduino. Current usually follows the path of least resistance. If a ground path is lost, the current may flow thru other paths to ground, sometimes resulting in smoke or equipment damage.