PID Controller running on Arduino in a closed loop Simulink model not working?

3 views (last 30 days)
I have the following closed loop system.
The data is supposed to be passed to an Arduino running the PID Controller for the system, which is modeled separately.
I was under the impression that Build Deploy & Start would run this on the board continuously. When I run the system model I do not get the expected value at the post PID scope just 0 the whole time. I have tried placing the Arduino block diagram in the same closed loop model but that just times out the simulation. I've tried entering different value in the PID to see if anything changes, it doesn't the post PID signal remains 0.

Answers (1)

Vishwa
Vishwa on 18 May 2023
Hi Micheal,
To monitor real-time data from the target hardware in Simulink, you need to configure “External Mode”, which can be found in “Hardware Settings > Hardware Implementation > Target hardware resources > External Mode”.
Next step is to run the model using “Monitor and Tune” rather than “Build and Deploy”. “Monitor and tune” will by default build and deploy the generated code and start fetching real-time data from the target.
For more information in Signal monitoring and tuning please refer the following documentation: Tune and Monitor Model Running on Hardware - MATLAB & Simulink - MathWorks India
For documentation on “External mode” please refer: External mode - MATLAB & Simulink - MathWorks India
Hope that helps!
Regards,
Vishwa

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!