Hack and / - Temper Temper

A $15 USB thermometer and some spare parts are all I needed to control my refrigerator with Linux.

If loving Linux ever became a crime and I were hauled into court,
I think the prosecution's argument would go something like this:

Your honor, I need to submit only two pieces of evidence to make my
case. First, I present Exhibit A: a stack of Linux
Journal magazines of
which the defendant is a columnist.

And your second piece of evidence?

Your honor, the defendant's refrigerator is powered by Linux.

(The audience gasps.) Order! I've heard enough! Guilty!

I can't help it. I mean, why wouldn't you power your
fridge with Linux if you had the chance? In my case, we recently purchased
a new fridge for our house, which meant our spare fridge was headed
for the garage where I would use it for beer fermentation. Fridges are
well-insulated, and it seemed ideal for the task at hand, but the problem
I ran into was that the built-in thermostat for the fridge would go
up to only around 45–50°F at its warmest. To ferment ales, I needed to maintain
temperatures between 60–72°F.

When most people convert fridges to ferment beer, they
purchase a purpose-built device from their local brew shop. Essentially,
you plug your fridge in to the device, plug the device in to the wall,
and then set the analog thermostat on the device to your desired
temperature. A temperature probe goes into your fridge, and when it gets
too warm, the fridge is powered on. These devices range from around $70 to
more than $100, depending on whether they are analog or digital, and I almost
bought one until I realized I could do the same thing with an old
Linux laptop, a couple pieces of hardware and a few scripts.

If you are into home automation at all, you are familiar with
the X10 suite of home automation gadgets. Essentially, you can connect
lamps and appliances to different X10 gadgets and then power them on
with a remote control. There's even a remote control that connects
to a serial port, so you can control everything from a computer. Linux
has a program called bottlerocket that works great with X10 serial port
controllers, and I had used one to control my DSL modem for many years,
but that's something for another column.

The TEMPer USB Thermometer

So, I had a laptop and could control the fridge power, but I still needed
a thermometer that worked under Linux and was relatively cheap. I
discovered a great little USB-powered thermometer made by a company
named TEMPer. It's small, cheap (less than $15 shipped), supports temperatures
between –40°C and +120°C, and with a little effort, it works under Linux. It
turns out many Linux administrators are using these devices to monitor
temperatures in their data centers.

Figure 1. TEMPer USB Thermometer (photo from the Amazon product page)

Apparently, the older versions of this thermometer showed up as a
USB-to-serial interface; however, the newer models, including the one I
bought, show up as a USB Human Interface Device when you plug it in:

At first I thought I could get the temperature from this thermometer
through some /proc or /sys interface, but unfortunately, the thermometer
is more proprietary than that. The Linux community is resourceful
though, and a quick search turned up a number of guides on how to pull
the temperature from Linux (see Resources for the most helpful guide I
found). Essentially, you need to install a few
custom Perl modules, including a special one created just for this device
that depends on Perl 5.10, so you need a relatively new distribution
for this to work (I used the latest stable Debian release).

Kyle Rankin is a director of engineering operations in the San Francisco Bay Area, the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal.

Trending Topics

Upcoming Webinar

Getting Started with DevOps - Including New Data on IT Performance from Puppet Labs 2015 State of DevOps Report

August 27, 2015
12:00 PM CDT

DevOps represents a profound change from the way most IT departments have traditionally worked: from siloed teams and high-anxiety releases to everyone collaborating on uneventful and more frequent releases of higher-quality code. It doesn't matter how large or small an organization is, or even whether it's historically slow moving or risk averse — there are ways to adopt DevOps sanely, and get measurable results in just weeks.