I modified both my HS-311 servos to rotate continuously. Now here's my problem. How can I get them to rotate both forward & backwards?
I'm using the Arduino Duemilanove to control the servo. But, it seems no matter what degree I set the servo to, it always rotates at the same speed and in the same direction
The servo pot : are you sure they are exactly centered, as shown in the tutorial, before you put them back together? Are they secured (glued) in the center as shown? Do you have an alternate method of driving a servo, like an RC receiver or servo tester to try the modified servos out on?
The program code : Are you using Arduino program code that has absolutely been shown to generate a 1 ms to 2 ms pulse? Do you have an oscilloscope or meter that can verify this? Do you have an unmodfied servo you can plug in, and attempt to move with the Arduino code you have?
What I did was remove the gears and send a signal (with the Arduino) to move the servo to zero degrees:
SOMETHING LIKE THIS:
loop() {
servo.write(0)
delay(1000)
}
and while the gears were spinning I turned the POT such that the gears stopped moving (it was sensitive but I got it)…Then, after testing the servos again to make sure the gears don’t spin, I applied super glue to the POT tabs and let them dry…
The only method I have for driving the servos now is through the example servo sketches that come with the Arduino software, which I modify as need for my testing. I could build something with a 555 timer I guess If needed? Is this needed?
"Are you using Arduino program code that has absolutely been shown to generate a 1 ms to 2 ms pulse? "
YES, THE EXAMPLE SERVO CODE THAT COMES WITH THE ARDUINO HAS A SWEEP SKETCH THAT I USED TO TEST THE SERVOS B4 MODIFICATION…IT SWEEPS THE ANGLE FROM 0->180 AND THEN BACK…THAT WORKED FINE.
"Do you have an oscilloscope or meter that can verify this?"
NO, DON’T HAVE ANYTHING TO MEASURE SIGNALS LENGTH…I’M ASSUMING UNDER THE COVERS OF THE ABOVE EXAMPLE CODE THAT IT’S SENDING THE CORRECT SIGNALS, BUT AT THE API LEVEL I ONLY SPECIFY THE ANGLE I WISH THE SERVO TO MOVE TO.
Do you have an unmodfied servo you can plug in, and attempt to move with the Arduino code you have?
YES…AS NOTED ABOVE, TESTED THE CODE ON THE UNMODIFIED SERVOS AND CODE DID WHAT IT WAS SUPPOSED TO DO.
MAYBE WHAT YOUR GETTING AT IS WHAT EXACTLY THE CODE IS DOING UNDER THE COVERS…DONT’ KNOW, MAYBE SHOULD TAKE A LOOK AND BE SURE THAT IT’S SENDING THE CORRECT SIGNALS…HOWEVER, (sorry, realized I’m typing in all caps!!) I think the signals are correct because the test code worked for the unmodifed servos?
You appearently have good working code, as the unmodified servos reacted as expected when driven. You could also try the unmodded with the API, to verify that added code operation as well.
All that is left is a possible "unglueing" of the internal pots in operation. That the gears rubbed enough on them to move the pot off center. It is sometimes tough to secure weel and some have pointed the pot out sideways from the case. Not sure how well that will work with the servos you have.
Maybe should have used 90 when zeroing… That does make some sense…if I’m controlling the servo by sending it degrees from 0-180 and I set it to zero for “zeroing” the servo before gluing the POT…then it might make sense I can only go up from there. But there are still some questions:
1) If that was the case it will only rotate in one direction (which is happening) but, should I have speed control? (i.e. set to 1 degree and servo will rotate very slowly but, set to 180 and it should be at MAX rotation).
2) Why does the servo rotate at all when I send it a 0 degree rotation command if that’s the degree that I used for “zeroing” the servo before gluing the POT. There should still be no rotation. Perhaps the comment above referring to the glue messing with the circuitry was correct AND/OR the pot moved during gluing?..Maybe I’ve got to try to un-superglue the darn thing and check that pot
Thanks again for all the insightful advise from everyone!
The guys are totally correct, here. I think this tutorial was written assuming you had your servo connected to radio control gear and that the transmitter was switched on with the stick centred.
The thing is that your servo is always trying to find an equilibrim. Your code has told it to go to position 0, but the pot has told the servo that it’s at position -1 (for example). So no matter what you do to your code teh servo is always going to try to get to a position greater than -1.
I found adjusting these pots was a rigt regular pain in the ass. It was OKay doing one, but I could never get two of them adjusted in an identical fashion, so my robots never went in a straight line! I ended up desoldering the pots alltogether and replacing them with a pair of matched resistors as a potential divider. This works great, but the resistors MUST be high-accuracy, like 1% or better.