# Controlling the rotational speed of servo motor

Hi guys,

I have to control 10 servo motors together at the same time. Also I want them to move very slowly 180 degree during 10 hours. Basically it’s kind of sun tracking project but it’s not pv panel.

Does anyone have any idea how to make them move very slowly or at least give them exact position every minute and its going to be exhausted to write

I attached a photo of the project.
Also I thought about using stepper motor but I didn’t know how to control 10 motors with 1 arduino and even with driver the maximum I found was 6 motors

You can use servo motor as well.
If you want to use 10 stepper motors, you can use this controller . You can stack up to 14 controllers on a single Arduino. This controller is very easy to use. There is only one issue: it is expensive

Many hobby servos have limited accuracy. You should experiment with one and see if it meets your needs.
Use servo.WriteMicroseconds() rather then servo.Write(). This gives you the great end control of the servo.
You will still be limited by the servo but you will not be introducing the additional inaccuracy of mapping degrees into microseconds.

Moving slowly is not the problem. Calculating what angle to move it to is the trick. As frequently as you want, every second, every 5 seconds, every minute, whatever, calculate the angle you want the servo to be at and tell it go go there. If it is the same location, the servo won’t move.

I expect that each servo will need to have the angle computed independently. Have you worked out that math?

vinceherman:
I expect that each servo will need to have the angle computed independently. Have you worked out that math?

Yes, pwm_width = map(angle, 0, MAX_ANGLE, WIDTH_MIN, WIDTH_MAX );

see explanation in How servo motor works

Actually, I was referring to the angle that each mirror will need to be placed at to focus on the target.
From the OPs image

you can see that each mirror is at a different angle. That angle will need to be computed for each mirror. I am curious about the math for that.

Its called trigonometry, figure out the triangle, figure out the expression, combine with the solar
incidence angle to get mirror angle (which is halfway between incoming and outgoing ray angles).

servo.writeMicroseconds can be used for finer resolution than 1 degree, but microseconds come in increments of 4 so the range of 0 to 180 degrees (544 to 2400 us) , 1856 us / 4 = 464 increments. I doubt would be fine enough resolution for your application, your sunbeam might jump from one side of the target to the other.
I have tried that before. All the servos I tried would either not move or sometimes jump 2 or more increments.

salahessam:
Does anyone have any idea how to make them move very slowly or at least give them exact position every minute and its going to be exhausted to write

That part is easy, calculate the current position they should have and write it to them, as often as you like,
it won’t matter if you do it every minute or 10000 times a second, the servos will obey without problem.

You need a formula to calculate the angle of each mirror at a given point in time, and put that in a function,
then you can call it for each servo, something like:

``````int servo_angle (float servo_position, float time_of_day)
{
return ......
}

void loop ()
{
for (i = 0 ; i < NUMBER_SERVOS ; i++)
{
servos[i].write (servo_angle (servo_positions[i], time_of_day) ;
}
...
...
}
``````

Use arrays for position information, the servo objects, then iterating through them is easy as above. You’ll need to figure out how to represent time (minutes past midnight perhaps?)

Another question for the OP.
Single axis or dual axis?