Question: What is the best way to get real time data from the Raspberry to influence a p5.js drawing?
Context: I am running a coding + art project as a school teacher (With students aged 11 - 15). We have a couple of raspberry pis (Rpi) with sensehats (sensors for humidity, accelerometer, magnetometer, gyroscope, etc attached to the GPIOs).
Students have done some
python, and some of the great coding train
p5.js tutorials. My objective would be for them to create a box which can make their art interactive. For example:
You blow on the raspberry pi, and the drawing becomes more red.
Now, the challenge is making that PiHat <-> Browser connection. Here are some ideas I explored:
- I/O processing library (it means learning yet another language, Java, and a lot of work figuring out the pins. Probably too much for the little time they have)
- Websockets (Sensors -> Python -> Websockets -> Server <- Browser <- JS <- p5.js) … I like the sound of that. The students would only need to touch the ends (python + p5.js if I can build the bridge) but I’m struggling to make most of the libraries work. Any recommendations?
- Spacebrew looks amazing … but the last commit was 2 years ago … and there doesn’t seem to be much python support.
- Is there something obvious and easier that I am missing?