www.nutsvolts.com/index.php?/magazine/article/december2010_Reilly
PUT A TEMPERATURE
SENSOR IN YOUR NEXT
By Rob Reilly
This project is a compost monitoring device (Figure 1)
that uses three temperature sensors (Dallas DS18B20),
a photocell, an Arduino, and an Xbee digital radio to
wirelessly send telemetry data to my notebook.
Temperatures are a good indicator of the need for turning
the compost or when it is ready for use around my plants.
My device is housed in PVC pipe and runs on four D cell
batteries.
■ FIGURE 1. Compost
temperature device.
In this article, I'll cover using the Dallas DS18B20 temperature sensor with the Arduino microcontroller. I'll
briefly describe the sensor, then summarize the Arduino
code needed for using one or several of them. We’ll finish
up with practical design implementation for putting these
bad boys into your own device. The sensors are
inexpensive and work well
with the Arduino. You'll find
a lot of uses for them.
A Cool Little
Device
The Dallas DS18B20
"one-wire" temperature
sensor is actually an
amazing piece of
technology. It can measure
temperatures from - 67
degrees to 257 degrees
Fahrenheit and operates on
3.0 to 5.0 volts DC. The TO-
92 version is physically
similar to a medium-sized
36 December 2010
■ FIGURE 2.
Pictorial schematic.
LED. Each device has a unique serial number and is
hooked up to a simple bus wiring layout. You can put one,
two, or 10 devices on a cable and retrieve each one's data
individually. It's called a one-wire because you can chain
multiple devices together and read them all using one
digital input line on your microcontroller.
Code to integrate the
DS18B20 and the Arduino
used to be complicated and
hard to understand. Today,
easy-to-use function calls to
pre-built libraries are the
way to go. The one built by
Miles Burton works very
well and makes reading
temperatures from the
DS18B20 device almost
painless (see Websites
Sidebar).
Put the System
Together
Figure 2 shows the