Help with creating a motor controller
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello! hope you are all well.
i am very new to the matlab and simulink experience, have been playing around with simulink to control an arduino.
Yesterday i made a little test curcuit where i could control the power, and direction of a motor until a limit switch was hit which would stop it.
what i am after now is a single button that can start and stop the motor. Currently i have an enabeled subsystem with the input from a physical button going to the enable port and a pwm signal generator going to the output to run the motor.
This starts when i hit the button but does not always stop unless i time it just right or press it a few times.
is there a better way you would reccomend?
Next. What i am having the most difficulty with is figuring out a way to start the motor off in a direction until it hits a limit switch, then have it pause for 5-6 seconds and reverse directions until it hits another limit switch followed by another pause. i need this to be in a loop where it will just continually run.
All of your thoughts and opinions are greatly appreciated! hopefully this will provide some useful answers to others as well.
It seems there are several ways to hold a state in simulink, but im having a hard time figuring out how to make it fit this application.
댓글 수: 1
답변 (1개)
Madhu Govindarajan
2019년 4월 24일
Here are some thoughts:
1) I think your approach is good as it is. The update I would recommend is to increase the sampling time of the arduino digital input to something bigger like 0.5 seconds or 1 second. Then when you are pressing the switch, make sure you are holding it for at least that much time period. This would eliminate some of the issues.
2) I think the easiest way would be if your motor takes the same amount of time to go from one limit switch to the other, you can create a time-based loop in simulink and make the motor go back and forth. Another approach would be to trigger some sensor everytime the limit switch is pushed and use this to control the motor direction.
All said, Stateflow is a great tool for event-based modeling (which is what you are trying to do) so do take a look at that product.
HTH,
Madhu
댓글 수: 0
커뮤니티
더 많은 답변 보기: Power Electronics Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!