Remote Thermostat Control, Part II

Having remote thermostat control has been such a success for us with our beach cottage, I decided it was time to try the same thing at home.

While we leave a PC running at the cottage, for our house server we use a Buffalo LinkStation (a NAS box) running FreeLink, in large part because the NAS consumes a lot less power.  (The cottage will likely have to be upgraded fairly soon, assuming this works out.)

Hardware Issues

Unlike a full PC, the NAS doesn't have any serial or parallel ports, although it does have two USB ports.  That's an important difference for this project, because, in the original cottage set-up, I use a serial port to read temperature information, and the parallel port to control the relay board. 

USB Parallel Port Replacement

The USB Bit Whacker (UBW) kit is $20 from SparkFun, and was originally conceived as a USB replacement for parallel port devices.  It's offered as a very general-purpose module, with I/O pins being terminated on PCB headers only, i.e., there's no parallel port connector or cable.

At first I thought I'd just stack the UBW above the relay board and connect them directly by header, but unfortunately the host spacings don't match.  Instead, I just soldered nine wires between the two boards, each wire being about an inch in length.  (Click pictures to enlarge.)

I was going to connect the mounting holes of the two boards using standoffs, but it turns out that the relays on the relay board are taller than the standoffs I had, so the UBW actually just floats above the relay board using the wires for support.  (Note that the distance between the mounting holes of the UBW is shorter than the mounting hole distance for the relay board, and longer than the mounting hole distance for the unused parallel port connector, but it is roughly the same as the diagonal distance between one mounting hole and one port connector hole.)

In this configuration, the relay board has to be externally powered, as the UBW can't provide the 12v necessary to drive the relays.  I found an old wall-wart marked for 12v DC output, and pressed it into service.

 

USB Serial Port Replacement

To connect the temperature logger board, there are any number of USB-to-serial port adapters; I picked one up for $10 based on the Prolific PL2303 chip.  (A Linux driver for this chip has been in the kernel since at least 2.6.16.)  Unfortunately, this adapter doesn't provide a DTR signal (or, at least, not enough of one to power the temperature logger), so I had to borrow power from the relay board.  I found the easiest place to introduce a 12v supply after building the temperature logger was to solder a wire to the diode on the board.  This wire then leads to the +12v connector on the relay board. 

The temperature logger's ground is tied to the relay board's ground by connecting ground from one of the temperature logger's headers to the GND connector on the relay board.

 

Software Issues

I'm quite impressed with FreeLink, the hacked Debian distribution that runs on the LinkStation.  Unfortunately, FreeLink isn't quite to the point of being as complete and automated as a standard Linux distribution.

In particular, FreeLink presently runs a kernel that doesn't include a lot of the standard kernel drivers.  (I don't honestly understand why this should be.  The nas-central.org site is the best source for information, but it all has the flavor of follow-on discussion after a meeting you didn't attend -- there's a lot of "here's the latest update," but not a clear statement of "why are we here."  At least, not clear to me.) 

The driver for the Prolific USB-to-serial device, the PL2303 driver, isn't available in the stock FreeLink kernel.

Recently there's been some activity making experimental kernels that include more drivers (as modules), and I hope soon to experiment with installing one of these.  The problem is, we run a lot of services on this machine that we consider vital to daily life, so experiments that may make those services temporarily unavailable require a bit of planning...