PWM: only a finite number of pulses? Controlling stepper motor




|



I’m wanting to use the BeagleBone Black to generate a FINITE number of pulses, in order to control a stepper motor. For the controller I have, an A4988, each pulse is one step on the motor. How can I use the PWM on the BBB to send, say, 5 pulses, and no more or less than 5? Or I can use a GPIO. Whichever works.



I have the Adafruit BBIO library installed. I have thought of doing this in a simple, stupid way - just using python’s time.wait() and toggling a GPIO pin, however many times I’d like. But this seems very inaccurate, timing-wise, and moreover inelegant; is there a way to do this better? I’m also investigating events – i.e., count the numberof pulses that have occured using another GPIO, then stop the PWM when the number of pulses I want has been counted.









Any ideas?




|

You will need to use a GPIO pin and manually toggle it.
If you need precise speed control, you can task a PRU unit to toggle the pins with precise timing.

You could use the SPI interface

May be you can ask these guys here: http://www.halaser.eu/e1701m.php

They’re offering an industrial motor controller based on an BBB and should have solved this problem.

see Linuxcnc.org and the beaglbone variant Machinekit does exactly that

what is the end product you want ? cnc ? 3d printer ?
Linuxcnc does all this and is proven and reliable and works on a beaglebone black ( machinekit)

i am a moderator for Linuxcnc , and have worked with steppers for a lot of years , so give me some more information and see how it fits or not to your project needs it all depends on what else you want the BBB to do , as you only have limited resources

A4988 is a standard stepper driver and works no differently than any other ,

if Linuxcnc is too much of bruteforce etc , see Derricks video here , it works very well

http://derekmolloy.ie/beaglebone/driving-stepper-motors-in-embedded-linux-on-the-beaglebone/

Shout if i can be of help

Dave

see
Linuxcnc.org

Machinekit see
http://www.machinekit.io/
google group machinekit