Electronics

Temperature Sensor Waterproof Thermal Probe DS18B20

AED 15.75

1

Description

The DS18B20 digital temperature sensor is one of the most widely used temperature sensors available produced by Maxim Integrated (formerly Dallas Semiconductor), it offers reasonable accuracy (0.5 °C) over a wide temperature range (-55 °C to + 125 °C) with waterproof capability and 1m long cable. The Sensor can be used with both the Arduino (which runs at 5 V) and electronics like the ESP32 and Raspberry Pi, which have 3.3 V GPIO pins because their operating voltage ranges from 3.0 to 5.5 V.

Package Includes:

  • 1x Waterproof DS18B20 Temperature Sensor 1m

Features:

  • 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
  • Can be powered from a data line. The power supply range is 3.0V to 5.5V
  • Long Cable 1m with waterproof stainless steel casing for protection
  • Measures temperatures from –55°C to +125°C 
  • Thermometer resolution is user-selectable from 9 to 12 bits
  • User-definable nonvolatile (NV) alarm settings with Alarm search command identify devices whose temperature is outside of programmed limits. 

Description:

The DS18B20 digital temperature sensor is one of the most widely used temperature sensors available produced by Maxim Integrated (formerly Dallas Semiconductor), it offers reasonable accuracy (0.5 °C) over a wide temperature range (-55 °C to + 125 °C) with waterproof capability and 1m long cable. The Sensor can be used with both the Arduino (which runs at 5 V) and electronics like the ESP32 and Raspberry Pi, which have 3.3 V GPIO pins because its operating voltage ranges from 3.0 to 5.5 V.One of this sensor's most significant benefits is that it can communicate with the Arduino using just one digital pin. The Sensor Module uses the Dallas Semiconductor 1-Wire® protocol for communication. Similar to I2C in operation, but with a greater operating range and slower data rates. Another benefit is that multiple DS18B20 sensors can operate on a single 1-Wire bus because each DS18B20 Sensor Module has a different 64-bit serial code.

you can use a single Arduino pin to read data from multiple sensors that are connected together. Programmatically, the sensor's resolution can be changed to 9, 10, 11, or 12 bits. This translates into temperatures of 0, 0, 25, 0, 125, and 0, 0635 degrees Celsius, respectively. 12-bit resolution is the initial default setting.

Principle of Work:

The Sensor operates using the 1-Wire communication protocol. The other two pins are used for power, and only the data pin needs to be connected to the microcontroller via a pull-up resistor. The pull-up resistor is used to maintain the line's high state when the bus is not in use. A 2-byte register inside the Sensor Module will hold the temperature reading obtained by the sensor. By sending a series of data, this data can be read using the 1-wire method. To read the values, two different types of commands must be sent: a ROM command and a function command. The data sheet below provides the address value and sequence for each ROM memory. To learn how to communicate with the sensor, you must read it. You need not worry about any of these if you intend to interface it with Arduino. To access the data, use the built-in functions and the available library.

Pinout of the Board:

DS18B20 Description
Black GND
Yellow Connected to any digital pin
Red 5V


Applications:

  1. Measuring temperature in hard environments
  2. Liquid temperature measurement
  3. Applications where the temperature has to be measured at multiple points

Circuit:

Connect digital pin 2 to the Yellow cable

Black wire to GND on Arduino 

Red wire to 5V on Arduino

Library: 

You can download the library by clicking here

Once the the.ZIP file is downloaded go to Arduino IDE -> Sketch -> Include Library -> Add.ZIP Library and look for the ZIP file to be installed.

Code:

This code is going to print the Temperature Sensor Module on the Serial Monitor.

#include "OneWire.h"
#include "DallasTemperature.h"

// Define to which pin of the Arduino the 1-Wire bus is connected:
#define ONE_WIRE_BUS 2

// Create a new instance of the oneWire class to communicate with any OneWire device:
OneWire oneWire(ONE_WIRE_BUS);

// Pass the oneWire reference to DallasTemperature library:
DallasTemperature sensors(&oneWire);

void setup() {
  // Begin serial communication at a baud rate of 9600:
  Serial.begin(9600);
  // Start up the library:
  sensors.begin();
}

void loop() {
  // Send the command for all devices on the bus to perform a temperature conversion:
  sensors.requestTemperatures();

  // Fetch the temperature in degrees Celsius for device index:
  float tempC = sensors.getTempCByIndex(0); // the index 0 refers to the first device
  // Fetch the temperature in degrees Fahrenheit for device index:
  float tempF = sensors.getTempFByIndex(0);

  // Print the temperature in Celsius in the Serial Monitor:
  Serial.print("Temperature: ");
  Serial.print(tempC);
  Serial.print(" \xC2\xB0"); // shows degree symbol
  Serial.print("C  |  ");

  // Print the temperature in Fahrenheit
  Serial.print(tempF);
  Serial.print(" \xC2\xB0"); // shows degree symbol
  Serial.println("F");

  // Wait 1 second:
  delay(1000);
}

Technical Details:

  • Programmable Digital Temperature Sensor
  • Communicates using 1-Wire method
  • Operating voltage: 3V to 5V
  • Temperature Range: -55°C to +125°C
  • Accuracy: ±0.5°C
  • Output Resolution: 9-bit to 12-bit (programmable)
  • Unique 64-bit address enables multiplexing
  • Conversion time: 750ms at 12-bit
  • Length of Cable: 1m
  • Size of Stainless steel sheath: 6*30mm

Resources:

Library

Tutorial

For Temperature Sensor  Arduino Tutorial, please click here

For the Temperature Sensor Raspberry Pi tutorial, please click here

Comparisons:

The Dallas DS18B20 waterproof has an advantage over DHT11 and other sensors because it can be used in water and it has a 1m long cable also it has a temperature range of -55 – 125° C / ± 0.5° C while in comparison to DHT11 which has a range of 0 – 50° C / ± 2° C the DS18B20 has an extraordinary speed compared to DHT11 but still, the DHT11 can sense the temperature and humidity.

DHT11 Specifications DS18B20
Humidity and temperature Measurement Temperature
0 – 50° C / ± 2° C Temperature Range -55 – 125° C / ± 0.5° C
20 – 80 / ± 5 % Humidity Range Nil
1 wire Communication Protocol  1 wire
1 Hz one reading every second Sampling Rate
3 – 5 V Operating Voltage 3 – 5 V
2.5 mA Minimum current 10 mA