A stupidly simple system to receive temperature readings (from Dallas 1-wire sensors) and push them to a website for pretty viewing by humans.
The "stupidly simple" part is important. This isn't about creating a robust website, so much as about working with my teenagers on a summer project.
It contains the following:
- A python script, intended for running on a Raspberry PI (or other device with GPIO) connected to Dallas 1Wire temperature sensors. This simple reads all the temperature sensors and, for each one, calls a URI.
- Some PHP, running out on a webserver, to accept the URI calls from the python script, and write the calls to a MySQL database and to show humans some (pretty) pages about their garden temperature.
- Code to create the database and the users required on a a MySQL server.
To make this work, you will need:
- A server running MySQL (if you're getting started, I recommend the mysql:5.7.22 docker image, but it should run on most versions of MySQL)
- A server running Apache with PHP (if you're getting started, I recommend the php:7.3-apache docker image, but it should run on most versions of PHP / Apache with MySQLI enabled)
- A raspberry Pi with Raspian and Python installed. [There's nothing too specific about needing Raspian, and I it should work on most Raspberry Pi linuxes.]
- One or more 1Wire temperature sensors connected to the GPIO ports. [This code assumes you already have them installed and working.]
The first two can be spun up quickly using the included docker-compose file. The docker-web directory also contains a Dockerfile to build a stable image for the web server, and includes the composer.json file required to install the third-party components.