Society of Robots - Robot Forum
Mechanics and Construction => Mechanics and Construction => Topic started by: dellagd on March 15, 2009, 12:07:50 PM
-
I am doing the servo modification tutorial and I am stuck here.
5) Next we need to center the servo. Do this by plugging it in to your controller and send the signal required for it to go to 0 degrees. You should probably see the gears rotating without stopping. Now rotate the pot head (no, not that type of pot head) so that the gears stop rotating. It will probably be very sensitive so take your time. It is very important for this to be perfect. Get some superglue and glue the pot head to make sure it remains in place.
when I send the zero command, all the servo does is twitch about 15 degrees.
It does the same thing when it is fully assembled.
is this a servo, program, or circuit board error?
(my guess is that when the microcontroller goes on(I am usein 4x1.5v batteries)it takes so much power that the batteries get drained and it only has enough thime to rotate 15 degrees)
-
You want to make it so your servo gets set to the position 0. I did it by hand, by making a program so if degrees is not 0 it would move, than when it stopped moving I glued it.
Make a program to spin servo to 0 degrees or do something I did. Also 6V of battery is enough, I have been using it, and I have been using the same pack for a while (not rechargeable)
-
if it isn't to much of a hassle, offy could you post the code for zeroing the servo(I am new to robotics programming(I know a fair amount of c++ for the computer, but not for robotics))
-
Ok I will type up a program really fast and test it. I will update post in a few.
This should work. I tested it on my servo and it went to 0.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos < 0; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
After you run this it should be at 0.
-
Note that 0 in the arduino program does not center the servo, 0 means it is all the way to the left or right.
-
The servo I was testing was a stupid little one. All my hs-311 ones are modified so I can't test them. I like soldering 2.2k ohm resistors.
-
where did you get the servo.h?
EDIT - I found the servo.h
-
Offy -
Even with the "servo.h" file, I can't get the program to compile. The most major error as I see it it that the compiler says that there is no such thing as a "servo object"
sorry for my noobishness as it is probably my own error and I don't mean to say it is your program that isn't working
-
is it servo.h or Servo.h
Also what microcontroller are you using?
-
Note that 0 in the arduino program does not center the servo, 0 means it is all the way to the left or right.
I wish someone would have told me that before I attempted my modification.
-
atmega8