What's alive? This blog, this Sourceforge project, and my weather net!
I've been tinkering around the edges of this for ages, and finally pulled all the different parts together to get the sensor part working. As I've been pulling this all together, the tought occurred to me that I should blog the steps I've taken, both technological and idealogical, to come up with this little project and bring it to some sort of useful life. So where we have the the weatherPi blog.
In this post, I just want to outline what is currently working. I'll go back and fill in how I got here, and what tools I used to get here, in the next few days. Then I can get onto where to go next.
As of this moment, I have these parts:
So far, the code archives here have to little blobs of code. On is the actual sensor code. It's trivially simple; it initializes the BME280 using a driver I found in PyPI, then loops once per minute scanning the environment from the chip and POSTing to the the web service. This is a whopping 29 lines of Python code, demonstrating how brilliant Python and the PyPI library is at making little tools like this.
On the server side, we have a Python Flask application that recevies samples via a POST, in JSON. The sample is unpacked into a Cassandra object model, which updates the database. There is more logging in the code that does this than actual code; now that it's all working, I'll go back and trim some of the logging. The Cassandra writes are enough wear and tear on the flash, we don't need to double them with paranoid debugging log messages. :)
Missing yet is the virtualenv setup for the Flask application. I'll get that added ASAP.
The next obvious setp is... a web UI. I've done "web UIs" before, but way back in the multi-page, PHP days. When you get done gagging or laughing, come on back.
Regained your composure? Good. Yes, this will be a single-page reactive app. The primary display with be a time-based graph of the past some interval of time showing how the weather has been lately. Of course it will. I'm still learning how to do one of these apps that updates a graph in real time, so if you have any suggestions, I'd like to hear them. If it can be hosted on a Pi with Nginx, so much the better. Ideally I'd like to host the app files on my bastion host, which is a Pi Zero W and runs Nginx to do web services redirects, with redirects to access the read-side of the weather data. (No, I'm not dumb enough to open the sample writing interface to the world.)
After that, I thought I'd add a sensor based on Arduino, to show the zealots just how much harder it is, code-wise. Then document the differences in cost and power budget. I have an Adafruit Feather M0 WiFi lying here, that already has a BME280 attached, so that's just some code away. Well, except for that whole printing floating point numbers thing in Arduino. :)
Then I can move on to powering the sensors with the sun. I have most of what I need, but the battery I have will only power the M0 for 2 hours, so I need about 8 times as much battery, or to learn how to put the M0 and the WiFi radio into low power sleep. Stay tuned.