Reading temperature sensors with Perl

HOW COOL IS PERL?

Author(s):

Linux lets tinkerers connect their hardware creations to computers. We’ll show you how you can use a simple Perl interface to check the temperature of your home or office while you’re away.

It’s not so long ago that users had to write their own device drivers to add hardware. But with the standardization of USB, and with fully-functional hot-plugging support in kernel 2.6, things have become far easier. The temperature sensor used in this article, a Dallas Semiconductor DS18S20 ([3]), can be controlled via the one-wire bus, which is driven by a USB dongle attached to the computer. The free owfs control software at [2] can request data via a Perl interface. Instead of one-wire, the bus should really be called two-wire, as two thin copper wires (typically in a single sheathing) connect the sensor to the USB dongle (see Figure 1). At the other end there is a western connector (RJ11), which plugs into the USB dongle.