Cinderella's clock need to go from 1/60 rpm to 10 rpm

I need some fairy god-mother magic!

I've made a clock for the pantomime (5 months to go) with the 12:1 gearing so the hands work and I will connect a stepper to the minutes hand spindle. So I need it to turn at 1/60 rpm normally but it has to speed up on an analogue pin / potentiometer to run at, say, 10 rpm.

Back to normal speed at midnight would be great (could make a contact / sensor from the hands).

Can't find any examples that do both so tips / suggested code would be a great help.

Can't promise the glass slipper will fit you though..

I'm using a NEMA 17 1.8 degree stepper motor and L298N driver

Thanks for reading,

Ralph

Or the AccelStepper library, which ramps speed up and down so is more likely to actually work. [ although for 10rpm that's probably not an issue ]

For very low speeds it may be more accurate to send step pulses by hand, the speed
resolution of each library may be less than is required for an accurate 1/60 rpm

Thanks for suggestions - I don't know how to look inside a library, I thought you just loaded them. Still a lot to learn but useful tips I'm sure. Thanks, Ralph

clockface:
Thanks for suggestions - I don't know how to look inside a library, I thought you just loaded them. Still a lot to learn but useful tips I'm sure. Thanks, Ralph

Arduino ecosystem is open source, you have it all on your machine waiting to be examined!

An Arduino library is source code.

clockface:
Thanks for suggestions - I don't know how to look inside a library,

You don't really need to look inside. Just read the documentation. The AccelStepper library is well documented.

...R

The documentation is inside, mainly in AccelStepper.h, some in AccelStepper.cpp

The documentation in the source is guaranteed to match the version you are using, external
documentation may not be. Learning to read code is a good way to learn (if its well written
of course!)

MarkT:
The documentation is inside,

Sure. But I meant this - much easier for a newbie

...R

Thank you all. I shall spend two or three hours thinking and reading!

Ralph

With a 200 step / rev motor, you will need 1 pulse every 18 seconds (18000 millis) for 1/60 RPM and 1 pulse every 30 millis for 10 RPM.
You will probably need a real time clock module for the 1/60 RPM since the Arduino oscillator may be off by several seconds per hour.

edgemoron:
You will probably need a real time clock module for the 1/60 RPM since the Arduino oscillator may be off by several seconds per hour.

If this is just for an artistic piece in a play it should be possible to fudge the interval between steps to get sufficient accuracy for a few hours without needing an RTC.

...R

clockface:
I'm using a NEMA 17 1.8 degree stepper motor and L298N driver

Thanks for reading,

Ralph

Try a DRV8825 stepper driver instead. Will be way more convenient. Or even an A4988 stepper driver. The L298N.... it can work, but power inefficient.