Go Down

Topic: Multiple DS18B20 on a 10meter long Cat5, not discoverable.... HELP!!!! (Read 1 time) previous topic - next topic

Newmill

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

Nick_Pyner

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

Quote
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.

johnwasser

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.

http://en.wikipedia.org/wiki/Category_5_cable
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

michinyon

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

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.

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

Nick_Pyner


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.

michinyon

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.


Nick_Pyner


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.

Newmill

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?

Nick_Pyner

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.

Newmill

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?

kallek

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

Nick_Pyner

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:

http://www.ebay.com/itm/10M-Waterproof-Digital-Thermal-Temperature-Temp-Sensor-Probe-DS18B20-Connector-/231022533385?pt=LH_DefaultDomain_0&hash=item35ca041b09

waski

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.

Newmill

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....

Code: [Select]
/* 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 )***********

Go Up