Gravity: Waterproof DS18B20 Temperature Sensor Kit

SKU: KIT0021

The waterproof DS18B20 temperature sensor features wide compatibility when paired with Arduino boards and can be applied in numerous scenarios, such as soil temperature detection and hot water tank temperature control. However, the waterproof DS18B20 temperature sensor requires a pull-up resistor for normal operation. To solve this problem, our Plugable Terminal adapter is designed for this exact purpose. This Plugable Terminal adapter integrates a pull-up resistor on its digital pin, which can be enabled via a jumper cap. It allows the waterproof DS18B20 temperature sensor to be directly connected to Arduino boards without additional wiring.

Angled shot of waterproof DS18B20 temperature sensor kit with USB and adapter components.-DFRobot product sku:KIT0021 image.
  • Tech Specs
  • Projects
  • Certifications
  • Specification

    Parameter Details
    Power/Data Voltage 3.0V to 5.5V
    Accuracy ¡À0.5¡æ from -10¡æ to +85¡æ
    Usable Temperature Range -55¡æ to 125¡æ (-67¨H to +257¨H)
    Resolution 9 to 12 bit selectable
    Interface 1-Wire interface - requires only one digital pin for communication
    Unique ID 64 bit ID burned into chip
    Multiple Sensors Can share one pin
    Alarm System Temperature-limit alarm system
    Query Time Less than 750ms
    Interface Wires
    - Red wire - VCC
    - Black wire - GND
    - Yellow wire - DATA
    Probe Dimensions Stainless steel tube 6mm diameter by 35mm long
    Cable Diameter 4mm
    Cable Length 90cm

    Connection Diagram


    Connection Method: Gently press the single gray terminal, insert the wire into the lower hole, and release the gray terminal to finish the connection.

    Pinout

    3-Wire Interface: It is available in Type A and Type B. Please confirm your sensor interface before wiring.
    Type A: Red wire (VCC), Black wire (GND), Yellow wire (DATA)
    Type B: Red wire (VCC), Black wire (GND), Green wire (DATA)

    Arduino 实例代码

    Download Link for Full DS18B20 Documents & Arduino Library: Sample Codes
    Sample Codes for Arduino 1.0

    #include <OneWire.h>

    int DS18S20_Pin = 3; //DS18S20 Signal pin on digital 3
    
    //Temperature chip i/o
    OneWire ds(DS18S20_Pin);  // on digital pin 2
    
    void setup(void) {
      Serial.begin(9600);
    }
    
    void loop(void) {
      float temperature = getTemp();
      Serial.println(temperature);
    
      delay(100); //just here to slow down the output so it is easier to read
    
    }
    
    
    float getTemp(){
      //returns the temperature from one DS18S20 in DEG Celsius
    
      byte data[12];
      byte addr[8];
    
      if ( !ds.search(addr)) {
          //no more sensors on chain, reset search
          ds.reset_search();
          return -1000;
      }
    
      if ( OneWire::crc8( addr, 7) != addr[7]) {
          Serial.println("CRC is not valid!");
          return -1000;
      }
    
      if ( addr[0] != 0x10 && addr[0] != 0x28) {
          Serial.print("Device is not recognized");
          return -1000;
      }
    
      ds.reset();
      ds.select(addr);
      ds.write(0x44,1); // start conversion, with parasite power on at the end
    
      byte present = ds.reset();
      ds.select(addr);
      ds.write(0xBE); // Read Scratchpad
    
    
      for (int i = 0; i < 9; i++) { // we need 9 bytes
        data[i] = ds.read();
      }
    
      ds.reset_search();
    
      byte MSB = data[1];
      byte LSB = data[0];
    
      float tempRead = ((MSB << 8) | LSB); //using two's compliment
      float TemperatureSum = tempRead / 16;
    
      return TemperatureSum;
    
    }
    

    Result:

    Programming via Mind+ Upload Mode

    Download and install the software. Download link: https://www.mindplus.cc; Detailed guide: Mind+ Basic Wiki – Software Download & Installation.
    Switch to Upload Mode. Detailed guide: Mind+ Basic Wiki – Programming Procedure under Upload Mode.
    Go to Extensions, select Arduino Uno under Main Controller, then add the DS18B20 Temperature Sensor from the Sensor category. Detailed guide: Mind+ Basic Wiki – How to Load Extension Libraries.
    Complete your programming as shown in the screenshot below.
    Click menu options: Connect Device → Upload to Device.
    After upload finishes, open the serial monitor to view real-time output data. Detailed guide: Mind+ Basic Wiki – Serial Port Printout.

    Programming in Mind+ Python Mode (Huskypad)

    Mind+ Python Mode supports full standard Python programming, so a main controller board compatible with complete Python runtime is required. The Unihiker is used as an example in this guide.

    Operation Steps

    Download and install the latest official software from: https://www.mindplus.cc. Detailed tutorial: Mind+ Basic Wiki – Software Download & Installation.
    Switch to Python Mode. Go to Extensions, select Unihiker under Official Libraries, then pick Pinpong Initialization and DS18B20 Temperature Sensor from the Pinpong library. Refer to the attached link for mode switching and library import instructions.
    Complete the program coding.
    Connect the Unihiker board and click Run; real-time data can be checked in the terminal. Official Unihiker Quick Start Guide: unihiker.com

    Code Example

    Sample codes based on the Pinpong library, see Unihiker official quick-start documentation (unihiker.com)

  • CE CE
  • RoHS RoHS
  • Was this article helpful?

    TOP