Pages: [1]   Go Down
Author Topic: Brand new to Arduino- servo fail right out of the box  (Read 560 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 171
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Full Member
***
Karma: 0
Posts: 171
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

ok I'm done smiley-roll
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you had a small servo, failing to connect the servo grounds with the arduino grounds can cause overheating and erattic behavior.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: