0

We (my team and I) are developing a prototype sensor that uses a raspberry to preprocess sensor readings. we have a working python script and made a simple GUI using GUIzero to test everything, but this needs a screen to be connected, and that is not possible once the setup is finished and deployed in a field for example.

We now have the raspberry acting as a wifi-hotspot, and after connecting to the local network, we can access the RBPi using VNC-viewer, and interact with the simple (guizero-)GUI. This is fine for continuing testing and developing. But once we will distribute the sensor to some test-users, the VNC-solution is not optimal, as it allows too much snooping around on the RBPi.

To solve this, we were thinking that a nice solution would be to somehow link our python script with a web page, hosted on the RBPi. A user could then walk upto the sensor, connect to the local wireless network, type in an IP in a browser and the page that loads would then allow starting/stopping the sensor, downloading measured data, managing archiving data, ...

Googling points in many directions (Django, flask, ...) and I'm too much of a beginner to choose the path to take (and understand (dis)advantages of all these frameworks/libs/...) Can someone point me in the correct direction? (we know more python than we know html or PHP or..., so if the solution could be friendly in that sense, that's a plus)

davidism
  • 121,510
  • 29
  • 395
  • 339

1 Answers1

0

If you are familiar with Python, I would advise you to set up a Django application on your RasPi (their beginner tutorial covers everything you need and the whole framework is documented really well). From there you could go two ways:

  • Either create a single view (basically a function that gets called when a certain URL is called) that renders some HTML with buttons you can connect to some Python code on your system
  • Or you could create one view per function (e.g. /api/start_sensor, /api/download_data) and connect these API-calls to a webview.

The latter variant would also allow controlling the sensor programmatically via network.