8
\$\begingroup\$

I have used DS18B20 temperature sensors many times and understand that they can be daisy chained on the same data pin. Could two different sensors be connected in the same manner?

For instance, could I use the same data pin to read data from both a DS18B20 and a DS2417? Would there be any limitations concerning either the hardware or the code aspect?

Taking a look at the example code on arduino.cc:

if ( addr[0] == 0x10) {
      Serial.print("Device is a DS18S20 family device.\n");
  }
  else if ( addr[0] == 0x28) {
      Serial.print("Device is a DS18B20 family device.\n");
  }
  else {
      Serial.print("Device family is not recognized: 0x");
      Serial.println(addr[0],HEX);
      return;
  }

It is clear that there is at least some tolerance for different devices, however the DS18B20 and DS18S20 are both temperature sensors and aren't all that different

\$\endgroup\$
7
\$\begingroup\$

There seems to be no difference in the protocol for the various chips, and generally one wire protocols allow you to mix and match. The one wire protocol here basically has a way of cycling between the devices. Other devices ignore all communications until a certain pulse is sent, which switches to the next device. With this in mind, it seems logical that daisy-chaining different ICs will work as well, since there is only a small point in time where there is more than one IC truly involved in the communication. And at that point the protocol has nothing to do with the specific device, it's just a matter of a reset pulse.

Besides, the picture here makes it abundantly clear that the 1 Wire protocol allows one to chain different devices:

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ +1, good answer. The 1-Wire protocol is by Dallas Semiconductor Corp. \$\endgroup\$ – Anindo Ghosh Apr 13 '13 at 4:27
  • \$\begingroup\$ @AnindoGhosh: Hm. I thought that was a different 1WP, but you seem to be correct :) \$\endgroup\$ – Manishearth Apr 13 '13 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.