Arduino 步进电机控制与 Simulink [英] Arduino stepper motor control with Simulink

查看:37
本文介绍了Arduino 步进电机控制与 Simulink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Arduino 和电子产品还很陌生,所以请耐心等待.

Hi Im quite new in Arduino and electronics so bear with me.

我有一个使用 Matlab 和 Simulink 控制步进电机的项目.现在我只想启动并运行它.我已经用一个简单的步进电机代码连接了原理图,它可以工作(这是在没有 Matlab 的情况下完成的).我的问题是如何使用 Simulink 和 Matlab 使电机运行?

I have a project to control a step motor using Matlab and Simulink. For now I just want to get the thing up and running. I have hooked up the schematic tested it with a simple code for a step motor and it works (this has been done without Matlab). My problem is how can i get the motor to run using Simulink and Matlab?

当我尝试运行 Simulink 模型时,我得到了这个

When i try to Run the Simulink model i get this

我的步进电机驱动板是 ULN2003APG 而我的电机是.

My step motor driver board is ULN2003APG and my motor is .

我已经下载了用于 Matlab 的 Arduino 硬件支持包,并且已经将服务器程序上传到 Arduino 以实现 Matlab 和 Arduino 之间的通信.

I have downloaded the Arduino Hardware Support Package for Matlab and have already uploaded the server program to Arduino to enable communication between Matlab and Arduino.

我不知道是什么导致了我得到的错误.任何帮助将不胜感激!

I have no idea what might be causing the error that i get. Any help would be greatly appreciated!

如果有任何现有的指南或任何涵盖此类主题的示例,您可以将我重定向到它们.

If there are any existing guides or any examples covering such topics u can redirect me to them.

(如果需要为电路板编写新的驱动程序,请给我发送一些教程,我可以在那里阅读.)

(If there is a need to write a new driver for the board please send me some tutorial where I can read about that.)

提前致谢.

编辑!

以下是我尝试让 Simulink 模型运行的分步操作:

Here are step by step the things that I do to try and get my Simulink model to run:

1:完成 教程.

2:下载用于 Arduino 的 MATLAB 支持包.

3:将arduino uno连接到PC,打开Arduino IDE并上传步骤2中的adioes.pde.

3: Connect the arduino uno to PC, open the Arduino IDE and upload adioes.pde from step 2.

4:打开Matlab更改工作路径(如果没有则报错)

4: Open Matlab change working path (if not it gives an error)

5:从下载的适用于 Arduino 的 MATLAB 支持包 ...\ArduinoIO\examples\stepper_sim.mdl

5: Open existing example from downloaded MATLAB Support Package for Arduino ...\ArduinoIO\examples\stepper_sim.mdl

6:更改 COMPORT 并单击工具/在目标硬件上运行/准备运行,然后单击工具/在目标硬件上运行/运行

6: Change COMPORT and click Tools/Run on Target Hardware/Prepare to run and after that Tools/Run on Target Hardware/Run

在那之后我得到了我的错误.

After that I get my error.

这是 simulink 模型的另一张图片:

Here is a nother image of the simulink model:

推荐答案

我最终设法使用 Simulink 使步进电机运行.不幸的是,我不得不更换驱动板才能做到这一点.似乎该板没有来自 Matlab 的驱动程序,或者只是不兼容(不确定).

I've finaly managed to get the stepper motor running using Simulink. Unfortunately I had to change the driver board to do that. It seems there isn't a driver from Matlab for this board or it's just not compatible (not sure).

我购买了 adafruit motor shield v2,一切运行良好.它不再给出有关缺少 .tlc 文件的错误.

I've bought an adafruit motor shield v2 and things worked perfectly. It no longer give's that error about a missing .tlc file.

干杯!

这篇关于Arduino 步进电机控制与 Simulink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆