Multiple DS18B20 on a 10meter long Cat5, not discoverable.... HELP!!!!

Hi guys,

I'm fairly new to this so please bear with me.
When I attach 1 or more of these sensors to an Mega, I find the addresses and get the readings...
But, (as usual), when I apply this to my real-world-project, I get absolutely nothing, zilt zilch zero!
I've summered the cable, and all wires are working, so I suspect that I'm missing something really obvious here...
I've got a Cat5 UTP-cable, somewhere in-between 5-10 meter long, sending out 5+, GND and a digital, on the other end, I put a 4K7 resistor between 5+ and the data.
The resistor is on the far end of the arduino, (does this really matter?), and to the cable on the far end, I've hooked up 2 of these sensors.

Now, when I run the sketch, supposed to scan for devices (http://arduino-info.wikispaces.com/Brick-Temperature-DS18B20), I get absolutely nothing. If I omit the cable and run everything locally, I get addresses and readings....

Once again, I've summered the cable so I know for sure that it's broken.
I've measured and it delivers 5v on the far end so I feel that I'm missing something here....

Unless it's a question about moving the resistor to the arduino-side of the cable, then I'm at total loss here.
I've even tried different sensors, (tried 5 different ones by now), and nothing seems to work...

So, please help me out here!!

Thanks in advance,
Karl

I understand Cat5 cable is the usual choice, so that should not be the problem, and 10m has been done befroe.

put a 4K7 resistor between 5+ and the data.
The resistor is on the far end of the arduino, (does this really matter?), and to the cable on the far end, I've hooked up 2 of these sensors.

I don't understand this but, if it is on the Arduiino, it should be OK. Besides, I understand everything works fine when the wiring is short. I think the resistor should be reduced to 2.2k. There has been other threads on this.

I don't know if it will help but I would put the pull-up resistor at the Arduino end.

Do you have multiple pairs available in the cable? If so, I would use several for power/ground and several for Data. Perhaps use the all of the '1' wires for Ground then two of the '2' wires for Vdd and two for Data. This should reduce resistance.

Are the two sensors at the end of the same cable ? Or two different cables ?

If you are using that sensor-brick thing, it already has the pull-up resistor on it, so adding another one is probably not a good idea.

Did you read all of the information linked from that website ?

michinyon:
If you are using that sensor-brick thing, it already has the pull-up resistor on it, so adding another one is probably not a good idea.

Bloody brilliant....... Everybody else uses one pullup on the arduino to do a swag of DS18B20s.

Not everybody uses this particular "brick" breakout module. It has the resistor on it. If you are using the actual DS18B20 yourself, you need to add the resistor yourself.

http://arduino-info.wikispaces.com/Brick-Temperature-DS18B20

It's on that webpage, down the bottom on the page. You can see the resistor on the little circuit board in the photo. If you use this particular device, and then add ANOTHER resistor of your own, the pull-up effect may be too strong, and the device will struggle to achieve it's signalling, which is does by pulling the signal wire down ( similar to I2C ).

Actually the OP doesn't say whether he uses this module, he only says he got the sample code from there.

michinyon:
Not everybody uses this particular "brick" breakout module.

Actually the OP doesn't say whether he uses this module, he only says he got the sample code from there.

Well, that's a relief. Particularly as it seems he is using more than one sensor.

Hi again,

So, I'm not using that brick, I'm using the sensor (waterproof) itself. Currently having 2 but I need 4.
I've swapped the resistor for a 2k2 but still no luck.
If I move the sensors right next to the arduino, then it works.
The cable is good, I've measured it and it's all good.

So, any good ideas?

Have you double up on the conductors, like Wasser said? This can't be serious. If you have reduced the pull-up, it must surely be in the cable.

Thats what I thought too, but given that I'm a novice at this, but I've even double the cable, I've given 2 wires to the vcc, 2 wires to the gnd, and 2 wires to the data, still the same.
But at the same time, loosing the cable and it works again?

So, it's a cat5, UTP, hardwires, is that a problem?

Hi.
Pairing up multiple connectors would increase the capacitance between of data line and ground that in turn would increase pullup time. If I remember correctly then the timings in OneWire library are minimal allowable according to the DS18B20 datasheet, there is not much margin for error. I have used wires from the same CAT5E pair for the data and ground and another one from different pair for power. Also for longer lines pullup resistor could be reduced to shorten the pullup time - you can have resistor close to sensor and lower value to see when it starts working.

Also the topology of sensor network is important. Ideally the cable should run from on sensor to another with minimum lenght stubs, say just few centimeters long. Long stubs can generate reflections.

If you check the signals at the ends of a long cable with oscilloscope you may see that there is quite a bit of "ringing" during the switching that may require additional filtering. Double shottky diodes perhaps?

You can find more info for 1-wire network setup here: http://www.gs-harper.com/documents/one-wire/One-Wire-Design%20Guide%20v1.0.pdf

Have you trawled up previous discussion on this matter? One of the great things you get to quickly learn about Arduino is that, no matter what your problem is, that chances are pretty good that somebody else has had it too. I'm sure people have gone well over 10m with CAT5 cable, so all of his can't be hard, for chrissakes, but, before you get blinded by science and double schottky-diodes, maybe a solution lies here:

I'm using cheap cat5 cable to read 7 sensors in quite noisy environment ( electrical noise) , each on separate kable ( star topology) where the longest cable is more than 30m. I use 3,3kOhm resistor at the arduino side. There is no problem reading those sensors with libraries : DallasTemperature and OneWire. So move pull up resistor to arduino side, and check once again your program - it has to work on that cable with such a short run.

Getting close to total breakdown...

I've swapped the cable, for a new one.
Lowered the resistor from 4k7 to 3k3.
I've got 4 different sensors, none is working "remote", but very well close to the board.
I'm powering the unit through the USB-cable.
If the sensors are 6-7 meters away, then it doesn't find the devices, but if I move them directly close to the board it detects 2 or more addresses.

I use the code below to just locate and display the devices.

Please, have mercy on me and tell me what the h##l is wrong....

/* YourDuino Example: Find Address of a DS18B20 Temperature Sensor
 Cut and paste the address to a text file for later use.
 V1.1 01/17/2013
 Questions: terry@yourduino.com 
 
 Connections:
 DS18B20 Pinout (Left to Right, pins down, flat side toward you)
 - Left   = Ground
 - Center = Signal (Pin 2):  (with 3.3K to 4.7K resistor to +5 or 3.3 )
 - Right  = +5 or +3.3 V   
 This sketch looks for 1-wire devices and  prints their addresses (serial number)
 to the Serial Monitor in a format that is useful in Arduino sketches.
 Based on example at: 
 http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
 */

/*-----( Import needed libraries )-----*/
#include <OneWire.h>

/*-----( Declare Constants and Pin Numbers )-----*/
#define SENSOR_PIN 7  // Any pin 2 to 12 (not 13) and A0 to A5

/*-----( Declare objects )-----*/
OneWire  ourBus(SENSOR_PIN);  // Create a 1-wire object

void setup()  /****** SETUP: RUNS ONCE ******/
{
  Serial.begin(9600);
 
  discoverOneWireDevices();  // Everything happens here!
}//--(end setup )---

void loop()   /****** LOOP: RUNS CONSTANTLY ******/
{
  // Nothing happening here
}

/*-----( Declare User-written Functions )-----*/
void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];

  Serial.print("Looking for 1-Wire devices...\n\r");// "\n\r" is NewLine 
  while(ourBus.search(addr)) {
    Serial.print("\n\r\n\rFound \'1-Wire\' device with address:\n\r");
    for( i = 0; i < 8; i++) {
      Serial.print("0x");
      if (addr[i] < 16) {
        Serial.print('0');
      }
      Serial.print(addr[i], HEX);
      if (i < 7) {
        Serial.print(", ");
      }
    }
    if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.print("CRC is not valid!\n\r");
      return;
    }
  }
  Serial.println();
  Serial.print("Done");
  ourBus.reset_search();
  return;
}

//*********( THE END )***********

Newmill:
Lowered the resistor from 4k7 to 3k3.
I've got 4 different sensors, none is working "remote", but very well close to the board.
I'm powering the unit through the USB-cable.
if I move them directly close to the board it detects 2 or more addresses.

I use the code below to just locate and display the devices.

Your report is confusing but at least you clearly understand what the code is for and, if it works at all, you can assume there is nothing wrong with it.
I believe people go down to 2.2k for pullup, and there is surely discussion hereabouts to that effect.
Your power supply could be marginal - even with short wiring. It is never a good idea to power a project from the USB cable, and now might be a good time to use a proper 9v wall wart. I never thought i would hear myself say this but, just to prove the point, even a 9v battery might suffice.

lease, have mercy on me and tell me what the h##l is wrong....

Your problem fundamentally is the distance.

Any kind of low voltage, high speed, signalling scheme is limited by this. Your little square wave digital on/off signals get corrupted and deformed by the electrical characteristics of the cable, and noise, which increase with distance, to the degree that the signal becomes unusable.

One solution is to put another arduino close to the sensors to make the readings, and then transfer the results by some other method, with greater practical range, to the remote location where you need to use the information.

Try this.

Connect the cable to your arduino. Take the sensor off the remote end of the cable. Connect the data line to a digital pin on the arduino. Write a sketch which sets the digital output to low, and get the sketch to make the output low and high alternatively at one second intervals. Use your voltmeter to measure the voltage on the remote end of the data line. You should see the voltage going high and low each second.

If this test works, then it means your wiring scheme is basically sound, you can signal at a 1 Hz rate, it then becomes an issue of speeding things up to whatever frequency the onewire devices use.

If this test doesn't work, then you have some kind of wiring problem. If you can't signal by pulling down the wire at 1 Hz, you got no chance at higher frequencies.

Other things you can try:
Connect the remote end of the cable back to an arduino input. You can try measuring the delay between when you switch the output, and detect the input. This could indicate that your cable has some huge and unwanted capacitance, for some reason.

Connect the remote end to an analog input on the arduino. Measure the voltage you are getting. Is the high signal sufficiently close to 5V ? Is the low signal sufficiently close to 0 V ?

Newmill:
....I'm using the sensor (waterproof) itself. .....

I used a couple of those too, (not sure its the same) but it seems they had resistors in the metal casing.

I was able to hook them up to a couple meters of cable without resistors and they worked fine.

Lennaert:
but it seems they had resistors in the metal casing.

I don't think there would be any pull-up resistor in the casing unless the supplier explicitly advised that.