Details

Python 3.x

Phidgets USB board

Phidgets Temperature sensors

Phidgets Windows and Python libraries

Python example code for Phidgets

Python module for mySQLconnector: >pip install mysql-connector-python

Created a tiny python module to read the data from the 5 sensors every second and write it to a file. I used the python logger module, and created a time-rotating log to write a new log every hour. I read the sensors every second, but discard most the data. After all, this code is a monitor for home thermometers, not a nuke station. The data is written as complete insert statements for mySQL database. Could write the data a CSV, and construct the insert statement later, but went for easy. Since the logs are SQL, they could be imported directly to a DB.

There are five sensors, one on the desk where I work at home, one on the floor of that room, one in attic directly above that room, one hanging out the window, and one in the heating duct. The theory is when the furnace starts, the duct temperature will change, rising while the furnace in on, and then falling off when the furnace heating shuts off, but the fan is still blowing. This will allow me to write code to process the data, and find furnace duty cycle for a day, or what ever. The sensor hanging out the window gives an approximation of the outside temperature (approximate because the sensor is not far enough outside the wall of the house, so the readings are higher than the true outside temperature). In theory, one should be able to correlate the furnace run time with the outside temperature. Or not. Laziness may strike the developer at any time.

Created anoter tiny python module to monitor the log files. When a rollover file appears (using pattern matching on some details of how the default rollover file names are constructed), code reads the data line by line from the file, and executes insert statements to the DB. The code writes first to a local DB and then redoes the file, running the inserts on the remote DB at my website. The local DB is for development. The python code use the MySQL Connector module. The code copies the file to a processing directory, adds an sql extension, and when finished processing, copies it to a done directory.

Added the GUI.

The links to draw graphs invoke a full day's worth of data, with a sensor id, and a time offset. Curiously, all the data is recorded at EST, but somewhere along the line, it gets a wrong time zone, so I provide an offset to allow relabeling of the X-axis (time). Assume the data is from midnight to midnight for the day selected.

The drawing code uses a PHP module called JPGraph. There may be better drawing modules, but this one worked for my code to draw H-R diagrams form astronomy data (Tycho database), and works well enough for this project.

The links have fixed parameters for now, but I will add a form to allow selecting a day from the current range of days in the DB, and for selecting various sensors. Duct temperature and outside temperature will alway be visible.