Help with creating a motor controller

3次观看(最近30天)
Kevin Graebner
Kevin Graebner on 24 Apr 2019
你好!希望你一切都好。
我是MATLAB和SIMULINK体验的新手,一直在与Simul金宝appink一起演奏以控制Arduino。
昨天,我做了一点测试姜黄,可以控制电动机的电源和方向,直到限制开关撞击以阻止它为止。
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.

Answers (1)

Madhu Govindarajan
Madhu Govindarajan on 24 Apr 2019
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)我认为最简单的方法是,如果您的电动机花费相同的时间从一个限制开关转到另一个限制,则可以在Simulink中创建一个基于时间的循环并使电动机来回往返。金宝app另一种方法是每次按下限制开关时触发一些传感器,并使用它来控制电动机方向。
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

Communities

More Answers in thePower Electronics Control

Community Treasure Hunt

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

开始狩猎!