DS18B20 Sensor - 1 out of 7 going offline repeatedly

I have a sonoff th16 connected to a hot water tank. As well as turning on and off the electric heater, I have connected 7 DS18B20 temperature sensors in parallel via the 1-wire bus to monitor the temperature at various heights on the tank.

This has been working well for approx 1 year but 2 days ago one of the sensors died. I rebooted the sonoff and checked the logs, only 6 were showing during initial discovery.

So I put it down to a broken sensor or cable and replaced it. All working fine after I reassigned the address.

But then 1 day later the new sensor in the exact same position died at 2am. No one touching it, no heating in progress, no automations etc. Multiple restarts, it seems the new sensor is completely dead.

I am looking for ideas… how could the sensor be working fine for so long then die twice in quick succession, and all others connected in parallel are completely fine? What made that particular one die?

Sure, there could be bad soldering/wiring to that sensor. But in that case why would it work then die with no one touching it?

Any suggestions welcome!

Update: I think I’ve fixed it.

When I replaced the sensor it changed from sensor.temperture3 to sensor.temperature3_2 in home assistant…
Strangely this did not take effect until several hours afterwards, so I got a period of normal operation out of the new sensor before it got renamed.

Maybe 2am is a time when homeassistant does some housekeeping.

1 Like

Hi Dave,

It’s almost one year ago, are your sensors still working ?

I bought one to know the temperature of my fish-pool, worked fine for a couple of weeks. Now the sensor is dead (ESP32 can’t find any sensors).

So I was wondering if I had bad luck or if these sensors only work for a couple of weeks/months ?

If not, where did you buy yours ?

Any suggestions welcome!

@Tsar actually it’s been pretty flawless since that hiccup.

Looking back at my AliExpress orders, this is where I got them:
https://a.aliexpress.com/_mL9PODa

Quite pleased with the performance and reliability now!

Dave

Thank you, Dave !

What is that adapter they sell ?
May I connect the DS18B20 directly to my ESP32 ? I now used a resistor of 4,7KΩ between the red and yellow wire…or is the adapter replacing this ?

I just want to be sure I’m doing it right :wink:

Sorry, not sure what that is, it’s not something I’ve used. I think you need the resistor if you have multiple sensors.

So you connected the sensor directly to the ESP32, makes it simpler :grinning:

I used a resistor because it was mentioned : Dallas Temperature Sensor — ESPHome

I have loads of these sensors. Tricky part is where runs get longer, the wire to use and the resistor value. Lots of discussion if you google

The protocol needs a weak pull-up which is what the resistor does. Keep it short if you can to maximise reliability. Total length of my setup is about 2m to the last sensor.

In my setup 1m will be enough.

So, should I use a resistor ?

Yes. I expect it will always be more reliable with a resistor.

OK, I will do that…thanks for your help !