How can i controll 3 stepper motors with MATLAB? - What do i need for hardware?
8 views (last 30 days)
Show older comments
Hello.
Im doing a project. I need to controll 3 stepper motors with MATLAB. One is gonna controll the x-axis. The second is gonna controll the y-axis and the third one is gonna controll z-axis.
But i don't know what programming lanuage im gonna use. I have heard that MATLAB could controll stepper motors but i don't know what hardware i need to use.
Do you know what hardware i need to use? What lanuage i need to use? Can i use C or Python? Any manual how to start?
Thank you.
0 Comments
Answers (3)
Grufff
on 12 Sep 2012
Edited: Grufff
on 12 Sep 2012
An Arduino board would certainly be a good place to start, they are low cost and provide a very accessible way to interface Matlab with external sensors and actuators. I'm doing something similar at the moment, but driving steppers in a delta robot arrangement rather than a Cartesian XYZ application.
The Adafruit motor shield is a good little device (I have one here), but it will only handle 2 steppers, so is no good for your purposes. As Rolfe suggests though, it's a cheap and easy way to start controlling actuators via Matlab. There's a decent webinar in the Mathworks library showing how to use it, so you could watch that for an introduction. Link here:
I don't know your application (and I'm no expert, just a student) but a possible solution would be an Arduino, three Pololu stepper drivers, your motors and power supply. Matlab will communicate with the Arduino via a standard serial object. A small C script can be written and run on the Arduino, so that it simply watches incoming serial data, reacting to instructions fired in from Matlab, sending the direction and distance (number of steps to rotate) signals onward to each of the motors.
Take a look at this page:
That article demonstrates something very similar, but driving servos instead of steppers, and sending signals from a Python script instead of Matlab - the principles and the code are very close.
The Pololu stepper drivers are one of the default choices for this kind of introductory stuff, they're cheap and reliable and there are plenty of tutorials online showing how to use them. Beware that they will handle up to 2amps per coil, if you want to drive motors that will demand more, you'll need to look elsewhere (and spend a lot more money):
0 Comments
Rolfe Dlugy-Hegwer
on 12 Sep 2012
Edited: Rolfe Dlugy-Hegwer
on 12 Sep 2012
You might want to consider MATLAB Support Package for Arduino (aka ArduinoIO Package), which can "access Arduino analog I/O, digital I/O, operate servo motors, read encoders, and even handle dc and stepper motors using the adafruit motor shield, all from the MATLAB command line."
0 Comments
Rolfe Dlugy-Hegwer
on 12 Sep 2012
If you decide to use servos, you can also use Simulink's support for Arduino hardware. Just enter "targetinstaller" in the MATLAB Command Window. Then use "Target Installer" to download/install support for Arduino. When you complete that process, Simulink Library browser will display a new block library for Arduino. Among those blocks are these three servo-related blocks:
0 Comments
Communities
More Answers in the Power Electronics Control
See Also
Categories
Find more on Simulink Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!