13 sensors DS18B20 - one wire

Hi Everyone,

I have 13 sensors DS18B20 with cable length from 5 to 12 meters and I have connected them (using 3 wires, + - and data) to one wire using a 4,7 K rezistor.
I notice that using 4,7 K I am able to discover and read 2 sensors only, when connect the 3rd not able to discover and read none of them.
when using 2K - 4 sensors are working
when using 1K - 8 sensors are working

my question - what is the lower and safest rezistor value I can use and what are the risks?
I can slit to 4 bus wires and use 2k rezistor, is that safe and stable?

It would be nice to know how you wired the sensors. Is EACH sensor attached to its own cable with a length of 5 to 12 meters and the other end is EACH attached to the Arduino (all in parallel) or is only one attached to the Arduino and all the others are attached in Serial with lengths of 5 to 12 meters between each?

ahhh,
from a central location I have 13 cables running to different places of the house and at the end of each cable I have one sensor.
in this location I have connected all of them in parallel 5v+, ground and from 5+ the rezistor to the bus pin.

http://i.stack.imgur.com/rbRcf.jpg same as this diagram.

The star with different lengths - really not good. The best solution is wire from sensor to sensor.
Try to read "1 wire design guide v1.0 pdf" (search on Google). All is explained in this document.

I am using twisted pair for data - to the sensor an back; and return wire continues to the next sensor. Have some problems but it works somehow. The max. length of the 1W can be about 200m (?).

Hi,

thank you for the document, really nice one... so I cannot change the way I have the cables.... how can I make it work or improve it... I was thinking to use multiple pins(bus). I am using Arduino UNO and will have Ethernet shield so I do not have a ping for each sensor but I can have 2 sensors per pin. that means 6 pins.

what do you think?

Then you would use the same length for sensors on common pin. The difference should not be more 0.5m or 'try/fault' method. BTW you have no free wire in a cable? Or, use parasitic power then the VCC wire would be return for sensor.

EDIT: Another idea. Try to use ~100ohm resistor on sensor data pin. It is described in the document, how it works.

sensors are inside of heating subfloor so I cannot modify wires..... and will be difficult to identify cable length... probably will try with ohmmeter

I doubt the ohmmeter will work.

if you group, then group so wire lengths are similar.
put the 2, 3 or 4 longest on one pin
the 2,3 or 4 shortest on another pin

in really simple terms.
when you ping the line, each sensor responds. if you call sensor 3 and it is close, it could be sending data while sensor 2 is saying 'I'm here' and the two signal overlap.

The star topology offer a much better chance that all the signals overlap and all return a signal at the same time.

Budvar10:
I doubt the ohmmeter will work.

what do you think about using signal timing to determine length of wire ?

after all, you really are trying to get signals that are in the same part of the 15-60µS window.

group the devices by response time.

Will try matching the sensors to work together.... but can I use a 2k rezistor? will that damage the board or sensors?

what do you think about using signal timing to determine length of wire ?

after all, you really are trying to get signals that are in the same part of the 15-60µS window.

group the devices by response time.

to complicated for me:(

ovex:
.... but can I use a 2k rezistor? will that damage the board or sensors?

No, 2k should work. The resistor 5k is recommended in the datasheet, 4k7 is usual near value, 2k is stronger - good for longer distances but I don't think it will solve the problem with pulse overlapping as Dave mentioned.

  1. Show the details about your wiring, which cable, how many wires, how the sensor is connected...Maybe we will find a solution.
  2. You can try to pair sensors step by step, which two works together and which not.
  3. In the worst case you can use separate pin for each sensor (you mentioned that they are built in - in concrete?). You can use different Arduino with more pins or some port expansion device etc.

ovex:
what do you think about using signal timing to determine length of wire ?
after all, you really are trying to get signals that are in the same part of the 15-60µS window.
group the devices by response time.

to complicated for me:(

The page #42 in the document. Nice example what is going inside of wire.

the beauty is that trial and error and your knowledge is a great team.

I have to assume you put the sensors in place and labeled the wirs.

you know the longest wire and can just take a few wild guesses as to what ones are close
2 or 3 per pin. if it works, great.

some trial and error and you should be able t find a workable solution.

you know that if you have groups that are at about the same distance, you colllions will be minimized and chances of success are greater.

Hi,

today I had some free time and I modify my circuit, and now I have 2 sensors connected on same wire and a 3K resistor.
I am able to discover all 13 sensors - that's good, but now I have to read all 7 pins (bus) with different ROM address on each bus.
can you please advice me how should I do that?

#define one_wire_bus_pin2 2
#define one_wire_bus_pin3 3

OneWire oneWire(ONE_WIRE_BUS_PIN2); {
DeviceAddress Probe01 = { 0x28, 0xFF, 0xF2, 0x4E, 0x69, 0x14, 0x04, 0x05 };
DeviceAddress Probe02 = { 0x28, 0xFF, 0xF2, 0x4E, 0x69, 0x14, 0x04, 0x06 };
}
OneWire oneWire(ONE_WIRE_BUS_PIN3);{
DeviceAddress Probe03 = { 0x28, 0xFF, 0xF2, 0x4E, 0x69, 0x14, 0x04, 0x07 };
DeviceAddress Probe04 = { 0x28, 0xFF, 0xF2, 0x4E, 0x69, 0x14, 0x04, 0x08 };
}

void setup(){

sensors.setResolution(Probe01, 10);
sensors.setResolution(Probe02, 10);
sensors.setResolution(Probe03, 10);
sensors.setResolution(Probe04, 10);}

void loop(){
delay(3000);
Serial.println();
Serial.print("Number of Devices found on bus = ");
Serial.println(sensors.getDeviceCount());
Serial.print("Getting temperatures... ");
Serial.println();

// Command all devices on bus to read temperature
sensors.requestTemperatures();

Serial.print("Probe 01 temperature is: ");
printTemperature(Probe01);
Serial.println();

Serial.print("Probe 02 temperature is: ");
printTemperature(Probe02);
Serial.println();

Serial.print("Probe 03 temperature is: ");
printTemperature(Probe03);
Serial.println();

Serial.print("Probe 04 temperature is: ");
printTemperature(Probe04);
Serial.println();}

something like this will work?

I think you should have

printTemperature()
{
}

I thought there would be a loop to get the temps that are loaded by

sensors.requestTemperatures()

considder that in printTemperatrue is the routine to get a specific temperature.
you might want to fill a variable using that routine.

Probe1 = put the routine here.

that way you can use other logic to control pumps and valves and solenoids and such.

I think all you can do with what you have is to call the printTemperature routine to only print.

as a note, there is a sticky at the top of every forum on 'how to use this forum'
and that will show #7 on how to post code using code tags.

and, if you did get the values, post THAT sketch so we can show you the bits needed to get what you ultimately want.