Go Down

Topic: Waterproof DS18B20 Digital temperature sensor (Read 155 times) previous topic - next topic

tomgurule

I bought the Waterproof DS18B20 Digital temperature sensor and the wire colors are red, yellow, and blue. I have the red as 5V, yellow to ground, and blue as my data. Using the serial monitor it displays -127. I tried changing the yellow and blue wires around. Still reads the same. Reads the same with the probe disconnected too. Im not sure what the wire color coding is and Im not sure how to get this to communicate with the probe. Can any one please help?

Thank,

Tom

Wawa

My sensors have yellow for data and red for supply.

Did you use a 4k7 pull up resistor on the data line?
Leo..

Nick_Pyner

#2
Jul 12, 2018, 03:59 pm Last Edit: Jul 13, 2018, 03:02 am by Nick_Pyner
-127 means no connection, which is definitely true if you disconnect it, and probably true if you didn't because it is connected the wrong way round. These devices can get spectacularly hot during the second adventure.

Try http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
or http://sheepdogguides.com/arduino/ar3ne1tt2.htm

I think the second can be useful if you are not using multiple sensors. Then note reply #1 again, and it is 4.7k in normal practice, not 2.2k. There should always be advice from the supplier about the connections. I have yellow for signal on some, blue on others.

Koepel

@tomgurule, When you mention something, please give a link to it. This one ? https://www.adafruit.com/product/381.

GolamMostafa

#4
Jul 12, 2018, 06:10 pm Last Edit: Jul 12, 2018, 06:14 pm by GolamMostafa
You may execute the following program to check that the sensor has been properly connected. This program reads the 64-bit (8-byte) ROM/Address Code of the DS18B20 sensor and shows on the Serial Monitor. To get the value of the address again, press the RESET button of UNO. The sensor's data line connected with DPin-3, and it is also terminated to 5V via 2.2k resistor.


Code: [Select]
#include<OneWire.h>
#define OneWireBusPin 3
OneWire ds(OneWireBusPin);  //3
byte dsAddr[8];         //to hold 64-bit ROM Codes of DS18B20 sensor

void setup()
{
  Serial.begin(9600);

  ds.reset();         //sensor is reset
  ds.search(dsAddr);    //collect 64-bit (8-byte) ROM/Addres code Sensor (DS1)
  Serial.print("Address of DS18B20: ");
  for (int i = 0; i < 8; i++)
  {
    if(dsAddr[i] <16)
    {
      Serial.print("0");
    }
    Serial.print(dsAddr[i], HEX);   //show on SM
    
  }
  Serial.println();
}

void loop()
{
  
}

Go Up