Strange Behavior on DS18B20 Temp sensor and Pull-up Resistor

Hi Guys,

All good?

I´m testing Arduino uno with 7 temperature sensors for a composting project :slight_smile: , all worked good until i add more than 2 sensors :).

The project consists of using Arduino Uno, Deek-robot datalogger shield v1.0, one watchdog led, and saving all the data to an SD card. :slight_smile:

All worked good now but only if i put one 4.7k ohm pull-up resistor every 3 sensors.

I use this example:

And my board looks like this:



Any explication for that?

Best Regards.

Check the how to use this forum, particularly on how to enter code and pictures. You might also be more enlightening about the cabling for your sensors, as the explanation are talking about so far reads like nonsense.

The example you showed says "one 4.7k resistor per bus". In your breadboard I think I saw three....

Thanks for tips, will read it.

Hi,

Thanks for answer,
I think i only use one bus on wiring. Because until 3 sensors works with only 1 pull-up resistor.
When i start adding more, have to put more resistors.. but will check it.
Im a newbie. :slight_smile:
Where you saw i use more then one bus and how to spot it?

Best Regards

In the schematic it has just one resistor but on the breadboard there are three...

Are the pull up resistors connected to the arduino 5V pin? If so, try connecting them to an external 5V source. I suspect that with more buses and pull ups the arduino board is not able to supply wnough current...

YY, because if i only put one i got no read values. :frowning:

Post a schematic of your setup. That will help us help you better.

I also tried to use an 5v extenal power supply to power directly the arduino beacause i also suspectd that could not be able to supply enougth current like you sugest. :slight_smile: Or should be connected the pull up directly to an 5v external ? if so will be no dangerous to got different mixed tensions? From 5v usb and 5v external?

The project works in this way, but i just wonder why i need more pull-up resistors. Because i almost sure i only use one bus.
Yeah will do that when i got to work.

Will put the images and code later to be according to the rules of forum also.

What I mean is to not use the arduino board's 5V for the pull up. You may power the arduino whichever way you want, just don't use its in-built 5V output for the bus.

The sensors don't take a lot of current and still work with 3.3V. The Arduino does not have a problem with powering those sensors.

Can you measure the 5V pin ? Is it at least 4.5V ?

Where did you buy the DS18B20 ?
The real ones are okay, but the cheap ones are counterfeit and the cheap "waterproof" ones are only waterproof for a day, or a week.

The most important wire is the GND wire from the Arduino board to the breadboard. Do you have a single core wire that fits ? Or try two wires.

You could add one or more decoupling capacitors on the breadboard at GND and 5V.

How long are the wires ?

Is your final project one long stretch of wire, or a star-configuration around the Arduino board.
With a star-configuration, you can make more than one 1-Wire bus. Even a 1-Wire bus for each DS18B20 is possible. That causes no problem in the sketch.

Hi @Koepel,

Thanks for such a detailed help, :slight_smile:

Will answer inline with bold.

The sensors don't take a lot of current and still work with 3.3V. The Arduino does not have a problem with powering those sensors.

Can you measure the 5V pin ? Is it at least 4.5V ?

For the 5v pin i got:

5,04 V without resistances
1 resistor -> 5.04V
2 resistors - > 5.04V
3 resitors -> 4,89V

Where did you buy the DS18B20 ?
The real ones are okay, but the cheap ones are counterfeit and the cheap "waterproof" ones are only waterproof for a day, or a week.

I think i buyed the real ones: Waterproof DS18B20 Temperature Sensor - 10m | Sensores de Temperatura (ptrobotics.com)

The most important wire is the GND wire from the Arduino board to the breadboard. Do you have a single core wire that fits ? Or try two wires.

For the GND wires i tried too with two wires i got same behavior. :slight_smile:

You could add one or more decoupling capacitors on the breadboard at GND and 5V.

I don't have this, will test when buy it.

How long are the wires ?

Of the sensores is 10M..

Is your final project one long stretch of wire, or a star-configuration around the Arduino board.
With a star-configuration, you can make more than one 1-Wire bus. Even a 1-Wire bus for each DS18B20 is possible. That causes no problem in the sketch.

Can you give me one example of an star vs one long stretch of wire? .I tried to be only one wire. I done some fast schematic, to exemplify:

Maybe the solution is Decreasing the pull-up resistor value on a single serial bus line when have more than 3 sensors. :slight_smile:

You don't have to repeat everything I wrote, what I wrote is already there :wink:
Did you know that you can select a text with the mouse in a message, and then click on the "Quote" text that appears ? Then you get this:

Yes, that will help. I forgot what the minimal value is.

I seriously doubt that.
Can you put one in boiling water ?
The counterfeit DS18B20 can go up to 70 or 80°C, the real ones have no problem at all with 100°C.
The counterfeit DS18B20 start to struggle with a long wires, the real ones not so much.

I made better drawings in kindergarten, but I think it shows the long wires with sensor along it, or a star-configuration with the Arduino board as a spider in the middle of the web:

1 Like

Hi guys, hi zeronix
You need more components (resistors) because you need a lower resistance (value) than 4.7K on this bus with 7 probes, for a good operation of your star bus with more than one probe.

4.7K is a frequently given average value for the OneWire bus, which fits all processors pins and their output current (which differ from one processor to another). For the Uno, I go down to 560 ohms, because the output current of the Uno processor allows it. With 3 times 4.7K, it's as if you had only one 1.6K resistor (you could also put 5 resistors of 4.7K, for a result of 1K).

1 Like

Now i know. Thanks :slight_smile:

Yeah, happened what patmax describe in previous post probably. For more sensors we need -~1k resistors.

Oh yeah they are real ones, i tested with boiled water and got 99,8 in serial com on my kettle. :slight_smile:

Hmm. I understand the first one, but the second the connections seems like first. I try to find in google but can't find any comparation of this 2 types connections. now i'm curious.

Anyway thanks for kind help :slight_smile:

Thanks for answer.

Yeah with 1.6 worked like a charm, and was trial and error, before now this kind of particularities.
it's a star bus or normal?

Now U2 @Koepel and @PatMax confused me hehe

Regards

I mentioned the star-configuration because that one can easily dedicate a digital pin per DS18B20.

You could draw your Arduino board with all the sensors and wiring and distances on a piece of paper and upload a photo of it.

According to the datasheet of the DS18B20, a resistor is 4k7 is a good value to start with and the maximum sink current is at least 4mA. That means that a resistor of 1250 Ω is the lowest allowed value.
They don't give a number for the "typical" current that the DS18B20 can sink. That is probably higher.

Ah so the star configuration stands for using more than one digital pins and coupling 1 or more sensors? If so i understand it :slight_smile:

I put an photo already on previous post using an fritzing schematic. :slight_smile:

Understood

Thanks

Yes, thank you. I also see that we already discussed to use perhaps only three sensors per digital pin. That are indeed a whole bunch of wires, too much for a single digital pin to drive them all.

1 Like

Thanks for kind help again :slight_smile: