MATLAB Answers

What is the best way for a raspberry pi to intermittently report on its activity?

1 view (last 30 days)
John Anderson
John Anderson on 12 Jun 2019
Commented: John Anderson on 12 Jun 2019
I am new to both raspberry pi and Simulink and also networking generally. I am interested in deploying Matlab functionality to the pi and have set up the Simulink support package to facilitate this. One of the things I am interested in doing is having the pi running independently on a network and intermittently reporting on its activity. I am not sure of the most sensible protocol to employ for achieving this. I don’t particularly want to have a computer always listening for pi activity on the network, however, if this is necessary then I can do this. One option I thought would be to utilise the Simulink block ‘to file’ to write various data to a file on the pi. I can then retrieve this file via the getFile java method of the raspberrypi object that I can instantiate when I want to check on the pi activity. However, one problem with this approach is that I need to stop the simulink model running to move the file. When I restart the simulink model the existing file is overwritten. In practice I don’t really want to have to stop and start models running I simply want them to make available any data they have accumulated. If the pi could simply send this file to another computer on the network this would be ideal. However, I did notice various blocks in the support package, such as UDP send and TCP/IP that could potentially be more appropriate ways of achieving this type of communication. Any advice on whether these might offer a more appropriate implementation would be welcome.

  2 Comments

Joel Handy
Joel Handy on 12 Jun 2019
UDP would probably make more sense in this case because you wouldnt need to maintain an open connection to another computer on the pi. You would however need to have a computer listening for said message.
You may be able to set something up using UDP where the pi responds when promptesd by another machine so that the pi is the machine listening on the network. Depending on just how much data you are looking to transfer, you could put together some sort of activity buffer that gets transmitted back to whomever sends the pi a simple message.
John Anderson
John Anderson on 12 Jun 2019
Hi Joel, Thanks for this feedback and the buffer idea. I will have a try with UDP and see how I get on and report back.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!