DS18B20 Waterproof Temperature Sensor : Working & Its Applications

Measuring the temperature in difficult environments such as chemical storage, deep soils, and mines is not an easy task and most temperature sensors cannot withstand extreme heat and environmental conditions. So, the DS18B20 waterproof temperature sensor is used, which is waterproof and moisture-proof, and suitable in harsh and hazardous environments.


It can measure a wide range of temperatures from -55°C to 125°C. This article gives a brief description of the DS18B20 sensor. The alternatives of DS18B20 waterproof temperature sensors are thermocouple, LM75, LM35DZ, TMP100, DHT11, TPA81, SHT15, D6T, and DS18S20 (equivalent).

What is the DS18B20 Waterproof Temperature Sensor?

The DS18B20 waterproof temperature sensor is a pre-wired, one-meter-long, sealed, waterproof digital temperature sensor probe and it is manufactured by Dallas semiconductor and maxim integrated corporations in a waterproof version. It is easy to use, well-designed and handy to measure the temperature in any environmental conditions.

It is a 1-wire digital temperature sensor with 12 bits precision from the onboard digital to analog converter. Its working principle is based on the conversion of temperature to digital format directly and operates in parasite power mode. The operation of this sensor is based on the 1-wire serial communication protocol and stores a 64-bit unique serial code.

As this is a 1-wire digital temperature sensor, it needs only the data pin and GND pin to interface with the Arduino or microcontroller. The temperature sensing of the sensor ranges from -55°C to +125°C with an accuracy of ±5°C. It is the best temperature sensor to measure the temperature value at multiple points and requires only one data/digital pin of the Arduino or microcontroller unit to transfer the data.

It operates with 3V to 5.5V positive power supply and consumes a current of a maximum of 1mA. The main advantage of DS18B20 is its alarm function. The output signal can be configured when the values of the temperature reach a high or low threshold value set by the user.

Pin Configuration/Pin Out:

The DS18B20 is a 3-pin Or 3-wire waterproof digital temperature sensor. The DS18B20 waterproof temperature sensor pin configuration/pin diagram is shown below.

DS18B20 Waterproof Temperature Sensor
DS18B20 Waterproof Temperature Sensor

Pin 1: GND (Ground): This pin or wire refers to the ground connection of the circuit parasite mode operation. The black wire of the DS18B20 represents the ground pin.

Pin 2: VCC: This pin refers to the positive power supply voltage of 3V to 5.5V to power up the sensor. The red wire of the DS18B20 represents the VCC pin.

Pin 3: DQ or DATA: This pin refers to the output pin that can generate the digital temperature value that can be read by using the 1-wire interface protocol. It is connected to the digital pin of an Arduino or microcontroller while interfacing. It provides power to the sensor when it is operated in the parasitic power mode. The yellow wire of DS18B20 represents the data pin.

 Technical Specifications and Features:

The DS18B20 waterproof temperature technical specifications and features are given below.

  • It is a unique 1-wire programmable digital temperature sensor.
  • The operating voltage is 3.0V to 5.5V.
  • It provides an accuracy of ±5°C from -10°C to +85°C.
  • The operating temperature range is -67°F to +257°F or -55°C to +125°C.
  • The selectable resolution is 9 to 12 bits.
  • It uses only one digital pin for communication with a 1-wire interface.
  • Unique 64-bit ID burned into the chip.
  • Multiple temperature sensors can share one pin.
  • It is a temperature-limiting alarm system.
  • Query time: <750ms.
  • It is a 3-wire interface: red wire for VCC, black wire for GND, and yellow wire for DATA.
  • It is stainless steel with 6mm diameter and 35mm long.
  • Diameter of the cable: 4mm or 0.16.
  • Length of the sensor: 95cm Or 37.4″.
  • Probe: 7mm diameter, 26mm long, 6 feet overall length.
  • To prevent short circuits, internal sealing glue, and to provide moisture-proof and waterproof, each pin uses a heat-shrinkable tube.
  • It uses a moisture-proof waterproof stainless steel encapsulated tube to prevent rust.
  • It uses a unique single bus with a 1-wire serial communication protocol without using any other external components.

Alarm Feature of DS18B20:

The DS18B20 contains an in-built alarm circuit with a buzzer and two different colored LEDs (red and blue). It uses the double guaranteed sound and a light signaling alarm method. The detected temperature is compared with the set threshold temperature constantly.

When the temperature exceeds the upper limit of the threshold, then the buzzer transmits an alarm signal with high frequency, and the red LED lights up at the same time and gives a high-temperature alarm. When the temperature is lower than the lower limit of the threshold, the buzzer sends out a low-frequency alarm, and at the same time, the blue LED lights up to give a low-temperature alarm.

Circuit Diagram/How to Use:

The best and easiest way of sensing the temperature is to use the DS18B20 waterproof temperature sensor. Because it doesn’t require any external components and is operated with the 1-wire serial communication protocol. Now let’s know how to interface the DS18B20 waterproof temperature with Arduino to know the value of the temperature. The circuit diagram of the DS18B20 sensor with Arduino is shown in the figure below. The components required are;

  • The power supply of 3.0V to 5.5V.
  • Arduino UNO.
  • DS18B20 digital temperature sensor (waterproof).
  • Pull-up resistor 4.7Kiloohms.
  • Connecting wires.

Make the connections as shown in the above circuit diagram. The DS18B20 sensors can operate in two modes. They are,

Normal Mode:

It requires a 3-pin Or 3-wire connection to operate the sensor in normal mode and the VCC pin of the DS18B20 is connected to a 5V power supply. The circuit diagram of the DS18B20 sensor interfacing with Arduino in normal mode is shown in the figure below.

Interfacing DS18B20 with Arduino
Interfacing DS18B20 with Arduino

Parasite Mode:

It requires a data pin and the ground pin. The DS18B20 sensor gets the voltage supply from the data line or data pin.

Interfacing DS18B20 with Arduino in Parasite Mode
Interfacing DS18B20 with Arduino in Parasite Mode

From the above circuit, the GND pin of the sensor is connected to the GND pin of Arduino UNO. The DQ/DATA pin of the sensor is connected to the digital pin 2 of Arduino UNO to form a one-wire communication bus. A pull-up resistor of 4.7 kilo-ohms is connected from the DQ/DATA path to the VCC path of the DS18B20 sensor and the Arduino to allow the data transfer. Finally, to get the power supply, the VCC pin of the sensor is connected to the ground. Since it operates in parasitic power mode. It takes the supply from the data line.

For the interfacing DS18B20 with a microcontroller for example lets us take Arduino, 1-wire and Dallas temperature. h library functions must be installed to get output temperature readings from the DS18B20 sensor with simple commands. After library function installation, the required code must be uploaded to the Arduino UNO board as shown below.

Arduino Code:

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into digital pin 2 on the Arduino
#define ONE_WIRE_BUS 2

// Setup a one-wire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);

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

void setup(void)
{
sensors.begin(); // Start up the library
Serial.begin(9600);
}

void loop(void)
{
// Send the command to get temperature
sensors.requestTemperatures();

//print the temperature in Celsius
Serial.print(“Temperature: “);
Serial.print(sensors.getTempCByIndex(0));
Serial.print((char)176);//shows degrees of character
Serial.print(“C | “);

//print the temperature in Fahrenheit
Serial.print((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);
Serial.print((char)176);//shows degrees of character
Serial.println(“F”);

delay(500);
}

Where to Use/Applications:

The applications of the DS18B20 waterproof temperature sensor are listed below.

  • Used to measure temperature in harsh environments like soils, mines, chemical solutions, etc.
  • Used to measure liquid temperature.
  • Used in multiple temperature measurement applications.
  • Used in industrial systems.
  • Used in consumer products.
  • Thermostatic controls, thermometers, and thermally sensitive systems.

Please refer to this link for DS18B20 Waterproof Temperature Sensor Datasheet.

Thus, this is all about an overview of the DS18B20 waterproof temperature sensor. Several digital temperature sensors are available in the market. Check the datasheet and choose the best temperature sensor that meets your project requirements.