From the Real World to the Web

Part of my quest for world domination, er, getting my Raspberry Pi to tell me about things in my basement without my having to actually go down there is just about complete.

I bought a temperature and humidity sensor from Adafruit and finally got around to wiring it up and getting the Python code written to read it. I took the coding step by step. First getting it working from a Python repl, then a super simple script, then a more complex script that saved the data to a csv file. At that point I was a bit stuck. I figured I was looking at MySQL and Apache, and I did try. And try. And try. And try to make it work, but I couldn’t. Then I started thinking about how sqlite3 comes baked into Python. Turns out, it was pretty easy to get that working.

But I was still stuck with how to get the data from the database and display it in a graph on a (internal) web page. Apache was like using dynamite when you really need a ball-peen hammer. Finally, after nights of searching and experimenting, I found this guy’s Medium site for doing just exactly what I wanted! I couldn’t believe it! EXACTLY what I wanted to do. And, it had the added bonus of tossing Apache aside and using Flask, which is more Python and new ground for me. I had to debug some of his code to get it running, and I am considering what I have a total beta, but the real point was figuring out how to get data from a database and into a graph on a web page. Mission accomplished!

Now to address the CSS…

This entry was posted in Geek and tagged , , , , , , , , . Bookmark the permalink.

One Response to From the Real World to the Web

  1. Pingback: Modernizing My Temperature and Humidity Sensor | Matt's Blarg

If you liked this post, please let me know!

This site uses Akismet to reduce spam. Learn how your comment data is processed.