Tags: Temperature, Sensor, Module, DS18B20

Temperature Sensor Module DYN - DS18B20

  • 19.00 AED
    • Ex Tax:19.00 AED
    • Brands RobotDyn
    • Product Code:
    • Availability: In Stock
    The DS18B20 Digital Thermometer provides 9 to 12-bit (configurable) temperature readings which indicate the temperature of the device. Information is sent to/from the DS18B20 over a 1-Wire interface, so that only one wire (and ground) needs to be connected from a central microprocessor to a DS18B20...

    The DS18B20 Digital Thermometer provides 9 to 12-bit (configurable) temperature readings which indicate the temperature of the device. Information is sent to/from the DS18B20 over a 1-Wire interface, so that only one wire (and ground) needs to be connected from a central microprocessor to a DS18B20.If you dont already have the OneWire library then you will need to copy that folder into the libraries folder also

    .Now, before we get to the programming part, lets wire up our temperature sensor. The DS18B20 can be powered by between 3.0V and 5.5V so you can simply connect its GND pin to 0V and the VDD pin to +5V from the Arduino.

    However, the DS18B20 can also extract its power from the data line which means we only effectively need two wires to connect it up. This makes it great for use as an external sensor


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

    DS18B20Arduino
    GNDGND
    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


    Schematic

    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
      Serial.begin(9600);
      // Start up the library
      sensors.begin();
    }
    
    void loop(void){ 
      // Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
      sensors.requestTemperatures(); 
      
      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(sensors.getTempCByIndex(0)); 
      Serial.print(" - Fahrenheit temperature: ");
      Serial.println(sensors.getTempFByIndex(0));
      delay(1000);
    }
    

    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