How to add a second ds18b20

Hi everyone, I'm new in the world nodered.
I'm a beginner, very beginner, I created a flow that reads the data of a ds18b20 saves them on influx and displayed with grafana.
I need help to add a second ds18b20, please indicate me a tutorial? thanks

1 Like

It’s useful if the title of you post describes the problem eg “how to add a second ds18b20”
which is far more likely to catch someone’s attention that knows the answer.

You can edit your post by using the pencil icon

If you are using "node-red-contrib-ds18b20-sensor" just connect the second sensor in parallel with the first. The node outputs an array with the measurements of each sensor. Each sensor has it's own id. If you attach a debug node set to show the complete message you will see that both sensors are being read. You do not need a pullup resistor on the second sensor!

2 Likes

Sorry i edit post.

1 Like

And you may need to fiddle with the value of the existing pullup sensor depending on how long your cable run is.

Also prior to connecting the 2nd sensor i would suggest you get the serial number of the 1st sensor so you know which is which and identify it with some white out or other distinguishing feature.

Also running them in parasitic power mode can be problematic, so i would recommend against doing that unless you have a large issue with running cables (or available pairs)

Craig

1 Like

Thank a lots.

Thanks a lots.

you can also use node-red-contrib-ds18b20 which allows you to pick the ds18b20 sensor (by id) you want. This way you could have different nodes to read at different times.

Many thanks

I am having a problem with 2 ds18b20's and a DHT11. they were working fine and then one of the ds18 started giving weird readings high or low by 300 degrees then it would settle back down and be fine for hours. Now none of them are working. I had them all connected to the same wire heading back to the Pi (pic 1). I have tried several different things -
1- replaced all of the sensors. no change
2- added a new sensor directly to the Pi. it behaves the same as the others
3- changed the one wire GPIO from 4 to 21. no change
4- tried all of the different nodes for reading a ds18b20. no change
5- moved the sensors to another pi and they work!

The behavior is very strange the nodes can 'see' the sensors, read their serial numbers, and try to read data at the appropriate times. But what ever the sensors are returning is not readable the error is "The input value (undefined) is not a number" I don't know if this is a Pi issue or Node Red issue or both. Here are some screen shots and pics.
Craig had said maybe the value of the resistor should change, should I go up or down? I'd like to try that but I think I should get a single ds18b20 working connected directly to the Pi first. Thanks again you folks are always a wealth of knowledge.

Pic 1 - wiring with resistor

Nodered screen caps

42%20AM

What voltage are they running on?

@Poodlepapa

  1. What do you see if you connect a debug node diredtly to the ds18b20 node?
  2. Which contrib node are you using
  3. what version of
    a - raspbian
    b - node-red
    c - node.js
    d - what models are the pi's that works and doesn't work
  4. if both pi are the same, what happens if you swap sd cards?

Sounds like you have already done a reasonable amount of testing.

If i was to guess i would say that you have ended up with some updated/changed code for reading the DS18B20 that is throwing this.

The idea of swapping SD cards is a good one - or the other option would be to just do a clean install and try some of the python libraries

In terms of multiple DS18B20 on the one pin - i would use a 2k2 resistor rather than the standard 4k7 - but it is all dependant on voltages, length of cable run and number of units

Craig

(re swapping SD cards - as long as they are similar types of Pi. You can use a card from an Arm6 device (Pi0, Pi1) in an Arm7 (Pi2,3) - but not the other way round.)