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

6 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Manikanta Aditya
Manikanta Aditya il 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.

Più risposte (0)

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by