Tags: Temperature, Sensor, Module, DS18B20

Temperature Sensor Module - DS18B20

  • 19.00 AED
    • Ex Tax:19.00 AED
    • Brands China
    • Product Code:
    • Availability: In Stock
    - This sensor is for detecting ambient air temperature for your Arduino or Raspberry Pi project.- Range of resolution: 9-12 bits.- Easy installation with mounting hole. Hole Diameter: 2.5mm.- Temperature measurement range: -55~+125℃ ; 0.5℃ accuracy.- Working Voltage: DC 5V.- Digital signal output.Th..

    - This sensor is for detecting ambient air temperature for your Arduino or Raspberry Pi project.
    - Range of resolution: 9-12 bits.
    - Easy installation with mounting hole. Hole Diameter: 2.5mm.
    - Temperature measurement range: -55~+125℃ ; 0.5℃ accuracy.
    - Working Voltage: DC 5V.
    - Digital signal output.

    The following table shows how you should wire the DS18B20 sensor to your Arduino board:

    DQAny digital pin (with 4.7k Ohm pull-up resistor)
    VDD5V (normal mode) or GND (parasite mode)

    Each DS18B20 temperature sensor has a unique 64-bit serial code. This allows you to wire multiple sensors to the same data wire. So, you can get temperature from multiple sensors using just one Arduino digital pin

    Here’s a summary of the most relevant specs of the DS18B20 temperature sensor:

    • Communicates over one-wire bus communication
    • Power supply range: 3.0V to 5.5V
    • Operating temperature range: -55ºC to +125ºC
    • Accuracy +/-0.5 ºC (between the range -10ºC to 85ºC)

    For more information consult the DS18B20 datasheet.

    Parts Required

    To show you how the sensor works, we’ll build a simple example that reads the temperature from the DS18B20 sensor with the Arduino and displays the values on the Arduino Serial Monitor.

    Here’s a list of parts you need to complete this tutorial

    • Arduino UNO – read Best Arduino Starter Kits DS18B20 temperature sensor (one or multiple sensors) – waterproof version 4.7k Ohm resistor BreadboaJumper wires


    The sensor can operate in two modes:

    • Normal mode: 3-wire connection is needed. You provide power to the VDD pin.

    • Parasite mode: You only need data and GND. The sensor derives its power from the data line. In this case,

    You can read the temperature of more than one sensor at the same time using just one Arduino digital pin. For that, you just need to wire together all the sensors data pins to an Arduino digital pin.

    Upload Code – Single DS18B20

    To interface with the DS18B20 temperature sensor, you need to install the One Wire library by Paul Stoffregen and the Dallas Temperature library. Follow the next steps to install those libraries.

    Installing Libraries

    1. Open your Arduino IDE and go to Sketch Include Library > Manage Libraries. The Library Manager should open.

    2. Type “OneWire” in the search box and install the OneWire library by Paul Stoffregen.

    Installing OneWire library Arduino IDE

    3. Then, search for “Dallas” and install the Dallas Temperature library by Miles Burton.

    Installing Dallas temperature DS18B20 library Arduino IDE

    After installing the needed libraries, upload the following code to your Arduino board. This sketch is based on an example from the Dallas Temperature library.

      Rui Santos
      Complete project details at https://randomnerdtutorials.com  
      Based on the Dallas Temperature Library example
    #include <OneWire.h>
    #include <DallasTemperature.h>
    // Data wire is conntec to the Arduino digital pin 4
    #define ONE_WIRE_BUS 4
    // Setup a oneWire instance to communicate with any OneWire devices
    OneWire oneWire(ONE_WIRE_BUS);
    // Pass our oneWire reference to Dallas Temperature sensor 
    DallasTemperature sensors(&oneWire);
    void setup(void)
      // Start serial communication for debugging purposes
      // Start up the library
    void loop(void){ 
      // Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
      Serial.print("Celsius temperature: ");
      // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
      Serial.print(" - Fahrenheit temperature: ");

    View raw code

    There are many different ways to get the temperature from DS18B20 temperature sensors. If you’re using just one single sensor, this is one of the easiest and simplest ways.

    How the Code Works

    There are no reviews for this product.

    Write a review

    Please login or register to review


    *for faulty items and in-store drop off for unused items. T&C applies.

    Customer Support

    We really care about you and your order as much as you do. Please contact us without hesitation.


    We can ship your order internationally. Please contact us first before proceeding with your order.

    Fast Delivery

    You want your item next day? No problem! We advise contacting us ASAP to insure smooth delivery experience