hanna8754
Posts: 5
Joined: Tue Dec 31, 2019 5:17 pm

Stepper motor RPM

Tue Dec 31, 2019 5:27 pm

Hi all,

I am very new to the world of pi, and i am trying to learn some basics in order to use them. I currently work with a lot of stepper motors and have a project that requires a stepper motor to run at a constant RPM. I have done a lot of work moving stepper motors, but i am unsure how to make one move at a constant RPM. I am currently using a pi 4, and adafruit DC & Stepper Motor HAT, and a NEMA 17 stepper motor. I was wondering if anyone had any examples of a basic code to drive a stepper motor at a desired RPM. When i say desired, i mean adjustable. (like 1-50 or so) Thank you so much for any help.

pootle
Posts: 371
Joined: Wed Sep 04, 2013 10:20 am
Location: Staffordshire
Contact: Website

Re: Stepper motor RPM

Wed Jan 01, 2020 10:04 am

This adafruit hat is not very good at driving steppers, I tested it in some detail, the info is here, but in summary (assuming their base code is still as it was then).
  • standard adafruit library maxes out at around 80 steps per second. If your motor is 1.8 degrees per step this is about 25 rpm
  • with some minor code changes to the adafruit library I got it close to 300 steps per second - this should comfortably do 50 rpm if you don't need too much torque
For the best possible use of the adafruit board, see this post and discussion. The limiting factor with the adafruit hat is the i2c bus,

Moving to an a4988 type driver will improve things a lot as these boards also do current limiting which enables use of a higher drive voltage without the motor overheating. This means much more torque as well as being able to reach higher speeds. There are many variations of this chip for different voltages and currents. Also the step pin can easily be driven direct from a gpio pin, so removing the limitations introduced by the i2c bus

hanna8754
Posts: 5
Joined: Tue Dec 31, 2019 5:17 pm

Re: Stepper motor RPM

Fri Jan 03, 2020 2:41 am

Thank you, this helps a lot and explains a lot of the problems I have been having!!

Return to “Python”