Go Down

Topic: Brand new to Arduino- servo fail right out of the box (Read 668 times) previous topic - next topic

c131frdave

I'm going through the tutorials as I am brand new to the arduino.  I've got a little bit of experience with the BasicStamp, so I'm not a total noob, but close.

I did the servo examples and they worked fine.  Then I wrote a program of my own, one where a sensor is read and if the sensor's input is higher, the arm on the servo moves more.  So zero position is zero, and it goes up to 180 as the sensor input is increased.  The program worked well, but I noticed that the servo was very hot.  After about two minutes, the gears stripped in the servo.  Now it just sits and spins...

So, obviously the range of the servo vs. the range in the code is different, and zero degrees was making the servo try to move the arm past its stop (to some negative angle as far as the servo was concerned).  Is there a way to rescale the myservo.write(pos);  so that the zero degrees is actually the zero degrees on any servo, and the 180 degrees is the actual 180 degrees on the servo?  BTW, the servo I used was the one that came in the Radio Shack basic beginner package (plastic geared junk, imo...).   Thanks!

permnoob

yeah, iirc when you initialize your servo, there is a SetMaxPosition or some such function.  look at the servo library.

ok ok, I did the footwork for you

servo.attach(pin, min, max)

min max is the min position in uSec (ie pulse size, default is 544 and 2400)
http://arduino.cc/en/Reference/ServoAttach

c131frdave

Thank you sir!  That is exactly what I was looking for. 

permnoob

it's rare I get something right, so please give me a second whilst I bask in this...  8)

ok I'm done :smiley-roll:

zoomkat

If you had a small servo, failing to connect the servo grounds with the arduino grounds can cause overheating and erattic behavior.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Go Up