Reading multiple DS18B20 sensors

Hi,

I want to read 12 different DS18B20 with 10m long cable and send the data to the Thingsboard IoT Cloud to visualize it.
I first tested everything with just 3 DS18B20 and everything worked fine.
But as soon as I connect a fourth one, some sensors wont measure the correct temperature, they always measure -127°C, the same value the ESP gets when I measure a sensor that isnt connected.
The whole thing gets worse the more sensors are in the Network. I tried it with 6 Sensors and only 2 can give me good Data. (Always different ones)

All Sensors are in parallel, like in the schematic. There are only connectors for 3 DS18B20 to keep the Schematic simple.
I use a 5V, 2,4A Power Supply and an ESP32.

What can I do to get good readings on all Sensors ?

Please post your code.

In particular, how are you addressing the sensors?

Also, what are the lengths of the wires involved?

Once upon a time, I mananged to operate only six DS18B20 in pararllel using UNO. I think, the situation depends on the correct value of the common pull-up rsistor. You can try using parasite power schemes for the sensors.

The simple drive with just a passive pull-up is fine in simple cases - but maybe not so much when you come to large networks of many sensors.

Take a look at this:

Why are you using a pull-up resistor going to 5v when you are using a 3v3 ESP ?

And, why 5v to the DS18B20 ?

:scream:

1 Like

I did it like this guy: ESP32 with Multiple DS18B20 Temperature Sensors | Random Nerd Tutorials

First i got the address of each sensor. I also tried every sensor on its own already to make sure they are all working.

Each Sensor has 10 meter long wires.

The AD 1-Wire spec does require a pull-up to 5V ...

... but that will be a problem!

Its a ESP DevKit. It will be fine.
The DS18B20 can be powered with 3-5.5V.

So a total of 120m of cable!

You definitely need to be looking at that App Note - I think that's going to be beyond the capability of a simple pull-up:

You also have the problem, mentioned by @LarryD, that the 1-Wire works at 5V, while your ESP is only 3.3V...

No argument there.

However, the ESP32 inputs wants 3v3 and you are feeding the ESP 04 input 0-5v :wink:

1 Like

Well, I didnt thought about that.
Do you think 3.3V will work on 10 metres of wire ?

If you read through the comments there, you'll see several other people having problems with lots of sensors and/or long cables...

I think I will try this.
Do I have to do this for every sensor or just once like the Pullup ?

Your ESP may well be "clamping" the data line to 3.3V already - which probably adds to the problems.

Note that you don't just have 10m of wire: you have 10m of wire per sensor - so the pin has to drive a total of 120m!

I rather doubt it.

Note that it's using a DS2480B master - which probably has a better driver than just a simple pullup.

I think you'll need to look at the "improved" driver for your ESP:

image

So I will try this. But instead of the 5V, I use 3,3V, right ?

Yes, it does:

It would be a start.

I think you could adapt that to drive the 1-Wire bus at 5V from a 3V microcontroller...

Would be worth searching the AD forum to see if they've already covered driving 1-Wire from lower-voltage microcontrollers.

If not, post the question there...

Alright, thank you for youre help :slight_smile: