The DS18B20 is a programmable digital thermometer that needs no calibration and uses only one wire of the microcontroller.

The DS18B20 is extremely popular as a temperature sensor, for obvious reasons: they’re digital, and require no calibration, in contrast to using a thermistor or similar analogue device which would need to be characterised against reference temperatures. They’re not as cheap as analogue components, but their simplicity of use and accuracy probably make up for that in scientific applications.

The devices are also notable as using the OneWire protocol developed by Dallas Semiconductor (now Maxim) and used in (amongst other devices) their iButton devices. Essentially OneWire is an embedded systems equivalent of USB that allows a set of devices to be chained together and addressed using only one pin on a microcontroller. This means that there’s no real limit on the number of sensors that even a small chip can make use of. The datasheet is available if needed, but they’re so easy to use and have such good software support (see below) that there’s no real need to refer to it.

The sensors are packaged almost like transistors, with three wires for ground, power, and data. The easiest way to use them is to power them directly with 5V and ground, and use the third wire for communications. (There’s also a “parasitic” mode that takes power from the data bus, which I haven’t got to work yet.) The communications line is the “one wire” that runs the communications protocol.

Using OneWire devices, and DS18B20s in particular, is made very simple by the existence of two libraries, providing the protocol driver and temperature conversion and packaging respectively. Links and installation instructions can be found on the 3rd-part tools and libraries page.

(Part of the series Citizen sensing.)