Reading temperature sensors with Perl

HOW COOL IS PERL?

Article from Issue 65/2006
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.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Sensor Shootout

    Any application that collects a large number of measurements is bound to have some anomalous measurements, but good sensor breakouts should not output such values all the time. We tested eight temperature and humidity sensors for accuracy.

  • Home Assistant with MQTT

    Automating your four walls does not necessarily require commercial solutions. With a little skill, you can develop your own projects on a low budget.

  • Monitoring Beehives

    Beekeepers can get to know their colonies better without continuously disturbing the industrious insects. Using a Raspberry Pi and various sensors, two hobby beekeepers monitor the temperature and humidity of their hives, with plans to monitor their weight.

  • Monitorix 1.0.0 Monitors Hardware and Software

    Version 1.0.0 of the Monitorix monitoring program has just been released. It now shows fan speeds, and CPU, motherboard and hard disk temperatures among other system data.

  • Monitoring Old Devices

    Create monitoring dashboards with SSH, command-line tools, and Node-RED.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News