Reading an analog sensor via Arduino in Simulink Desktop Real Time External (SLDRT)

1 view (last 30 days)
Hi,
as part of a project where I am missing a real measurements card to read a sensor, I am now forced to do the reading of a that sensor for my control loop with some Arduino and stream it into Simulink.
For now I have a Simulink Desktop Real-Time External (SLDRT - External) program for the control of two robots and would now like to add the data from the Arduiono to this program. By know I know that there exists a Simulink Support Package for Arduino Hardware (https://de.mathworks.com/matlabcentral/fileexchange/40312-simulink-support-package-for-arduino-hardware) but I also read, that these blocks do not work in external mode ( https://de.mathworks.com/matlabcentral/answers/712848-control-arduino-using-gamepad-through-simulink ), which is why I am opening this topic.
I further found another post explaining on how to bypass the support package by using serial blocks (https://github.com/leomariga/Simulink-Arduino-Serial) but I did not find any information if the serial blocks are available in SLDRT - External.
My main question would be How to read an analog sensor using an Arduino into a Simulink Desktop Real-Time External program? But maybe one of the other questions could help me solve the program also:
  1. Is the official Simulink Support Package for Arduino Hardware by now available for SLDRT - External?
  2. Are the serial blocks available in SLDRT - External?
  3. How exactly does the serial communication with the Arduino look like? Do I need a program running on the Arduino or just when I use the serial blocks or any other own implementation?
I am very new to this topic, so thank you in advance for any hint.
Kind regards,
Max

Answers (0)

Community Treasure Hunt

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

Start Hunting!