What is the best way to send and recive data from arduino to raspberry pi using simulink?

2 次查看(过去 30 天)
Hello,
I have a Raspberry Pi 4 B and an Arduino Due and I want to use the Arduino to read data from several sensors and give commands to several servo motors, all connected to the Arduino.
All the data from the sensors need to be sent to the Raspberri Pi which in turn will send new servo commands that the Arduino then needs to execute.
What is the best way to do that using simulink?
Thanks in advance,
Kay

采纳的回答

Ameer Hamza
Ameer Hamza 2020-3-31
"Best" is a subjective term.
Probably the easiest way is to use serial communication between Arduino and raspberry pi. The advantage of this method is that Simulink provides blocks for serial communication for both boards.
Now the most robust approach I can think of is to use the Robot Operating System (ROS). On raspberry pi, run a ROS server and run an ROS node on Arduino. The disadvantage is that Simulink does not provide any support to deploy an ROS node on Arduino, and you will need to write your own S-functions to make it work with Simulink. Simulink does provide support to deploy an ROS node on raspberry pi. The main advantage of this approach is that ROS will handle the communication protocols and consistency itself. However, I would suggest going down this path only if you already a bit of knowledge about ROS and its Arduino libraries. I do have a file exchange submission on deploying a ROS node on Arduino. If you decide to use this method, that will be helpful.

更多回答(0 个)

类别

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

产品

Community Treasure Hunt

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

Start Hunting!

Translated by