Stepper motor speed controller using Arduino

Hi,
I am trying to develop a small project that requires me to rotate stepper motor with very low speed of 1.5 to 2.5 degrees per minute. While I was researching options, I came across Arduino based circuits and microsetpping concept in stepper motors.
I want to know from experts if it would be possible to create a setup using Arduino board to control speed of stepper motor at such low speed with precision? If this is an already solved problem, please guide me to it. Thanks.

  • Shantanu

The speed of a stepper motor depends on the interval between steps. You can make that as long as you want - an hour, a day, a week.

However stepper motors move in steps so the motion will not be smooth. Using micro-stepping will reduce the roughness, but not eliminate it. If you need smooth motion a geared DC motor might be more appropriate.

If you tell us the project you want to create it will be easier to help

...R
Stepper Motor Basics
Simple Stepper Code

Hi,
Thanks for your response. I am trying to achieve set that allows 1 rotation in a day using stepper motor. My project is to create a module that will help me in astrophotography and that's where the requirement to generate 1 rotation in 1 day comes from. Let me know if you would need me to explain the requirement in more detail.

  • Shantanu

shandesh19:
My project is to create a module that will help me in astrophotography

Does that mean that you want to take very long-exposure still pictures while the camera is rotated to stay aligned with a star?

I don't have any experience but I wonder if a stepper motor would be too jerky?

Maybe you could use a stepper motor combined with a significant gear reduction so that the motor can run at a higher speed?

I think if this was my project I would also seek advice on a Forum that deals with astro-photography.

...R

You need a gearbox with a very high ratio. Then you can use a stepper motor or a DC motor. Because a stepper motor can rotate much more slowly than a dc motor, the gear ratio can be perhaps 1000 times lower than with a DC motor, and no encoder or speed controller would be needed.

But even if a stepper rotated at 60rpm, you would still need a gearbox with a ratio of 1:1440 to achieve one rotation per day. Worm drives are often used in these gearboxes.

If a stepper rotated at 6rpm, then the gearbox would only need to be 1:144, but even with microstepping, I don't know if the movement would be smooth enough for astrophotography. It might blur the image.

You might consider something like this that I found on eBay
s-l400 (21).jpg

s-l400 (21).jpg

Hi,
I have done some search on astrophotography forums and found some setps like "barn door tracker" implementations using DC motors and gears. But it has limitations. First of all, you need to use a motor with really low RPM and high torque. Second, you can reduce rotation speed using gears but it has inherent problems of gear backlash.
To overcome these problems I thought of setting up this using minimal dependency on gears (1 pair which I can't avoid) and stepper motor. I meant to to control rotation speed using Arduino circuits and microstepping method.

My target (so to speak):
Create a setup with NEMA 17 or NEMA 23 stepper motors, Arduino circuits, A4988 stepper motor drive, breadboard and jumper wires to implement microstepping mechanism. This setup along with appropriate code should be able to help me rotate stepper motor at 0.25 degree per minute. Stepper motor will have gear mounted on the axle and will drive rest of my mechanical setup.

My questions:
While I have seen writeups on how to arrange these equipments together, I don't know following points.

  1. Can someone comment on this from feasibility perspective based on their experience.
  2. What kind of coding is required for microstepping?
  3. Can I generate 1/16 or 1/32 microsteps with code and A4988 stepper motor drive? Based on what I read, increased microstepping will help achieve accuracy and that will help me in my project.

I am a complete newbie to this. So if someone can point me in the right direction, I would be really grateful.

  • Shantanu

The coding for microstepping should be quite straight forward. The Arduino just sends a pulse to the controller using a digital or pwm output. Timing those pulses is the critical part. The Arduino can use up to 3 digital pins to control the level of microstepping, if required. The A4988 controller can do 1/16 microstepping. To achieve this, the ms1, ms2 & ms3 inputs on the controller would need to be set high by the Arduino. When faster movement is needed, the controller ms inputs could be set low.

At 1/16 stepping, assuming your motor is 200 steps per rotation, each step represents 0.1125 degrees. To achieve 0.25 degrees per minute, 2.2 steps per minute would be required, which is one step every 27 seconds. I am not sure that will be smooth enough for your purpose.

shandesh19:
I am a complete newbie to this. So if someone can point me in the right direction, I would be really grateful.

Have you studied the links in Reply #1?

...R

Hi Robin,
I missed the links earlier, I found them when you pointed out. I will study them. Thanks a lot for sharing.

  • Shantanu

Hi Robin,
I have read through the two articles you had shared as links. It has consolidated location where basic information is available so I really liked it. Those were really helpful for a newbie like me.
I have one question on something you wrote in Stepper Motor Basics post. You mentioned that while Pololu A4988 has ability to do 1/2, 1/4, 1/8 and 1/16 microsteps, BigEasyDrive does 1/16 microstepping by default. Since I know I need microstepping in my project, should I go with BigEasyDrive directly or keep the flexibility available with Pololu A4988?

  • Shantanu

BigEasyDriver is also based on the same A4988 chip. Both drivers can easily be set full stepping down to 1/16 stepping.

You should be aware, having read Robin2's posts, that microstepping is not as accurate as full stepping. It may not be accurate enough to keep your pictures sharp. I hope it does work. It would be great to see some pictures taken with your finished project.

You still have not answered Robin's question in post $3 relating to the type of picture you are taking. You do realize you can program to NOT take pictures during the camera movement, don't you?

Paul

Hi Paul,
I do understand that microstepping may not be as accurate as single step as per Robin's post. Here is my thought about tackling it.
There are two ways of shooting astrophotography, long exposure that allows more light or taking short multiple pictures and stacking them together. I plan to use the second method.
My intention is to synchronize stepper motor steps with camera exposures. This way I can avoid shake in the camera exposures while motor is moving. It will need good amount trial and error tests before I could make it work.
Frankly there are devices available that perform this action in seamless manner with no jerks whatsoever. But they are expensive and no challenge in using something off the self. I am really looking forward to put my brains to work. I may not reach an ultimate goal quickly but my first test would be on 6th October when I have opportunity to shoot using this setup. This also means I have nearly 45 days to sort out this setup.

  • Shantanu

If you are using this multiple picture technique, I assume you will use some software package that can combine the pictures in a way that compensates for minor registration errors between frames? If so, why is gear backlash a problem?

If the system is always moving in the same direction while taking pictures it should be easy to eliminate backlash by applying a small amount of friction to the output shaft.

If you are new to Arduinos and steppermotors then 45 days is not all that long :slight_smile:

...R

Hi,
Will also need to make sure you have a suitable power supply and that the stepper is happy with 24hour continuous microstepping.
Micro-stepping is basically a magnetic tug or war between the pair of stepper windings.
The controller and stepper will be dissipating some heat.

If you are doing a continuous open shutter exposure, your image resolution will be compromised by the steps, no matter how small.
Have will need to calculate the angle of arc of each micro-step, this will be the jitter your image will present to the camera.

Tom.... :slight_smile:

Hi,
I finally managed to get all components I needed for my project.

Components:
Arduino Uno
A4988 stepper motor driver
NEMA 23 stepper motor
9 V battery
Breadboard and Jumper Wires

I have setup connections using instructions provided in Arduino forum topic "Arduino for A4988 Pololu Stepper Motor Driver code" (Arduino for A4988 Pololu Stepper Motor Driver code! - Project Guidance - Arduino Forum). I also loaded Arduino with code given in reply #5.
I am happy to note that the motor turns as expected. So I guess I managed to successfully run basic test of see that it works. Now comes the hard part. I need to now implement microstepping to ensure I can turn the motor at speed I want.
Based on what I could read, microstepping requires two changes; first is circuit changes that involve MS1, MS2 and MS3 ports on A4988 and second is changes to Arduino code to ensure I can control overall speed by adding proper delays etc.
I am not clear on both sides. Can someone please guide me in the right direction? Is there a place where can I find glossary of commands that can be run against stepper motors?

  • Shantanu

Hi PaulRB / Robin,
I am aware of stacking mechanism using which noise within multiple pictures can be eliminated. But my basic problem is to be able to get small gear box that will allow me to get to very low speeds of 0.25 degrees per minute. I searched on the net but I couldn't find gearbox with that much reduction. I could get something like 10 RPM or 6 RPM but that still requires further angular speed reduction.
I am trying to avoid multiple mechanical setups as they would be difficult to manage over time. I am looking to achieve this within electronics and some amount of software (Arduino code).

I hope I was able to answer both of your questions. Let me know if you any other points to suggest.

  • Shantanu

shandesh19:
I finally managed to get all components I needed for my project.
9 V battery

That is one you don't need or want. Put it back in the smoke detector where it belongs, Shantanu. It is useless for anything else. It is certainly not useful for any project using stepper motors.

Hi Paul,
Do you mean the overall project is not feasible or you were commenting on some specific component I mentioned?

  • Shantanu