Go Down

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


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!


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)


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


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:


If you had a small servo, failing to connect the servo grounds with the arduino grounds can cause overheating and erattic behavior.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Go Up