Pages: [1]   Go Down
Author Topic: Maximum number of 1wire temp sensors  (Read 749 times)
0 Members and 1 Guest are viewing this topic.
New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 516
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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);
  }
Logged

Dee Why NSW
Offline Offline
Full Member
***
Karma: 5
Posts: 206
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13471
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Rob Tillaart

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

New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 516
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Logged

Pages: [1]   Go Up
Jump to: