Hey, this is a great place here. I'm the proud owner of a Arduino Deuamillanove . I've also bought a regular servo and modded it so it could move 360degrees.
The way I did this was simply remove the metal block preventing it from making a full 360degrees. What I need the servo to do is start at a position (moved by hand if need be) , then turn 360degrees and stop. Then turn again, etc..etc.
Here is my code:
#include <Servo.h>
//Servo servo2; // create servo object to control a servo
Servo servo1;
//int pos = 0; // variable to store the servo position
//int flag=0;
void setup()
{
servo1.attach(9); // attaches the servo on pin 9 to the servo object
//servo2.attach(6);
}
void loop()
{
servo1.write(120);
delay(1540);
servo1.write(132);
delay(500);
}
Some lines have been commented out, I'm waiting to get this to work properly and then i can add on other servos (total of 6 in the end).
Through experimentation i've found that values below 130 move the servo clockwise. Values above 140 move it counter clockwise. 132 is the value i need to write in order for it to stop. I have a feeling this is only true for THIS servo, and will need to find these values again for the other 5. I think it's because when modding it, I didn't adjust the potentiometer (though it is still attached inside, not connected to the main gear though) . Is it necessary to adjust it, even now? If yes, how would i do that?
I don't have a problem actually finding those values, just takes time. The real main problem is with the bigger delay of 1540ms it does make a full circle the first time. Then it slowly increases, 370deg, 380deg, etc .. I don't understand why this is happening? I've tried adjusting the delay time but i either have it going too much or too little (it starts going backwards 350deg, 330deg ) . I did find a value where it was doing 360degrees exactly for about 5 turns, after that it would go either too much or too little. Is there anyway to control this at all , i dont even understand WHY it's doing this..any help, suggestions or even an idea as to what's happening would be greatly appreciated.
Lastly, my biggest worry here is that the delay im using will NOT be the same for the other servos, again i think this has to do with the pot, any ideas on how i could keep consistency ..the motors are required to move together so i can only give one delay for the motors.
Wow, that was a long post ...thanks again and its great to be on these forums, hoping to learn a lot!