Smart Home Automation Forum
[Arduino source code for KC868-AM]-02 DS18b20 - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-AM (https://www.kincony.com/forum/forumdisplay.php?fid=45)
+--- Thread: [Arduino source code for KC868-AM]-02 DS18b20 (/showthread.php?tid=2712)



[Arduino source code for KC868-AM]-02 DS18b20 - KinCony Support - 03-22-2023

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);
}



RE: [Arduino source code for KC868-AM]-02 DS18b20 - MonsterJoe - 04-25-2023

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.


RE: [Arduino source code for KC868-AM]-02 DS18b20 - admin - 04-25-2023

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


RE: [Arduino source code for KC868-AM]-02 DS18b20 - MonsterJoe - 04-26-2023

Wow, ok. Thanks.

Hmm, not sure why it failed then.

And the max cable length?


RE: [Arduino source code for KC868-AM]-02 DS18b20 - admin - 04-26-2023

i have tested with one sensor, MAX about 30 meter.
here is test video: