Archives for category: Home automation

SparkFun offered a discount on some components useful for home weather stations, so I finally bought them recently. More importantly, I assembled them and installed them outside.

The sensors consist of:

  • wind speed anemometer
  • wind direction
  • air temperature
  • relative humidity
  • rainfall
  • barometric pressure

I’m using an Arduino Uno to collect the raw data from the sensors and publish it via the USB port to my local server. On that server I then run a Python script which reads the incoming weather sensor measurements and, every minute, uses the Weather Underground API to publish to them. To be able to publish, I registered with wunderground, which means I can now use them for real-time, local weather conditions. It’s the same place I also use as a store of historical data.

At the moment, I’m still tuning the location of the air temperature sensor. It’s not in direct sunlight, but I think it’s getting too much radiation from the garage exterior wall.


I live in the US and have two-phase, 240 VAC, 60 Hz electric service to my home. I’ve wanted to better understand the electricity consumption patterns at my home, to see if I could reduce that consumption. I had a WattNode from a previous project in my inventory, so it was time to finally put it to good use.

The WattNode model I have is capable of monitoring up to three phases, so I’ll only use two-thirds of its capacity. Communication with the WattNode is via an RS-485 bus, so I’ll need a way to connect it via USB to my dedicated monitoring server. For that I plan to use an opto-isolated USB-to-RS485 device from B&B Electronics.

I’ll write the monitoring software myself, using Python and the MinimalModbus module. I have not yet found a good off-site place to publish and store my consumption data, so I’ll store it locally in an RDBMS. I have a basic class written in Python, which I’ll use to collect the frequency, voltage and current measurements from the device.

The next step is to install the WattNode in my primary electrical panel and then pull some low-voltage wire from it to my server.

I have had a couple of USB temperature sensors in my collections for some time now. They are the PCsensor Temper units from Tenx Technology, Inc.. The USB Vendor ID is 1130 and the Product ID is 660C. I wanted to use them in my Linux environment, as part of my home monitoring system. I also wanted to interact with them using Python, since that is my preferred language for most of my monitoring and robotics projects. I didn’t look very hard but didn’t find anything that someone else had already written in Python, which worked out well because I wanted to exercise my new-found PyUSB skills. I couldn’t find a datasheet for the devices but I did find a C version on Robert Kavaler’s ‘blog.

My Python class to read the temperature from the TEMPer unit is here.

I live in a building with five other units. This building has a shared source of hot water. This single, shared source has a 120 gallon reservoir and supplies all of the hot water for the kitchens, dishwashers, clothes washers, bathrooms, showers and bathtubs in the building. On a recurring basis, occupants are complaining about the water not being hot enough or being simply not heated at all. Being an engineer and an environmentalist (and a bit of a curmudgeon) I decided to look closer at the situation.

The water supply to the building is from the municipal source. It is heated by a gas-fired unit, separate from the reservoir. As mentioned earlier, the reservoir has a 120 gallon capacity. The system also has a pump which keeps heated water circulating through the entire building, regardless of a demand. This recirculation pump runs non-stop.

I thought the way to understand the system was to measure the water temperature at various points and to measure the flow of water. I found a water flow meter from Badger Meter  to measure the flow. I used 1-Wire temperature sensors to measure the temperature and a LinkUSB device to collect the data from the 1-Wire devices. I used a LabJack U12 to capture the flow data from the meter. All of this data was collected by an old notebook computer which I attached to a sheet of plywood and then hung on the basement wall.

The Badger Meter was used to measure the total volume of water flowing through the water heating system. I installed it on the cold input, instead of the hot output, in order to stay within the operating temperature range of the meter.

The 1-Wire devices were used to measure the temperature of the system at various points. I didn’t want to actually penetrate any of the plumbing, in order to avoid creating leaks. Since all of the plumbing for the system consists of copper tubing, I used heat sink compound and electrical tape to attache the sensors directly to the plumbing. I used a total of six sensors, at the following locations:

  1. the ambient air temperature surrounding the system
  2. the heated water output from the reservoir
  3. the recirculation loop return
  4. the municipal supply
  5. the flow into the heating unit
  6. the flow out of the heating unit and into the reservoir

The last and possibly most important piece of this entire system was the software which I used to collect and process all of the data. I wanted to accomplish several things:

  1. understand how the system worked and how the temperatures were related to each other
  2. understand how much water we used on average
  3. send advance notice of an impending hot water shortage
  4. record sudden large increases in consumption
  5. confirm or deny an actual outage
  6. understand the conditions leading up to an outage

The software which collected and processed all of the data was rrdtool and a program which I wrote in Python. This software captured the sensor data every 60 seconds, archived and processed it. If measurements exceeded thresholds, an E-mail message was sent to interested parties.

I’ll describe the specific details of the system in the next article. I was surprised, and a bit disgusted, by what I learned about the usage of hot water in my building.