The gist of my problem is that I'm trying to make a basic simulation for periodically collected data. More specifically, given the position of a radio antenna, the RF patterns would be simulated using the Python library Pylayers, where the finished model is constructed in matplotlib for viewing.

I want this to be done remotely on, say, a Raspberry Pi, which would periodically perform a new simulation as it receives new data and then displays the simulation results on a web page. The idea is that this way any heavy lifting is confined to the remote device and the results can be viewed anywhere.

I've done a similar project that just exported the output of matplotlib to a .png image for display online, but it would be nice to have some interactivity, along the lines of rotating the graph for display.

I'm far more familiar with low level programming and feel out of my depth in web programming, so what I'm really after is a conceptual explanation of a good way to handle this and why.

What do you think is the best way to go about this?

  • 3
    I think the graph/visualization should be done in the web browser, and only data should pass between the raspberry pi and the target web interface. – Robert Harvey Jun 1 '18 at 21:25
  • I suppose my idea was to only allow manipulation of the generated graph in the web interface -- but if the device being used for viewing the web page can render and manipulate a visual, it may as well generate it too. What kind of limitations would you estimate this (performing 3D rendering and propagation calculations) places on the type of device used by the end user, if any? – Forest LeBlanc Jun 4 '18 at 13:45

I agree with Robert Harvey. Only pass data from the pi.. You can cache it on the powerful machine for further processing in any way you'd like( FileSystem, RDBMS, ODBMS(nosql))

Your PI can insert anywhere or talk anything you would like, so it depends on what you're comfortable working with on the client side; where most of the work should reside.

For the client side, it could be worth looking into Web Workers in combination with Socket.io. I have a basic web worker proof of concept located at PowerBall Monte Carlo if you want to review source dependencies for my web worker trial! Plenty of socket.io resources out there as well. I'd recommend their live chat tutorial on that front.

Edit: For the limitation concern from the additional comment, most smart phones and their native browsers have about the same specs in processing and graphics power as a single PI as far as I know, so it's a win win particularly if more than one client is in the mix. If real time data on the screen is of major importance, client graphics become required if there's more than 1 client in my opinion.

If you can sacrifice real time info, production and caching of rendered graphics on the PI is certainly an option at longer 5-15min cacheing intervals. As graphics workload increases, resources for serving/collecting may become limited (or nonexistant) if centralized on the PI. Something to ponder! While this is potentially the easiest route, it's also the least scalable.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.