360 Servo, need help for final project, low on time

Hello, thank you for coming to my aid...

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 :slight_smile:

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.

Stepper Motor Basics
Simple Stepper Code

Those are "continuous rotation servos" . They are standard servos with the positional feedback disabled, so they are no longer servos.

If it were up to me, I'd have finished it long ago, sadly the parts arrived way too late, it was out of my control.

It is a Continuous Rotation Servo, Pololu - SpringRC SM-S4303R Continuous Rotation Servo this one, if I'm not mistaken.

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?

Thank you for your reply.

To make it rotate at a known rate, you'll have to add some form of feedback, like a shaft encoder.

#include <Servo.h>

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 :slight_smile:

motor.attach(6); // attaches the servo on pin 8No, it doesn't

And the pointers move the desired angle during the delay(100)?