Steve hi, after making your SP10 clock (great design, see picture) I started designing my own clock using your motor controller. The idea is that the seconds would be a separate dial with Geneva mechanism (see attached picture). In order to make it more alive I want each cycle to be 20 seconds so it moves faster.
I am currently using the SP10 RPM. I want to triple the RPM. Can you please help with the correct numbers I should replace in the code?
Thanks. Rami.
Thank you. I will post the results once completed.
Hi Rami,
If you are trying to make the motor turn exactly 3X faster, then find the switch statement for SP10 and tripple the number of steps while reducing the delays to 1/3. One example would change from this:
case 1: // 4.630 RPM (SP10 with 200 step motors)
motor_steps = 246; // 3200 / (60/25*15/25*9) = 246.9135802
extra_steps = 74; // 913580246 extra steps every 999999999 seconds
extra_step_time = 81; // (74 extra steps every 81 seconds)
min_motor_delay = 1930;
max_motor_delay = 2040;
break;
to this:
case 1: // 4.630 RPM * 3
motor_steps = 738; // 246 * 3
extra_steps = 222; // 74 * 3
extra_step_time = 81;
min_motor_delay = 643; // ~1930 / 3
max_motor_delay = 680; // 2040 / 3
break;
The delay values don't have to be exactly 1/3. The algorithm will switch between the min and max values to track the RTC. The key is that there needs to be 3X as many steps per second.
One optimization would be to spread out some of the extra (partial) steps that occur every 81 cycles. Increase motor_steps by 1 for every 81 partial extra_steps. The new routine could be:
case 1: // 4.630 RPM * 3
motor_steps = 740; // 738 + 2
extra_steps = 60; // 222 - (81 * 2)
extra_step_time = 81;
min_motor_delay = 643; // 1930 / 3
max_motor_delay = 680; // 2040 / 3
break;
If you are using different gear ratios that are not an exact 3X multiple of SP10, then you have to calculate new settings. A standard stepper motor has 200 steps per revolution. The stepper motor controller uses 16X microstepping so this increases to 200 * 16 = 3200 steps per revolution. The second hand rotates once per minute, so figure out how many steps per minute are needed for your gear ratios.
The min and max delay values start with this calculation and adjust slightly until you get around 50% "+" and "-" on the serial debug monitor.
// min_motor_delay is approx 960000us / motor_steps / 2
// max_motor_delay is approx 1010000us / motor_steps / 2
Steve