Reliable reading multiple ds18b20’s with a raspberry pi without flow stalls

Hi all,
I have the following setup:
4 digital temperature sensors DS18b20 which are physically wired in a parallel configuration (sensors are connected one after the other in a line) with CAT5 wires to the GPIO4 of the PI. Furthest sensor is 10 meters away from PI. I use a 4.7 kOhm resistor between GPIO4 pin and +5V (used to power the sensors). In node-red I read each sensor every 10 seconds with the sensor-ds18b20 node.
The issue I do have is that from time to time (couple of times a day or more), I don't get the signal from the the DS18B20 sensors for some minutes, randomly. Then it comes back without doing anything.
To read the sensors I use the node-red-contrib-sensor-ds18b20.
In the log file I have this error:
w1_slave_driver 28-000009d3a74a: Read failed CRC check.
[warn] [rbe:898bd609.617c28] no number found in payload

I need to solve this issue asap and I am considering the following options:

  1. buy an USB to 1-wire adaptor as Colin suggested. I found the usb USB9097 as a possible model but it's not available anymore. Is anyone having experience with this method and could support how to set it up?
  2. writing a Node.js script that runs as a service, outside of Node-RED, but on the same machine(Pi) as suggest here (Quick note if you're a) reading multiple ds18b20's with a raspberry pi and b) struggling with flow stalls - #2 by nrbrt). But how to do this in practice? Is this really solving the issue? I am asking because, when the sensors are down and I try from the command line to access them (sudo cat/sys/bus/w1/Devices....), they are not visible.
  3. add to my setup one ESP32 board, connect physically all the 4 sensors to it and send the values to the PI. Since I need a reliable solution (wifi is not stable enough) I was thinking to use bluethooth to connect the ESP with the PI. Anyone tried this? Is BLE stable enough?

Any advise is really appreciated.
Thank you.

As was pointed out in the previous thread you linked to, if you are directly wired into the pi you should power the sensors from the pi 3.3v and the resistor should pull up to 3.3v not 5v. As you have it at the moment you are lucky you have not blown up the pi.

Also 4.7k is too high, try 1.8k or even 1.2k.

Have you used three wires to connect to the sensors or just two? It may be more reliable with three. Try the other fixes first though.

I have not bought one for a number of years but a quick google search came up with several, this for example LinkUSBi - 1-wire controller with identity – Homechip Ltd

Most likely I was lucky so far. I will then change and go for 3.3V and 1.8k or 1.2k resistor.

Have you used three wires to connect to the sensors or just two? It may be more reliable with three. Try the other fixes first though

Do you mean to the Data wire of the Ds18b20 sensor? At the moment I have one single wire of the CAT cable for VDD, one for GND and one for the Data pins.

I have not bought one for a number of years but a quick google search came up with several, this for example LinkUSBi - 1-wire controller with identity – Homechip Ltd

Ok thanks. Just to be sure this was the device you meant

I meant have you joined up all three wires of the sensors, to power, ground and data, which it appears you have. They are capable of working without the power line, but it is better with all three.

I would like to suggest to use a DS9490R controller. Reliable & fully supported (as others as well) by owfs. There as well several nodes available to operate with owfs.

I'm quite convinced that your primary issue comes from the setup of the wiring to the sensors. That solved, the next challenge is the timing on the 1-Wire bus. Emulating this in software (as you're currently doing) might work - with deficits regarding reliability (that I already experienced myself). Rather than adding complexity now (by handing over the job to an ESP), I encourage you to invest in a standard bus-controller. Both issues solved, it's a pleasure to have a 1-wire system operational.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.