DS18B20 Arduino Example

DS18B20 is 1-Wire digital temperature sensor from Maxim IC. Reports degrees in Celsius from -55 to 125 ( /-0.5). Each sensor has a unique 64-Bit Serial number etched into it – allows for a huge number of sensors to be used on one data bus. To use the sensor, we need two libraries: OneWire.h and Arduino-Temperature-Control-Library-master. Pin OUT must be connected to a Vcc 10K ohm resistor, if you don’t do this your sensor will show -127 degrees Celsius.


  • Unique 1-Wire interface requires only one port pin for communication
  • Each device has a unique 64-bit serial code stored in an onboard ROM
  • Requires no external components
  • Can be powered from data line.
  • Power supply range is 3.0V to 5.5V
  • Measures temperatures from –55°C to 125°C (–67°F to 257°F)±0.5°C accuracy from –10°C to 85°C
  • Thermometer resolution is user-selectable from 9 to 12 bits

Sketch 2 version: