This week I learned an awful lot about programming! I was lucky to be home in California for Thanksgiving, where I could pester my brother about all the things that I don't know how to make instead of my housemates and TAs. So here's my brother Albie, software engineer and founder of the parking app Spotter, helping me build a web app and sensor interface.
My initial plan was to do something simple and straightforward using just Python with Tkinter, especially since Thras helped me get that all working last week. So I read through Neil's temperature code a few times and came up with a vague plan to position 6 different bars (two bars for each of the three joint temperature/humidity sensors) on a diagram of the trailer in which I'm building an evaporative cooler. It would look something like this.
This part turned out to be nontrivial. Python was the obvious choice for pulling data from the sensors via the serial port, and then we needed to install Flask to create a RESTful application programming interface (API) to send data to the web GUI. We also had to employ Ajax for network requests (GET/PUT) requests on the GUI side. When you run the Python code (via the command line), it sets up a local host on port 5000 to generate random numbers that oscillate around mostly-reasonable temperature and humidity values-- and all those values are then displayed in the GUI via your browser window. The temperature and humidity gauges oscillate and refresh as new numbers come in. The next step will be to debug the data-logging script, which should create a CSV on the desktop (or somewhere local) with all the logged values. Here's the web app in action!
Sadly I ran into some trouble actually interfacing my interface with the temperature sensor-- first I couldn't download the Adafruit sensor library (which supposedly contained a script for reading and logging temperature/humidity sensor data), then I couldn't find a functional ISP cable and my thermristor board may have been acting finicky. But the main problem was that I flew back from California with only a couple hours to spare before Wednesday's class, so I'll hopefully get it all sorted this week. Regardless, everything will have to be working in time to measure the temperature and humidity of my final evaporative cooler in a few weeks...