# Ds18b20 node modification help

**URL:** https://discourse.nodered.org/t/ds18b20-node-modification-help/423
**Category:** General
**Created:** [26 May 2018 21:56 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423 "2018-05-26T21:56:20Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [26 May 2018 21:56 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/1 "2018-05-26T21:56:20Z")

</div>

Hey guys.

Currently using this node in my set up [https://flows.nodered.org/node/node-red-contrib-sensor-ds18b20](https://flows.nodered.org/node/node-red-contrib-sensor-ds18b20) I’m really happy with the results but it displays to 1 decimal point (e.g. 26.1).

Is there a way to modify the node to make it’s ready to 2 decimal points? If so, how would I do this?

I wanted to contact the guy who made it but I can’t see how to on the information page.

Thanks

Simon

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [26 May 2018 22:16 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/2 "2018-05-26T22:16:54Z")

</div>

You can follow the links through to his github page if you like, where you could raise an issue, but given that the manufacturers spec says its only accurate to ± 0.5 degrees you would do as well by just adding a random digit to the end.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [26 May 2018 22:23 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/3 "2018-05-26T22:23:31Z")

</div>

Actually his node depends on another ds1820 library that hasn’t been touched in 3 years and has some open requests to added extra precision… So that’s unlikely to be fixed unless he moves to a different library.

---

<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: [27 May 2018 07:51 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/4 "2018-05-27T07:51:00Z")

</div>

I use node-red-contrib-owfs for access to my 1-wire devices and find it works very well.

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 10:10 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/5 "2018-05-27T10:10:09Z")

</div>

Are there more accurate probes available that work the same?

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 10:11 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/6 "2018-05-27T10:11:27Z")

</div>

I’ll check it out, thanks.

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 May 2018 10:15 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/7 "2018-05-27T10:15:28Z")

</div>

Why do you need more accuracy?

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 10:16 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/8 "2018-05-27T10:16:47Z")

</div>

Current lab standards and the current probes are within 0.2.

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 May 2018 10:22 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/9 "2018-05-27T10:22:30Z")

</div>

OK, I don’t think there are any one wire probes with that sort of accuracy, you will probably have to move to I2C  
[https://www.sensirion.com/en/environmental-sensors/temperature-sensors/](https://www.sensirion.com/en/environmental-sensors/temperature-sensors/) looks to be the only ones I could find that meets your needs.

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 10:26 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/10 "2018-05-27T10:26:45Z")

</div>

I’m guessing there are a little more difficult to get to work?

This is only the development stage of the project so perhaps this would be goof for mk2

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 May 2018 10:38 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/11 "2018-05-27T10:38:26Z")

</div>

You would probably have to write code in a function node to get the values. I2C is well documented and there is a good I2C node for getting the raw data. You might also consider calibrating DS18B20’s using your existing lab setup using an offset. It depends on the repeatability of the DS18B20 being up to your requirements.

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 10:39 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/12 "2018-05-27T10:39:09Z")

</div>

This is the code for the probe node i’m using now.

var ds18b20 = require(‘ds18b20’);  
ds18b20.sensors(function(err, ids) {  
// got sensor IDs …  
});

// … async call  
ds18b20.temperature(‘10-00080283a977’, function(err, value) {  
console.log(‘Current temperature is’, value);  
});

// … or sync call  
console.log(‘Current temperature is’ + ds18b20.temperatureSync(‘10-00080283a977’));

// default parser is the decimal one. You can use the hex one by setting an option  
ds18b20.temperature(‘10-00080283a977’, {parser: ‘hex’}, function(err, value) {  
console.log(‘Current temperature is’, value);  
});

console.log(‘Current temperature is’ + ds18b20.temperatureSync(‘10-00080283a977’, {parser: ‘hex’}));

its says above:

// default parser is the decimal one. You can use the hex one by setting an option  
ds18b20.temperature(‘10-00080283a977’, {parser: ‘hex’}, function(err, value) {  
console.log(‘Current temperature is’, value);  
});

Does this mean I can manually change it to give the 2 decimal’s I want?

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 10:42 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/13 "2018-05-27T10:42:42Z")

</div>

I think it would be something to think about if the project got some more funding. For the first field tests, I’ll be using the conventional method with the lab prob alongside my new rig so I should get a good idea of whats happening.

If i could get my current flow to read to 2 points it would be good as we work to 2 points normally

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 May 2018 10:51 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/14 "2018-05-27T10:51:22Z")

</div>

> [@Colin](#):
>
> node-red-contrib-owfs

Might be the way to go to get a reading to 2 points. I am not using this node, maybe Colin can help here.

---

<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: [27 May 2018 10:58 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/15 "2018-05-27T10:58:22Z")

</div>

The DS18B20 has a **resolution** of 0.0625C (12 bit) but an **accuracy** of ±0.5. This means that if you get the value to full resolution and plot it on a graph it will give you values changing in intervals of 0.0625 degrees so a nice smooth graph, but the actual temperature shown may be out by 0.5 degrees.  
If you need better accuracy then you can calibrate the individual sensors.  
node-red-contrib-owfs will give you the value to the full resolution.

---

<div class="post-metadata">

### Author: ![sjegz](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@sjegz](https://discourse.nodered.org/u/sjegz)
#### Post date: [27 May 2018 11:01 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/16 "2018-05-27T11:01:34Z")

</div>

Hi Colin,

i’m trying out this node but it gives me Error: connect ECONNREFUSED 127.0.0.1:4304

Is this because the probes are currently being used on the flow?

---

<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: [27 May 2018 11:20 UTC](https://discourse.nodered.org/t/ds18b20-node-modification-help/423/17 "2018-05-27T11:20:10Z")

</div>

That is saying it can’t connect to the one wire server.  
Have you installed owserver? You probably want ow-shell too.  
sudo apt-get install owserver ow-shell

I don’t know whether there will be a problem with another server trying to access the 1-wire bus, probably yes.
