Stepper motor module

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
filipmar.mf
Posts: 3
Joined: Thu Jul 28, 2016 3:21 pm

Stepper motor module

Post by filipmar.mf » Tue Mar 07, 2017 7:24 am

Hi,
there is my module for Stepper motor driven by Adafruit Easy driver.
https://github.com/Euter2/MicroPython/b ... stepper.py

Your feedback is welcome ;)

sjp770
Posts: 7
Joined: Thu Aug 24, 2017 12:50 am

Re: Stepper motor module

Post by sjp770 » Fri Aug 25, 2017 1:42 pm

Looks good, is there doco on how to use it? I'm still new to micropython.

User avatar
pythoncoder
Posts: 2157
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Stepper motor module

Post by pythoncoder » Mon Aug 28, 2017 7:29 am

That's a useful driver. For anyone puzzled (as I was) Easy Driver is this nice piece of hardware: https://www.sparkfun.com/products/12779.

An asynchronous version of the driver would be an interesting project. It could use a timer interrupt or uasyncio to achieve nonblocking behaviour. The drawback would be a substantially lower maximum step rate, especially on the ESP8266.
Peter Hinch

sjp770
Posts: 7
Joined: Thu Aug 24, 2017 12:50 am

Re: Stepper motor module

Post by sjp770 » Thu Aug 31, 2017 3:09 am

My driver is a more common Polou A4988, (https://www.pololu.com/product/1182) Any idea if it would work with this or if there is a way to control it yet?

User avatar
dbc
Posts: 89
Joined: Fri Aug 28, 2015 11:02 pm
Location: Sunnyvale, CA

Re: Stepper motor module

Post by dbc » Fri Sep 01, 2017 11:03 pm

The drawback would be a substantially lower maximum step rate, especially on the ESP826
Yes, well, say you are using a common 200 steps/rev motor, and 1/4 microstepping, and two edges per step, or 1600 edges to generate per revolution. The OP's code has a 20 uSec minimum time between edges. At 20 uSec minimum time between edges, that is 32 mSec per revolution, or 1875 RPM, which is pretty zippy. (Feel free to look for errors in my math..) So I don't think a slower step rate is a problem for many applications.

Related, since motors have real mass, you can't make them go from 0 RPM to a fast step rate all in one go. It might be nice to add some kind of acceleration ramp parameter to the API.

OutoftheBOTS_
Posts: 111
Joined: Mon Nov 20, 2017 10:18 am

Re: Stepper motor module

Post by OutoftheBOTS_ » Mon Dec 04, 2017 7:48 am

Usually most people will use a A4988 or a DRV8825 for controlling small to median stepper motors.
The A4988 was the classic used by most 3dprinters and smaller CNC machines until the DRV8825 came alone with better specs (smaller micro-stepping and higher current) and now is very standard. Both drivers r chopper drivers(constant current driver).

To get good acceleration torque you need to use a chopper driver (standard with all CNC machine)

To get a smooth rotation rather than a chunky stepping motion you need micro stepping the smaller the better usually.

Both these drivers have a step pin and a direction pin. U set the direction pin to high or low for direction of stepping and pulse the step pin to make it take a step. You can drive the step pin with a PWM freq to get a certain speed and you adjust the freq to adjust the speed of the stepping, you will need a counter that counts the pulses if you want to know the rotation amount.

Post Reply