- ‘assignin’: https://www.mathworks.com/help/matlab/ref/assignin.html
- ‘readVoltage’: https://www.mathworks.com/help/supportpkg/arduinoio/ref/readvoltage.html
data transfer to matlab workspace by running the simulink control logic in Arduino due hardware
6 views (last 30 days)
Show older comments
aakash dewangan
on 9 Mar 2023
Answered: Manikanta Aditya
on 17 Mar 2023
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!
0 Comments
Accepted Answer
Manikanta Aditya
on 17 Mar 2023
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 Comments
More Answers (0)
See Also
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!