data transfer to matlab workspace by running the simulink control logic in Arduino due hardware

6 次查看(过去 30 天)
Hello,
I am using Arduino due with control block diagram in simulink to control the speed of DC motor. I want to run the control loop completely in hardware (i.e., After uploading the simulink file, entire calculation should be done in Arduino board, NOT in simulink), and I want to save the data in matlab workspace.
Please suggest me how can I do the same.
Thanks in advance!

采纳的回答

Manikanta Aditya
Manikanta Aditya 2023-3-17
Hi Aakash,
As per my understanding, you are using an Arduino Due and you want to run your complete control loop in hardware and save the data to MATLAB workspace.
You can create the Control System on Simulink with Control System Toolbox blocks and then use Simulink Support Package for Arduino Hardware to generate code. Once code is generated you can run the code on Arduino, and then the control loop will run completely on the hardware.
To save data to MATLAB Workspace, you can use the MATLAB Support Package for Arduino Hardware. In MATLAB, you can create a new MATLAB script and use ‘arduino’ function to create Arduino object and use ‘readVoltage’ function to read the data from Arduino board. You can then store the data to MATLAB Workspace using ‘assignin’ function.
For further reference, please go through these links:
From this link, you can check the Arduino integration with MATLAB and Simulink:
From these links, you can learn more about ‘assignin’ and ‘readVoltage’ functions:
I hope this resolves the issue you are facing.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by