Arduino DS18B20 digital Temperature Sensor Library, wiring & Programming

(Last Updated On: July 21, 2019)

Arduino DS18B20

Description:

Arduino DS18B20- In this Tutorial, you will learn how to use Ds18b20 waterproof one wire digital Temperature sensor with Arduino and display the temperature in Celsius and Fahrenheit on a 16×2 LCD. So far I have covered different temperature sensors like

Dht11, which can monitor temperature and humidity

Bmp180 which can monitor temperature, pressure and altitude and a K type thermocouple, which can measure temperatures up to 1000 Centigrade.  I will provide links at the end of this Article.


In today’s episode we will cover

  1. Ds18b20 waterproof digital temperature sensor introduction
  2. Complete circuit diagram
  3. Programming and finally
  4. Testing

Let’s get started!!!!!

The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Arduino Uno: https://amzn.to/2tVz1vu
Mega 2560: https://amzn.to/2ze1kdu
DS12b20 waterproof digital temperature sensor: best offer https://amzn.to/2S5Ky52
16×2 LCD: https://amzn.to/2FcXuUS
Potentiometer: https://amzn.to/2JSLbfg
330 ohm resistors pack: https://amzn.to/2NtlAeh
5v 2A adaptor: https://amzn.to/2GsNfcw
2n2222 npn transistors: https://amzn.to/2EmXsIb
10k Resistor: https://amzn.to/2KTd6OW
lm7805 Voltage Regulator: https://amzn.to/2IZEl5x
330-ohm resistors pack: https://amzn.to/2NtlAeh
female DC power jack socket: https://amzn.to/2KEo1gt
470 uf capacitors: https://amzn.to/2xDCOzf
5×7 cm vero board: https://amzn.to/2OHGbvn
female headers: https://amzn.to/2zqmtiJ
connection wires: https://amzn.to/2DpBuW7
Super Starter kit for Beginners: https://amzn.to/2KJvmKG
Jumper Wires: https://amzn.to/2KMoVXs
Bread Board: https://amzn.to/2MS4q8X
12v Adaptor: https://amzn.to/2Ntr6h1
PCB plate: https://amzn.to/2IUwpCt
Variable Supply: https://amzn.to/2MT4Qfj
Digital Multimeter: https://amzn.to/2Nvft9i
Vero Board / strip board: https://amzn.to/2MTf9jD
Soldering iron kit: “best” You guys should definitely purchase this: https://amzn.to/2zfoNuJ
Solder wire: https://amzn.to/2ufUMWf
Wire Stripper: https://amzn.to/2KOqxfU
wire cutter: https://amzn.to/2ucIq14
PCB small portable drill machine: https://amzn.to/2Nu62XF


About the DS18B20 Waterproof Temperature Sensor:

Arduino DS18B20

One-wire temperature sensors like the DS18B20 are devices that can measure temperature with a minimal amount of hardware and wiring.  These sensors use a digital protocol to send accurate temperature readings directly to your development board without the need of an analog to digital converter or other extra hardware. You can get one-wire sensors in different form factors like waterproof and high-temperature probes–these are perfect for sensing temperature in many different projects and applications.  And since these sensors use the one-wire protocol you can even have multiple of them connected to the same pin and read all their temperature values independently.


Arduino DS18B20

The DS18B20 Waterproof Temperature Sensor has three wires

  • The red wire is the VCC wire: the operating voltage is 3 to 5 volts. In my case, I will use 3.3 volts.
  • Yellow Wire is the Data wire: we usually connect a resistor between the data wire and VCC wire, I will explain this in the circuit diagram.
  • The black wire is the Ground wire. This wire is connected with the Nodemcu Esp8266 wifi module ground.

This temperature sensor is capable of measuring the temperature ranging from -55°C to 125°C

Arduino DS18B20 Circuit Diagram:

Arduino DS18B20

This schematic is designed in cadsoft eagle 9.1.0 version. If you want to learn how to make schematics and pcb then watch my tutorial.

 

 

Let’s start with the DS18b20 digital temperature sensor. As you can see a 330 ohm resistor is connected between the Vcc and data wires. You can also use a 4.7k resistor. The Vcc is connected with 3.3 volts. While the ground is connected with the Arduino’s ground.

As you can see ground from the Arduino is connected with pin number 1, 5 and pin number 16 of the LCD. 5v from the Arduino is connected with pin number 2 and pin number 15. The middle pin of the variable resistor or potentiometer is connected with pin number 3 of the LCD. while the other two pins are connected with the ground and 5v. Pin’s 4 to 7 of the Arduino are connected with pins D7 to D4 of the LCD.



Pin number 8 of the Arduino is connected with the enable pin of the LCD. Pin number 9 of the Arduino is connected with the RS pin of the LCD, watch my tutorial on 16×2 LCD if you want to learn the basics, like soldering, troubleshooting.

 

Libraries needed for the DS18B20:

Before you start the programming first off all, download the following libraries.

Arduino DS18B20 Library “onewire”

Download: onewire

Arduino DS18B20 Library “DallasTemperature”

Download: DallasTemperature

Arduino DS18B20 digital Temperature Sensor Programming:

For the Program explanation watch video Tutorial given below. Don’t forget to subscribe my channel. Support my channel by liking and sharing the video.


Watch Video Tutorial:

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Close