I have 4 DS18B20 sensors with different cable lenghts of 1m, 2m, 12m and 13m. They are all connected together via I2C. I am using a 4,7kOhm resistor and the values I get seem realistic.
Do I need a smaller resistor because of the total cable length? I also need to add one more sensor with 3m cable length. Or isn't there a problem as long as I get realistic values?
skywatch:
You should be fine with good cable and connections.
Put the resistor at the farthest end away from the arduino.
Cable is CAT5.
Not sure what you mean by farthest end away from arduino. I have all sensors come together in one luster terminal on one side. On the other side of the luster terminal I have three jumper wires coming out for 5V, GND and DATA. The jumper wires for 5V and DATA are connected via the resistor inside the luster terminal.
ut the resistor at the farthest end away from the arduino.
This is wrong. Put the resistor to the Arduino side.
Is that the correct way of wiring?
Yes.
They are all connected together via I2C
This is wrong. DS18B20 connect by OneWire not I2C.
Do I need a smaller resistor because of the total cable length?
No.
If you get problems with increasing bus length you may try to switch off parasite mode. As you're using Cat5 cable you have more than enough wires to have a separate Vcc signal.
pylon:
If you get problems with increasing bus length you may try to switch off parasite mode. As you're using Cat5 cable you have more than enough wires to have a separate Vcc signal.
I have 3 wires going in to the arduino from the DS18B20 sensors, so it's already not in parasite mode, is it??
I have 4 DS18B20 sensors with different cable lenghts of 1m, 2m, 12m and 13m. They are all connected together via I2C. I am using a 4,7kOhm resistor and the values I get seem realistic.
Do I need a smaller resistor because of the total cable length? I also need to add one more sensor with 3m cable length. Or isn't there a problem as long as I get realistic values?
Nothing to do with I2C, you are confusing it with OneWire.
How have you used the signal pairs in the CAT5?
Do you have decoupling capacitors on each sensor (this is advisable)
It is possible and you can get pre-wired waterproof sensors with 15m of kosher cable. No decoupling capacitors included, but I have never heard of them being used and I think it is nonsense. Since you claim to have realistic values already, you are using one-wire bus or, specifically not I2C, and the only problem is that you might not know the difference - which is not relevant at this stage.
I now connected five DS18B20 sensors together via OneWire and it doesn't work. But it works with four sensors. With five sensors, either the one sensor with the longest cable or the four other sensors are working, but never all five.
My Interpretation is, the resistor is too big for all five sensors.
So, I would buy a 3.3kOhm instead of the 4.7kOhm resistor to make it work. Does that make sense??
So, I would buy a 3.3kOhm instead of the 4.7kOhm resistor to make it work. Does that make sense??
I would put the sensor with the long cable to a separate pin, so establishing a separate OneWire bus.
Using a smaller resistor is outside the specs so it may or may not work but you also risk to damage the sensors (although that needs a lot more in my experience).