Temperature Sensor Waterproof Thermal Probe DS18B20

AED 14.00



The DS18B20 digital temperature sensor, produced by Maxim Integrated (formerly Dallas Semiconductor), is a highly regarded choice in temperature sensing. It is known for its versatility, reliability, and impressive accuracy of 0.5°C. With a wide temperature range of -55°C to +125°C, waterproof capabilities, and a 1-meter cable, it offers adaptability. Moreover, it stands out for its compatibility with various platforms like Arduino, ESP32, and Raspberry Pi, accommodating both 5V and 3.3V setups (3.0V to 5.5V voltage range). This sensor is a trusted companion for temperature sensing in diverse applications.


Package Includes:

  • 1x Waterproof DS18B20 Temperature Sensor 1m


  • Unique 1-Wire® Interface: This sensor employs a distinctive 1-Wire® interface, which simplifies communication by requiring only a single port pin. This efficient design reduces the complexity of connecting the sensor to your chosen platform.
  • Unique 64-bit Serial Code: Each DS18B20 sensor is equipped with a one-of-a-kind 64-bit serial code that is stored in an onboard ROM. This serial code serves as a digital fingerprint for easy identification and differentiation between multiple sensors in a network.
  • Flexible Power Options: The DS18B20 sensor is highly adaptable when it comes to power supply. It can be powered directly from a data line, eliminating the need for a separate power source. The sensor's power supply range extends from 3.0V to 5.5V, accommodating various voltage requirements.
  • Long Cable with Waterproof Casing: With a generous 1-meter cable, the DS18B20 offers extended reach for temperature monitoring. Additionally, the cable is encased in waterproof stainless steel, ensuring the sensor remains protected in challenging environments, including wet or outdoor settings.
  • Wide Temperature Range: This sensor is capable of measuring temperatures across an extensive range, from a bone-chilling -55°C to a scorching +125°C. This broad operating range makes it suitable for applications in extreme temperature conditions.
  • Selectable Thermometer Resolution: Users have the flexibility to choose the thermometer resolution that suits their specific needs. The resolution is user-selectable and can range from 9 to 12 bits, allowing for customization based on the level of detail required in temperature readings.
  • User-Definable Nonvolatile Alarm Settings: The DS18B20 sensor supports user-definable nonvolatile (NV) alarm settings. These settings can be programmed to trigger alarms when the temperature readings fall outside specified limits. The "Alarm search command" simplifies the identification of devices with temperatures beyond the programmed thresholds, making it a valuable tool for monitoring and control applications.



The DS18B20 digital temperature sensor, a product of Maxim Integrated (formerly known as Dallas Semiconductor), stands as a stalwart in the realm of temperature sensors. Known for its wide acclaim, this sensor offers a remarkable degree of accuracy, maintaining temperature readings within a margin of 0.5°C, making it an indispensable tool for temperature-sensitive applications. Its versatility extends across a broad temperature range, from a bone-chilling -55°C to a scorching +125°C, ensuring it can adapt to the most demanding environmental conditions. However, what truly sets the DS18B20 apart is its ability to communicate seamlessly with the Arduino using just a single digital pin, thanks to its unique 1-Wire® interface. Similar in concept to I2C, this interface distinguishes itself with a wider operating range and slower data rates. Moreover, the DS18B20's individuality shines through its provision of distinct 64-bit serial codes for each sensor, enabling you to effortlessly distinguish and manage multiple sensors connected on a single 1-Wire bus. Beyond its communication prowess, the DS18B20 empowers users with programmable thermometer resolution. Ranging from 9 to 12 bits, this feature grants precision control over temperature readings, translating to resolutions of 0.0625, 0.125, 0.25, and 1.0 degrees Celsius, respectively. Notably, the 12-bit resolution stands as the default setting.


Principle of Work:

The DS18B20 digital temperature sensor operates by using the principles of the 1-Wire® protocol. Internally, it consists of a temperature sensor, a 64-bit ROM for storing a unique serial code, and control logic for communication.

  1. Temperature Sensing: The heart of the DS18B20 is the temperature sensor itself, which utilizes a semiconductor material with temperature-dependent electrical characteristics. Changes in temperature cause variations in the electrical properties of this material, allowing the sensor to measure temperature.
  2. Unique Serial Code: Each DS18B20 sensor comes with a unique 64-bit serial code stored in ROM. This code serves as a digital identifier and is used to differentiate between multiple sensors on the same 1-Wire bus.
  3. 1-Wire® Communication: The DS18B20 communicates with a microcontroller (MCU) or other devices using the 1-Wire® communication protocol. It operates by transmitting and receiving data serially over a single data line (the 1-Wire bus). The communication protocol is robust, allowing multiple DS18B20 sensors to share the same data line.

Interaction with Microcontroller (MCU):

When connecting the DS18B20 sensor to an MCU like Arduino, ESP32, or Raspberry Pi, the following steps are generally involved:

  1. Initialization: The MCU initiates communication by sending a command to the DS18B20 on the 1-Wire bus. This command can request temperature conversion, read the temperature data, or perform other operations.
  2. Temperature Conversion: If the MCU requests temperature data, the DS18B20 begins the temperature conversion process. During this time, the sensor measures the temperature and converts it into a digital format.
  3. Data Transmission: Once the conversion is complete, the DS18B20 sends the digital temperature data back to the MCU over the 1-Wire bus.
  4. Processing: The MCU receives the temperature data and can process it further. It may convert the data into Celsius or Fahrenheit, apply calibration factors, or take specific actions based on the temperature reading.

Advice for Using the Module:

When using the DS18B20 digital temperature sensor module, consider the following tips for optimal performance and accuracy:

  1. Wiring: Ensure proper wiring and connections. Connect the sensor's data pin to the MCU's digital pin and provide it with the required power supply (3.0V to 5.5V).
  2. Pull-up Resistor: Use a 4.7kΩ pull-up resistor between the data pin and the power supply (Vcc). This resistor is essential for proper communication on the 1-wire bus.
  3. Temperature Conversion Time: Be aware of the sensor's temperature conversion time. The DS18B20 takes a specific amount of time to complete a temperature conversion (typically 750ms for 12-bit resolution). Ensure you allow enough time for accurate readings.
  4. Serial Code Management: If you have multiple DS18B20 sensors on the same 1-Wire bus, manage their unique serial codes to distinguish between them in your code.
  5. Resolution Selection: Choose the thermometer resolution that matches your application's requirements. Higher resolution provides more precise temperature readings but may take longer to complete.
  6. Calibration: Consider calibrating the sensor if precise temperature accuracy is crucial for your application. You can apply correction factors to align the readings with a reference standard.
  7. Error Handling: Implement error handling in your code to account for situations where the sensor might not respond or provide valid data.


Pinout of the Board:

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


  1. Environmental Monitoring: The DS18B20 is used in weather stations, climate monitoring systems, and environmental data loggers to measure and record temperature data over time.
  2. Home Automation: It plays a vital role in smart home systems for controlling heating, ventilation, and air conditioning (HVAC) systems based on room or ambient temperatures.
  3. Industrial Automation: In industrial settings, it monitors temperature in manufacturing processes, storage facilities, and equipment to ensure optimal conditions and safety.
  4. Food and Beverage Industry: The DS18B20 is employed in food storage and transportation to monitor and maintain the temperature of perishable goods.
  5. Medical Devices: It is used in medical equipment such as incubators, refrigerators for storing vaccines and medications, and patient temperature monitoring systems.
  6. HVAC Systems: Heating, ventilation, and air conditioning systems in both residential and commercial buildings use DS18B20 sensors for temperature control.
  7. Aquariums and Pet Care: Aquarium enthusiasts use these sensors to maintain the water temperature in fish tanks, and they are also employed in pet habitats to ensure a comfortable environment.
  8. Cold Chain Management: It is crucial in logistics and transportation to monitor the temperature of goods during storage and transit, especially for pharmaceuticals and perishable items.
  9. Automotive: The DS18B20 can be found in automotive applications for monitoring engine temperature, cabin climate control, and battery temperature management in electric vehicles.
  10. Research and Development: Scientists and researchers use DS18B20 sensors in various experiments and studies where precise temperature measurements are required.
  11. Energy Efficiency: In energy management systems, these sensors help optimize energy consumption by regulating heating and cooling systems based on real-time temperature data.
  12. Greenhouses: DS18B20 sensors are used in greenhouse automation to control temperature and humidity, ensuring optimal growing conditions for plants.
  13. Cold Storage Warehouses: Temperature-sensitive products stored in cold storage facilities rely on DS18B20 sensors to maintain proper storage conditions.
  14. Solar Energy Systems: In solar water heating systems, the DS18B20 can monitor the temperature of the solar collector and storage tanks, optimizing energy efficiency.
  15. Data Centers: Ensuring proper cooling and temperature control in data centers is critical for the reliable operation of servers and networking equipment.




  1. Connect Digital Pin 2 to the Yellow Cable:

    • To establish communication between your Arduino microcontroller and the DS18B20 temperature sensor module, connect a wire to one of the digital pins on your Arduino. In this specific case, use Digital Pin 2.

    • Digital Pin 2 serves as the communication channel, allowing the Arduino to send and receive digital signals to and from the DS18B20 temperature sensor module. This connection is essential for retrieving temperature data from the sensor.

  2. Black Wire to GND on Arduino:

    • Ground reference is critical for proper electrical operation in any circuit. To ensure a stable ground reference, connect the black wire from the DS18B20 module to the Ground (GND) terminal or pin on your Arduino.

    • GND serves as the common electrical reference point for all components in your circuit. By connecting the black wire to GND, you establish a shared ground reference between the Arduino and the DS18B20 module, enabling reliable communication and accurate temperature readings.

  3. Red Wire to 5V on Arduino:

    • Powering the DS18B20 module is essential for it to function correctly. To provide the necessary voltage, connect the red wire from the DS18B20 module to the 5V (5-volt) terminal or pin on your Arduino.

    • Arduino boards typically offer a 5V power output, which is suitable for powering external devices and sensors like the DS18B20. Connecting the red wire to the 5V pin ensures that the DS18B20 module receives the required voltage to operate effectively.



  1. Download the Library ZIP File:

    • Visit the GitHub repository you mentioned: Arduino-Temperature-Control-Library.
    • Click the green "Code" button, and then select "Download ZIP" from the dropdown menu.
    • Save the downloaded ZIP file to a location on your computer.
  2. Open the Arduino IDE:

    • Launch the Arduino IDE on your computer.
  3. Install the Library from ZIP File:

    • In the Arduino IDE, go to the "Sketch" menu at the top.
    • Select "Include Library" and then click on "Add .ZIP Library..."
  4. Locate and Select the ZIP File:

    • A file dialog will open. Navigate to the location where you downloaded the ZIP file in step 1.
    • Select the downloaded ZIP file ("Arduino-Temperature-Control-Library-master.zip").
  5. Install the Library:

    • Click the "Open" button in the file dialog.
    • The Arduino IDE will now install the library from the ZIP file.



This code is designed to work with DS18B20 temperature sensors connected to the Arduino via the 1-Wire bus. It continuously requests and displays temperature readings in both Celsius and Fahrenheit in 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 the DallasTemperature library:
DallasTemperature sensors(&oneWire);

void setup() {
  // Begin serial communication at a baud rate of 9600:

  // Start up the DallasTemperature library:

void loop() {
  // Request temperature readings from all devices on the 1-Wire bus:

  // Fetch the temperature in degrees Celsius for device index 0 (first device on the bus):
  float tempC = sensors.getTempCByIndex(0);

  // Fetch the temperature in degrees Fahrenheit for device index 0:
  float tempF = sensors.getTempFByIndex(0);

  // Print the temperature in Celsius in the Serial Monitor:
  Serial.print("Temperature: ");
  Serial.print(tempC, 2); // Display temperature with 2 decimal places
  Serial.print(" \xC2\xB0C  |  "); // Show the degree symbol for Celsius

  // Print the temperature in Fahrenheit:
  Serial.print(tempF, 2); // Display temperature with 2 decimal places
  Serial.print(" \xC2\xB0F"); // Show the degree symbol for Fahrenheit

  // Print a newline character for better readability:

  // Wait for a moment before taking another reading (adjust as needed):
  delay(1000); // Delay for 1 second (adjust for your desired reading interval)


  1. Library Inclusions:

    • The code starts by including two libraries: OneWire.h and DallasTemperature.h. These libraries are essential for communicating with and reading data from DS18B20 temperature sensors.
  2. Pin Configuration:

    • It defines the pin on the Arduino to which the 1-Wire bus is connected. In this case, it's defined as ONE_WIRE_BUS and set to digital pin 2.
  3. Initialization:

    • The code creates an instance of the OneWire class called oneWire and passes the ONE_WIRE_BUS pin to it.
    • It also creates an instance of the DallasTemperature class called sensors and passes the oneWire reference to it. This sets up communication with the DS18B20 sensors.
  4. Setup Function:

    • In the setup function, it initializes serial communication with a baud rate of 9600, allowing you to see the temperature readings in the Serial Monitor.
  5. Loop Function:

    • The loop function continuously executes the following steps:

    • Request Temperature Readings:

      • It sends a command to all devices on the 1-Wire bus to perform a temperature conversion using sensors.requestTemperatures();.
    • Read Temperature in Celsius:

      • It fetches the temperature in degrees Celsius for device index 0 (the first device on the bus) using sensors.getTempCByIndex(0);.
    • Read Temperature in Fahrenheit:

      • It also fetches the temperature in degrees Fahrenheit for device index 0 using sensors.getTempFByIndex(0);.
    • Serial Output:

      • It prints the temperature in Celsius and Fahrenheit to the Serial Monitor. Temperature values are displayed with two decimal places for precision.
      • The degree symbol (°) is displayed for both Celsius and Fahrenheit readings.
    • Delay:

      • It adds a delay of 1 second (adjustable) to control the rate at which temperature readings are taken. In this case, it waits for 1 second before taking the next reading.


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




The DS18B20 waterproof 1m module and the DHT11 module are both temperature and humidity sensors used in various electronic projects, but they have distinct differences in terms of their features and capabilities:

DS18B20 Waterproof 1m Module:

  • Temperature Sensor: The DS18B20 module is primarily a temperature sensor designed to measure temperature accurately.
  • Accuracy: It offers a relatively high level of temperature accuracy, typically within ±0.5°C.
  • Temperature Range: The DS18B20 has a wide temperature range, typically from -55°C to +125°C, making it suitable for various temperature measurement applications, including extreme environments.
  • Communication: It uses the 1-Wire communication protocol, which allows multiple DS18B20 sensors to be connected to a single data bus.
  • Waterproof: This module comes with a waterproof stainless steel casing and a 1-meter long cable, making it suitable for applications where the sensor needs to be submerged or exposed to harsh environmental conditions.
  • Resolution: The resolution of the DS18B20 is adjustable, ranging from 9 to 12 bits, allowing you to choose between high precision and faster response time.
  • Power Supply: It operates within a voltage range of 3.0V to 5.5V, which is compatible with a wide range of microcontrollers, including Arduino.

DHT11 Module:

  • Temperature and Humidity Sensor: The DHT11 module measures both temperature and humidity.
  • Accuracy: While the DHT11 is a cost-effective option, its accuracy is lower compared to the DS18B20, typically within ±2°C for temperature and ±5% for humidity.
  • Temperature Range: It has a more limited temperature range, typically from 0°C to 50°C, making it suitable for indoor applications.
  • Communication: The DHT11 uses a proprietary one-wire communication protocol, which can be less versatile than the 1-Wire protocol.
  • Not Waterproof: The DHT11 module is not waterproof and should be used in controlled indoor environments. Exposing it to moisture can lead to inaccurate readings or damage.
  • Resolution: The DHT11 has fixed resolution and doesn't offer the same level of configurability as the DS18B20.
  • Power Supply: It operates at 3.3V to 5.5V, making it compatible with various microcontrollers, including Arduino.

Comparison Summary:

  • The DS18B20 is ideal for accurate temperature measurements over a wide range and in harsh conditions, while the DHT11 is more suitable for basic indoor temperature and humidity monitoring.
  • The DS18B20 offers higher accuracy, better temperature range, and waterproof capabilities, making it versatile for various applications, including outdoor and industrial settings.
  • The DHT11 is a more budget-friendly option and is commonly used for simple environmental monitoring in home automation and similar projects.
  • The choice between the two modules depends on your specific project requirements, with the DS18B20 being the better option for high-precision temperature measurement, and the DHT11 being a more affordable choice for basic temperature and humidity monitoring indoors.