Smart Home Automation Forum

Full Version: [Arduino source code for KC868-AM]-02 DS18b20
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
#include <DS18B20.h>

DS18B20 ds1(5); 
DS18B20 ds2(14); 
DS18B20 ds3(13);
DS18B20 ds4(33);
void setup() {
  Serial.begin(115200);
}
void loop() {
Serial.printf("T1:%.2fC||T2:%.2fC||T3:%.2fC||T4:%.2fC\n",ds1.getTempC(),ds2.getTempC(),ds3.getTempC(),ds4.getTempC());
      delay(500);
}
Hi,

for the DS18B20, what is the max cable length this should work with?

Also. OneWire should support multiple devices on the same bus. I tried 2, which worked fine on the same GPIO. Then 3 and it stopped working and it seems the sensor(s) is/are dead.
it according to wire quality. i have tested with 10pcs DS18B20 work together, also work well,
[Image: attachment.php?aid=1392]
details see here:
https://www.kincony.com/forum/showthread.php?tid=2290
Wow, ok. Thanks.

Hmm, not sure why it failed then.

And the max cable length?
i have tested with one sensor, MAX about 30 meter.
here is test video: