Go Down

Topic: Maximum number of 1wire temp sensors (Read 976 times) previous topic - next topic

ScottG

I have 3 strings of 1wire temp sensors (DS18B20) where each string has 9 sensors on it.  If I plug one string into my Arduino, I can read everything fine.  I can even splice two strings together and everything is fine. But when I tie all 3 together my sketch says zero devices found.  Is there a limit to the number of devices the library supports?  I've tried each string by itself and it's fine.
Here's my sketch

Code: [Select]

#include <OneWire.h>
#include <DallasTemperature.h> 
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup(void) {
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC Control Library Demo");
  sensors.begin();
}

void loop(void) {
  int deviceCount;

  sensors.requestTemperatures(); // Send the command to get temperatures
 
  deviceCount = sensors.getDeviceCount();
  Serial.print("Found ");
  Serial.print(deviceCount);
  Serial.println(" devices");

  for (int i=0; i < deviceCount; i++)
  {
    Serial.print("Temperature for Device ");
    Serial.print(i);
    Serial.print(" is: ");
    Serial.print(sensors.getTempFByIndex(i));
    Serial.println();
  }
  Serial.println(); 
  delay(2000);
  }

NickPyner

If you are using just a USB cable rather than a wall-wart, your problem may simply be one of inadequate power.
 

robtillaart

can you make a drawing of the topology?

more cable means that you might need other values for your pull up/down resistors to get a nice square wave signal...

- http://www.gammon.com.au/forum/?id=10896 - search the section of pull up (yes it is another bus type but the problem can be similar)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ScottG

There are 5 strands, one of them is a T shape.  There is a 1wire every 16 inches.  There's 60 sensors all together. I'm powering it with +5 volts and ground from the Arduino Mega 2560.   I'm not using parasite power.  I have a 4.7k resistor between data and +5v.  Every strand works fine if it's the only one connected to the Arduino. Iif I connect the 9 device strand and 10 device strand together, it works, as does the 9 + 9 device strands.  But when I try to connect the 15 or 17 device strands to any other strand, it reads zero devices found.  That's why I suspect I'm exceeding some maximum.

Here's the topology:

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy