I believe every engineer (legally entitled or not) should spend some time on research. When I first discovered the USB devices from Phidgets last fall, I realized that my very own research budget seemed destined to increase.
And having successfully built a remotely controlled LED-system using the Interface kit, I figured literally anything would be possible.
I recently acquired my first apartment. So, as I was told the entire apartment could be heated with a single fireplace and a small electric floor radiator, I quickly decided to look into temperature monitoring the rooms. This would be rewarding both in accomplishment, but it will probably also play a role in smarter heating (and hopefully heating cost savings). The core of the system will as always be the trusty Ubuntu server, and most likely the beforementioned Phidgets interface kit. But the most critical components, not to forget how to put it all together, were still unknown.
Browsing the catalogue, I quickly found that Phidgets has a 4-port temperature sensor. And having some knowledge in temperature instrumentation, I were able to find the right thermocouples and extension wire.
So – at this point, I knew I could get the necessary equipment to get it all up and running. Still, this wasn’t all:
- The system shall record temperatures in several places (rooms).
- The instrumentation shall not be visible.
- The data must be recorded.
- The data must be recorded several times every hour, and must run from a cron script.
- The recorded data has to be presented. If not, the effort will be all wasted.
- The system must be as affordable as possible.
Point 1 is covered by just buying enough thermocouples, but is on the other hand limited by the latter point – the cost. Point 2 is a challenge, as wires has to be pulled to spots were it makes sense to measure the temperature – preferably shady areas with access to circulating air. Point 3 involves some kind of database, most likely mySQL. I were depending on finding bindings between Python and mySQL, as the temperature extraction script most likely would be written in Python. Fortunately, Ubuntu has this already in repositories. Point 4 involves a cron script. Cron is always messy, but the GNOME Schedule application makes it a little easier to set up. Point 5 is the final part, but makes it all worthwhile. Point 6 is a prerequisite, as this project doesn’t make sense if it costs a huge amount of money.
I might add, the temperature monitoring is interesting for several matters. In Norway, as with other Nordic countries, there is a serious concern that piping and plumbing may freeze over and create massive leaks. By always being able to check the indoor temperature, it may be possible to allow colder temperatures indoor if one should be away for longer periods of time – and still be able to react if temperatures should drop. Secondly, monitoring temperatures may reveal areas/rooms with high heat leakage.
Having spent quite a few hours wiring up the server and the thermocouples, the measurements started pouring into the database. I confronted the Phidget staff on connecting to the Temperature reading device as frequent as every 10 minutes, but they didn’t have any major concerns with this:
I don’t see there being a downside to this. If you were looking to
get the temperature data in 10 minute intervals that would certainly be one way to do it. A cron job that launches a simple application that will poll the data and store it somewhere.
You could also just have an active running service that simply polls the value and stores it based on a timer as well, but I haven’t done services using Python so not sure how that works exactly.
I specified 4 ciphers and 2 decimal digits for the temp readings, and currently have about 4,400 X 4 readings taking up 126KB space.
The final part was to create some kind of service for mobile devices. This sure might get improved on a later time, but currently holds 3 diagrams:
- A 3D model of the apartment, with current temperatures plotted.
- 24 hours plot
- Week plot
The first diagram is solved using the internal capabilities of GD. The two latter ones are created using latest version of jpgraph, which actually where a whole lot more complicated than first expected. Thanks to Maxiwebs for providing a php5-gd compiled with imageantialias() support.
Most of the thermocouples are mounted quite close to the ceiling, which introduces readings that are quite off the actual temperature mid-room. I tried to come up with a clever correction to this, but I’m at the moment using only a linear correction based on a separate temperature reading. I have however attempted to find correlations, logging temperatures mid-room with a separate thermocouple (extension wire standing at the floor):
Several ways to correlate the data were attempted. None were working as well as I had hoped for:
Using the plots, it is possible to identify at least one room which has issues regarding severe heat leakage – the bedroom. Here the temperature shows to drop by 2 degrees in a mere hour – far worse than any of the other rooms: