Arduino + Servo Help

I'm trying to set up Arduino to use the Sweep code on a servo I have.
I am using an Arduino Uno and this servo: http://toysdownunder.com/light-weight-servo-3-7g.html

I plugged the gnd in, the signal cable to digital pin 9 and the power cable to 5V. When I plugged it into 5V however the Arduino would turn off, take it out and it would start back up again. So I plugged the power cable into 3.3V and the Arduino would stay.

Anyway this setup isn't working for me, as the servo isn't working. Is this because the servo I am using is busted from me trying to use it on 5V when it is recommended for 4.8V? Or perhaps its because the Arduino is feeding off the power from the USB? Any troubleshooting advice would be great.

Generally, the arduino can't supply enough current to drive a servo, you need to use a separate power supply & tie the grounds together.

I hooked it up to a lab power supply and set it to roughly 4.8V (hard to tell as it is an analog interface). Still no go but I haven't tied the grounds together, what do you mean by this?

I would also like to add upon using the read() function of the Servo library, it just constantly reports 1 (even if i manually change the position by hand)

Narwhal:
I hooked it up to a lab power supply and set it to roughly 4.8V (hard to tell as it is an analog interface). Still no go but I haven't tied the grounds together, what do you mean by this?

Ground on the servo power supply and ground on the arduino need to be connected

I am actually powering 5 servos with a single arduino and it works fine.

njkl44:
I am actually powering 5 servos with a single arduino and it works fine.

Then you might be using especially small servos with possibly little or no machincal load on them and possibly not trying to have them all move at the same time. Servos have motors in them and are best powered from external voltages sources capable of supplying much more current then the Arduino USB or external power connector is designed to provide. What you are doing is not a recommended practice.

Lefty

retrolefty:

njkl44:
I am actually powering 5 servos with a single arduino and it works fine.

Then you might be using especially small servos with possibly little or no machincal load on them and possibly not trying to have them all move at the same time. Servos have motors in them and are best powered from external voltages sources capable of supplying much more current then the Arduino USB or external power connector is designed to provide. What you are doing is not a recommended practice.

Lefty

Here, i do power them all at the same time, they do have a good amount of load, and here is my instructable with a video: http://www.instructables.com/id/Arduino-Wireless-Animatronic-Hand/

Narwhal:
I would also like to add upon using the read() function of the Servo library, it just constantly reports 1 (even if i manually change the position by hand)

The servo read method does nothing to report the actual position of the servo.
It only reports the last value sent with a servo write.

[/quote]

Here, i do power them all at the same time, they do have a good amount of load, and here is my instructable with a video: http://www.instructables.com/id/Arduino-Wireless-Animatronic-Hand/
[/quote]

Very impressive project. What is the power source for the arduino/breadboard +5VDC that is driving the servos?

Lefty

OK so I still can't get this going,

Servo has signal connected to digital 9, positive connected to lab power supply, negative connected to lab power supply, and there is also a wire connecting the negative lab power supply terminal with the gnd in the arduino.

Yet no movement, I am following the Sweep tutorial (and the model is posted in the original post)

Do you have another servo you can try?
Do you have and RC transmitter/receiver that you can hook the servo to to test it for proper operation?

Well, I recently did this and it worked fine for me 1st time. Still what are the possible source for errors and have you checked them all?
1: Wiring. The picture of your servo is Brown, red, orange, the schematic on the Sweep tutorial shows Black, Red, Yellow. You have the orange to pin 9, the brown to GND and the Red to +5V, right?
1a: Check the wiring again. :stuck_out_tongue: Good connections? Is there actually power? To BOTH the Servo and Arduino?
2: Loaded the "wrong" program into the Arduino, or not loaded at all.
2a: Program not running (something is blocking Arduino execution) Modify Sweep with digitalWrite(13,HIGH) before the first for-loop and the same with "LOW" before th other, to verify that your loop is looping. (the onboard LED blinks, slowly). Alternativly put insome Serial.print() calls. This loop will run whether the servo is connected or not.
3: The Servo is broken. See previous suggestions by vinceherman

That servo shown on your picture seems tiny enough to power from your Arduino. If it takes too much power, the Arduino would reset. You might notice that on the starnge/modified LED blink

Simple servo test code that should make your servo move if power, wiring, the servo, etc are ok.

// zoomkat 10-4-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// for IDE 0019 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-21"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(1);  
    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
    } 
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n;
    char carray[6]; //converting string to number
    readString.toCharArray(carray, sizeof(carray));
    n = atoi(carray); 
    myservo.writeMicroseconds(n); // for microseconds
    //myservo.write(n); //for degees 0-180
    readString="";
  } 
}

I would also like to add upon using the read() function of the Servo library, it just constantly reports 1 (even if i manually change the position by hand)

It has been pointed out that the read method only reports the last value written.
Maybe this is telling us something about the sketch the OP is using.

I would also like to add upon using the read() function of the Servo library, it just constantly reports 1 (even if i manually change the position by hand)

Anyway this setup isn't working for me, as the servo isn't working. Is this because the servo I am using is busted from me trying to use it on 5V when it is recommended for 4.8V?

You can strip the gears in a servo by twisting on the servo horn. Probably too late.

Is it possible the servo is bad or connected improperly? (The positive voltage switched with the variable lead) I have also purchased a DOA servo with a cold solder joint, that when re flowed, worked fine.
-E