DS18B20 sensors.requestTemperatures , what happens with hardware ?

Hello!

I try connect multiple ds18b20 ( 18 pcs ) to two arduino with same power....

The results are strange; sometimes read value, sometimes it does not, etc. 4 second is OK, then 1 second ....

My question is how work sensor DS18B20,

  • Send all the time temperature value every x msecond, and arduino only open port, to receive value with the command sensors.requestTemperatures

or

  • sensor waiting for the command from arduino "sensors.requestTemperatures" and then send value to arduino....

I would like to use the same sensors on two Arduino. One is in the room where run code for the web server and 2x lcd displey, the other is in the boiler-fired room where run code for 7segment display.. I know I should probably use i2c connection between them,

But to me it is not clear why it would not be possible to use the same sensors on two arduino ( wuth sane power source )

Thank you for interpretation

Send all the time temperature value every x msecond, and arduino only open port, to receive value with the command sensors.requestTemperatures

As long as you understand that x will be a large value.

If you think that temperatures are going to change rapidly, and the you are going to accurately observe such changes with DS18B20 sensors, I'm afraid that you are going to be disappointed.

But to me it is not clear why it would not be possible to use the same sensors on two arduino ( wuth sane power source )

I's probably your code.

svedr: My question is how work sensor DS18B20,

The datasheet covers this in great detail: https://cdn.sparkfun.com/datasheets/Sensors/Temp/DS18B20.pdf

svedr: But to me it is not clear why it would not be possible to use the same sensors on two arduino ( wuth sane power source )

I believe the OneWire protocol supports only one bus master.

svedr: But to me it is not clear why it would not be possible to use the same sensors on two arduino

But to everybody else, I imagine it is not clear as to why on earth you would ever want to do that.

Don't. Don't attempt it. The one-wire bus is not designed for this kind of thing. You can't have two masters on one bus. It's like asking why you can't drive the other direction on the freeway.

Don't attempt I2C either. It's not going to work at the distances you seem to need.

But, why not have one Arduino act as a one-wire slave? The first one can query the temperature sensor then send the appropriate information to the other Arduino. Googling "Arduino onewire slave" shows at least two libraries that let you do this.

Nick_Pyner: But to everybody else, I imagine it is not clear as to why on earth you would ever want to do that.

Here is answer :

On the connecting cable betwen my room and boiler room we are missing two wires..... :drooling_face: I want to have one screen in the room and another in the boiler room Duplicate sensors on 18 sites it does not make sense for me.........

svedr: On the connecting cable between my room and boiler room we are missing two wires..... :drooling_face: I want to have one screen in the room and another in the boiler room Duplicate sensors on 18 sites it does not make sense for me.........

So you only have one spare wire in the cable? You thought you could have your room Arduino be a second bus master on the OneWire bus using that one wire. Do you need bi-directional communication? If all you want is for your room Arduino to have access to the temperature sensors you could use that one wire for a unidirectional serial line and have the boiler-room Arduino send the temperatures to the room Arduino.

I had to install new cable in the house.

I have problems with sending float over serial, im not profi but amateur user Arduino, It is difficult for me....

Right now I'm trying to combine code from these two arduinov and have problem.... Probably with the brackets..... I do not understand so well these brackets at the end of the code

svedr: I do not understand so well these brackets at the end of the code

Brackets come in pairs. For every open bracket ('{') you need a matching close bracket ('}'). If the brackets don't match properly you will get an error. The brackets combine zero or more statements into a single statement. The 'if', 'else', 'for', 'while', and 'do while' statements can only control one single statement. Often you want to have them control more than one statement. You put brackets around the statements to combine them into one single statement. Similarly, function declarations have brackets around the body of the function and declarations have brackets around multiple initializers.

Thank you for the explanation. So I also represented. The problem I had, because I'm used to many

IF {
}

ELSE {
IF {
}

ELSE {
IF {
}

ELSE {
IF {
}

ELSE {
}
}
}
}

instead

IF {
}
ELSE IF {
}
ELSE IF {
}
ELSE IF {
}
ELSE {
}

I hope that I will now successfully merge code