Driving Stepper Motors in Embedded Linux on the Beaglebone
This video examines how we can drive stepper motors using C++ within Embedded Linux using the open source hardware EasyDriver board. The video begins by describing stepper motors and the effects of micro-stepping. It then discusses the EasyDriver Board (V4.4) and all of the available inputs and outputs. The board uses the Allegro A3967 which allows for full, half-, quarter and one eight micro-stepping. The video then explains C++ code that uses the GPIOs on the Beagleboard to wrap the EasyDriver with a C++ class that is easy to use by creating an object of the class for each stepper motor that is connected.
The source code in this video is available through githhub:
1 | git clone git://github.com/derekmolloy/beaglebone |
Finally I show an example of my code running on the Mercury Motor (SM-42BYG011-25), which is a low cost stepper motor.
Very informative article post.Really looking forward to read more. Really Great.
Hey Derek,
First of all, thanks for the very enlightening example.
However the code you provide no longer works as of the latest kernel. I assume it has to do with the new device tree and overlays. Any chance you can update your example to use the new kernel devices?
Thanks,
Will
Jim, is AC freq (50-60hz) effect stepepr motors? My XYL has an embroidery machine the runs on 120VAC 60hz and we are now living overseas at 220AC 50hz. A step down transformer does not operate the motors in the machine. I suspect that the reason is due to? that the step down passes the 50Hz which is to slow for the motors.
Hi Derek,
thank you so much for such a detailed video. It is certainly very helpful. I have a question though:
I am trying to implement the same circuit you are having. The problem is that the EasyDriver and the motor need a 12V supply, whereas the BB needs a 5 V (2A)supply. How are you doing this? Do you use a voltage regulator for the BB? (My application cannot afford having two power supplies because of the size.)
Thanks in advance.
Hi. I am using two separate supplies in the video, but if you have a 12V supply you can use a 7805 to regulate the power for the Beaglebone and take it from the same source. The Beaglebone doesn’t draw anything more than 500mA unless you are driving loads of capes/usb devices/WiFi adapters etc. so the 7805 should be able to handle the current too. It may get a little bit hot over time so a heatsink could be added to the 7805 and the EasyDriver to save burnt fingers.
Hi sir…very nice articles.I have purchased my Beaglebone Black recently and have run few c++ programs.
But there is a problem regarding date setting.i have followed all the steps mentioned in the video but it is unable to access the link(irish ntp pool).
Hello,
I used a beagle bone back with the “Stepper motor – NEMA” and L293D as hardware (https://learn.adafruit.com/adafruits-raspberry-pi-lesson-10-stepper-motors/hardware-l293d adapted for beaglebone). This circuit and adafruit code work perfectly with “Small Reduction Stepper Motor – 5VDC 32-Step 1/16 Gearing PRODUCT ID: 858” but don’t work with “Stepper motor – NEMA-17 size – 200 steps/rev, 12V 350mA PRODUCT ID: 324”.
I don’t understand why… could you help me (NB: I am not a pro ;( … and I don’t find the answer on your forum, or internet).
Thanks by advance for your help
Franck
How to connecet WIFI usb for Beaglebone? Can connect all wifi usb to BBB? else, Have anything particular wifi usb available for BBB?
Hello!
What is the max speed (RPM) that you can reach with your configuration?
There seems to be a limit in switching the GPIO – from the user space – for pulses the motor. I’using a similar configuration and cannot exceed 200 RPM. An obvious solution, would be to use the PRU, but I’m looking for a viable alterative to reach higher speeds switching GPIO within the host CPU in C/C++/Python.
Any idea?
Your stepper RPM will almost certainly be limited by the physical constraints of the stepper, rather than the computer. You might look at a stepper with a larger step size, or at another type of motor altogether, if speed is your primary concern.
plz tel the ir sensor specification for beagle bone black
Hi Derek, it seems to me link for github doen’s work and can’t find it on github itself. What do I have to enter in url to find your source code?
Hi there!
Really an informative post. Thanx for sharing. Could you tell me How to connecet WIFI usb for Beaglebone?
Hi Derek,
I do have same question, can you tell us how to connecet wifi usb for Beaglebone?
muchas gracias.but one question i have. how would it work with a bigger driver with 5v dir and step inputs ? using some sort of level shifting or how would you do connect a bigger driver like gecko or dm542 to the beagle bone black. im thinking about upgrading my cnc router … have a nice day !!!
Hi, I’m trying to replicate what you’re doing, but the motor isn’t turning at all. The only difference I can spot is that you seem to be passing the ground wire through a resistor, and I just plain can’t figure out what the DC power is attached to. It connects to the bread board, but then the bread board stretches off the edge of the image. Is there a 5v power supply over there somewhere? What size is the resistor?
nice articles keep sharing these type of articles with us thanks for your articles
your code is not working but your example was very good it was helpful for me in future
Howdy!
Extremely an educational post. Thanx for sharing. Might you be able to disclose to me How to connecet WIFI usb for Beaglebone?
Regards
There is good information for us thanks for sharing with us.
It’s very nice post thanks for sharing but I want to know Why a driver is required to drive stepper motors?
Nice video explaining to drive stepper motors using C++ within Embedded Linux.
Thanks for sharing!
Hi Derek,
can´t get this work on my Beaglebone run Debian 4.9.44-ti-r56
failed to open OMAP_MUX: No such file or directory
Read aout GPIO rules and insert the file from your book edited the user but still the same error…
Hope you have got an idea on fix this
Thanks and best regards
Rudi
Hi Derek,
can´t get this working on my beaglebone black running Debian 4.9.44-ti-r56
…
failed to open OMAP_MUX: No such file or directory
…
Read about gpio rules and insert the file 99-gpio.rules and edit the user to mine
But still the same error
Hope you have got an idea
Thanks and best regards Rudi
Hi Derek,
sorry for double post
can´t get this working on my beaglebone black running Debian 4.9.44-ti-r56
…
failed to open OMAP_MUX: No such file or directory
…
Read about gpio rules and insert the file 99-gpio.rules and edit the user to mine
But still the same error
Hope you have got an idea
Thanks and best regards Rudi
Thanks for sharing this piece of code. Do you have an idea on implement a function to drive a stepper with Encoder?
Thanks for sharing such a great peice of information!
Hello there Derek,
much thanks to you such a great amount for such an itemized video. It is surely extremely accommodating. I have an inquiry however:
I am attempting to actualize a similar circuit you are having. The issue is that the EasyDriver and the engine need a 12V gracefully, while the BB needs a 5 V (2A)supply. How are you getting along this? Do you utilize a voltage controller for the BB? (My application can’t bear the cost of having two force supplies as a result of the size.)
Much appreciated ahead of time.