I've got to make an analog clock using servo motors to move the pointers and I'm wondering how I can set certain servos to move like pointers for seconds, minutes and hours.
How can I set, let's say the seconds servo, to move 6 degrees every second like a pointer would on a clock? I'm using SM-4303R 360 servos.
If you have left it too late to complete your project you will not find much sympathy here
When you say "360 servo" do you mean a continuous rotation servo or a servo that can move between 0 and 360 degrees with position control?
Continuous rotation servos are really just DC motors in a convenient package and you can control their speed and direction but not their position.
If this does not make sense then post a link to the datasheet for your servo.
Have you considered putting a rotary encoder on the output shaft - that could be used to identify the position. However the cheaper encoders just report the relative position and you will need some additional hardware to identify a HOME or ZERO position from which to start counting.
Another option might be a stepper motor. But they, also, will need some means to establish the ZERO position. And stepper motors are very inefficient.
If all I can do is control the speed and direction, that's fine I guess, but how can I control the speed exactly? I could just make it go slow enough so it makes one rotation in a minute?
Servo motor; // create a servo object to control a servo
int mspeed = 1500; // variable to store the motor speed
void setup() {
motor.attach(6); // attaches the servo on pin 6 to the servo object amotor
}
void loop(){
// Run Motor
mspeed = 3000; //set position variable
motor.writeMicroseconds(mspeed); // tell servo to move as indicated by variable 'mspeed'
delay(100); //time for the servo to move
//Stop Motor
mspeed = 1500; //set position variable
motor.writeMicroseconds(mspeed); // tell servo to move as indicated by variable 'mspeed'
delay(60000); //time for the servo to move
}
This works, all I need to do is change the stop day, 1000 for a second, 60000 for a minute, etc. thanks to the people who replied