Pregunta

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

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?

When i try to Run the Simulink model i get this error

My step motor driver board is ULN2003APG ULN2003APG and my motor is enter image description here.

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.)

Thanks in advance.

EDIT!

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

1: Complete the steps in this tutorial.

2: Download MATLAB Support Package for Arduino.

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

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

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

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.

Here is a nother image of the simulink model: enter image description here

¿Fue útil?

Solución 3

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).

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

Cheers !

Otros consejos

From your file name it looks like you have downloaded this from a file exchange submission "MATLAB Support Package for Arduino (aka ArduinoIO Package)". Based on one of the comments in that submission this package does not support code generation. It can be run only using Simulink "normal" mode. For other targets which require code generation you need tlc files and you will see this error.

I believe the error window already tells you what is the problem. You need to move the file msfun_arduino_io_setup.tlc to you project's working directory. We can only have this much sight in your project with what you have given to us. If there is, you need to give more information, for instance SS of your Simulink Model.

Besides all, I suggest you to download Arduino Support Package and other add-ins, extensions and files from Matlab itself if you can.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top