# Best DS18B20 Node? Mine doesn't work properly

**URL:** <https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724>\
**Category:** General\
**Created:** [8 July 2020 16:28 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724 "2020-07-08T16:28:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![oncdastan](https://avatars.discourse-cdn.com/v4/letter/o/34f0e0/32.png) [@oncdastan](https://discourse.nodered.org/u/oncdastan)\
**Post date:** [8 July 2020 16:29 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/1 "2020-07-08T16:29:00Z")

</div>

Hi. I am using this node:

> **[node-red-contrib-ds18b20-sensor](https://flows.nodered.org/node/node-red-contrib-ds18b20-sensor)**
>
> Node-red node to connect DS18B20 sensors

But it is not working properly. Please, check this post:

> [@Problem Using a Button with DS18B20 Node](https://discourse.nodered.org/t/problem-using-a-button-with-ds18b20-node/29674):
>
> Hi. I am using the node below: The problem is, I need to control a relay with a button on the screen, but for now, I am using an LED to see if it works or not. When I click on it, it takes 2-3 seconds for LED to light up, and another 2-3 seconds for the button icon to change on my dashboard. I tried removing nodes one by one, the node with the link above is the problem. Without that, the response time is perfect. I don't know how to fix this issue.

I am trying to use a switch, but it responds after the sensor node is done doing its own thing. It works really fast without the node I linked above. In this forum post, I tried to fix it with Colin's help, but it didn't work. Surely, there must be other people having the same issue. I am open to all kinds of advices.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [8 July 2020 16:44 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/2 "2020-07-08T16:44:00Z")

</div>

For the record, I took a quick look at the source of node-red-contrib-DS18B20-sensor node. It seems to use `fs.readdirSync` and `fs.readFileSync` for accessing the device tree. This surely isn't good unless you don't have anything timing critical running on the same Node.js script as it's blocking everything for the time it takes to read the sensors.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 July 2020 16:46 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/3 "2020-07-08T16:46:22Z")

</div>

> [@ristomatti](#):
>
> as it's blocking everything for the time it takes to read the sensors.

Yes, that is exactly the problem in the other thread. Reading four sensors every ten seconds it practically brings node-red on a Pi 4 to its knees. It is basically not fit for purpose.

---

<div class="post-metadata">

**Author:** ![oncdastan](https://avatars.discourse-cdn.com/v4/letter/o/34f0e0/32.png) [@oncdastan](https://discourse.nodered.org/u/oncdastan)\
**Post date:** [8 July 2020 16:52 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/4 "2020-07-08T16:52:07Z")

</div>

How can I fix this issue? Can I edit custom nodes like this one? Should I use another node?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 July 2020 17:01 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/5 "2020-07-08T17:01:32Z")

</div>

If you search for ds18b20 you will see there are a couple of other options. Does anyone else have experience of these. If not then go and look at them on github and check to see if any serious issues have been opened on them.

---

<div class="post-metadata">

**Author:** ![oncdastan](https://avatars.discourse-cdn.com/v4/letter/o/34f0e0/32.png) [@oncdastan](https://discourse.nodered.org/u/oncdastan)\
**Post date:** [8 July 2020 17:07 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/6 "2020-07-08T17:07:26Z")

</div>

Okay. I'll do that tomorrow, and let you know the results. Thanks.

---

<div class="post-metadata">

**Author:** ![oncdastan](https://avatars.discourse-cdn.com/v4/letter/o/34f0e0/32.png) [@oncdastan](https://discourse.nodered.org/u/oncdastan)\
**Post date:** [10 July 2020 15:17 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/7 "2020-07-10T15:17:06Z")

</div>

Switched to this one:

> **[node-red-contrib-sensor-ds18b20](https://flows.nodered.org/node/node-red-contrib-sensor-ds18b20)**
>
> Node-RED node to get temperature in centigrades from DS18B20 sensors

It greatly reduced the delay of the switch.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 July 2020 15:17 UTC](https://discourse.nodered.org/t/best-ds18b20-node-mine-doesnt-work-properly/29724/8 "2020-07-24T15:17:09Z")

</div>

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