Waterproof DS18B20 no showing

Hi all
I'm trying to find the address of my waterproof DS18B20 as per the code below. It's showing
Found 0 devices.
Also is a pic of the setup which is the same as the schematic but with only 1 sensor
any ideas?

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 15 on the ESP32
#define ONE_WIRE_BUS 15

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// variable to hold device addresses
DeviceAddress Thermometer;

int deviceCount = 0;

void setup(void)
{
  // start serial port
  Serial.begin(115200);

  // Start up the library
  sensors.begin();

  // locate devices on the bus
  Serial.println("Locating devices...");
  Serial.print("Found ");
  deviceCount = sensors.getDeviceCount();
  Serial.print(deviceCount, DEC);
  Serial.println(" devices.");
  Serial.println("");
  
  Serial.println("Printing addresses...");
  for (int i = 0;  i < deviceCount;  i++)
  {
    Serial.print("Sensor ");
    Serial.print(i+1);
    Serial.print(" : ");
    sensors.getAddress(Thermometer, i);
    printAddress(Thermometer);
  }
}

void loop(void)
{ }

void printAddress(DeviceAddress deviceAddress)
{ 
  for (uint8_t i = 0; i < 8; i++)
  {
    Serial.print("0x");
    if (deviceAddress[i] < 0x10) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);
    if (i < 7) Serial.print(", ");
  }
  Serial.println("");
}

Wiring-Multiple-DS18B20-Temperature-Sensors-to-ESP32.png

Wiring-Multiple-DS18B20-Temperature-Sensors-to-ESP32.png

I wired 3 18B20 waterproof sensors to my ESP32 dev board in accordance with the posted diagram and ran the code that you posted, unchanged. I got the following on the serial monitor. The code, as posted, sure seems to work OK. I did have to press the EN button on the ESP to get it to reset and start up.

Locating devices...
Found 3 devices.

Printing addresses...
Sensor 1 : 0x28, 0x36, 0x87, 0x11, 0x5F, 0x14, 0x01, 0xC1
Sensor 2 : 0x28, 0xAE, 0x6B, 0xE2, 0x12, 0x19, 0x01, 0x7B
Sensor 3 : 0x28, 0x27, 0x73, 0x5C, 0x12, 0x19, 0x01, 0xC1

With just one 18B20 connected it showed:

Locating devices...
Found 1 devices.

Printing addresses...
Sensor 1 : 0x28, 0x27, 0x73, 0x5C, 0x12, 0x19, 0x01, 0xC1

I am really new to the ESP32 so can't offer much more help.

What value is the pullup resistor? 4.7K is what I see recommended.

need to check the wiring and pins

Pinout: What wire colors?

DS18B20_pinout.png

DS18B20_pinout.png

Hi,
Check that your protoboard is functioning correctly.
Do you have a DMM?

Thanks… Tom… :slight_smile:

Here's the readings I get with DVM on diode test setting, red (+) probe on DS18B20 GND (-) pin, black probe (-) on DS18B20 Vcc (+) pin, 0.568V. Black probe on DS18B20 signal pin (DQ), 0.505V. Open circuit (OL) on all other combinations.
There is no standard on cable colors, Vcc may be red, orange or brown, GND may be black, green or blue, signal may be white or yellow or ? ?
Good luck.

pic of board layout

I don't think the resistor is particularly critical but you should check this is the correct value for a 3.3v device.

Nick_Pyner:
I don't think the resistor is particularly critical but you should check this is correct because I understand the ESP32 is a 3.3v device.

The 18B20 will work on 3V3 supply, but may need a lower pullup.
Try two 4k7 resistors in parallel as the pullup.
Tom... :slight_smile:

I used a 4.7K pull-up to do the (successful) tests mentioned in reply #1.

There are fakes and clones of the 18B20 sensors out there. Unless you bought the sensors from a reputable dealer (DigiKey, RS, Farnell, Mouser, etc.) the sensors could be fake. See here.

If this is a trailing lead type sensor sold as water proof , then they are not - the tip is, but if submerge the lot it will stop working

hammy:
If this is a trailing lead type sensor sold as water proof , then they are not - the tip is, but if submerge the lot it will stop working

if they are waterproof, then they have colored wires.
often black, white and yellow.
lots of confusion on which wire color is power and which is signal.
but using a fritzrig cartoon does not point out details.
I use 2 at a time, and the lower address is the first to read. I don't bother hard coding the address.

pic of setup

Hi,
Where is the connection from the 18B20 data signal pin to the ESP32 pin 15?

Please do not go back and add images to old posts, it make the flow of the thread disjointed.
Until this post here, the image in your first post did not exist.

Tom... :slight_smile:

sorry Tom
Correct pic here.
I put up the wrong one

Hi,
PLEASE do not go back and update old posts.
It will be confusing to anyone using this thread later to try and fix a problem that is similar to yours.

Tom.... :slight_smile:

To which pins are the black and red jumpers connected? They should go to ground and Vcc (3.3V), respectively.

It looks like (compared to my ESP32 Dev board) like the black wire goes to GPIO18 and the red wire goes to EN.

yes red to 3.3 and ground but not end one it one in the middle. I had it on the end one and just tried a different one,
the sensors were bought from Core electric so are the real items.

Hi,
Do you have an Arduino UNO or NANO?
If so try the sensors on one of them with the appropriate library.

Do you have a DMM?

Thanks.. Tom... :slight_smile: