several DS18b20 on one one-wire bus

So, I am building a machine which, among other things, will heat Milk (Or water/milk-powder) to around 40deg C. I am using electric elements bonded to the outside of the bottom of a stainless steel tank (of up-to 250 Litres)

I would like to use either 3 or 4 DS18b20 temperature sensors for the feedback to the PID heating routines. It is obviously critically important for me (or the sketch) to know which physical sensor is sending which values.

from my reading of all I have found so far on the 1-wire interface, I cannot find how to be certain that the sensor IDs returned by search(addr) are returned in the same sequence, each startup. I could hack with a test sketch and a cigarette lighter to identify which is which, but if/when I destroy one of the sensors and replace it with a new one - will I have to hack for the sequence of returned IDs again, or what ?

A solution would be to have each sensor on it's own pin, somewhat defeating the whole point if 1-wire ....

Run your test sketch with each sensor connected on its own.

Note its serial number.

Label it with that number or a cross reference you have noted down in a table.

Now in your code, you use the serial numbers corresponding to which sensors you have fitted in a particular position.

Do not remove the labels on the sensors. :roll_eyes:

There are two modes.
The program requests the unique 1wire addresses and stores in an array
Or you read the address and then hard code
Both will work.
If the sketch scans the addresses it will always start with the lowest number first
I mark mine with colored heat shrink
I use
As my reference for both modes

Thanks, guys

I mark mine with coloured heat shrink

I visualise little narrow bands of heatshrink like a resistor colour code. :grinning: