# How to control a unipolar stepper motor ?

4 views (last 30 days)
Jérémy Perichon on 22 Jan 2020
Answered: Priyanshu Mishra on 29 Jan 2020
Hello,
I am a french high school student (I do my best not to make language mistakes :) )
For my last year of high school, I have to product something called "project" and I have to use MATLAB for this... but I never did it before so it is quite difficult for me...
I have to create with 3 classmates an aquarium that distributes food (it will be a part of our exam score so it is important), and I am responsable of a stepper motor, which is linked with a cylindrical plastic part (that I drew on SolidWorks). I have to model this engine, more particularly the stepper motor, on Matlab as I said. So I did it, no problem with that, but when I start the simulation, I get absurd values, something like a speed which is 10^-15... My model is valid (almost I think), but I learnt that I have to "control the motor", I don't know how to do it... I found the block "unipolar stepper motor controller" but I don't know how to use it...
Ideally, my motor should do a quarter turn, then stop 1sec, then a half turn, then stop 1sec, then a quarter of turn (back to original position), but I don't succeed in doing it, and the end of the project is near...
If someone could help me, I would be very grateful to him,
Thanks,
Jeremy.pe
If you want me to put my model here, don't hesitate.

Priyanshu Mishra on 29 Jan 2020
Hi Jérémy,
Following are the requirements for the stepper motor control using MATLAB:
Software:
Hardware:
• Arduino Due
• Motor party Add on pack for Arduino
• Dc battery pack
• USB cable
For controlling motor I would suggest you use Adafruit Motor Shield V2. Adafruit Motor Shield V2 is an add-on shield that you can plug into Arduino. You can create a motorshieldv2 object using the add-on shield specified above and connect a stepper motor to the appropriate pins on the motor shield.

R2016b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by