I have been using the MQTT protocol to send images to a streamlit app over a network, and over time this has proven to be robust and straightforward to maintain. MQTT is commonly used in the IOT world to interface with and collect data from remote hardware, sensors etc, and there are already many interfaces for devices using MQTT. I have a background in science, building large experiments in the lab. These experiments are often assembled by grad students with minimal software development experience, and I believe python/streamlit/MQTT would enable them to get results far quicker and at much lower cost than the traditional approaches (c++, labview etc). Therefore I thought I would start this thread to highlight some best-practice examples of using MQTT to control hardware, with a streamlit UI of course! I found this great example maskcam below, where streamlit and MQTT are used to control and read state from an AI camera. Hopefully this will inspire others to interface with hardware using streamlit as the UI
Oh wow this looks absolutely stunningly awesome @robmarkcole !
Not gonna lie, I’d love a blogpost about this if you have time to write one ?
Have a nice day,
Fanilo
+1 on the @andfanilo note - would love to read a blog post on this and share it with the community on blog.streamlit.io
@robmarkcole that is such a well executed pipeline and you are 100% correct in your assessment of the challenges with grad students writing software. I had the same experience (except my lab was computational, you’d expect better but scientists care about results and often skimp on the architecture).
I’d love to assist in helping disseminate information about designing such systems, a blog post sounds like a great start but ultimately I’d love solid templates and boilerplates. I’ve found that my best success with adoption of stuff like this at university came when I basically boiled everything down to a couple “make” commands that removed as much friction as possible.
@mathematicalmichael one route is to create an awesome repo that aggregates resources on this topic, linking to functioning code. Something like awesome-streamlit-on-hardware
perhaps, or even just add a section to awesome-streamlit or awesome-mqtt?
@andfanilo I am totally up for writing a blog post, and starting a blog has been high on my todo for a while now! I think once we have a few more examples of mqtt/streamlit/hardware this article will write itself
A nice demo of streamlit and hardware, not using MQTT but instead publishing data over the serial port (could be forwarded over mqtt however):
The author did the same with a temperature sensor: How to Build a Real-time SCADA System Using Python and Arduino | by M Khorasani | Towards Data Science
Yes absolutely, with Streamlit the limit is what you want it to be. I’ve had great experiences rendering SCADA dashboards and interfacing with a multitude of hardware including but not limited to motors using Streamlit!
Hello everyone, thanks in advance for your great work grouping interesting projects related to this topic. I’m new to streamlit and to using MQTT with it.
Nonetheless, I am trying to build an app that connects to an MQTT server to fetch data of a lot of sensors. Hence my search for a robust and scalable architecture using MQTT and streamlit. Is there any good example where I can find more information ?