Control of Stepper Motor with Simulink

조회 수: 15 (최근 30일)
Nicky Man
Nicky Man 2018년 4월 6일
답변: Michael Goebel 2020년 6월 24일
Hi there!
I have a program that tells the step sequence for a step motor to take. So far, I have been able to make the stepper motor turn clockwise and counter-clockwise. I did this using a repeating sequence stair, where the output is [0,1,2,3], and the sample rate is .01 seconds
Now I want that if I push a button (eg. arduino push button), then the repeating sequence stair logic will operate for 5 seconds. However, the repeating sequence stair logic is a source with no input.
Therefore, my question now is, how do I integrate an if statement so that when the push button is pressed, then the repeating sequence stair logic will initiate for five seconds?
Hardware used:
Arduino Uno
5 Volt DC 28BYJ-48 step motor
Motor Driver Board ULN2003
-----
Thanks, Nick
  댓글 수: 2
Cosimo Mercuro
Cosimo Mercuro 2018년 5월 5일
Hi Nicky. May you provide me the simulink file? Thanks in advance
Nicky Man
Nicky Man 2018년 5월 13일
Here you are. Let me know if it works or not.
https://drive.google.com/file/d/1ld9JExjWdWl8oDiPtMAot4Wi5-hbVWAa/view?usp=sharing
Regards, Nick

댓글을 달려면 로그인하십시오.

답변 (2개)

Cosimo Mercuro
Cosimo Mercuro 2018년 4월 26일
Hi Nicky. I've the same issue. Have you found any solution? Thanks in advance
  댓글 수: 1
Nicky Man
Nicky Man 2018년 4월 27일
Hi Cosimo,
Yes. I added a delay block as an input u2 to the if statement block. I set the delay block to the amount of time I wish for the motor to be delayed. The delay block becomes u1 after this period of time. The logic in the if statement is that if u2 becomes u1, then it will output the constant 8, which stops the stepper motor.

댓글을 달려면 로그인하십시오.


Michael Goebel
Michael Goebel 2020년 6월 24일
You could try to implement it with
  • stateflow or
  • an enabled subsystem or
  • look under the mask of the repeating sequence block and adjust it as u want

커뮤니티

더 많은 답변 보기:  Power Electronics Community

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by