List All Products

Advanced Search

Lost Password?
Forgot your username?
No account yet? Register

View Cart/Checkout
Your Cart is currently empty.

Newest Products!

Current Sensor 30 Amp
Current Sensor 30 Amp

Arduino Pro
Arduino Pro

Seeeduino Mega
Seeeduino Mega

Arduino Digital Temperature Sensor Tutorial


This tutorial is now deprecated, and you should use the new one.  This old tutorial works nicely with a single temperature sensor, but if you would like to use multiple temperature sensors, then you should check out our newest tutorial here:

It sucks less.


Old tutorial:


Is it hot in here?

Your Arduino can tell you.  With an Arduino board and a DS18B20 digital temperature sensor, you can easily build a digital thermometer, a thermostat to turn devices on/off at certain temperatures, a safety device to power off when something gets too hot, etc.

Software used in this tutorial can be downloaded here:

Arduino Digital Temperature Software Example

OneWire protocol library

Hardware used in this tutorial:


DS18B20 Digital Temperature Sensor

LCD HackPack, 16x2 or 20x4 (optional, used to display the temperature)

Arduino Uno board



If this is your first Arduino project, start with our “Arduino: Getting Started” and “Beginning Solderless Breadboards” tutorials.


Use the solderless breadboard and wire jumpers to make these connections for the LCD:


 LCD Pin Connect to
 1 (VSS) GND Arduino pin*
 2 (VDD) + 5v Arduino pin
 3 (contrast) 1k Ohm resistor to GND Arduino pin*
 4 RS Arduino pin 12
 5 R/W Arduino pin 11
 6 Enable Arduino pin 10
 7 No connection 
 8 No connection 
 9 No connection 
 10 No connection 
 11 Data 4 Arduino pin 5
 12 Data 5 Arduino pin 4
 13 Data 6 Arduino pin 3
 14 Data 7 Arduino pin 2
 15 Backlight +
 Arduino pin 13
 16 Backlight GND GND Arduino pin*

*Use a breadboard rail to make multiple connections to the Arduino GND pin


DS18B20 temperature sensor connections:

 DS18B20 Pin 
 Connect to 
 1- GND Arduino pin

- Arduino pin 8

- Also, install a 5k, or so, pullup resistor to pin 2. You can

just connect pins 2 & 3 together with the resistor.

 3 + 5v Arduino pin

 * See the DS18B20 datasheet for the pin diagram, and be careful.  Wiring it backwards will fry it!




Download the OneWire protocol library here


Unzip the archive and copy the "OneWire" folder into your Arduino software libraries folder.


For Windows users:


My Documents -> Arduino -> libraries


Mac users:

<home directory> -> Documents -> Arduino -> Libraries


Linux users:

 <home directory>/sketchbook/libraries


Then restart the Arduino software.


Download the example DS18B20 software, and unzip the folder.

You will now have a folder called “ds18b20_temp_sensor”

Start your Arduino software. Load the example program by clicking File->Sketchbook->Open

Navigate to the "ds18b20_temp_sensor" folder and select the "ds18b20_temp_sensor.pde” file.

Upload the program to your Arduino by clicking the “Upload to I/O board” button. After uploading, on the LCD you should see the current temperature displayed in both Celsius and Fahrenheit.


If you do not see this message, your LCD module may be out of sync with your Arduino. Just press the reset button on your Arduino (it may take a couple of resets), and they should synchronize.


Happy hacking.

Send feedback on this tutorial here.