servo problems

Hello,

i have got some issues with getting a servo started.
i had a thread for this here: http://arduino.cc/forum/index.php/topic,88394.15.html
but it turned out to be some hardware problem.

so:
i have got an arduino uno and the servo from the arduino store. when i test it with
the servo-sweep example, it does not move. instead you can hear some buzzing
getting louder and quite in a loop. when i plug an LED instead, its lighting brighter
and darker in that same loop.
the battery supplies 7.2 volt, i tested it with another servo (same model), installed
other software versions, tested with a wall-power-supply, changed wiring.
attached you can see the latest picture of it.

what is wrong???
i am working on this since 4 days :frowning:

thank you in advance

You need to show the code you are using and if you are powering the servo directly with 7.2v you may be damaging it if its max rated voltage is 6v.

ok, i will try keep the current at 5V later this evening.
the code i am using is exactly this:
http://arduino.cc/it/Tutorial/Sweep

in addition i ordered another servo for testing. i hope i can get this all started soon!

by the way: which equipment do you recommend for driving 3 servos and one motor?
another board or/and the motor-stepper-servo-shield?
in case i try to drive servos with the uno controlled with flash (as3glue -> firmata),
it is just possible to run 2 servos (on pin 9 and 10).
what do you recommend?!

thank you so much!

Below is some simple servo test code you can use with the serial monitor, and bottom is a basic wiring diagram for a servo.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 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.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7);  //the pin for the servo control 
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}

something that is poorly documented AFAIK is that your arduino can only run 2 servos on whichever pin has a 16bit timer. Atleast with the library you are likely using. I know you CAN controll more on other pins, but less neatly.

try your code, unchanged, but on pin 9 or 10. that could be your whole problem

take this with a grain of salt, i have been playing w/ arduino for a bout 3 weeks and this is my first microcontroller experience ever. learning as i go

Hi,

Have you tried putting a 1K resistor on the servo signal connection ?

Also I am not sure from your post whether you have managed to get the servo sweep example working or its just your code which has the problem ?

Duane B

rcarduino.blogspot.com

Hi,

Have you tried putting a 1K resistor on the servo signal connection ?

Also I am not sure from your post whether you have managed to get the servo sweep example working or its just your code which has the problem ?

And as to -

DuaneB:
something that is poorly documented AFAIK is that your arduino can only run 2 servos on whichever pin has a 16bit timer. Atleast with the library you are likely using. I know you CAN controll more on other pins, but less neatly.

The poster does point out that they are a bit new (me too) but I have spent some time today looking at the code for the servo library and it definitely supports upto 12 servos on any of the freely available pins. As the other poster has suggested I have seen reference to earlier versions of Arduino and the library only supporting pin 9 and maybe 10, but that is no longer the case.

As for for whether it is neat or not, I was very surprised at how simply it is achieved, so yes lots of servos on lots of pins, and to my mind its neat too. I am writting a post for my blog on this subject as its one of the most commonly recurring themes on the forum.

Stay tuned...

Duane B

rcarduino.blogspot.com

take this with a grain of salt, i have been playing w/ arduino for a bout 3 weeks and this is my first microcontroller experience ever. learning as i go

Yes, I can see that. The below has some current info on servo code for the arduino. As to the suggestion to use a resistor on the servo control line, I've never had to use one on the servos I have connected to my arduino.

his blog is fantastic, anyone following this thread with questions should look into it. can the original poster copy and paste ALL his code as it is being used? also do you have wall power you can use on your arduino? if so I would do that, and use the 5v plug on the arduino board to feed the power to the servo, take the battery back out of the picture all together. does the uno have a ext power/USB power switch? I would set it to ext so you are only using data on the USB and not the power, just to protect ur computer.

The BEST advice I can give is check your wiring and then just use one of the example files like SWEEP, and then if that works go back to your original problem.

ok one quick question than i will stop derailing this poor guys thread.

zoomkat: I saw that and was excited about it, but since I am using a sanguino personally (may move to mega) i can not take anything for granted that the new stuff works on my hardware. I know for a fact the Sanguino will ONLY work on the pins connected to the 16 bit timer. Tested it on my desk, pin 9 wouldn't do it for me, which is the pin in the example code, changing it to 13 worked on my sanguino though. My question to you however is, when using the new servo library on pins that aren't 9&10, does the servo continue executing code while the pulse is being generated, or does it need to pause to update the servo? my tiny comprehension of the way pins and timers work say this can only be done in the background with 16 bit timers, but could be done on any pin using software control of the pin. bitbanging i do belive is the technical term?

hey guys:

@zoomkat: i am waiting for some electronic components,
amongst others a low-dropout regulator. think i will be able to test it on monday.
basically i have wired it that way, though. i does not work.

@permnoob: well, i am driving it on pin 9 / 10 ... bootless :confused:
but, thanks for your encouragement :slight_smile: i will keep my head up!

@DuaneB: i put that resistor in between, but i does not work, too.
event that sweep example does not drive the servo. the same buzzing.

i ordered new (other) servos, and that low-dropout regulator to do some more tests.
if the board was broken, i would not be able to lighten an led, right?

i am looking foreward to your blogpost duaneB !!!

Hi,
I have the answer in a draft blog post. I will tidy it up over the weekend and post it. Cut a long story short, the timer works like an interrupt so your loop code stops while the library quickly pulses the pin then lets your code carry on. Its actually a bit better than that but you can wait a day or two for indepth anwer :wink:

Duane B.

but since I am using a sanguino personally (may move to mega) i can not take anything for granted that the new stuff works on my hardware.

You should be careful in your post that your issues/solutions apply to the "sanguino" and possibly not to a standard arduino. I don't have knowledge of a "sanguino" so I can't speak to its particular issues.

@zoomkat: i am waiting for some electronic components,
amongst others a low-dropout regulator. think i will be able to test it on monday. basically i have wired it that way, though. i does not work.

Buzzing from a servo can be the result of mal formed control signals to the servo (often causing it to turn until it hits the servo internal stop), or failure to properly connect the grounds between the arduino and the servo power supply. You probably need to explain your intentions with a "low-dropout regulator". I power my test servos using a wall wart and a 7805 regulator chip setup like below. They work with no issues.

zoomkat: Yes I am trying to make sure I mention that in every post, I know how quickly it can get confusing, I am going to make myself a signature.

DuaneB: He is not using Servo signals for input, he is getting his input from a computer over a USB cable

DerFloh: since it is really confusing to go back and forth between the two threads, can you post a picture of how it is all wired up right now? and a copy paste of the exact code you are using. that way we are all on the same page. a quick search on your servo says its a continuous rotation servo? the arduino store has no info on it, but i CAN run @ 6v just fyi, i would assume it was a regular position servo, not continous rotation but googleing the part number in the stock photo turns up confusing info. can you post the part number on your servo?

lunch is over, gotta get back to work.

I'm sorry that photo at the top is the current wiring correct? hook up some wall power to the arduino power plug. If so I would say disonnect the power supply you have attached to the bread board, and connect a wire from the + power rail on the top of the board to the 5V pwr on the arduino. might fix it.

oops had to edit that, made a mistake looking at teh photo

well, to be honest i tried the wiring in every way. definitely. even what you ment in your latest post.
the picture from the very beginning of that thread, is what it is wired up at present.

with the lowdropout regulator (not quite sure if thats the name) i want to turn 7.2v to 5v

i have no additional info from that servo. the shopinfo is all i got, too. on the servo you can read: "springrc sm-s430r"

Buzzing from a servo can be the result of mal formed control signals to the servo

thats what i thought about too, but i have got no idea of fixing that.

@DuaneB: i am soooo looking forward to this blog post!!! i wont get to do some more test until monday,
so i can wait two days for your answer. this would really help me on!!!

thanks guys

thats what i thought about too, but i have got no idea of fixing that.

Appropriately use servo code and that will not be a problem.

you are trying to use the sweep example code, right? I suspect a bum servo at this point.

@permnoob, are your earlier replies in any way tainted by your other post regarding servos and arrays?