Live data visualization from sensor

Good morning,

I’m Elisa, I’m a biomedical engineer and I’d like to develope a live dashboard to visualize data coming from a sensor.

In particular, I developed a TCP connection using Socket that allows me to read my data via Wifi on a PC. I created the client with the Arduino IDE using the wifi101 library and the server with Python using Socket.

I’d like to visualize live my data coming from the sensor in a dashboard developed using anvil. I searched in the forum but I just found solution that save data in a file/database, and then visualize them, but I’d like to visualize them in the same time they come from the sensor. Is there someone who already did it?
The problem is how to pass data from python code to the dashboard.

Thank you so much.

Elisa

Welcome, @ellie.95!

In Anvil, the center of control generally resides in the Client, i.e., the instance of the App that runs in the browser. This is because Python code running in this instance can call other Python code, running elsewhere, but not vice versa.

For examples, see Uplink: Code outside Anvil.

In particular, this shows how a Python program running on your PC can be polled by your Client code, running in any browser, anywhere.

There are more specific examples here, in Q&A, of other people doing exactly this sort of thing. A closer look at how they did it, should offer some more concrete clues than I can.

For a genuinely real-time solution, I’ve had a play with crossbar.io and been pleased with the results.

You’d need a crossbar router installed somewhere but you can then write a javascript client for that router that will connect over a websocket.

Sorry I don’t have anything that I can share.