Tuesday, 21 June 2016

Finally! 800 steps per second - Stepper control with a Raspberry Pi and Pololu A4988 drive carrier

800 steps per second on multiple motors!

Well I think this is about as good as it will get. The hardware is Pololu A4988 drive carriers controlled directly from Raspberry Pi io pins. The test software is some fairly straightforward Python code the uses pigpio to do all the donkey work. By increasing the power supply to 24v (after carefully setting up the current limiting on the Pololu boards) I can got to around 800 full steps per second with moderately good torque and stability. Faster rates do work, but torque falls off rapidly, and any real load stalls the motors quite easily.

On this journey, which is detailed in earlier posts, I achieved the maximum step rates as follows:

 AdaFruit DC & stepper HAT (standard code)
75 - 80 steps per second.

 AdaFruit DC & stepper HAT (modded code)
 260 - 280 steps per second.

Pololu driver board direct gpio with pigpio, 12 volt supply
400 steps per second.

 Pololu driver board direct gpio with pigpio, 24 volt supply
800 steps per second. (limited by stepper - much higher rates could be achieved with other steppers.)

All the gory detail follows......

AdaFruit  DC and stepper motor HAT. (£21 from here)

max step rate: 75 - 80 steps per second total (2 motors means 1/2 the rate). Limited by the rate at which data can be stuffed down the I2C pipe. The motors have to be run in single step mode. (i.e. no interleaving / part stepping)

AdaFruit  DC and stepper motor HAT with modified Adafruit code.

max step rate: 260 - 280 steps per second (again 2 motors means halving the rate). Detailed in this blog post. Again the motors must be run in single step mode.

Pololu driver board (available in the UK from here for £7).

max step rate with 12 volt supply: 400 steps per second.
max step rate with 24 volt supply: 800 steps per second.


Using pigpio documented here. This is some very smart software!
max step rate with 12 volt supply: 400 steps per second using 1/2 steps (reaches higher speeds in 1/2 step mode than any other mode).

Documentation on the stepper motor I am using (PF42-4813G) suggests that with current limiting in place, the supply can be up to 24 volts. With the driver board regulator set to 0.12 volts limiting current to 300mA, the motors now run reliably up to  800 steps per second. With no load they will run close to 1,000 steps per second.

With 2 motors running at the same time this is 3,200 pulses per second which the pigpio driver delivers flawlessly on a Pi 2B.




The circuit used is is the standard Pololu basic circuit, although I included a small tantulum capacitor as well as the large electrolytic.
6 inputs to the chip are hooked up to the pi's GPIO pins.
Here is the first lash up on a small breadboard beside the pi 2B that I am testing this all with.
A real rat's nest, but it did prove it works and allowed me to do some initial performance tests as well as writing the test software.
Here is the final version, built on an Adafruit Perma-Proto HAT. This sits snugly on top of the Pi, although I will need to get some proper cooling going before I put this on a pi 3.

The test program I have written can use either wave chains or a pigpio script to drive the gpio pins. Both work reliably and I have also run them simultaniously.

No comments:

Post a Comment