Table of Contents
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 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 tutorial, we will cover
- Ds18b20 waterproof digital temperature sensor introduction
- Complete circuit diagram
- Programming and finally
Let’s get started!!!!!
Other Tools and Components:
Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
About the DS18B20 Waterproof Temperature Sensor:
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 for 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.
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:
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”
Arduino DS18B20 Library “DallasTemperature”
Arduino DS18B20 digital Temperature Sensor Programming:
#define ONE_WIRE_BUS 3
#define rs 9
#define en 8
#define d4 7
#define d5 6
#define d6 5
#define d7 4
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// set up the LCD's number of columns and rows:
// Print a message to the LCD.
Serial.print(" C ");
Serial.print(" F ");
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.